Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-76018

Navigation: Activity header gives warning if module has no intro

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.0.5
    • 4.0.4
    • Navigation
    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-76018-master
    • Hide
      1. Ensure Debug messages (on Site administration > Development > Debugging) is set to DEVELOPER, and Display debug messages is enabled.
      2. The attached indescribable.zip contains a Moodle activity module plugin. Unzip it and place the 'indescribable' directory inside the 'mod' directory of your moodle installation.
      3. Go to the admin page /admin to trigger the module install, and contine through all the prompts.
      4. Go to any course page and turn editing on.
      5. Add an instance of the 'indescribable' module (it's under the Resources tab).
      6. Edit settings for the instance.
      7. View page source (usually Ctrl-U depending on browser) and look right at the top to see if there is a PHP warning.
        EXPECTED: There should be no PHP warning on the page, it should start with a '<!DOCTYPE html>' line.
      Show
      Ensure Debug messages (on Site administration > Development > Debugging ) is set to DEVELOPER, and Display debug messages is enabled. The attached indescribable.zip contains a Moodle activity module plugin. Unzip it and place the 'indescribable' directory inside the 'mod' directory of your moodle installation. Go to the admin page /admin to trigger the module install, and contine through all the prompts. Go to any course page and turn editing on. Add an instance of the 'indescribable' module (it's under the Resources tab). Edit settings for the instance. View page source (usually Ctrl-U depending on browser) and look right at the top to see if there is a PHP warning. EXPECTED: There should be no PHP warning on the page, it should start with a '<!DOCTYPE html>' line.

      The activity header code contains this line:

      if (empty($layoutoptions['nodescription']) && $page->activityrecord->intro && trim($page->activityrecord->intro)) {
      

      It is possible (and sometimes useful, in special cases) to create an activity that doesn't have an 'intro' field. When doing this, you should define false for the FEATURE_MOD_INTRO constant in the module's 'supports' function (see attached example module for code).

      But, even when that is set, the line above causes a PHP warning when you edit settings for the activity.

      On Boost theme it is hard to see the warning (it flickers on) but if you edit source you can see it. At the start of the source it looks like this.

      <br />
      <b>Warning</b>:  Undefined property: stdClass::$intro in <b>C:\Users\sm449\workspace\core-moodle-github\lib\classes\output\activity_header.php</b> on line <b>70</b><br />
      

        1. MDL-76018_v400.png
          MDL-76018_v400.png
          72 kB
        2. MDL-76018_master.png
          MDL-76018_master.png
          71 kB
        3. indescribable.zip
          7 kB

            quen Sam Marshall
            quen Sam Marshall
            Katie Ransom Katie Ransom
            Huong Nguyen Huong Nguyen
            John Edward Pedregosa John Edward Pedregosa
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 35 minutes
                1h 35m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.