3 require_once "$CFG->libdir/form/select.php";
6 * HTML class for a drop down element to select the grade for an activity,
7 * used in mod update form
12 class MoodleQuickForm_modgrade
extends MoodleQuickForm_select
{
15 var $_includenograde=true;
19 * @param string Select name attribute
20 * @param mixed Label(s) for the select
21 * @param mixed Either a typical HTML attribute string or an associative array
22 * @param mixed $options ignored
26 function MoodleQuickForm_modgrade($elementName=null, $elementLabel=null, $attributes=null, $includenograde=true)
28 HTML_QuickForm_element
::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null);
29 $this->_type
= 'modgrade';
30 $this->_includenograde
=$includenograde;
35 * Called by HTML_QuickForm whenever form event is made on this element
37 * @param string $event Name of event
38 * @param mixed $arg event arguments
39 * @param object $caller calling object
44 function onQuickFormEvent($event, $arg, &$caller)
49 $strscale = get_string('scale');
50 $strscales = get_string('scales');
51 $scales = get_scales_menu($COURSE->id
);
52 foreach ($scales as $i => $scalename) {
53 $grades[-$i] = $strscale .': '. $scalename;
55 if ($this->_includenograde
) {
56 $grades[0] = get_string('nograde');
58 for ($i=100; $i>=1; $i--) {
62 $linkobject = '<span class="helplink"><img height="17" width="17" alt="'.$strscales.'" src="'.$CFG->pixpath
.'/help.gif" /></span>';
63 $this->setHelpButton(array('/course/scales.php?id='. $COURSE->id
.'&list=true', 'ratingscales',
64 $linkobject, 400, 500, $strscales, 'none', true), 'link_to_popup_window');
67 return parent
::onQuickFormEvent($event, $arg, $caller);