Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

~chameleon.php contains all code neccessary to add the Chameleon engi…

…ne to any theme.
  • Loading branch information...
commit 5990290185fd7fafe26bfa4df987d4b72776cd77 1 parent 186142b
urs_hunkler authored
Showing with 34 additions and 0 deletions.
  1. +34 −0 theme/chameleon/ui/chameleon.php
View
34 theme/chameleon/ui/chameleon.php
@@ -0,0 +1,34 @@
+<?php
+
+
+if (isset($THEME->chameleonenabled) && $THEME->chameleonenabled) {
+ $chameleon_isadmin = isadmin();
+ $chameleon_isteacher = false;
+ if (isset($course->id)) {
+ $chameleon_courseparam = '?id=' . $course->id;
+ if (!$chameleon_isadmin) {
+ $chameleon_isteacher = (isteacher($course->id) && isset($CFG->coursetheme));
+ }
+ } else {
+ $chameleon_courseparam = '';
+ }
+
+ if ($chameleon_isadmin || $chameleon_isteacher) {
+ // either we're an admin or we're a teacher and this is being used as the course theme
+ // if we're on a page using a course theme edit that, otherwise edit the main chameleon theme
+ // $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : $CFG->theme;
+ $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : current_theme();
+?>
+
+<style type="text/css"> @import '<?php echo "$CFG->wwwroot/theme/$chameleon_theme" ?>/ui/chameleon_ui.css'; </style>
+
+<script type="text/javascript" src="<?php echo "$CFG->wwwroot/theme/$chameleon_theme/ui/css_query.js" ?>"> </script>
+<script type="text/javascript" src="<?php echo "$CFG->wwwroot/theme/$chameleon_theme/ui/sarissa.js" ?>"> </script>
+<script type="text/javascript" src="<?php echo "$CFG->wwwroot/theme/$chameleon_theme/ui/chameleon_js.php$chameleon_courseparam" ?>"> </script>
+
+<?php
+ }
+}
+?>
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.