From 5019cff2f0470116c9351d3e045e846b97f5aa46 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 14 Feb 2012 18:22:24 +0100 Subject: [PATCH] Big news! Now we use smarty for all the platform! display_header and display_footer were hacked + some smarty "smarty" templates (requires testing) --- main/inc/banner.inc.php | 11 +- main/inc/footer.inc.php | 191 +--------------- main/inc/header.inc.php | 216 ------------------ main/inc/lib/banner.lib.php | 4 +- main/inc/lib/display.lib.php | 95 +------- main/inc/lib/template.lib.php | 10 + main/template/default/layout/head.tpl | 19 ++ main/template/default/layout/header.tpl | 2 + main/template/default/layout/main.tpl | 40 +--- main/template/default/layout/main_footer.tpl | 3 + main/template/default/layout/main_header.tpl | 16 ++ .../default/layout/main_post_content.tpl | 6 + .../default/layout/main_pre_content.tpl | 12 + main/template/default/layout/show_footer.tpl | 3 + main/template/default/layout/show_header.tpl | 3 + 15 files changed, 96 insertions(+), 535 deletions(-) create mode 100644 main/template/default/layout/main_footer.tpl create mode 100644 main/template/default/layout/main_header.tpl create mode 100644 main/template/default/layout/main_post_content.tpl create mode 100644 main/template/default/layout/main_pre_content.tpl create mode 100644 main/template/default/layout/show_footer.tpl create mode 100644 main/template/default/layout/show_header.tpl diff --git a/main/inc/banner.inc.php b/main/inc/banner.inc.php index 3d41ac64c8..ee9511b59c 100644 --- a/main/inc/banner.inc.php +++ b/main/inc/banner.inc.php @@ -45,18 +45,11 @@ show_header_1($language_file, $nameTools); show_header_2(); echo '
'; +echo ''; +echo '
'; -if (isset($database_connection)) { - // connect to the main database. - // if single database, don't pefix table names with the main database name in SQL queries - // (ex. SELECT * FROM table) - // if multiple database, prefix table names with the course database name in SQL queries (or no prefix if the table is in - // the main database) - // (ex. SELECT * FROM table_from_main_db - SELECT * FROM courseDB.table_from_course_db) - Database::select_db($_configuration['main_database'], $database_connection); -} echo ''; // diff --git a/main/inc/footer.inc.php b/main/inc/footer.inc.php index e33b3181bd..cd073a6e91 100644 --- a/main/inc/footer.inc.php +++ b/main/inc/footer.inc.php @@ -1,193 +1,4 @@ '; - echo ' '; - } - require_once api_get_path(INCLUDE_PATH).'tool_navigation_menu.inc.php'; - show_navigation_menu(); - } -} - -?> -
 
- - - -
- -'; -} else { - echo '

No translated strings on this page?!

'; -}*/ - -?> -'; //copyright div - -echo ''; - - -echo ' '; - -if (!api_is_platform_admin()) { - $extra_footer = trim(api_get_setting('footer_extra_content')); - if (!empty($extra_footer)) { - echo $extra_footer; - } -} - -/* -// Test server mode indicator and information for testing purposes. -if (api_is_platform_admin()) { - if (api_get_setting('server_type') == 'test') { - - echo '
'; - echo ' '.get_lang('TestServerMode').' '; - - // @todo page execution time - $mtime = microtime(); - $mtime = explode(" ",$mtime); - $mtime = $mtime[1] + $mtime[0]; - $endtime = $mtime; - $starttime = $_SESSION['page_start_time_execution']; - $totaltime = ($endtime - $starttime); - - $starttime = null; - unset($_SESSION['page_start_time_execution']); - - $totaltime = number_format(($totaltime), 4, '.', ''); - echo '

'.get_lang('PageExecutionTimeWas').' '.$totaltime.' '.get_lang('Seconds').'

'; - unset($_SESSION['page_start_time_execution']); - - - // Memory usage - echo get_lang('MemoryUsage').': '.number_format((memory_get_usage()/1048576), 3, '.', '') .' Mb' ; - echo '
'; - echo get_lang('MemoryUsagePeak').': '.number_format((memory_get_peak_usage()/1048576), 3, '.', '').' Mb'; - } -}*/ -?> - - - \ No newline at end of file +echo $global_tpl->show_footer(); \ No newline at end of file diff --git a/main/inc/header.inc.php b/main/inc/header.inc.php index a204a2775f..b5fbd49a14 100644 --- a/main/inc/header.inc.php +++ b/main/inc/header.inc.php @@ -6,219 +6,3 @@ * @package chamilo.include */ -/* HEADERS SECTION */ - -header('Content-Type: text/html; charset='.api_get_system_encoding()); -//show the X-Powered-By header so that parsers can find it -global $_configuration, $this_section; -header('X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'],0,1)); - -$navigator_info = api_get_navigator(); -//ie6 fix -if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { - $htmlHeadXtra[] = ''; -} - -// Include here the script ASCIIMathML.js if you want to show mathematical formulas and graphics -// not only in the "Documents" tool, but elsewhere in the system. This setting is related to the -// online editor's plugins 'asciimath' and 'asciisvg'. -if (api_get_setting('include_asciimathml_script') == 'true') { - $htmlHeadXtra[] = api_get_js('asciimath/ASCIIMathML.js'); -} - -if (isset($httpHeadXtra) && $httpHeadXtra) { - foreach ($httpHeadXtra as & $thisHttpHead) { - header($thisHttpHead); - } -} - -// Get language iso-code for this page - ignore errors -$document_language = api_get_language_isocode(); - -$course_title = $_course['name']; -$title_list[] = api_get_setting('Institution'); -$title_list[] = api_get_setting('siteName'); -if (!empty($course_title)) { - $title_list[] = $course_title; -} - -if ($nameTools != '') { - $title_list[] = $nameTools; -} - -$title_string = ''; -for($i=0; $i - - - - -<?php -echo Security::remove_XSS($title_string); -?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'; -} - -if (isset($htmlHeadXtra) && $htmlHeadXtra) { - foreach ($htmlHeadXtra as & $this_html_head) { - echo $this_html_head; - } -} -if (isset($htmlIncHeadXtra) && $htmlIncHeadXtra) { - foreach ($htmlIncHeadXtra as & $this_html_head) { - include($this_html_head); - } -} -// The following include might be subject to a setting proper to the course or platform. -include api_get_path(LIBRARY_PATH).'javascript/email_links.lib.js.php'; - -$favico = ''; -if (isset($_configuration['multiple_access_urls']) && $_configuration['multiple_access_urls']) { - $access_url_id = api_get_current_access_url_id(); - if ($access_url_id != -1) { - $url_info = api_get_access_url($access_url_id); - $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - $clean_url = replace_dangerous_char($url); - $clean_url = str_replace('/', '-', $clean_url); - $clean_url .= '/'; - $homep = api_get_path(REL_PATH).'home/'.$clean_url; //homep for Home Path - //we create the new dir for the new sites - if (is_file($homep.'favicon.ico')) { - $favico = ''; - } - } -} -echo $favico; -if (!api_is_platform_admin()) { - $extra_header = trim(api_get_setting('header_extra_content')); - if (!empty($extra_header)) { - echo $extra_header; - } -} -?> - -> - -'; + $header3 .= ''; } if (!empty($lis)) { - $header3 .= '