MDL-8337 has_capability() ignores default roles for $userid and does not detect chang...
[moodle.git] / theme / chameleon / ui / chameleon.php
CommitLineData
59902901 1<?php
2
3
4if (isset($THEME->chameleonenabled) && $THEME->chameleonenabled) {
ae9e4c06 5 $chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
59902901 6 $chameleon_isteacher = false;
7 if (isset($course->id)) {
8 $chameleon_courseparam = '?id=' . $course->id;
9 if (!$chameleon_isadmin) {
9ce384ba 10 $chameleon_isteacher = (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id)) && isset($CFG->coursetheme));
59902901 11 }
12 } else {
13 $chameleon_courseparam = '';
14 }
b08c4173 15
16 if ($chameleon_isadmin || ($chameleon_isteacher && !empty($CFG->allowcoursethemes) && !empty($THEME->chameleonteachereditenabled))) {
59902901 17 // either we're an admin or we're a teacher and this is being used as the course theme
18 // if we're on a page using a course theme edit that, otherwise edit the main chameleon theme
19 // $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : $CFG->theme;
20 $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : current_theme();
21?>
22
a44091bf 23<style type="text/css"> @import '<?php echo "$CFG->themewww/$chameleon_theme" ?>/ui/chameleon_ui.css'; </style>
59902901 24
a44091bf 25<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/css_query.js" ?>"> </script>
26<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/sarissa.js" ?>"> </script>
27<script type="text/javascript" src="<?php echo "$CFG->themewww/$chameleon_theme/ui/chameleon_js.php$chameleon_courseparam" ?>"> </script>
59902901 28
29<?php
30 }
31}
32?>
33
34