Updated the 19 build version to 20101010
[moodle.git] / question / category_form.php
blob57cade3fd1c54562217cd2e59297b37a4b82caba
1 <?php // $Id$
3 if (!defined('MOODLE_INTERNAL')) {
4 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
7 require_once($CFG->libdir.'/formslib.php');
9 class question_category_edit_form extends moodleform {
11 function definition() {
12 global $CFG;
13 $mform =& $this->_form;
15 $contexts = $this->_customdata['contexts'];
16 $currentcat = $this->_customdata['currentcat'];
17 //--------------------------------------------------------------------------------
18 $mform->addElement('header', 'categoryheader', get_string('addcategory', 'quiz'));
20 $questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parent', 'quiz'),
21 array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat));
22 $mform->setType('parent', PARAM_SEQUENCE);
23 if (question_is_only_toplevel_category_in_context($currentcat)){
24 $mform->hardFreeze('parent');
26 $mform->setHelpButton('parent', array('categoryparent', get_string('parent', 'quiz'), 'question'));
28 $mform->addElement('text','name', get_string('name'),'maxlength="254" size="50"');
29 $mform->setDefault('name', '');
30 $mform->addRule('name', get_string('categorynamecantbeblank', 'quiz'), 'required', null, 'client');
31 $mform->setType('name', PARAM_MULTILANG);
33 $mform->addElement('textarea', 'info', get_string('categoryinfo', 'quiz'), array('rows'=> '10', 'cols'=>'45'));
34 $mform->setDefault('info', '');
35 $mform->setType('info', PARAM_MULTILANG);
36 //--------------------------------------------------------------------------------
37 $this->add_action_buttons(false, get_string('addcategory', 'quiz'));
38 //--------------------------------------------------------------------------------
39 $mform->addElement('hidden', 'id', 0);
40 $mform->setType('id', PARAM_INT);