MDL-23395, go straight to page editing page when title is not empyt and forceformat...
[moodle.git] / question / category_form.php
blob22ece91b741b57df4eddcb017e23750c00bc757b
1 <?php
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, $DB;
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('parentcategory', 'question'),
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->addHelpButton('parent', 'parentcategory', '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);