|
|
|
|
@ -119,9 +119,6 @@ class Template |
|
|
|
|
//$this->set_footer($show_footer); |
|
|
|
|
//$this->set_header($show_header); |
|
|
|
|
|
|
|
|
|
//$this->set_header_parameters($sendHeaders); |
|
|
|
|
//$this->set_footer_parameters(); |
|
|
|
|
|
|
|
|
|
$defaultStyle = api_get_setting('display.default_template'); |
|
|
|
|
if (!empty($defaultStyle)) { |
|
|
|
|
$this->templateFolder = $defaultStyle; |
|
|
|
|
@ -1076,247 +1073,6 @@ class Template |
|
|
|
|
$this->assign('_c', $_c); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Set header parameters. |
|
|
|
|
* |
|
|
|
|
* @deprecated |
|
|
|
|
* |
|
|
|
|
* @param bool $sendHeaders send headers |
|
|
|
|
*/ |
|
|
|
|
private function set_header_parameters($sendHeaders) |
|
|
|
|
{ |
|
|
|
|
global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section; |
|
|
|
|
$_course = api_get_course_info(); |
|
|
|
|
$nameTools = $this->title; |
|
|
|
|
$navigation = return_navigation_array(); |
|
|
|
|
$this->menu_navigation = $navigation['menu_navigation']; |
|
|
|
|
|
|
|
|
|
$this->assign('system_charset', api_get_system_encoding()); |
|
|
|
|
|
|
|
|
|
if (isset($httpHeadXtra) && $httpHeadXtra) { |
|
|
|
|
foreach ($httpHeadXtra as &$thisHttpHead) { |
|
|
|
|
//header($thisHttpHead); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->assign( |
|
|
|
|
'online_button', |
|
|
|
|
Display::return_icon('statusonline.png', null, [], ICON_SIZE_ATOM) |
|
|
|
|
); |
|
|
|
|
$this->assign( |
|
|
|
|
'offline_button', |
|
|
|
|
Display::return_icon('statusoffline.png', null, [], ICON_SIZE_ATOM) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Get language iso-code for this page - ignore errors |
|
|
|
|
$this->assign('document_language', api_get_language_isocode()); |
|
|
|
|
|
|
|
|
|
$course_title = isset($_course['name']) ? $_course['name'] : null; |
|
|
|
|
|
|
|
|
|
$title_list = []; |
|
|
|
|
|
|
|
|
|
$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 < count($title_list); $i++) { |
|
|
|
|
$title_string .= $title_list[$i]; |
|
|
|
|
if (isset($title_list[$i + 1])) { |
|
|
|
|
$item = trim($title_list[$i + 1]); |
|
|
|
|
if (!empty($item)) { |
|
|
|
|
$title_string .= ' - '; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->assign('title_string', $title_string); |
|
|
|
|
|
|
|
|
|
// Setting the theme and CSS files |
|
|
|
|
//$this->setCssFiles(); |
|
|
|
|
$this->set_js_files(); |
|
|
|
|
$this->setCssCustomFiles(); |
|
|
|
|
|
|
|
|
|
/*$browser = api_browser_support('check_browser'); |
|
|
|
|
if ('Internet Explorer' == $browser[0] && $browser[1] >= '11') { |
|
|
|
|
$browser_head = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />'; |
|
|
|
|
$this->assign('browser_specific_head', $browser_head); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
// Implementation of prefetch. |
|
|
|
|
// See http://cdn.chamilo.org/main/img/online.png for details |
|
|
|
|
$prefetch = ''; |
|
|
|
|
if (!empty($_configuration['cdn_enable'])) { |
|
|
|
|
$prefetch .= '<meta http-equiv="x-dns-prefetch-control" content="on">'; |
|
|
|
|
foreach ($_configuration['cdn'] as $host => $exts) { |
|
|
|
|
$prefetch .= '<link rel="dns-prefetch" href="'.$host.'">'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->assign('prefetch', $prefetch); |
|
|
|
|
$this->assign('text_direction', api_get_text_direction()); |
|
|
|
|
$this->assign('section_name', 'section-'.$this_section); |
|
|
|
|
$this->assignFavIcon(); |
|
|
|
|
$this->setHelp(); |
|
|
|
|
|
|
|
|
|
$this->assignBugNotification(); //Prepare the 'bug_notification' var for the template |
|
|
|
|
|
|
|
|
|
$this->assignAccessibilityBlock(); //Prepare the 'accessibility' var for the template |
|
|
|
|
|
|
|
|
|
// Preparing values for the menu |
|
|
|
|
|
|
|
|
|
// Logout link |
|
|
|
|
$hideLogout = api_get_setting('hide_logout_button'); |
|
|
|
|
if ('true' === $hideLogout) { |
|
|
|
|
$this->assign('logout_link', null); |
|
|
|
|
} else { |
|
|
|
|
$this->assign('logout_link', api_get_path(WEB_PATH).'index.php?logout=logout&uid='.api_get_user_id()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Profile link |
|
|
|
|
if ('true' == api_get_setting('allow_social_tool')) { |
|
|
|
|
$profile_url = api_get_path(WEB_CODE_PATH).'social/home.php'; |
|
|
|
|
} else { |
|
|
|
|
$profile_url = api_get_path(WEB_CODE_PATH).'auth/profile.php'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->assign('profile_url', $profile_url); |
|
|
|
|
|
|
|
|
|
//Message link |
|
|
|
|
$message_link = null; |
|
|
|
|
$message_url = null; |
|
|
|
|
if ('true' == api_get_setting('allow_message_tool')) { |
|
|
|
|
$message_url = api_get_path(WEB_CODE_PATH).'messages/inbox.php'; |
|
|
|
|
$message_link = '<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">'.get_lang('Inbox').'</a>'; |
|
|
|
|
} |
|
|
|
|
$this->assign('message_link', $message_link); |
|
|
|
|
$this->assign('message_url', $message_url); |
|
|
|
|
|
|
|
|
|
$pendingSurveyLink = ''; |
|
|
|
|
$show = api_get_configuration_value('show_pending_survey_in_menu'); |
|
|
|
|
if ($show) { |
|
|
|
|
$pendingSurveyLink = api_get_path(WEB_CODE_PATH).'survey/pending.php'; |
|
|
|
|
} |
|
|
|
|
$this->assign('pending_survey_url', $pendingSurveyLink); |
|
|
|
|
|
|
|
|
|
// Certificate Link |
|
|
|
|
$allow = api_get_configuration_value('certificate.hide_my_certificate_link'); |
|
|
|
|
if (false === $allow) { |
|
|
|
|
$certificateUrl = api_get_path(WEB_CODE_PATH).'gradebook/my_certificates.php'; |
|
|
|
|
$certificateLink = Display::url( |
|
|
|
|
get_lang('My certificates'), |
|
|
|
|
$certificateUrl |
|
|
|
|
); |
|
|
|
|
$this->assign('certificate_link', $certificateLink); |
|
|
|
|
$this->assign('certificate_url', $certificateUrl); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$institution = api_get_setting('Institution'); |
|
|
|
|
$portal_name = empty($institution) ? api_get_setting('siteName') : $institution; |
|
|
|
|
|
|
|
|
|
$this->assign('portal_name', $portal_name); |
|
|
|
|
|
|
|
|
|
//Menu |
|
|
|
|
//$menu = menuArray(); |
|
|
|
|
//$this->assign('menu', $menu); |
|
|
|
|
|
|
|
|
|
$breadcrumb = ''; |
|
|
|
|
// Hide breadcrumb in LP |
|
|
|
|
if (false == $this->show_learnpath) { |
|
|
|
|
$breadcrumb = return_breadcrumb( |
|
|
|
|
$interbreadcrumb, |
|
|
|
|
$language_file, |
|
|
|
|
$nameTools |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
$this->assign('breadcrumb', $breadcrumb); |
|
|
|
|
|
|
|
|
|
//Extra content |
|
|
|
|
$extra_header = null; |
|
|
|
|
if (!api_is_platform_admin()) { |
|
|
|
|
$extra_header = trim(api_get_setting('header_extra_content')); |
|
|
|
|
} |
|
|
|
|
$this->assign('header_extra_content', $extra_header); |
|
|
|
|
|
|
|
|
|
if ($sendHeaders) { |
|
|
|
|
/*header('Content-Type: text/html; charset='.api_get_system_encoding()); |
|
|
|
|
header( |
|
|
|
|
'X-Powered-By: '.$_configuration['software_name'].' '.substr($_configuration['system_version'], 0, 1) |
|
|
|
|
); |
|
|
|
|
self::addHTTPSecurityHeaders();*/ |
|
|
|
|
|
|
|
|
|
$responseCode = $this->getResponseCode(); |
|
|
|
|
if (!empty($responseCode)) { |
|
|
|
|
switch ($responseCode) { |
|
|
|
|
case '404': |
|
|
|
|
header("HTTP/1.0 404 Not Found"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$socialMeta = ''; |
|
|
|
|
$metaTitle = api_get_setting('meta_title'); |
|
|
|
|
if (!empty($metaTitle)) { |
|
|
|
|
$socialMeta .= '<meta name="twitter:card" content="summary" />'."\n"; |
|
|
|
|
$metaSite = api_get_setting('meta_twitter_site'); |
|
|
|
|
if (!empty($metaSite)) { |
|
|
|
|
$socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n"; |
|
|
|
|
$metaCreator = api_get_setting('meta_twitter_creator'); |
|
|
|
|
if (!empty($metaCreator)) { |
|
|
|
|
$socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// The user badge page emits its own meta tags, so if this is |
|
|
|
|
// enabled, ignore the global ones |
|
|
|
|
$userId = isset($_GET['user']) ? intval($_GET['user']) : 0; |
|
|
|
|
$skillId = isset($_GET['skill']) ? intval($_GET['skill']) : 0; |
|
|
|
|
|
|
|
|
|
if (!$userId && !$skillId) { |
|
|
|
|
// no combination of user and skill ID has been defined, |
|
|
|
|
// so print the normal OpenGraph meta tags |
|
|
|
|
$socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n"; |
|
|
|
|
$socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n"; |
|
|
|
|
|
|
|
|
|
$metaDescription = api_get_setting('meta_description'); |
|
|
|
|
if (!empty($metaDescription)) { |
|
|
|
|
$socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$metaImage = api_get_setting('meta_image_path'); |
|
|
|
|
if (!empty($metaImage)) { |
|
|
|
|
if (is_file(api_get_path(SYS_PATH).$metaImage)) { |
|
|
|
|
$path = api_get_path(WEB_PATH).$metaImage; |
|
|
|
|
$socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->assign('social_meta', $socialMeta); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Set footer parameters. |
|
|
|
|
*/ |
|
|
|
|
private function set_footer_parameters() |
|
|
|
|
{ |
|
|
|
|
// Loading footer extra content |
|
|
|
|
if (!api_is_platform_admin()) { |
|
|
|
|
$extra_footer = trim(api_get_setting('footer_extra_content')); |
|
|
|
|
if (!empty($extra_footer)) { |
|
|
|
|
$this->assign('footer_extra_content', $extra_footer); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Manage specific HTTP headers security. |
|
|
|
|
*/ |
|
|
|
|
|