Replace getWebPlatformLogoPath with getPlatformLogoPath fix pdf export

see BT#13394
pull/2487/head
jmontoyaa 9 years ago
parent 0de12982d3
commit 66ccac4acb
  1. 2
      main/admin/settings.lib.php
  2. 4
      main/inc/lib/pdf.lib.php
  3. 20
      src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php

@ -355,7 +355,7 @@ function handleStylesheets()
$url = api_get_path(WEB_CSS_PATH).'/'.$themeDir.'/images/';
$logoFileName = 'header-logo.png';
$newLogoFileName = 'header-logo-custom'.api_get_current_access_url_id().'.png';
$webPlatformLogoPath = ChamiloApi::getWebPlatformLogoPath($selected);
$webPlatformLogoPath = ChamiloApi::getPlatformLogoPath($selected);
$logoForm = new FormValidator(
'logo_upload',

@ -690,14 +690,14 @@ class PDF
}
}
$organization = ChamiloApi::getPlatformLogo();
$organization = ChamiloApi::getPlatformLogo('', [], true);
// Use custom logo image.
$pdfLogo = api_get_setting('pdf_logo_header');
if ($pdfLogo === 'true') {
$visualTheme = api_get_visual_theme();
$img = api_get_path(SYS_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png';
if (file_exists($img)) {
$img = api_get_path(WEB_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png';
//$img = api_get_path(WEB_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png';
$organization = "<img src='$img'>";
}
}

@ -65,9 +65,11 @@ class ChamiloApi
/**
* Get the platform logo path
* @return null|string
* @param string $theme
* @param bool $getSysPath
* @return string
*/
public static function getWebPlatformLogoPath($theme = '')
public static function getPlatformLogoPath($theme = '', $getSysPath = false)
{
$theme = empty($theme) ? api_get_visual_theme() : $theme;
$accessUrlId = api_get_current_access_url_id();
@ -75,27 +77,35 @@ class ChamiloApi
$customLogoPath = $themeDir."images/header-logo-custom$accessUrlId.png";
if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/$customLogoPath")) {
if ($getSysPath) {
return api_get_path(SYS_PUBLIC_PATH)."css/$customLogoPath";
}
return api_get_path(WEB_CSS_PATH).$customLogoPath;
}
$originalLogoPath = $themeDir."images/header-logo.png";
if (file_exists(api_get_path(SYS_CSS_PATH).$originalLogoPath)) {
if ($getSysPath) {
return api_get_path(SYS_CSS_PATH).$originalLogoPath;
}
return api_get_path(WEB_CSS_PATH).$originalLogoPath;
}
return null;
return '';
}
/**
* Get the platform logo.
* Return a <img> if the logo image exists. Otherwise return a <h2> with the institution name.
* @param string $theme
* @param array $imageAttributes Optional.
* @param bool $getSysPath
* @return string
*/
public static function getPlatformLogo($theme = '', $imageAttributes = [])
public static function getPlatformLogo($theme = '', $imageAttributes = [], $getSysPath = false)
{
$logoPath = self::getWebPlatformLogoPath($theme);
$logoPath = self::getPlatformLogoPath($theme, $getSysPath);
$institution = api_get_setting('Institution');
$institutionUrl = api_get_setting('InstitutionUrl');
$siteName = api_get_setting('siteName');

Loading…
Cancel
Save