]> git.mjollnir.org Git - moodle.git/commitdiff
blocklib: MDL-19010 remove no-longer-necessary global variable use from blocks
authortjhunt <tjhunt>
Wed, 6 May 2009 09:28:26 +0000 (09:28 +0000)
committertjhunt <tjhunt>
Wed, 6 May 2009 09:28:26 +0000 (09:28 +0000)
19 files changed:
blocks/activity_modules/block_activity_modules.php
blocks/admin_bookmarks/block_admin_bookmarks.php
blocks/admin_tree/block_admin_tree.php
blocks/blog_menu/block_blog_menu.php
blocks/blog_tags/block_blog_tags.php
blocks/calendar_month/block_calendar_month.php
blocks/calendar_upcoming/block_calendar_upcoming.php
blocks/course_summary/block_course_summary.php
blocks/glossary_random/block_glossary_random.php
blocks/moodleblock.class.php
blocks/news_items/block_news_items.php
blocks/online_users/block_online_users.php
blocks/participants/block_participants.php
blocks/recent_activity/block_recent_activity.php
blocks/rss_client/block_rss_client.php
blocks/section_links/block_section_links.php
blocks/site_main_menu/block_site_main_menu.php
blocks/social_activities/block_social_activities.php
blocks/tags/block_tags.php

