Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-19428: mform - Fixed the 'includenograde' option in modgrade type

  • Loading branch information...
commit 17f822bd40f22596a64263f1e13f95cf0ba4c932 1 parent b5840c4
sam_marshall authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/form/modgrade.php
View
15 lib/form/modgrade.php
@@ -11,8 +11,8 @@
*/
class MoodleQuickForm_modgrade extends MoodleQuickForm_select{
-
- var $_includenograde=true;
+ var $_hidenograde = false;
+
/**
* Class constructor
*
@@ -23,11 +23,11 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_select{
* @access public
* @return void
*/
- function MoodleQuickForm_modgrade($elementName=null, $elementLabel=null, $attributes=null, $includenograde=true)
+ function MoodleQuickForm_modgrade($elementName=null, $elementLabel=null, $attributes=null, $hidenograde=false)
{
HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null);
$this->_type = 'modgrade';
- $this->_includenograde=$includenograde;
+ $this->_hidenograde = $hidenograde;
} //end constructor
@@ -46,13 +46,16 @@ 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->_includenograde) {
+ if (!$this->_hidenograde) {
$grades[0] = get_string('nograde');
}
for ($i=100; $i>=1; $i--) {
@@ -62,7 +65,7 @@ function onQuickFormEvent($event, $arg, &$caller)
$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 .'&amp;list=true', 'ratingscales',
$linkobject, 400, 500, $strscales, 'none', true), 'link_to_popup_window');
- break;
+ return $result;
}
return parent::onQuickFormEvent($event, $arg, $caller);
}
Please sign in to comment.
Something went wrong with that request. Please try again.