MDL-10496:
[moodle-linuxchix.git] / lib / form / modvisible.php
blob0f91e668ed11a6fc9362684238bc8eb69cf76023
1 <?php
2 global $CFG;
3 require_once "$CFG->libdir/form/select.php";
5 /**
6 * HTML class for a drop down element to select visibility in an activity mod update form
8 * @author Jamie Pratt
9 * @access public
11 class MoodleQuickForm_modvisible extends MoodleQuickForm_select{
13 /**
14 * Class constructor
16 * @param string $elementName Select name attribute
17 * @param mixed $elementLabel Label(s) for the select
18 * @param mixed $attributes Either a typical HTML attribute string or an associative array
19 * @param array $options ignored
20 * @access public
21 * @return void
23 function MoodleQuickForm_modvisible($elementName=null, $elementLabel=null, $attributes=null, $options=null)
25 HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null);
26 $this->_type = 'modvisible';
29 } //end constructor
31 /**
32 * Called by HTML_QuickForm whenever form event is made on this element
34 * @param string $event Name of event
35 * @param mixed $arg event arguments
36 * @param object $caller calling object
37 * @access public
38 * @return mixed
40 function onQuickFormEvent($event, $arg, &$caller)
42 switch ($event) {
43 case 'createElement':
44 $choices=array();
45 $choices[1] = get_string('show');
46 $choices[0] = get_string('hide');
47 $this->load($choices);
48 break;
51 return parent::onQuickFormEvent($event, $arg, $caller);