3 require_once($CFG->dirroot
.'/lib/formslib.php');
5 class key_form
extends moodleform
{
8 function definition () {
9 global $USER, $CFG, $COURSE;
11 $mform =& $this->_form
;
13 $mform->addElement('static', 'value', get_string('keyvalue', 'userkey'));
14 $mform->addElement('text', 'iprestriction', get_string('keyiprestriction', 'userkey'), array('size'=>80));
15 $mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil', 'userkey'), array('optional'=>true));
17 $mform->setHelpButton('iprestriction', array(false, get_string('keyiprestriction', 'userkey'),
18 false, true, false, get_string("keyiprestrictionhelp", 'userkey')));
19 $mform->setHelpButton('validuntil', array(false, get_string('keyvaliduntil', 'userkey'), false, true, false, get_string("keyvaliduntilhelp", 'userkey')));
21 $mform->addElement('hidden','id');
22 $mform->setType('id', PARAM_INT
);
24 $mform->addElement('hidden','courseid');
25 $mform->setType('courseid', PARAM_INT
);
27 $this->add_action_buttons();