Commit 223a312d authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Change admin menu structure again

parent 50d5af7b
......@@ -34,13 +34,18 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'adminusers');
require_once('pieforms/pieform.php');
define('MENUITEM', ($USER->get('admin') ? 'configusers' : 'manageinstitutions') . '/institutionadmins');
define('MENUITEM', 'manageinstitutions/institutionadmins');
$smarty = smarty();
require_once('institution.php');
$institution = add_institution_selector_to_page(&$smarty, param_alphanum('institution', false),
get_config('wwwroot') . 'admin/users/institutionadmins.php');
if ($institution === false) {
$smarty->display('admin/users/noinstitutions.tpl');
exit;
}
// Get users who are currently admins
$adminusers = get_column('usr_institution', 'usr', 'admin', 1, 'institution', $institution);
......
......@@ -31,7 +31,7 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutions');
require_once('pieforms/pieform.php');
define('MENUITEM', ($USER->get('admin') ? 'configusers' : 'manageinstitutions') . '/institutions');
define('MENUITEM', 'manageinstitutions/institutions');
$smarty = smarty();
$institution = param_variable('i', '');
......
......@@ -34,13 +34,18 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'staffusers');
require_once('pieforms/pieform.php');
define('MENUITEM', ($USER->get('admin') ? 'configusers' : 'manageinstitutions') . '/institutionstaff');
define('MENUITEM', 'manageinstitutions/institutionstaff');
$smarty = smarty();
require_once('institution.php');
$institution = add_institution_selector_to_page(&$smarty, param_alphanum('institution', false),
get_config('wwwroot') . 'admin/users/institutionstaff.php');
if ($institution === false) {
$smarty->display('admin/users/noinstitutions.tpl');
exit;
}
// Get users who are currently staff
$staffusers = get_column('usr_institution', 'usr', 'staff', 1, 'institution', $institution);
......
......@@ -33,10 +33,15 @@ define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutionusers');
define('MENUITEM', 'configusers/institutionusers');
define('MENUITEM', 'manageinstitutions/institutionusers');
require_once('pieforms/pieform.php');
require_once('institution.php');
$institutionelement = get_institution_selector(false);
$smarty = smarty();
if (empty($institutionelement)) {
$smarty->display('admin/users/noinstitutions.tpl');
exit;
}
$institution = param_alphanum('institution', false);
if (!$institution || !$USER->can_edit_institution($institution)) {
......@@ -201,7 +206,6 @@ addLoadEvent(function() {
});
EOF;
$smarty = smarty();
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('usertypeselector', $usertypeselector);
$smarty->assign('institutionusersform', $userlistform);
......
......@@ -89,7 +89,9 @@ $string['uploadcsvdescription'] = 'Upload a CSV file containing new users';
$string['usersearch'] = 'User Search';
$string['usersearchdescription'] = 'Search all users and perform administrative actions on them';
$string['usersearchinstructions'] = 'You can search for users by clicking on the initials of their first and last names, or by entering a name in the search box. You can also enter an email address in the search box if you would like to search email addresses.';
$string['institutionmembersdescription'] = 'Associate users with institutions';
$string['institutionstaffdescription'] = 'Assign users Staff permissions';
$string['institutionadminsdescription'] = 'Assign Institution Administrator access rights';
$string['pluginadmin'] = 'Plugin Administration';
$string['pluginadmindescription'] = 'Install and configure plugins';
......@@ -362,6 +364,9 @@ $string['Maximum'] = 'Maximum';
$string['Staff'] = 'Staff';
$string['Admins'] = 'Admins';
$string['noinstitutions'] = 'No Institutions';
$string['noinstitutionsdescription'] = 'If you would like to associate users with an institution, you should create the institution first.';
// Admin User Search
$string['Query'] = 'Query';
$string['Institution'] = 'Institution';
......
......@@ -415,6 +415,10 @@ function get_institution_selector($includedefault = true) {
return null;
}
if (empty($institutions)) {
return null;
}
if (count($institutions) > 1) {
$options = array();
foreach ($institutions as $i) {
......@@ -448,6 +452,10 @@ function add_institution_selector_to_page($smarty, $institution, $page) {
require_once('pieforms/pieform.php');
$institutionelement = get_institution_selector(false);
if (empty($institutionelement)) {
return false;
}
global $USER;
if (empty($institution) || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
......
......@@ -1380,23 +1380,47 @@ function admin_nav() {
'title' => get_string('adminnotifications', 'admin'),
'weight' => 40,
),
array(
'path' => 'configusers/institutions',
'url' => 'admin/users/institutions.php',
'title' => get_string('institutions', 'admin'),
'weight' => 50,
),
array(
'path' => 'configusers/adduser',
'url' => 'admin/users/add.php',
'title' => get_string('adduser', 'admin'),
'weight' => 90,
'weight' => 50,
),
array(
'path' => 'configusers/uploadcsv',
'url' => 'admin/users/uploadcsv.php',
'title' => get_string('uploadcsv', 'admin'),
'weight' => 100,
'weight' => 60,
),
array(
'path' => 'manageinstitutions',
'url' => 'admin/users/institutions.php',
'title' => get_string('manageinstitutions', 'admin'),
'weight' => 35,
),
array(
'path' => 'manageinstitutions/institutions',
'url' => 'admin/users/institutions.php',
'title' => get_string('institutions', 'admin'),
'weight' => 10,
),
array(
'path' => 'manageinstitutions/institutionusers',
'url' => 'admin/users/institutionusers.php',
'title' => get_string('institutionmembers', 'admin'),
'weight' => 20,
),
array(
'path' => 'manageinstitutions/institutionstaff',
'url' => 'admin/users/institutionstaff.php',
'title' => get_string('institutionstaff', 'admin'),
'weight' => 30,
),
array(
'path' => 'manageinstitutions/institutionadmins',
'url' => 'admin/users/institutionadmins.php',
'title' => get_string('institutionadmins', 'admin'),
'weight' => 40,
),
array(
'path' => 'configextensions',
......@@ -1441,23 +1465,17 @@ function institutional_admin_nav() {
'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,
'weight' => 30,
),
array(
'path' => 'configusers/uploadcsv',
'url' => 'admin/users/uploadcsv.php',
'title' => get_string('uploadcsv', 'admin'),
'weight' => 50,
'weight' => 40,
),
array(
'path' => 'manageinstitutions',
......@@ -1471,23 +1489,29 @@ function institutional_admin_nav() {
'title' => get_string('institutionsettings', 'admin'),
'weight' => 10,
),
array(
'path' => 'manageinstitutions/institutionusers',
'url' => 'admin/users/institutionusers.php',
'title' => get_string('institutionmembers', 'admin'),
'weight' => 20,
),
array(
'path' => 'manageinstitutions/institutionstaff',
'url' => 'admin/users/institutionstaff.php',
'title' => get_string('staffusers', 'admin'),
'weight' => 20,
'title' => get_string('institutionstaff', 'admin'),
'weight' => 30,
),
array(
'path' => 'manageinstitutions/institutionadmins',
'url' => 'admin/users/institutionadmins.php',
'title' => get_string('adminusers', 'admin'),
'weight' => 30,
'title' => get_string('institutionadmins', 'admin'),
'weight' => 40,
),
array(
'path' => 'manageinstitutions/adminnotifications',
'url' => 'admin/users/notifications.php',
'title' => get_string('adminnotifications', 'admin'),
'weight' => 40,
'weight' => 50,
),
);
......
......@@ -43,11 +43,18 @@
<li><strong><a href="{$WWWROOT}admin/users/staff.php">{str tag=sitestaff section=admin}</a></strong> - {str tag=staffusersdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/admins.php">{str tag=siteadmins section=admin}</a></strong> - {str tag=adminusersdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/notifications.php">{str tag=adminnotifications section=admin}</a></strong> - {str tag=adminnotificationsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/institutions.php">{str tag=institutions section=admin}</a></strong> - {str tag=institutionsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/add.php">{str tag=adduser section=admin}</a></strong> - {str tag=adduserdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/uploadcsv.php">{str tag=uploadcsv section=admin}</a></strong> - {str tag=uploadcsvdescription section=admin}</li>
</ul>
</li>
<li><h3>{str tag=manageinstitutions section=admin}</h3>
<ul>
<li><strong><a href="{$WWWROOT}admin/users/institutions.php">{str tag=institutions section=admin}</a></strong> - {str tag=institutionsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/institutionusers.php">{str tag=institutionmembers section=admin}</a></strong> - {str tag=institutionmembersdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/institutionstaff.php">{str tag=institutionstaff section=admin}</a></strong> - {str tag=institutionstaffdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/institutionadmins.php">{str tag=institutionadmins section=admin}</a></strong> - {str tag=institutionadminsdescription section=admin}</li>
</ul>
</li>
<li><h3>{str tag=configextensions section=admin}</h3>
<ul>
<li><strong><a href="{$WWWROOT}admin/extensions/plugins.php">{str tag=pluginadmin section=admin}</a></strong> - {str tag=pluginadmindescription section=admin}</li>
......
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