diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index 641e9ab81d..be23973d88 100755 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -295,7 +295,7 @@ function handle_stylesheets() $dirpath = api_get_path(SYS_PATH).'main/css/'.$style_dir; if (is_dir($dirpath)) { if ($style_dir != '.' && $style_dir != '..') { - if ($currentstyle == $style_dir OR ($style_dir == 'dokeos_classic' AND !$currentstyle)) { + if ($currentstyle == $style_dir OR ($style_dir == 'chamilo' AND !$currentstyle)) { $selected = 'selected="true"'; } else { $selected = ''; diff --git a/main/chat/chat.php b/main/chat/chat.php index 22c3a8e4e2..f850d870c5 100755 --- a/main/chat/chat.php +++ b/main/chat/chat.php @@ -26,26 +26,10 @@ header('Content-Type: text/html; charset='.api_get_system_encoding()); /* * Choose CSS style (platform's, user's, or course's) */ -$platform_theme = api_get_setting('stylesheets'); // plataform's css -$my_style = $platform_theme; -if (api_get_setting('user_selected_theme') == 'true') { - $useri = api_get_user_info(); - $user_theme = $useri['theme']; - if (!empty($user_theme) && $user_theme != $my_style) { - $my_style = $user_theme; // user's css - } -} +$my_style = api_get_visual_theme(); $mycourseid = api_get_course_id(); if (!empty($mycourseid) && $mycourseid != -1) { - if (api_get_setting('allow_course_theme') == 'true') { - $mycoursetheme = api_get_course_setting('course_theme'); - if (!empty($mycoursetheme) && $mycoursetheme != -1) { - if (!empty($mycoursetheme) && $mycoursetheme != $my_style) { - $my_style = $mycoursetheme; // course's css - } - } - } $open_chat_window = api_get_course_setting('allow_open_chat_window'); } @@ -102,9 +86,8 @@ if ($_SESSION['_gid'] OR $_GET['group_id']) { if (empty($open_chat_window)) { -Display::display_header($tool_name, 'Chat'); + Display::display_header($tool_name, 'Chat'); } - echo ''; echo ''; @@ -112,7 +95,7 @@ echo ''; if (empty($open_chat_window)) { -Display::display_footer(); + Display::display_footer(); } echo ''; diff --git a/main/chat/header_frame.inc.php b/main/chat/header_frame.inc.php old mode 100644 new mode 100755 index 95032fede2..1382bc8a71 --- a/main/chat/header_frame.inc.php +++ b/main/chat/header_frame.inc.php @@ -25,29 +25,7 @@ if (FRAME == 'hidden') { /* * Choose CSS style (platform's, user's, or course's) */ - -$platform_theme = api_get_setting('stylesheets'); // plataform's css -$my_style = $platform_theme; -if (api_get_setting('user_selected_theme') == 'true') { - $useri = api_get_user_info(); - $user_theme = $useri['theme']; - if (!empty($user_theme) && $user_theme != $my_style) { - $my_style = $user_theme; // user's css - } -} - -$mycourseid = api_get_course_id(); - -if (!empty($mycourseid) && $mycourseid != -1) { - if (api_get_setting('allow_course_theme') == 'true') { - $mycoursetheme = api_get_course_setting('course_theme'); - if (!empty($mycoursetheme) && $mycoursetheme != -1) { - if (!empty($mycoursetheme) && $mycoursetheme != $my_style) { - $my_style = $mycoursetheme; // course's css - } - } - } -} +$my_style = api_get_visual_theme(); if (empty($mycourseid)) { // If it is not set $mycourse id we reload the chat_message window in order to hide the textarea to submit a message. diff --git a/main/document/footerpage.php b/main/document/footerpage.php index 82c0f74b34..5ea43ab0e2 100755 --- a/main/document/footerpage.php +++ b/main/document/footerpage.php @@ -8,44 +8,7 @@ require_once '../inc/global.inc.php'; -$platform_theme = api_get_setting('stylesheets'); // plataform's css -$my_style = $platform_theme; - -if (api_get_setting('user_selected_theme') == 'true') { - $useri = api_get_user_info(); - $user_theme = $useri['theme']; - if (!empty($user_theme) && $user_theme != $my_style) { - $my_style = $user_theme; // user's css - } -} -$mycourseid = api_get_course_id(); -if (!empty($mycourseid) && $mycourseid != -1) { - if (api_get_setting('allow_course_theme') == 'true') { - $mycoursetheme=api_get_course_setting('course_theme'); - - if (!empty($mycoursetheme) && $mycoursetheme != -1) { - if (!empty($mycoursetheme) && $mycoursetheme != $my_style) { - $my_style = $mycoursetheme; // course's css - } - } - - $mycourselptheme = api_get_course_setting('allow_learning_path_theme'); - if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) { - - global $lp_theme_css; // it comes from the lp_controller.php - global $lp_theme_config; // it comes from the lp_controller.php - - if (!$lp_theme_config) { - if ($lp_theme_css != '') { - $theme = $lp_theme_css; - if (!empty($theme) && $theme != $my_style) { - $my_style = $theme; // LP's css - } - } - } - } - } -} +$my_style = api_get_visual_theme(); ?> diff --git a/main/inc/header.inc.php b/main/inc/header.inc.php index eca9d8f2a0..c2b7a7b4ea 100755 --- a/main/inc/header.inc.php +++ b/main/inc/header.inc.php @@ -12,7 +12,7 @@ /* * HTTP HEADER */ - + // Server mode indicator. if (api_is_platform_admin()) { if (api_get_setting('server_type') == 'test') { @@ -69,44 +69,8 @@ echo api_get_setting('siteName'); /*'; //will be moved } -if (empty($my_style)) { - $my_style = 'dokeos_classic'; -} echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/default.css";'."\n"; echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/course.css";'."\n"; diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index b827a9d488..7625ba7a2f 100755 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -2646,6 +2646,64 @@ function api_get_language_id($language) { return $row['id']; } +/** + * Returns the name of the visual theme to be applied on the current page. + * The rethurned name depends on platform, course or user -wide settings. + * @return string The visual theme's name, it is the name of a folder inside .../chamilo/main/css/ + */ +function api_get_visual_theme() { + + static $visual_theme; + + if (!isset($visual_theme)) { + + $platform_theme = api_get_setting('stylesheets'); // Plataform's theme. + $visual_theme = $platform_theme; + + if (api_get_setting('user_selected_theme') == 'true') { + $user_info = api_get_user_info(); + $user_theme = $user_info['theme']; + if (!empty($user_theme)) { + $visual_theme = $user_theme; // User's theme. + } + } + + $course_id = api_get_course_id(); + if (!empty($course_id) && $course_id != -1) { + if (api_get_setting('allow_course_theme') == 'true') { + $course_theme = api_get_course_setting('course_theme'); + + if (!empty($course_theme) && $course_theme != -1) { + if (!empty($course_theme)) { + $visual_theme = $course_theme; // Course's theme. + } + } + + $allow_lp_theme = api_get_course_setting('allow_learning_path_theme'); + if ($allow_lp_theme == 1) { + global $lp_theme_css, $lp_theme_config; // These variables come from the file lp_controller.php. + if (!$lp_theme_config) { + if (!empty($lp_theme_css)) { + $visual_theme = $lp_theme_css; // LP's theme. + } + } + } + } + } + + if (empty($visual_theme)) { + $visual_theme = 'chamilo'; + } + + global $lp_theme_log; + if ($lp_theme_log) { + $visual_theme = $platform_theme; + } + } + + return $visual_theme; +} + /** * Returns a list of CSS themes currently available in the CSS folder * @return array List of themes directories from the css folder diff --git a/main/inc/reduced_header.inc.php b/main/inc/reduced_header.inc.php index 39c1919a89..b69bc5dd20 100755 --- a/main/inc/reduced_header.inc.php +++ b/main/inc/reduced_header.inc.php @@ -53,45 +53,8 @@ echo api_get_setting('siteName'); * Choose CSS style platform's, user's, course's, or Learning path CSS */ -$platform_theme = api_get_setting('stylesheets'); // plataform's css -$my_style = $platform_theme; -if (api_get_setting('user_selected_theme') == 'true') { - $useri = api_get_user_info(); - $user_theme = $useri['theme']; - if (!empty($user_theme) && $user_theme != $my_style) { - $my_style = $user_theme; // user's css - } -} -$mycourseid = api_get_course_id(); -if (!empty($mycourseid) && $mycourseid != -1) { - if (api_get_setting('allow_course_theme') == 'true') { - $mycoursetheme=api_get_course_setting('course_theme'); - if (!empty($mycoursetheme) && $mycoursetheme != -1) { - if (!empty($mycoursetheme) && $mycoursetheme != $my_style) { - $my_style = $mycoursetheme; // course's css - } - } - - $mycourselptheme=api_get_course_setting('allow_learning_path_theme'); - if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) { - global $lp_theme_css; // it comes from the lp_controller.php - global $lp_theme_config; // it comes from the lp_controller.php - - if (!empty($lp_theme_css)) - { - $theme=$lp_theme_css; - if (!empty($theme) && $theme != $my_style) { - $my_style = $theme; // LP's css - } - } - - } - } -} - -if (!empty($lp_theme_log)) { - $my_style = $platform_theme; -} +$platform_theme = api_get_setting('stylesheets'); +$my_style = api_get_visual_theme(); // Sets the css reference it is call from lp_nav.php, lp_toc.php, lp_message, lp_log.php if (!empty($scorm_css_header)) { diff --git a/main/install/index.php b/main/install/index.php index a22bda17a6..2dd1218246 100755 --- a/main/install/index.php +++ b/main/install/index.php @@ -51,7 +51,8 @@ $_setting = array( 'platform_charset' => 'UTF-8', 'server_type' => 'production', // 'production' | 'test' 'permissions_for_new_directories' => '0770', - 'permissions_for_new_files' => '0660' + 'permissions_for_new_files' => '0660', + 'stylesheets' => 'chamilo' ); // Determination of the language during the installation procedure. @@ -306,7 +307,7 @@ if ($encryptPassForm == '1') { — <?php echo get_lang('ChamiloInstallation').' — '.get_lang('Version_').' '.$new_version; ?> diff --git a/main/newscorm/openoffice_text.class.php b/main/newscorm/openoffice_text.class.php index 326126a34b..7d29dc0734 100755 --- a/main/newscorm/openoffice_text.class.php +++ b/main/newscorm/openoffice_text.class.php @@ -76,7 +76,7 @@ class OpenofficeText extends OpenofficeDocument { // dokeos styles $my_style = api_get_setting('stylesheets'); - if(empty($my_style)){$my_style = 'dokeos_classic';} + if(empty($my_style)){$my_style = 'chamilo';} $style_to_import = "