MDL-46523 navigation: add body class when roleswitched and not in initial install
authorJetha Chan <jetha@moodle.com>
Tue, 16 Sep 2014 05:41:41 +0000 (13:41 +0800)
committerJetha Chan <jetha@moodle.com>
Tue, 16 Sep 2014 05:41:41 +0000 (13:41 +0800)
lib/outputrenderers.php

index 531be80..c3f9faf 100644 (file)
@@ -827,6 +827,13 @@ class core_renderer extends renderer_base {
             $this->page->add_body_class('userloggedinas');
         }
 
             $this->page->add_body_class('userloggedinas');
         }
 
+        // If the user is logged in, and we're not in initial install,
+        // check to see if the user is role-switched and add the appropriate
+        // CSS class to the body element.
+        if (!during_initial_install() && isloggedin() && is_role_switched($this->page->course->id)) {
+            $this->page->add_body_class('userswitchedrole');
+        }
+
         // Give themes a chance to init/alter the page object.
         $this->page->theme->init_page($this->page);
 
         // Give themes a chance to init/alter the page object.
         $this->page->theme->init_page($this->page);