Skip to content

Commit 2f81664

Browse files
committed
Display: Add 'email_logo' setting to allow for a different logo to be used only for e-mail communication - refs BT#21755
1 parent 5d47ce3 commit 2f81664

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

main/inc/lib/api.lib.php

+18-2
Original file line numberDiff line numberDiff line change
@@ -9442,11 +9442,11 @@ function api_site_use_cookie_warning_cookie_exist()
94429442
* Given a number of seconds, format the time to show hours, minutes and seconds.
94439443
*
94449444
* @param int $time The time in seconds
9445-
* @param string $originFormat Optional.
9445+
* @param string $originFormat Optional.
94469446
* PHP (used for scorm)
94479447
* JS (used in most cases and understood by excel)
94489448
* LANG (used to present unit in the user language)
9449-
*
9449+
*
94509450
* @return string (00h00'00")
94519451
*/
94529452
function api_format_time($time, $originFormat = 'php')
@@ -9675,6 +9675,22 @@ function api_mail_html(
96759675
}
96769676
if (isset($additionalParameters['logo'])) {
96779677
$mailView->assign('logo', $additionalParameters['logo']);
9678+
} elseif (api_get_configuration_value('email_logo') == true) {
9679+
$logoSubPath = 'themes/'.api_get_visual_theme().'/images/email-logo.png';
9680+
$logoSysPath = api_get_path(SYS_PATH).'web/css/'.$logoSubPath;
9681+
if (file_exists($logoSysPath)) {
9682+
$logoWebPath = api_get_path(WEB_CSS_PATH).$logoSubPath;
9683+
$imgTag = \Display::img(
9684+
$logoWebPath,
9685+
api_get_setting('siteName'),
9686+
[
9687+
'id' => 'header-logo',
9688+
'class' => 'img-responsive'
9689+
]
9690+
);
9691+
$logoTag = \Display::url($imgTag, api_get_path(WEB_PATH));
9692+
$mailView->assign('logo', $logoTag);
9693+
}
96789694
}
96799695
$mailView->assign('mail_header_style', api_get_configuration_value('mail_header_style'));
96809696
$mailView->assign('mail_content_style', api_get_configuration_value('mail_content_style'));

main/install/configuration.dist.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -2546,5 +2546,12 @@
25462546
// Set the following parameter to true to enable student to be assign as teacher of a course
25472547
//$_configuration['course_allow_student_role_to_be_teacher'] = false;
25482548

2549-
// Set the followinf parameter to true to activate the integration of the mathjax script in all HTML documents
2549+
// Set the following parameter to true to activate the integration of the mathjax script in all HTML documents
25502550
//$_configuration['mathjax_enable_script_header_in_all_HTML_document'] = false;
2551+
2552+
// E-mail-specific logo
2553+
// Set to true to use web/css/[current-theme]/images/email-logo.png as an
2554+
// e-mail logo instead of the platform logo. Only works if setting
2555+
// 'use_course_logo_in_course_page' is not set or there is no logo for that
2556+
// course. Recommended e-mail logo width is 540px.
2557+
//$_configuration['email_logo'] = false;

0 commit comments

Comments
 (0)