adding current groupid to grade_export class - soon to be used in plugins
[moodle-pu.git] / question / category_form.php
blob84a0d28e18c0c74ef389cd1b55b059f700dbba7d
1 <?php //$Id$
3 require_once($CFG->libdir.'/formslib.php');
5 class question_category_edit_form extends moodleform {
7 function definition() {
8 global $CFG;
9 $mform =& $this->_form;
11 $contexts = $this->_customdata['contexts'];
12 $currentcat = $this->_customdata['currentcat'];
13 //--------------------------------------------------------------------------------
14 $mform->addElement('header', 'categoryheader', get_string('addcategory', 'quiz'));
15 $mform->setHelpButton('categoryheader', array('categories_edit', get_string('addcategory', 'quiz'), 'quiz'));
17 $questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parent', 'quiz'),
18 array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat));
19 $mform->setType('parent', PARAM_SEQUENCE);
20 if (1 == count_records_sql("SELECT count(*) FROM {$CFG->prefix}question_categories c1, {$CFG->prefix}question_categories c2 WHERE c2.id = $currentcat AND c1.contextid = c2.contextid")){
21 $mform->hardFreeze('parent');
24 $mform->addElement('text','name', get_string('name'),'maxlength="254" size="50"');
25 $mform->setDefault('name', '');
26 $mform->addRule('name', get_string('categorynamecantbeblank', 'quiz'), 'required', null, 'client');
27 $mform->setType('name', PARAM_MULTILANG);
29 $mform->addElement('textarea', 'info', get_string('categoryinfo', 'quiz'), array('rows'=> '10', 'cols'=>'45'));
30 $mform->setDefault('info', '');
31 $mform->setType('info', PARAM_MULTILANG);
32 //--------------------------------------------------------------------------------
33 $this->add_action_buttons(false, get_string('addcategory', 'quiz'));
34 //--------------------------------------------------------------------------------
35 $mform->addElement('hidden', 'id', 0);
36 $mform->setType('id', PARAM_INT);