]> git.mjollnir.org Git - moodle.git/commitdiff
core MDL-19799 Upgraded deprecated calls and minor documentation improvement
authorsamhemelryk <samhemelryk>
Wed, 30 Sep 2009 06:14:58 +0000 (06:14 +0000)
committersamhemelryk <samhemelryk>
Wed, 30 Sep 2009 06:14:58 +0000 (06:14 +0000)
lib/deprecatedlib.php
lib/navigationlib.php
theme/preview.php

index cd44793efc3409c2c4cc3f8eb365de6e57e2e5eb..41468d5198da0b87a4c220caa636f53421fe790d 100644 (file)
@@ -113,8 +113,10 @@ function isteacherinanycourse($userid=0, $includeadmin=true) {
 /**
  * Determines if the specified user is logged in as guest.
  *
+ * See {@link isguestuser()} as an alternative
+ *
+ * @deprecated
  * @global object
- * @uses CONTEXT_SYSTEM
  * @param int $userid The user being tested. You can set this to 0 or leave it blank to test the currently logged in user.
  * @return bool
  */
index 692fe67fd6215623bba3aeb1377b4910f80f51a8..2e46a611b94ec5dec416d2ef306c1eea2a127df4 100644 (file)
@@ -1467,15 +1467,17 @@ class global_navigation extends navigation_node {
     protected function load_categories($categoryid=0) {
         global $PAGE, $CFG, $DB, $USER;
 
+        $systemcontext = get_context_instance(CONTEXT_SYSTEM);
+
         // Cache capability moodle/site:config we use this in the next bit of code
         if (!$this->cache->cached('hassiteconfig')) {
-            $this->cache->hassiteconfig = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+            $this->cache->hassiteconfig = has_capability('moodle/site:config', $systemcontext);
         }
 
         // If the user is logged in (but not as a guest), doesnt have the site config capability,
         // and my courses havn't been disabled then we will show the user's courses in the
         // global navigation, otherwise we will show up to FRONTPAGECOURSELIMIT available courses
-        if (isloggedin() && !$this->cache->hassiteconfig && !isguest() && empty($CFG->disablemycourses)) {
+        if (isloggedin() && !$this->cache->hassiteconfig && !isguestuser() && empty($CFG->disablemycourses)) {
             if (!$this->cache->cached('mycourses')) {
                 $this->cache->mycourses = get_my_courses($USER->id);
             }
index a2404424cdde9ad00b9758e488517a837a7a2b80..30fb709f9e080af63695b6f5e61d47fadddab23d 100644 (file)
@@ -27,6 +27,8 @@ if (!file_exists($CFG->themedir .'/'. $preview)) {
     $preview = 'standard';
 }
 
+$PAGE->set_url(new moodle_url($CFG->wwwroot.'/theme/preview.php', array('preview'=>$preview)));
+
 require_login();
 
 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));