Moodle
  1. Moodle
  2. MDL-19428

The 'modgrade' (scale/maxgrade) form type has a $includenograde parameter which does not work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.5
    • Fix Version/s: 1.9.6
    • Component/s: Forms Library
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      31660

      Description

      Lines such as the following:

      $mform->addElement('modgrade', 'ratingscale', get_string('scale'), null, false);

      ought to override the =true on the last parameter of the modgrade item type, causing it to hide the 'nograde' option from the list.

      In fact the list is built before the constructor is called, due to the rather weird architecture of HTML QuickForm. Consequently the variable is not available. In addition, it is not possible to have a QuickForm parameter within the first 5 that defaults to true because there is code that goes around setting all the first 5 parameters to null if they are not set. [I.e. all defaults must be to null/false, not true.]

        Activity

        Hide
        Sam Marshall added a comment -

        I searched the code and found out that (assuming my regular expression worked...) nobody is actually calling this with all 5 parameters anywhere in core. Which makes sense seeing as it doesn't work.

        Consequently I was free to change the parameter definition. I made it into $hidenograde (which obviously now defaults to false, as required by the system). I then moved the bit where it runs the constructor to before where it tries to use the variable that was defined in it.

        Changes to lib/form/modgrade.php only.

        Show
        Sam Marshall added a comment - I searched the code and found out that (assuming my regular expression worked...) nobody is actually calling this with all 5 parameters anywhere in core. Which makes sense seeing as it doesn't work. Consequently I was free to change the parameter definition. I made it into $hidenograde (which obviously now defaults to false, as required by the system). I then moved the bit where it runs the constructor to before where it tries to use the variable that was defined in it. Changes to lib/form/modgrade.php only.

          People

          • Assignee:
            Sam Marshall
            Reporter:
            Sam Marshall
            Participants:
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: