Commit 113a5266 authored by Elliot Pahl's avatar Elliot Pahl Committed by Elliot Pahl
Browse files

Add 'Institution expiry date' field to add/edit institutions page.

parent 5c8ac9f1
......@@ -123,7 +123,7 @@ if ($institution || $add) {
if (!$add) {
$data = get_record('institution', 'name', $institution);
$lockedprofilefields = (array) get_column('institution_locked_profile_field', 'profilefield', 'name', $institution);
// TODO: Find a better way to work around Smarty's minimal looping logic
if (!empty($authinstances)) {
foreach($authinstances as $key => $val) {
......@@ -146,6 +146,7 @@ if ($institution || $add) {
else {
$data = new StdClass;
$data->displayname = '';
$data->expiry = null;
if (!get_config('usersuniquebyusername')) {
$data->registerallowed = 1;
}
......@@ -159,7 +160,9 @@ if ($institution || $add) {
$themeoptions = get_themes();
$themeoptions['sitedefault'] = '- ' . get_string('sitedefault', 'admin') . ' (' . $themeoptions[get_config('theme')] . ') -';
uksort($themeoptions, 'theme_sort');
$sitename = get_config('sitename');
safe_require('artefact', 'internal');
$elements = array(
'name' => array(
......@@ -199,6 +202,15 @@ if ($institution || $add) {
),
'help' => true,
),
'expiry' => array(
'type' => 'date',
'title' => get_string('institutionexpiry', 'admin'),
'description' => get_string('institutionexpirydescription', 'admin', $sitename),
'defaultvalue' => is_null($data->expiry) ? null : strtotime($data->expiry),
'help' => true,
'minyear' => date('Y') - 2,
'maxyear' => date('Y') + 10,
),
);
if ($USER->get('admin')) {
......@@ -366,6 +378,7 @@ function institution_submit(Pieform $form, $values) {
}
$newinstitution->displayname = $values['displayname'];
$newinstitution->expiry = db_format_timestamp($values['expiry']);
$newinstitution->authplugin = empty($values['authplugin']) ? null : $values['authplugin'];
if (get_config('usersuniquebyusername')) {
// Registering absolutely not allowed when this setting is on, it's a
......
......@@ -391,6 +391,8 @@ $string['adminnoauthpluginforinstitution'] = 'Please configure an authentication
$string['institutionname'] = 'Institution name';
$string['institutionnamealreadytaken'] = 'This institution name is already taken';
$string['institutiondisplayname'] = 'Institution display name';
$string['institutionexpiry'] = 'Institution expiry date';
$string['institutionexpirydescription'] = 'The date at which this institutions membership of %s will be suspended.';
$string['institutionupdatedsuccessfully'] = 'Institution updated successfully.';
$string['registrationallowed'] = 'Registration allowed?';
$string['registrationalloweddescription2'] = 'Whether users can register for your site for this institution using the registration form';
......
<h3>Institution expiry date</h3>
<p>The Institution's expiry date is the date that the institution will be suspended on and users from this institution won't be able to login until the institution is unsuspended.</p>
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