mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
MDL-72930 navigation: Remove duplicated navigation boxes.
Some pages have settings that really aren't required anymore. These have been removed and a function has been aded so that other developers can turn off the navigation overflow if they want.
This commit is contained in:
parent
f56ecc27f9
commit
0a04ebde11
4 changed files with 31 additions and 28 deletions
|
@ -453,33 +453,13 @@ class grading_manager {
|
||||||
// no money, no funny
|
// no money, no funny
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (count($areas) == 1) {
|
} else {
|
||||||
// make just a single node for the management screen
|
// make just a single node for the management screen
|
||||||
$areatitle = reset($areas);
|
$areatitle = reset($areas);
|
||||||
$areaname = key($areas);
|
$areaname = key($areas);
|
||||||
$this->set_area($areaname);
|
$this->set_area($areaname);
|
||||||
$method = $this->get_active_method();
|
|
||||||
$managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'),
|
$managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'),
|
||||||
$this->get_management_url(), settings_navigation::TYPE_CUSTOM, null, 'advgrading');
|
$this->get_management_url(), settings_navigation::TYPE_CUSTOM, null, 'advgrading');
|
||||||
if ($method) {
|
|
||||||
$controller = $this->get_controller($method);
|
|
||||||
$controller->extend_settings_navigation($settingsnav, $managementnode);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// make management screen node for each area
|
|
||||||
$managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'),
|
|
||||||
null, settings_navigation::TYPE_CUSTOM, null, 'advgrading');
|
|
||||||
foreach ($areas as $areaname => $areatitle) {
|
|
||||||
$this->set_area($areaname);
|
|
||||||
$method = $this->get_active_method();
|
|
||||||
$node = $managementnode->add($areatitle,
|
|
||||||
$this->get_management_url(), settings_navigation::TYPE_CUSTOM);
|
|
||||||
if ($method) {
|
|
||||||
$controller = $this->get_controller($method);
|
|
||||||
$controller->extend_settings_navigation($settingsnav, $node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -433,6 +433,11 @@ class secondary extends view {
|
||||||
* @return url_select|null The overflow menu data.
|
* @return url_select|null The overflow menu data.
|
||||||
*/
|
*/
|
||||||
public function get_overflow_menu_data(): ?url_select {
|
public function get_overflow_menu_data(): ?url_select {
|
||||||
|
|
||||||
|
if (!$this->page->get_navigation_overflow_state()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$activenode = $this->find_active_node();
|
$activenode = $this->find_active_node();
|
||||||
$incourseadmin = false;
|
$incourseadmin = false;
|
||||||
|
|
||||||
|
|
|
@ -408,6 +408,11 @@ class moodle_page {
|
||||||
*/
|
*/
|
||||||
protected $_activityheader;
|
protected $_activityheader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool The value of displaying the navigation overflow.
|
||||||
|
*/
|
||||||
|
protected $_navigationoverflow = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force the settings menu to be displayed on this page. This will only force the
|
* Force the settings menu to be displayed on this page. This will only force the
|
||||||
* settings menu on an activity / resource page that is being displayed on a theme that
|
* settings menu on an activity / resource page that is being displayed on a theme that
|
||||||
|
@ -2258,4 +2263,23 @@ class moodle_page {
|
||||||
public function get_primary_activate_tab(): ?string {
|
public function get_primary_activate_tab(): ?string {
|
||||||
return $this->_activenodeprimary;
|
return $this->_activenodeprimary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the navigation overflow state. This allows developers to turn off the overflow menu if they perhaps are using
|
||||||
|
* some other navigation to show settings.
|
||||||
|
*
|
||||||
|
* @param bool $state The state of whether to show the navigation overflow.
|
||||||
|
*/
|
||||||
|
public function set_navigation_overflow_state(bool $state): void {
|
||||||
|
$this->_navigationoverflow = $state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the navigation overflow state.
|
||||||
|
*
|
||||||
|
* @return bool The navigation overflow state.
|
||||||
|
*/
|
||||||
|
public function get_navigation_overflow_state(): bool {
|
||||||
|
return $this->_navigationoverflow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3633,14 +3633,8 @@ function data_extend_settings_navigation(settings_navigation $settings, navigati
|
||||||
|
|
||||||
$datanode->add(get_string('fields', 'data'),
|
$datanode->add(get_string('fields', 'data'),
|
||||||
new moodle_url('/mod/data/field.php', array('d' => $data->id)));
|
new moodle_url('/mod/data/field.php', array('d' => $data->id)));
|
||||||
$templates = $datanode->add(get_string('templates', 'data'),
|
$datanode->add(get_string('templates', 'data'),
|
||||||
new moodle_url('/mod/data/templates.php', array('d' => $data->id)));
|
new moodle_url('/mod/data/templates.php', array('d' => $data->id)));
|
||||||
|
|
||||||
$templatelist = array ('listtemplate', 'singletemplate', 'asearchtemplate', 'addtemplate', 'rsstemplate', 'csstemplate', 'jstemplate');
|
|
||||||
foreach ($templatelist as $template) {
|
|
||||||
$templates->add(get_string($template, 'data'), new moodle_url('/mod/data/templates.php', array('d'=>$data->id,'mode'=>$template)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$datanode->add(get_string('presets', 'data'), new moodle_url('/mod/data/preset.php', array('d' => $data->id)));
|
$datanode->add(get_string('presets', 'data'), new moodle_url('/mod/data/preset.php', array('d' => $data->id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue