MDL-20636 Finish off converting question import.
[moodle.git] / question / category_form.php
CommitLineData
aeb15530 1<?php
515ed4c3 2
bfebaf64
MD
3if (!defined('MOODLE_INTERNAL')) {
4 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
5}
6
515ed4c3 7require_once($CFG->libdir.'/formslib.php');
8
9class question_category_edit_form extends moodleform {
10
11 function definition() {
f34488b2 12 global $CFG, $DB;
515ed4c3 13 $mform =& $this->_form;
14
15 $contexts = $this->_customdata['contexts'];
16 $currentcat = $this->_customdata['currentcat'];
17//--------------------------------------------------------------------------------
18 $mform->addElement('header', 'categoryheader', get_string('addcategory', 'quiz'));
515ed4c3 19
5fcefc97 20 $questioncategoryel = $mform->addElement('questioncategory', 'parent', get_string('parentcategory', 'question'),
515ed4c3 21 array('contexts'=>$contexts, 'top'=>true, 'currentcat'=>$currentcat, 'nochildrenof'=>$currentcat));
22 $mform->setType('parent', PARAM_SEQUENCE);
df4e2244 23 if (question_is_only_toplevel_category_in_context($currentcat)) {
515ed4c3 24 $mform->hardFreeze('parent');
25 }
5fcefc97 26 $mform->addHelpButton('parent', 'parentcategory', 'question');
515ed4c3 27
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);
32
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);
41 }
42}
aeb15530 43