3 require_once($CFG->libdir
.'/formslib.php');
5 class question_category_edit_form_randomquestion
extends moodleform
{
7 function definition() {
9 $mform =& $this->_form
;
11 $contexts = $this->_customdata
['contexts'];
12 $currentcat = $this->_customdata
['currentcat'];
13 //--------------------------------------------------------------------------------
14 $mform->addElement('header', 'categoryheader', get_string('createcategoryfornewrandomquestion', 'quiz'));
16 $questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parentcategory', 'question'),
17 array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat));
18 $mform->setType('parent', PARAM_SEQUENCE
);
19 $mform->addHelpButton('parent', 'parentcategory', 'question');
21 $mform->addElement('text','name', get_string('name'),'maxlength="254" size="50"');
22 $mform->setDefault('name', '');
23 $mform->addRule('name', get_string('categorynamecantbeblank', 'quiz'), 'required', null, 'client');
24 $mform->setType('name', PARAM_MULTILANG
);
26 $mform->addElement('hidden', 'info', '');
27 $mform->setType('info', PARAM_MULTILANG
);
29 //--------------------------------------------------------------------------------
30 $this->add_action_buttons(true, get_string('addrandomquestion', 'quiz'));
31 //--------------------------------------------------------------------------------
32 $mform->addElement('hidden', 'id', 0);
33 $mform->setType('id', PARAM_INT
);
34 $mform->addElement('hidden', 'addonpage', 0, 'id="rform_qpage"');
35 $mform->setType('addonpage', PARAM_SEQUENCE
);