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

Incorrect references to global $PAGE in blocklib.php. Should always use $this->page

XMLWordPrintable

      This breaks the kind of code that automatically creates a Moodle coures, including blocks, by creating a $page object, and then using it to add blocks. E.g. this typical OU code.

              // Add some blocks.
              $coursepage = new \moodle_page();
              $coursepage->set_course($newcourse);
              $coursepage->set_pagetype('course-view-*');
              $coursepage->set_pagelayout('course');
              $coursepage->blocks->get_regions();
       
              // News, Resources, Forums, Recommender and Handy links on the right.
              $coursepage->blocks->add_block('oucontacttutor', 'side-post', -7, false);
              $coursepage->blocks->add_block('news', 'side-post', 10, false);
              $coursepage->blocks->add_block('ourecent_activity', 'side-post', 20, false);
              $coursepage->blocks->add_block('oukeycoursedates', 'side-post', 43, false);
      

      Several new methods added during the theme Boost changes break this rule. I'll fix them.

            timhunt Tim Hunt
            timhunt Tim Hunt
            Jake Dallimore Jake Dallimore
            Dan Poltawski Dan Poltawski
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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