/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @since 1.0 * @access public * @return mixed */ function onQuickFormEvent($event, $arg, &$caller) { global $COURSE, $CFG, $OUTPUT; switch ($event) { case 'createElement': // Need to call superclass first because we want the constructor // to run. $result = parent::onQuickFormEvent($event, $arg, $caller); $strscale = get_string('scale'); $strscales = get_string('scales'); $scales = get_scales_menu($COURSE->id); foreach ($scales as $i => $scalename) { $grades[-$i] = $strscale . ': ' . $scalename; } if (!$this->_hidenograde) { $grades[0] = get_string('nograde'); } for ($i = 100; $i >= 1; $i--) { $grades[$i] = $i; } $this->load($grades); //TODO: rewrite mod grading support in modforms return $result; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @since 1.0 * @access public * @return mixed */ function onQuickFormEvent($event, $arg, &$caller) { global $COURSE, $CFG; switch ($event) { case 'createElement': // Need to call superclass first because we want the constructor // to run. $result = parent::onQuickFormEvent($event, $arg, $caller); $strscale = get_string('scale'); $strscales = get_string('scales'); $scales = get_scales_menu($COURSE->id); foreach ($scales as $i => $scalename) { $grades[-$i] = $strscale . ': ' . $scalename; } if (!$this->_hidenograde) { $grades[0] = get_string('nograde'); } for ($i = 100; $i >= 1; $i--) { $grades[$i] = $i; } $this->load($grades); $linkobject = '<span class="helplink"><img height="17" width="17" alt="' . $strscales . '" src="' . $CFG->pixpath . '/help.gif" /></span>'; $this->setHelpButton(array('/course/scales.php?id=' . $COURSE->id . '&list=true', 'ratingscales', $linkobject, 400, 500, $strscales, 'none', true), 'link_to_popup_window'); return $result; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @access public * @return mixed */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $this->load(question_category_options($this->_courseid, $this->_published, $this->_only_editable)); break; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @return mixed */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $choices = array(); $choices[0] = get_string('no'); $choices[1] = get_string('yes'); $this->load($choices); break; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @since 1.0 * @access public * @return mixed */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $choices = array(); $choices[NOGROUPS] = get_string('groupsnone'); $choices[SEPARATEGROUPS] = get_string('groupsseparate'); $choices[VISIBLEGROUPS] = get_string('groupsvisible'); $this->setHelpButton(array('groupmode', get_string('groupmode'))); $this->load($choices); break; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @return bool */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $caller->setType($arg[0], PARAM_TAGLIST); break; } return parent::onQuickFormEvent($event, $arg, $caller); }
/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string $event Name of event * @param mixed $arg event arguments * @param object $caller calling object * @since 1.0 * @access public * @return mixed */ function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'createElement': $menu = format_text_menu(); $this->load($menu); $this->setHelpButton(array('textformat', get_string('helpformatting'))); break; case 'updateValue': $value = $this->_findValue($caller->_constantValues); if (null === $value) { $value = $this->_findValue($caller->_submitValues); // Fix for bug #4465 & #5269 // XXX: should we push this to element::onQuickFormEvent()? if (null === $value && (!$caller->isSubmitted() || !$this->getMultiple())) { $value = $this->_findValue($caller->_defaultValues); } } if (null !== $value) { $format = $value; } else { $format = FORMAT_MOODLE; } if ($this->_useHtmlEditor) { $this->setValue(array(FORMAT_HTML)); } else { $this->setValue(array($format)); } return true; break; } return parent::onQuickFormEvent($event, $arg, $caller); }