Added new selection items to the form

This commit is contained in:
Valentin Popov 2017-12-03 18:29:52 +04:00
parent 9d65bf2c2c
commit 44a4729bab

View File

@ -50,12 +50,16 @@ class token_editor_form extends moodleform {
/* Defines roles */ /* Defines roles */
$targettypetypes = array( $targettypetypes = array(
"null" => new lang_string("none", "moodle"),
"user" => new lang_string("user", "moodle") "user" => new lang_string("user", "moodle")
); );
/* Defines additional actions */ /* Defines additional actions */
$extendedactiontypes = array( $extendedactiontypes = array(
"null" => new lang_string("none", "moodle"), "cohort" => new lang_string("cohort", "cohort"),
"course" => new lang_string("course", "moodle"),
"group" => new lang_string("group", "moodle"),
"null" => new lang_string("none", "moodle"),
"redirect" => new lang_string("redirect", "moodle") "redirect" => new lang_string("redirect", "moodle")
); );
@ -76,14 +80,13 @@ class token_editor_form extends moodleform {
/* The role selection element */ /* The role selection element */
$mform->addElement("select", "targettype", new lang_string("role", "moodle"), $targettypetypes); $mform->addElement("select", "targettype", new lang_string("role", "moodle"), $targettypetypes);
$mform->addRule("targettype", null, "required");
$mform->setDefault("targettype", "user"); $mform->setDefault("targettype", "user");
$mform->setType("targettype", PARAM_TAG); $mform->setType("targettype", PARAM_TAG);
/* The identifier element */ /* The identifier element */
$mform->addElement("text", "targetid", new lang_string("idnumbermod", "moodle")); $mform->addElement("text", "targetid", new lang_string("idnumbermod", "moodle"));
$mform->addRule("targetid", null, "required"); $mform->setDefault("targetid", 1);
$mform->setType("targetid", PARAM_RAW_TRIMMED); $mform->setType("targetid", PARAM_INT);
/* The header of constraints */ /* The header of constraints */
$mform->addElement("header", "statsuserlogins", new lang_string("statsuserlogins", "moodle")); $mform->addElement("header", "statsuserlogins", new lang_string("statsuserlogins", "moodle"));