Commit 891514f5 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't highlight Staff Users/Admin Users menu items for site admin editing...

Don't highlight Staff Users/Admin Users menu items for site admin editing institution staff/admin pages
parent a67320b3
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
// here might need to be fixed there too. // here might need to be fixed there too.
define('INTERNAL', 1); define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1); define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers/adminusers');
require(dirname(dirname(dirname(__FILE__))) . '/init.php'); require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('adminusers', 'admin')); define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin'); define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminusers'); define('SECTION_PAGE', 'adminusers');
global $USER;
define('MENUITEM', $USER->get('admin') ? 'configusers/institutions' : 'configusers/institutionadmins');
require_once('pieforms/pieform.php'); require_once('pieforms/pieform.php');
$smarty = smarty(); $smarty = smarty();
......
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
// here might need to be fixed there too. // here might need to be fixed there too.
define('INTERNAL', 1); define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1); define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers/staffusers');
require(dirname(dirname(dirname(__FILE__))) . '/init.php'); require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('staffusers', 'admin')); define('TITLE', get_string('staffusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin'); define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'staffusers'); define('SECTION_PAGE', 'staffusers');
global $USER;
define('MENUITEM', $USER->get('admin') ? 'configusers/institutions' : 'configusers/institutionstaff');
require_once('pieforms/pieform.php'); require_once('pieforms/pieform.php');
$smarty = smarty(); $smarty = smarty();
......
...@@ -28,18 +28,18 @@ ...@@ -28,18 +28,18 @@
// here might need to be fixed there too. // here might need to be fixed there too.
define('INTERNAL', 1); define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1); define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers/institutionusers');
require(dirname(dirname(dirname(__FILE__))) . '/init.php'); require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('adminusers', 'admin')); define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin'); define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutionusers'); define('SECTION_PAGE', 'institutionusers');
global $USER;
define('MENUITEM', $USER->get('admin') ? 'configusers/institutions' : 'configusers/institutionusers');
require_once('pieforms/pieform.php'); require_once('pieforms/pieform.php');
require_once('institution.php'); require_once('institution.php');
$institutionelement = get_institution_selector(false); $institutionelement = get_institution_selector(false);
global $USER;
$institution = param_alphanum('institution', false); $institution = param_alphanum('institution', false);
if (!$institution || !$USER->can_edit_institution($institution)) { if (!$institution || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value']; $institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
......
...@@ -1324,13 +1324,13 @@ function admin_nav() { ...@@ -1324,13 +1324,13 @@ function admin_nav() {
'weight' => 20, 'weight' => 20,
), ),
array( array(
'path' => 'configusers/staff', 'path' => 'configusers/institutionstaff',
'url' => 'admin/users/institutionstaff.php', 'url' => 'admin/users/institutionstaff.php',
'title' => get_string('staffusers', 'admin'), 'title' => get_string('staffusers', 'admin'),
'weight' => 30, 'weight' => 30,
), ),
array( array(
'path' => 'configusers/admin', 'path' => 'configusers/institutionadmins',
'url' => 'admin/users/institutionadmins.php', 'url' => 'admin/users/institutionadmins.php',
'title' => get_string('adminusers', 'admin'), 'title' => get_string('adminusers', 'admin'),
'weight' => 40, 'weight' => 40,
...@@ -1575,12 +1575,10 @@ function find_menu_children(&$menu, $path) { ...@@ -1575,12 +1575,10 @@ function find_menu_children(&$menu, $path) {
} }
foreach ($menu as $key => $item) { foreach ($menu as $key => $item) {
if ( $len = strlen($item['path']);
defined('MENUITEM') && $item['selected'] = defined('MENUITEM')
((MENUITEM == '' && $item['path'] == '') || && ($item['path'] == MENUITEM
($item['path'] != '' && $item['path'] == substr(MENUITEM, 0, strlen($item['path']))))) { || ($item['path'] . '/' == substr(MENUITEM, 0, strlen($item['path'])+1)));
$item['selected'] = true;
}
if ( if (
($path == '' && $item['path'] == '') || ($path == '' && $item['path'] == '') ||
($item['path'] != '' && substr($item['path'], 0, strlen($path)) == $path && !preg_match('%/%', substr($item['path'], strlen($path) + 1)))) { ($item['path'] != '' && substr($item['path'], 0, strlen($path)) == $path && !preg_match('%/%', substr($item['path'], strlen($path) + 1)))) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment