Commit 137591f9 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add max user accounts option to Edit institution page

parent 2d1da0c1
......@@ -225,6 +225,15 @@ if ($institution || $add) {
'options' => $themeoptions,
'help' => true,
);
if ($USER->get('admin')) {
$elements['maxuseraccounts'] = array(
'type' => 'text',
'title' => get_string('maxuseraccounts','admin'),
'description' => get_string('maxuseraccountsdescription','admin'),
'defaultvalue' => empty($data->maxuseraccounts) ? '' : $data->maxuseraccounts,
'rules' => array('regex' => '/^\d*$/'),
);
}
}
$elements['lockedfields'] = array(
......@@ -274,7 +283,7 @@ else {
}
function institution_submit(Pieform $form, $values) {
global $SESSION, $institution, $add, $instancearray;
global $SESSION, $institution, $add, $instancearray, $USER;
db_begin();
// Update the basic institution record...
......@@ -289,6 +298,10 @@ function institution_submit(Pieform $form, $values) {
$newinstitution->theme = empty($values['theme']) ? null : $values['theme'];
$newinstitution->defaultmembershipperiod = ($values['defaultmembershipperiod']) ? intval($values['defaultmembershipperiod']) : null;
if ($USER->get('admin')) {
$newinstitution->maxuseraccounts = ($values['maxuseraccounts']) ? intval($values['maxuseraccounts']) : null;
}
$allinstances = array_merge($values['authplugin']['instancearray'], $values['authplugin']['deletearray']);
if (array_diff($allinstances, $instancearray)) {
......
......@@ -316,6 +316,9 @@ $string['institutionusersupdatedrequesters'] = 'Users added';
$string['institutionusersupdatedmembers'] = 'Users removed';
$string['institutionusersupdatednonmembers'] = 'Invitations sent';
$string['maxuseraccounts'] = 'Maximum User Accounts Allowed';
$string['maxuseraccountsdescription'] = 'The maximum number of user accounts that can be associated with the institution. If there is no limit, this field should be left blank.';
// general stuff
$string['notificationssaved'] = 'Notification settings saved';
......
......@@ -535,6 +535,10 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2007121000) {
execute_sql('ALTER TABLE {institution} ADD COLUMN maxuseraccounts bigint');
}
return $status;
}
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007120500;
$config->version = 2007121000;
$config->release = '0.9.0alpha3dev';
$config->minupgradefrom = 2007080700;
$config->minupgraderelease = '0.8.0 (release tag 0.8.0_RELEASE)';
......
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