$alloweduserselector->invalidate_selected_users();
}
}
-
+/// Print the form.
+ check_theme_arrows();
/// display the UI
?>
$frommonth = optional_param('frommonth', '', PARAM_INT);
$fromyear = optional_param('fromyear', '', PARAM_INT);
$addcap = optional_param('addcap', false, PARAM_INT);
+ $enablevaliduntil = optional_param('enablevaliduntil', false, PARAM_INT);
$validuntil = mktime(23, 59, 59, $frommonth, $fromday, $fromyear);
$serviceuser = new object();
$serviceuser->id = $serviceuserid;
- $serviceuser->validuntil = $validuntil;
+ if ($enablevaliduntil) {
+ $serviceuser->validuntil = $validuntil;
+ } else {
+ $serviceuser->validuntil = null; //the valid until field is disabled, we reset the value
+ }
$serviceuser->iprestriction = $iprestriction;
$DB->update_record('external_services_users', $serviceuser);
echo $OUTPUT->box_start('generalbox', 'alloweduserlist');
echo "<label><strong>".get_string('serviceuserssettings', 'webservice').":</strong></label>";
- echo "<br/><br/><span style=\"font-size:90%\">"; //reduce font of the user settings
+ echo "<br/><br/><span style=\"font-size:85%\">"; //reduce font of the user settings
foreach($allowedusers as $user) {
echo "<strong>";
$selectors = html_select::make_time_selectors(array('days' => 'fromday','months' => 'frommonth', 'years' => 'fromyear'),$user->validuntil);
foreach ($selectors as $select) {
$contents .= $OUTPUT->select($select);
- }
+ } $checkbox = new html_select_option();
+ $checkbox->value = 1;
+ $checkbox->selected = empty($user->validuntil)?false:true;
+ $checkbox->text = get_string('enabled', 'webservice');
+ $checkbox->label->text = get_string('enabled', 'webservice');
+ $checkbox->alt = get_string('enabled', 'webservice');
+ $contents .= $OUTPUT->checkbox($checkbox, 'enablevaliduntil');
$contents .= "</div></div>";
//TO IMPLEMENT : assign the required capability (if needed)
$contents .= "<div class=\"fitem\"><div class=\"fitemtitle\"><label>".get_string('addrequiredcapability','webservice')." </label></div><div class=\"felement fcheckbox\">";
$temp = new admin_settingpage('externalservices', get_string('externalservices', 'webservice'));
$temp->add(new admin_setting_manageexternalservices());
$ADMIN->add('webservicesettings', $temp);
- $ADMIN->add('webservicesettings', new admin_externalpage('externalservice', get_string('externalservice', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service.php"), 'moodle/site:config', true);
- $ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', get_string('externalservicefunctions', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service_functions.php"), 'moodle/site:config', true);
- $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', get_string('externalserviceusers', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service_users.php"), 'moodle/site:config', true);
+ $ADMIN->add('webservicesettings', new admin_externalpage('externalservice', get_string('externalservice', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service.php", 'moodle/site:config', true));
+ $ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', get_string('externalservicefunctions', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service_functions.php", 'moodle/site:config', true));
+ $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', get_string('externalserviceusers', 'webservice'), "$CFG->wwwroot/$CFG->admin/external_service_users.php", 'moodle/site:config', true));
$temp = new admin_settingpage('webserviceprotocols', get_string('manageprotocols', 'webservice'));
$temp->add(new admin_setting_managewebserviceprotocols());
if (empty($CFG->enablewebservices)) {
if ($service->restrictedusers) {
$users = "<a href=\"$euurl?id=$service->id\">$strusers</a>";
} else {
- $users = '-';
+ $users = get_string('nouserrestriction','webservice');
}
$edit = "<a href=\"$esurl?id=$service->id\">$stredit</a>";
if ($service->restrictedusers) {
$users = "<a href=\"$euurl?id=$service->id\">$strusers</a>";
} else {
- $users = '-';
+ $users = get_string('nouserrestriction','webservice');
}
$edit = "<a href=\"$esurl?id=$service->id\">$stredit</a>";