]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-21149 preparation for renaming of old standard to standardold
authorPetr Skoda <skodak@moodle.org>
Tue, 12 Jan 2010 17:21:52 +0000 (17:21 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 12 Jan 2010 17:21:52 +0000 (17:21 +0000)
lib/db/install.php
lib/outputlib.php
lib/simpletest/testpagelib_moodlepage.php

index 954b674142b3a8a18e7ae62f865e7746d0ac3ded..fdd92deda1d1632f841050dbafde8b882554a176 100644 (file)
@@ -49,7 +49,7 @@ function xmldb_main_install() {
         'enrol_plugins_enabled' => 'manual',
         'style'                 => 'default',
         'template'              => 'default',
-        'theme'                 => 'standard', //TODO: MDL-21149 replace with some new default theme when implemented
+        'theme'                 => theme_config::DEFAULT_THEME,
         'filter_multilang_converted' => 1,
         'siteidentifier'        => random_string(32).get_host_from_url($CFG->wwwroot),
         'backup_version'        => 2008111700,
index c6a45266d98c6da3f9cbcf8d362bfdd3bc44f01b..cbded86407233e5bfd50050a064617db450568b1 100644 (file)
@@ -101,6 +101,12 @@ function theme_get_revision() {
  * @since     Moodle 2.0
  */
 class theme_config {
+    /**
+     * @var string default theme, used when requested theme not found
+     *      TODO: MDL-21149 replace with some new default theme when implemented
+     */
+    const DEFAULT_THEME = 'standard';
+
     /**
      * You can base your theme on other themes by linking to the other theme as
      * parents. This lets you use the CSS and layouts from the other themes
@@ -351,9 +357,13 @@ class theme_config {
 
         if ($config = theme_config::find_theme_config($themename, $settings)) {
             return new theme_config($config);
+
+        } else if ($themename == theme_config::DEFAULT_THEME) {
+            throw new coding_exception('Default theme '.theme_config::DEFAULT_THEME.' not available or broken!');
+
         } else {
             // bad luck, the requested theme has some problems - admin see details in theme config
-            return new theme_config(theme_config::find_theme_config('standard', $settings)); // TODO: use some other default MDL-21149
+            return new theme_config(theme_config::find_theme_config(theme_config::DEFAULT_THEME, $settings));
         }
     }
 
index d6f18124cd1187291e9fdb0d4c5f5e9d32d1c258..ab57b0b3eb5a5bdac803a2c95fb568ed9be95241 100644 (file)
@@ -137,7 +137,7 @@ class moodle_page_test extends UnitTestCase {
 
     public function test_cannot_set_course_once_theme_set() {
         // Setup fixture
-        $this->testpage->force_theme('standard');
+        $this->testpage->force_theme(theme_config::DEFAULT_THEME);
         $course = $this->create_a_course();
         // Set expectation.
         $this->expectException();
@@ -147,7 +147,7 @@ class moodle_page_test extends UnitTestCase {
 
     public function test_cannot_set_category_once_theme_set() {
         // Setup fixture
-        $this->testpage->force_theme('standard');
+        $this->testpage->force_theme(theme_config::DEFAULT_THEME);
         // Set expectation.
         $this->expectException();
         // Exercise SUT