Added .gitignore
[moodle-linuxchix.git] / lib / form / questioncategory.php
blob2347af82c8064c6ddd829423c7bd121d74f9f640
1 <?php
2 /**
3 * A moodle form field type for question categories.
5 * @copyright Jamie Pratt
6 * @author Jamie Pratt
7 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
8 * @package moodleforms
9 */
11 global $CFG;
12 require_once("$CFG->libdir/form/selectgroups.php");
13 require_once("$CFG->libdir/questionlib.php");
15 /**
16 * HTML class for a drop down element to select a question category.
17 * @access public
19 class MoodleQuickForm_questioncategory extends MoodleQuickForm_selectgroups {
20 var $_options = array('top'=>false, 'currentcat'=>0, 'nochildrenof' => -1);
22 /**
23 * Constructor
25 * @param string $elementName Select name attribute
26 * @param mixed $elementLabel Label(s) for the select
27 * @param mixed $attributes Either a typical HTML attribute string or an associative array
28 * @param array $options additional options. Recognised options are courseid, published and
29 * only_editable, corresponding to the arguments of question_category_options from moodlelib.php.
30 * @access public
31 * @return void
33 function MoodleQuickForm_questioncategory($elementName = null, $elementLabel = null, $options = null, $attributes = null) {
34 MoodleQuickForm_selectgroups::MoodleQuickForm_selectgroups($elementName, $elementLabel, array(), $attributes);
35 $this->_type = 'questioncategory';
36 if (is_array($options)) {
37 $this->_options = $options + $this->_options;
38 $this->loadArrayOptGroups(
39 question_category_options($this->_options['contexts'], $this->_options['top'], $this->_options['currentcat'],
40 false, $this->_options['nochildrenof']));