Commit 177d40f5 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1840713: Allow 'mahara' institution to populate institution admin list page"

parents 655640a9 bf3143cc
...@@ -25,14 +25,20 @@ if (is_isolated() && !in_array($inst, array_keys($USER->get('institutions'))) && ...@@ -25,14 +25,20 @@ if (is_isolated() && !in_array($inst, array_keys($USER->get('institutions'))) &&
throw new AccessDeniedException(get_string('notinstitutionmember', 'error')); throw new AccessDeniedException(get_string('notinstitutionmember', 'error'));
} }
$institution = new Institution($inst); try {
$institution = new Institution($inst);
}
catch (Exception $e) {
throw new NotFoundException(get_string('institutionnotfound', 'mahara', $inst));
}
$admins = $institution->admins(); $admins = $institution->admins();
$staff = $institution->staff(); $staff = $institution->staff();
build_stafflist_html($admins, 'institution', 'admin', $inst); build_stafflist_html($admins, 'institution', 'admin', $inst);
build_stafflist_html($staff, 'institution', 'staff', $inst); build_stafflist_html($staff, 'institution', 'staff', $inst);
define('TITLE', $institution->displayname); $displayname = $institution->name == 'mahara' ? get_config('sitename') : $institution->displayname;
define('TITLE', $displayname);
$smarty = smarty(); $smarty = smarty();
$smarty->assign('admins', $admins); $smarty->assign('admins', $admins);
......
...@@ -492,6 +492,7 @@ $string['senddeletenotification'] = 'Send request'; ...@@ -492,6 +492,7 @@ $string['senddeletenotification'] = 'Send request';
$string['javascriptnotenabled'] = 'Your browser does not have JavaScript enabled. This site requires JavaScript to be enabled before you can log in.'; $string['javascriptnotenabled'] = 'Your browser does not have JavaScript enabled. This site requires JavaScript to be enabled before you can log in.';
$string['cookiesnotenabled'] = 'Your browser does not have cookies enabled or is blocking cookies. This site requires cookies to be enabled before you can log in.'; $string['cookiesnotenabled'] = 'Your browser does not have cookies enabled or is blocking cookies. This site requires cookies to be enabled before you can log in.';
$string['institution'] = 'Institution'; $string['institution'] = 'Institution';
$string['institutionnotfound'] = 'Institution "%s" not found';
$string['institutioncontacts'] = '\'%s\' contacts'; $string['institutioncontacts'] = '\'%s\' contacts';
$string['institutionlink'] = '<a href="%s">%s</a>'; $string['institutionlink'] = '<a href="%s">%s</a>';
$string['link'] = '<a href="%s">%s</a>'; $string['link'] = '<a href="%s">%s</a>';
......
...@@ -799,6 +799,9 @@ class Institution { ...@@ -799,6 +799,9 @@ class Institution {
WHERE i.institution = ? AND u.deleted = 0 AND i.admin = 1', array($this->name))) { WHERE i.institution = ? AND u.deleted = 0 AND i.admin = 1', array($this->name))) {
return array_map('extract_institution_user_id', $results); return array_map('extract_institution_user_id', $results);
} }
if ($this->name == 'mahara') {
return $this->institution_and_site_admins();
}
return array(); return array();
} }
......
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