Commit da81c4e4 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Divide institutional admin menu into two parts

parent 2741b619
......@@ -33,8 +33,9 @@ define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminusers');
define('MENUITEM', 'configusers/institutionadmins');
require_once('pieforms/pieform.php');
global $USER;
define('MENUITEM', ($USER->get('admin') ? 'configusers' : 'manageinstitutions') . '/institutionadmins');
$smarty = smarty();
require_once('institution.php');
......
......@@ -25,13 +25,14 @@
*/
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers/institutions');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('institutions', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutions');
require_once('pieforms/pieform.php');
global $USER;
define('MENUITEM', ($USER->get('admin') ? 'configusers' : 'manageinstitutions') . '/institutions');
$smarty = smarty();
$institution = param_variable('i', '');
......@@ -39,7 +40,6 @@ $add = param_boolean('add');
$edit = param_boolean('edit');
$delete = param_boolean('delete');
global $USER;
if (!$USER->get('admin')) {
// Institutional admins with only 1 institution go straight to the edit page for that institution
// They cannot add or delete institutions, or edit an institution they don't administer
......
......@@ -33,8 +33,9 @@ define('TITLE', get_string('staffusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'staffusers');
define('MENUITEM', 'configusers/institutionstaff');
require_once('pieforms/pieform.php');
global $USER;
define('MENUITEM', ($USER->get('admin') ? 'configusers' : 'manageinstitutions') . '/institutionstaff');
$smarty = smarty();
require_once('institution.php');
......
......@@ -26,16 +26,14 @@
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers/adminnotifications');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('adminnotifications', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'notifications');
require_once('pieforms/pieform.php');
global $USER;
define('MENUITEM', ($USER->get('admin') ? 'configusers' : 'manageinstitutions') . '/adminnotifications');
$sql = '
SELECT
......
......@@ -60,6 +60,7 @@ $string['adminhome'] = 'Admin home';
$string['configsite'] = 'Configure Site';
$string['configusers'] = 'Manage Users';
$string['configextensions'] = 'Administer Extensions';
$string['manageinstitutions'] = 'Manage Institutions';
// Admin homepage strings
$string['siteoptions'] = 'Site options';
......
......@@ -1301,76 +1301,9 @@ function make_link($url) {
* @return $adminnav a data structure containing the admin navigation
*/
function admin_nav() {
global $USER;
if (!$USER->get('admin')) {
// Institutional Admin menu
return array(
array(
'path' => 'configusers',
'url' => 'admin/users/search.php',
'title' => get_string('institutionadministration', 'admin'),
'weight' => 10,
),
array(
'path' => 'configusers/usersearch',
'url' => 'admin/users/search.php',
'title' => get_string('usersearch', 'admin'),
'weight' => 10,
),
array(
'path' => 'configusers/suspendedusers',
'url' => 'admin/users/suspended.php',
'title' => get_string('suspendedusers', 'admin'),
'weight' => 20,
),
array(
'path' => 'configusers/institutionusers',
'url' => 'admin/users/institutionusers.php',
'title' => get_string('institutionmembers', 'admin'),
'weight' => 30,
),
array(
'path' => 'configusers/institutionstaff',
'url' => 'admin/users/institutionstaff.php',
'title' => get_string('staffusers', 'admin'),
'weight' => 40,
),
array(
'path' => 'configusers/institutionadmins',
'url' => 'admin/users/institutionadmins.php',
'title' => get_string('adminusers', 'admin'),
'weight' => 50,
),
array(
'path' => 'configusers/institutions',
'url' => 'admin/users/institutions.php',
'title' => get_string('institutionsettings', 'admin'),
'weight' => 60,
),
array(
'path' => 'configusers/adminnotifications',
'url' => 'admin/users/notifications.php',
'title' => get_string('adminnotifications', 'admin'),
'weight' => 70,
),
array(
'path' => 'configusers/adduser',
'url' => 'admin/users/add.php',
'title' => get_string('adduser', 'admin'),
'weight' => 80,
),
array(
'path' => 'configusers/uploadcsv',
'url' => 'admin/users/uploadcsv.php',
'title' => get_string('uploadcsv', 'admin'),
'weight' => 90,
),
);
}
$menu = array(
array(
'path' => 'admin',
'path' => 'adminhome',
'url' => 'admin/',
'title' => get_string('adminhome', 'admin'),
'weight' => 10,
......@@ -1482,12 +1415,91 @@ function admin_nav() {
return $menu;
}
/**
* Returns the entries in the standard institutional admin menu
*
* @return $adminnav a data structure containing the admin navigation
*/
function institutional_admin_nav() {
return array(
array(
'path' => 'configusers',
'url' => 'admin/users/search.php',
'title' => get_string('configusers', 'admin'),
'weight' => 10,
),
array(
'path' => 'configusers/usersearch',
'url' => 'admin/users/search.php',
'title' => get_string('usersearch', 'admin'),
'weight' => 10,
),
array(
'path' => 'configusers/suspendedusers',
'url' => 'admin/users/suspended.php',
'title' => get_string('suspendedusers', 'admin'),
'weight' => 20,
),
array(
'path' => 'configusers/institutionusers',
'url' => 'admin/users/institutionusers.php',
'title' => get_string('institutionmembers', 'admin'),
'weight' => 30,
),
array(
'path' => 'configusers/adduser',
'url' => 'admin/users/add.php',
'title' => get_string('adduser', 'admin'),
'weight' => 40,
),
array(
'path' => 'configusers/uploadcsv',
'url' => 'admin/users/uploadcsv.php',
'title' => get_string('uploadcsv', 'admin'),
'weight' => 50,
),
array(
'path' => 'manageinstitutions',
'url' => 'admin/users/institutions.php',
'title' => get_string('manageinstitutions', 'admin'),
'weight' => 20,
),
array(
'path' => 'manageinstitutions/institutions',
'url' => 'admin/users/institutions.php',
'title' => get_string('institutionsettings', 'admin'),
'weight' => 10,
),
array(
'path' => 'manageinstitutions/institutionstaff',
'url' => 'admin/users/institutionstaff.php',
'title' => get_string('staffusers', 'admin'),
'weight' => 20,
),
array(
'path' => 'manageinstitutions/institutionadmins',
'url' => 'admin/users/institutionadmins.php',
'title' => get_string('adminusers', 'admin'),
'weight' => 30,
),
array(
'path' => 'manageinstitutions/adminnotifications',
'url' => 'admin/users/notifications.php',
'title' => get_string('adminnotifications', 'admin'),
'weight' => 40,
),
);
}
/**
* Builds a data structure representing the menu for Mahara.
*/
function main_nav() {
if (defined('ADMIN') || defined('INSTITUTIONALADMIN')) {
$menu = admin_nav();
global $USER;
$menu = $USER->get('admin') ? admin_nav() : institutional_admin_nav();
}
else {
// Build the menu structure for the site
......
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