index bf9c770e823b9036d6ac10c653da84dd31941409..0efc4a27f684d65c2c42f3203ad4fa12de049508 100644 (file)
@@ -7,7 +7,7 @@ class block_activity_modules extends block_list {
     }
 
     function get_content() {
-        global $CFG, $COURSE, $DB;
+        global $CFG, $DB;
 
         if($this->content !== NULL) {
             return $this->content;
index 0cd292ea46ddc764dc0708bbb41c4fe9f2228506..79029809cbd104a89d180652d91ef75ebee2ff22 100644 (file)
@@ -29,7 +29,7 @@ class block_admin_bookmarks extends block_base {
 
     function get_content() {
 
-        global $CFG, $USER, $PAGE;
+        global $CFG, $USER;
 
         if ($this->content !== NULL) {
             return $this->content;
@@ -62,12 +62,13 @@ class block_admin_bookmarks extends block_base {
             $bookmarks = array();
         }
 
-        if (isset($PAGE->section) and $PAGE->section == 'search'){
+        // TODO
+        if (isset($this->page->section) and $this->page->section == 'search'){
             // the search page can't be properly bookmarked at present
             $this->content->footer = '';
-        } else if (($section = (isset($PAGE->section) ? $PAGE->section : '')) && (in_array($section, $bookmarks))) {
+        } else if (($section = (isset($this->page->section) ? $this->page->section : '')) && (in_array($section, $bookmarks))) {
             $this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/delete.php?section=' . $section . '&amp;sesskey='.sesskey().'">' . get_string('unbookmarkthispage','admin') . '</a>';
-        } else if ($section = (isset($PAGE->section) ? $PAGE->section : '')) {
+        } else if ($section = (isset($this->page->section) ? $this->page->section : '')) {
             $this->content->footer = '<a href="' . $CFG->wwwroot . '/blocks/admin_bookmarks/create.php?section=' . $section . '&amp;sesskey='.sesskey().'">' . get_string('bookmarkthispage','admin') . '</a>';
         } else {
             $this->content->footer = '';
index ef6a3a6a359df34746c1affd7495ca68bdc179a4..5ac22c0b9372381bba0ef5d8d8b454133422fb29 100644 (file)
@@ -10,13 +10,13 @@ class block_admin_tree extends block_base {
     var $destination;
 
     function init() {
-        global $PAGE;
         $this->title = get_string('administrationsite');
         $this->version = 2007101509;
         $this->currentdepth = 0;
         $this->divcounter = 1;
         $this->tempcontent = '';
-        $this->section = (isset($PAGE->section) ? $PAGE->section : '');
+        // TODO
+        $this->section = (isset($this->page->section) ? $this->page->section : '');
         $this->pathtosection = array();
         $this->expandnodes = array();
     }
index 4bbd378dd8ddd88fffdea38b275ea684aaa69d61..2967304084f67b2a1acf625122492149073e413a 100755 (executable)
@@ -11,7 +11,7 @@ class block_blog_menu extends block_base {
     }
 
     function get_content() {
-        global $CFG, $USER, $COURSE;
+        global $CFG, $USER;
 
         if (empty($CFG->bloglevel)) {
             $this->content->text = '';
@@ -47,10 +47,10 @@ class block_blog_menu extends block_base {
 
             $sitecontext = get_context_instance(CONTEXT_SYSTEM);
 
-            if ($COURSE->id != SITEID) {
+            if ($this->page->course->id != SITEID) {
 
                 $incoursecontext = true;
-                $curcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
+                $curcontext = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
             } else {
                 $incoursecontext = false;
                 $curcontext = $sitecontext;
@@ -63,10 +63,10 @@ class block_blog_menu extends block_base {
             if ( (isloggedin() && !isguest()) && $incoursecontext
                     && $CFG->bloglevel >= BLOG_COURSE_LEVEL && $canviewblogs) {
 
-                $coursearg = '&amp;courseid='.$COURSE->id;
+                $coursearg = '&amp;courseid='.$this->page->course->id;
                 // a course is specified
 
-                $courseviewlink = '<li><a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=course&amp;filterselect='. $COURSE->id .'">';
+                $courseviewlink = '<li><a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=course&amp;filterselect='. $this->page->course->id .'">';
                 $courseviewlink .= get_string('viewcourseentries', 'blog') ."</a></li>\n";
             }
 
index c230a743eb67775010def8c5f23d13f1c1c493d8..77e42b891decca12e6f73f44f38187dc50f51d41 100644 (file)
@@ -39,7 +39,7 @@ class block_blog_tags extends block_base {
     }
 
     function get_content() {
-        global $CFG, $SITE, $COURSE, $USER, $DB;
+        global $CFG, $SITE, $USER, $DB;
 
         if (empty($CFG->usetags) || empty($CFG->bloglevel)) {
             $this->content->text = '';
@@ -130,18 +130,18 @@ class block_blog_tags extends block_base {
 
                     case BLOG_GROUP_LEVEL:
                         $filtertype = 'group';
-                        $filterselect = groups_get_course_group($COURSE);
+                        $filterselect = groups_get_course_group($this->page->course);
                     break;
 
                     case BLOG_COURSE_LEVEL:
                         $filtertype = 'course';
-                        $filterselect = $COURSE->id;
+                        $filterselect = $this->page->course->id;
                     break;
 
                     default:
-                        if (isset($COURSE->id) && $COURSE->id != SITEID) {
+                        if ($this->page->course->id != SITEID) {
                             $filtertype = 'course';
-                            $filterselect = $COURSE->id;
+                            $filterselect = $this->page->course->id;
                         } else {
                             $filtertype = 'site';
                             $filterselect = SITEID;
index 626864a03b48f2e9bc9a491a1b76d0c4debdec45..a699935f51e661097b695e57e0690e64e43e257c 100644 (file)
@@ -11,7 +11,7 @@ class block_calendar_month extends block_base {
     }
 
     function get_content() {
-        global $USER, $CFG, $SESSION, $COURSE;
+        global $USER, $CFG, $SESSION;
         $cal_m = optional_param( 'cal_m', 0, PARAM_INT );
         $cal_y = optional_param( 'cal_y', 0, PARAM_INT );
 
@@ -21,7 +21,7 @@ class block_calendar_month extends block_base {
             return $this->content;
         }
         // Reset the session variables
-        calendar_session_vars($COURSE);
+        calendar_session_vars($this->page->course);
         
         $this->content = new stdClass;
         $this->content->text = '';
@@ -30,7 +30,7 @@ class block_calendar_month extends block_base {
         // [pj] To me it looks like this if would never be needed, but Penny added it 
         // when committing the /my/ stuff. Reminder to discuss and learn what it's about.
         // It definitely needs SOME comment here!
-        $courseshown = $COURSE->id;
+        $courseshown = $this->page->course->id;
 
         if ($courseshown == SITEID) {
             // Being displayed at site level. This will cause the filter to fall back to auto-detecting
@@ -42,9 +42,9 @@ class block_calendar_month extends block_base {
 
         } else {
             //MDL-14693: fix calendar on resource page
-            $courseshown =  optional_param( 'id', $COURSE->id, PARAM_INT );
+            $courseshown =  optional_param( 'id', $this->page->course->id, PARAM_INT );
             // Forcibly filter events to include only those from the particular course we are in.
-            $filtercourse    = array($courseshown => $COURSE);
+            $filtercourse    = array($courseshown => $this->page->course);
             $groupeventsfrom = array($courseshown => 1);
         }
 
@@ -52,9 +52,9 @@ class block_calendar_month extends block_base {
         calendar_set_referring_course($courseshown);
 
         // MDL-9059, set to show this course when admins go into a course, then unset it.
-        if ($COURSE->id != SITEID && !isset($SESSION->cal_courses_shown[$COURSE->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
+        if ($this->page->course->id != SITEID && !isset($SESSION->cal_courses_shown[$this->page->course->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
             $courseset = true;
-            $SESSION->cal_courses_shown[$COURSE->id] = $COURSE;
+            $SESSION->cal_courses_shown[$this->page->course->id] = $this->page->course;
         }
     
         // Be VERY careful with the format for default courses arguments!
@@ -73,13 +73,13 @@ class block_calendar_month extends block_base {
             $this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
             $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
             $this->content->text .= '<h3 class="eventskey">'.get_string('eventskey', 'calendar').'</h3>';
-            $this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $COURSE).'</div>';
+            $this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $this->page->course).'</div>';
             
         }
         
         // MDL-9059, unset this so that it doesn't stay in session
         if (!empty($courseset)) {
-            unset($SESSION->cal_courses_shown[$COURSE->id]);
+            unset($SESSION->cal_courses_shown[$this->page->course->id]);
         }
 
         return $this->content;
index f7060527f88c777b4265f5d5e4b545485b235c5e..32d748ed71db20d78f3f340074e583fea2e653d2 100644 (file)
@@ -7,7 +7,7 @@ class block_calendar_upcoming extends block_base {
     }
 
     function get_content() {
-        global $USER, $CFG, $SESSION, $COURSE;
+        global $USER, $CFG, $SESSION;
         $cal_m = optional_param( 'cal_m', 0, PARAM_INT );
         $cal_y = optional_param( 'cal_y', 0, PARAM_INT );
 
@@ -17,7 +17,7 @@ class block_calendar_upcoming extends block_base {
             return $this->content;
         }
         // Reset the session variables
-        calendar_session_vars($COURSE);
+        calendar_session_vars($this->page->course);
         $this->content = new stdClass;
         $this->content->text = '';
 
@@ -27,7 +27,7 @@ class block_calendar_upcoming extends block_base {
             $this->content->footer = '';
 
         } else {
-            $courseshown = $COURSE->id;
+            $courseshown = $this->page->course->id;
             $this->content->footer = '<br /><a href="'.$CFG->wwwroot.
                                      '/calendar/view.php?view=upcoming&amp;course='.$courseshown.'">'.
                                       get_string('gotocalendar', 'calendar').'</a>...';
@@ -47,7 +47,7 @@ class block_calendar_upcoming extends block_base {
                 calendar_set_referring_course(0);
             } else {
                 // Forcibly filter events to include only those from the particular course we are in.
-                $filtercourse    = array($courseshown => $COURSE);
+                $filtercourse    = array($courseshown => $this->page->course);
                 $groupeventsfrom = array($courseshown => 1);
             }
         }
index 55cde01dd25d9cfe5b5e47d25d178f2b716624ac..dcbf5d4661065d10abe6fb33ee8b895ac6d20008 100644 (file)
@@ -7,13 +7,13 @@ class block_course_summary extends block_base {
     }
 
     function specialization() {
-        if($this->page->pagetype == PAGE_COURSE_VIEW && $PAGE->course->id != SITEID) {
+        if($this->page->pagetype == PAGE_COURSE_VIEW && $this->page->course->id != SITEID) {
             $this->title = get_string('coursesummary', 'block_course_summary');
         }
     }
 
     function get_content() {
-        global $CFG, $COURSE, $PAGE;
+        global $CFG;
 
         if($this->content !== NULL) {
             return $this->content;
@@ -26,12 +26,12 @@ class block_course_summary extends block_base {
         $this->content = new object();
         $options = new object();
         $options->noclean = true;    // Don't clean Javascripts etc
-        $this->content->text = format_text($COURSE->summary, FORMAT_HTML, $options);
-        if ($PAGE->user_is_editing()) {
-            if($COURSE->id == SITEID) {
+        $this->content->text = format_text($this->page->course->summary, FORMAT_HTML, $options);
+        if ($this->page->user_is_editing()) {
+            if($this->page->course->id == SITEID) {
                 $editpage = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=frontpagesettings';
             } else {
-                $editpage = $CFG->wwwroot.'/course/edit.php?id='.$COURSE->id;
+                $editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->page->course->id;
             }
             $this->content->text .= "<div class=\"editbutton\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" alt=\"".get_string('edit')."\" /></a></div>";
         }
index 0140db8a842f26d71787c2f68a74998500f0c903..92c85182357f4a48d6d43b17edef1eee28510a8f 100644 (file)
@@ -13,8 +13,8 @@ class block_glossary_random extends block_base {
     }
 
     function specialization() {
-        global $CFG, $COURSE, $DB;
-        $this->course = $COURSE;
+        global $CFG, $DB;
+        $this->course = $this->page->course;
 
         // load userdefined title and make sure it's never empty
         if (empty($this->config->title)) {
@@ -152,7 +152,7 @@ class block_glossary_random extends block_base {
     }
 
     function get_content() {
-        global $USER, $CFG, $COURSE, $DB;
+        global $USER, $CFG, $DB;
 
         if (empty($this->config->glossary)) {
             $this->content->text   = get_string('notyetconfigured','block_glossary_random');
@@ -162,11 +162,7 @@ class block_glossary_random extends block_base {
 
         $glossaryid = $this->config->glossary;
 
-        if ($this->course->id == $COURSE->id) {
-            $course = $COURSE;
-        } else {
-            $course = $DB->get_record('course', array('id'=>$this->course->id)); 
-        }
+        $course = $this->page->course;
 
         require_once($CFG->dirroot.'/course/lib.php');
         $modinfo = get_fast_modinfo($course);
index 004e9702ff75b61d18315dcfacfb57a613bb1d11..c987b183c0f3a353be6ba33b8f653ca92121dd01 100644 (file)
@@ -406,7 +406,7 @@ class block_base {
      * @todo complete documenting this function. Define $options.
      */
     function _add_edit_controls($options) {
-        global $CFG, $USER, $PAGE;
+        global $CFG, $USER;
 
         // TODO
         if (empty($this->instance->pinned)) {
index 751209777161c8401b2252ea3abe2eca27cb42c5..941d8aaffcca93704931f467a42799f6022ec4d9 100644 (file)
@@ -7,7 +7,7 @@ class block_news_items extends block_base {
     }
 
     function get_content() {
-        global $CFG, $USER, $COURSE;
+        global $CFG, $USER;
 
         if ($this->content !== NULL) {
             return $this->content;
@@ -22,17 +22,17 @@ class block_news_items extends block_base {
         }
 
 
-        if ($COURSE->newsitems) {   // Create a nice listing of recent postings
+        if ($this->page->course->newsitems) {   // Create a nice listing of recent postings
 
             require_once($CFG->dirroot.'/mod/forum/lib.php');   // We'll need this
 
             $text = '';
 
-            if (!$forum = forum_get_course_forum($COURSE->id, 'news')) {
+            if (!$forum = forum_get_course_forum($this->page->course->id, 'news')) {
                 return '';
             }
 
-            $modinfo = get_fast_modinfo($COURSE);
+            $modinfo = get_fast_modinfo($this->page->course);
             if (empty($modinfo->instances['forum'][$forum->id])) {
                 return '';
             }
@@ -58,7 +58,7 @@ class block_news_items extends block_base {
         /// Get all the recent discussions we're allowed to see
 
             if (! $discussions = forum_get_discussions($cm, 'p.modified DESC', false, 
-                                                       $currentgroup, $COURSE->newsitems) ) {
+                                                       $currentgroup, $this->page->course->newsitems) ) {
                 $text .= '('.get_string('nonews', 'forum').')';
                 $this->content->text = $text;
                 return $this->content;
@@ -107,7 +107,7 @@ class block_news_items extends block_base {
                 } else {
                     $userid = $USER->id;
                 }
-                $this->content->footer .= '<br />'.rss_get_link($COURSE->id, $userid, 'forum', $forum->id, $tooltiptext);
+                $this->content->footer .= '<br />'.rss_get_link($this->page->course->id, $userid, 'forum', $forum->id, $tooltiptext);
             }
 
         }
index 17112c414e23d1354f2c25679eca7667f464b59c..4f16bfe775e0f706065654cd8916742d50dee057 100644 (file)
@@ -14,7 +14,7 @@ class block_online_users extends block_base {
     function has_config() {return true;}
 
     function get_content() {
-        global $USER, $CFG, $COURSE, $DB;
+        global $USER, $CFG, $DB;
 
         if ($this->content !== NULL) {
             return $this->content;
@@ -35,7 +35,7 @@ class block_online_users extends block_base {
         $timefrom = 100 * floor((time()-$timetoshowusers) / 100); // Round to nearest 100 seconds for better query cache
 
         // Get context so we can check capabilities.
-        $context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
+        $context = $this->page->context;
 
         // TODO
         if (empty($this->instance->pinned)) {
@@ -45,12 +45,12 @@ class block_online_users extends block_base {
         }
 
         //Calculate if we are in separate groups
-        $isseparategroups = ($COURSE->groupmode == SEPARATEGROUPS
-                             && $COURSE->groupmodeforce
+        $isseparategroups = ($this->page->course->groupmode == SEPARATEGROUPS
+                             && $this->page->course->groupmodeforce
                              && !has_capability('moodle/site:accessallgroups', $context));
 
         //Get the user current group
-        $currentgroup = $isseparategroups ? groups_get_course_group($COURSE) : NULL;
+        $currentgroup = $isseparategroups ? groups_get_course_group($this->page->course) : NULL;
 
         $groupmembers = "";
         $groupselect  = "";
@@ -65,7 +65,7 @@ class block_online_users extends block_base {
             $params['currentgroup'] = $currentgroup;
         }
 
-        if ($COURSE->id == SITEID) {  // Site-level
+        if ($this->page->course->id == SITEID) {  // Site-level
             $sql = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, MAX(u.lastaccess) AS lastaccess
                       FROM {user} u $groupmembers
                      WHERE u.lastaccess > $timefrom
@@ -103,7 +103,7 @@ class block_online_users extends block_base {
                            $groupselect $rawhere
                   GROUP BY u.id";
 
-            $params['courseid'] = $COURSE->id;
+            $params['courseid'] = $this->page->course->id;
         }
 
         //Calculate minutes
@@ -151,12 +151,12 @@ class block_online_users extends block_base {
                 $this->content->text .= '<li class="listentry">';
                 $timeago = format_time(time() - $user->lastaccess); //bruno to calculate correctly on frontpage
                 if ($user->username == 'guest') {
-                    $this->content->text .= '<div class="user">'.print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false, '', false);
+                    $this->content->text .= '<div class="user">'.print_user_picture($user->id, $this->page->course->id, $user->picture, 16, true, false, '', false);
                     $this->content->text .= get_string('guestuser').'</div>';
 
                 } else {
-                    $this->content->text .= '<div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$COURSE->id.'" title="'.$timeago.'">';
-                    $this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false, '', false);
+                    $this->content->text .= '<div class="user"><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->page->course->id.'" title="'.$timeago.'">';
+                    $this->content->text .= print_user_picture($user->id, $this->page->course->id, $user->picture, 16, true, false, '', false);
                     $this->content->text .= $user->fullname.'</a></div>';
                 }
                 if ($canshowicon and ($USER->id != $user->id) and  $user->username != 'guest') {  // Only when logged in and messaging active etc
index eb99df915975fe68a12c2ea8082fa423a2607003..c7653937ba6ae7d9b457ee57c0ed961439df2e0d 100644 (file)
@@ -8,7 +8,7 @@ class block_participants extends block_list {
 
     function get_content() {
 
-        global $CFG, $COURSE;
+        global $CFG;
 
         if (empty($this->instance)) {
             $this->content = '';
@@ -23,7 +23,7 @@ class block_participants extends block_list {
         /// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
         $currentcontext = $this->page->context;
 
-        if ($COURSE->id == SITEID) {
+        if ($this->page->course->id == SITEID) {
             if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
                 $this->content = '';
                 return $this->content;
index 4e326ff3e5f158a39f0c9ca9dbdb73776a7a2d73..37284e95164b8f8ed54771a00d6896f104bc3f59 100644 (file)
@@ -7,8 +7,6 @@ class block_recent_activity extends block_base {
     }
 
     function get_content() {
-        global $COURSE;
-
         if ($this->content !== NULL) {
             return $this->content;
         }
@@ -24,7 +22,7 @@ class block_recent_activity extends block_base {
 
         // Slightly hacky way to do it but...
         ob_start();
-        print_recent_activity($COURSE);
+        print_recent_activity($this->page->course);
         $this->content->text = ob_get_contents();
         ob_end_clean();
 
index a3dfaec1b550c7ae8a5386d670111c03396fad16..b264ea32f5adedbdced92ffb0cdf27c3820cbfd7 100644 (file)
     }
 
     function get_content() {
-        global $CFG, $editing, $COURSE, $USER;
+        global $CFG, $editing, $USER;
 
-        if (!empty($COURSE)) {
-            $this->courseid = $COURSE->id;
+        if (!empty($this->page->course)) {
+            $this->courseid = $this->page->course->id;
         }
 
     /// When displaying feeds in block, we double $CFG->block_rss_client_timeout
index e7c1bdc06d5fbe25176a9a4d8820c824c038734a..eadb0fb4088b4836bec84d087422b2e73d45a674 100644 (file)
@@ -28,7 +28,7 @@ class block_section_links extends block_base {
     }
 
     function get_content() {
-        global $CFG, $USER, $COURSE, $DB;
+        global $CFG, $USER, $DB;
 
         $highlight = 0;
 
index 8f7cb875fbac4ccbf79fe50079c8e9ed9793cc18..3d1cfd3c441c62af0043916a6c92b25ca237cc6f 100644 (file)
@@ -11,7 +11,7 @@ class block_site_main_menu extends block_list {
     }
 
     function get_content() {
-        global $USER, $CFG, $COURSE, $DB, $PAGE;
+        global $USER, $CFG, $DB;
 
         if ($this->content !== NULL) {
             return $this->content;
@@ -29,7 +29,7 @@ class block_site_main_menu extends block_list {
         $course = $this->page->course;
         require_once($CFG->dirroot.'/course/lib.php');
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
-        $isediting = $PAGE->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
+        $isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
         $modinfo = get_fast_modinfo($course);
 
 /// extra fast view mode
index cf2777e69e105392bf581f672393f01ca96af86f..5e5bd35ebf6107771d64a4773e241ccd4d0077f8 100644 (file)
@@ -11,7 +11,7 @@ class block_social_activities extends block_list {
     }
 
     function get_content() {
-        global $USER, $CFG, $COURSE, $DB, $PAGE;
+        global $USER, $CFG, $DB;
 
         if ($this->content !== NULL) {
             return $this->content;
@@ -31,7 +31,7 @@ class block_social_activities extends block_list {
         require_once($CFG->dirroot.'/course/lib.php');
 
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
-        $isediting = $PAGE->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
+        $isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
         $modinfo = get_fast_modinfo($course);
 
 /// extra fast view mode
index f3865d4bda8874f9060ef72cd548268ca846ff21..7a54fc2b3919da188e2ad1c9aeb6aeeff9b3d4ed 100644 (file)
@@ -38,7 +38,7 @@ class block_tags extends block_base {
 
     function get_content() {
 
-        global $CFG, $SITE, $COURSE, $USER, $SCRIPT;
+        global $CFG, $SITE, $USER, $SCRIPT;
 
         if (empty($CFG->usetags)) {
             $this->content->text = '';
@@ -79,10 +79,10 @@ class block_tags extends block_base {
             $isguest = has_capability('moodle/legacy:guest', $systemcontext, $USER->id, false);
             $loggedin = isloggedin() && !$isguest;
             $coursepage = $canedit = false;
-            $coursepage = (isset($COURSE->id) && $COURSE->id != SITEID);
+            $coursepage = (isset($this->page->course->id) && $this->page->course->id != SITEID);
             $mymoodlepage = ($SCRIPT == '/my/index.php') ? true : false;
-            $sitepage = (isset($COURSE->id) && $COURSE->id == SITEID && !$mymoodlepage);
-            $coursecontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
+            $sitepage = (isset($this->page->course->id) && $this->page->course->id == SITEID && !$mymoodlepage);
+            $coursecontext = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
             if ($coursepage) {
                 $canedit =  has_capability('moodle/tag:create', $systemcontext);
             }
@@ -111,9 +111,9 @@ class block_tags extends block_base {
                 }
             }
             if ($coursepage) {
-                $coursetags = coursetag_print_cloud(coursetag_get_tags($COURSE->id, 0, '', $numoftags, $sort), true);
+                $coursetags = coursetag_print_cloud(coursetag_get_tags($this->page->course->id, 0, '', $numoftags, $sort), true);
                 if (!$coursetags) $coursetags = get_string('notagsyet', $tagslang);
-                $courseflag = '&amp;courseid='.$COURSE->id;
+                $courseflag = '&amp;courseid='.$this->page->course->id;
             }
             if ($mymoodlepage) {
                 $mytags = coursetag_print_cloud(coursetag_get_tags(0, $USER->id, 'default', $numoftags, $sort), true);
@@ -236,7 +236,7 @@ class block_tags extends block_base {
                         <form action="{$CFG->wwwroot}/tag/coursetags_add.php" method="post" id="coursetag"
                                 onsubmit="return ctags_checkinput(this.coursetag_new_tag.value)">
                             <div style="display: none;">
-                                <input type="hidden" name="entryid" value="$COURSE->id" />
+                                <input type="hidden" name="entryid" value="$this->page->course->id" />
                                 <input type="hidden" name="userid" value="$USER->id" />
                                 <input type="hidden" name="sesskey" value="$sesskey" />
                             </div>
@@ -266,7 +266,7 @@ EOT;
                     // add the edit link
                     $this->content->footer .= '
                         <div>
-                        <a href="'.$CFG->wwwroot.'/tag/coursetags_edit.php?courseid='.$COURSE->id.'"
+                        <a href="'.$CFG->wwwroot.'/tag/coursetags_edit.php?courseid='.$this->page->course->id.'"
                         title="'.get_string('edittags', $tagslang).'">'.get_string('edittags', $tagslang).'</a>
                         </div>';
                 }