Use project or organization logo image for printing

This commit is contained in:
Manuel Cillero 2017-10-01 12:26:21 +02:00
parent 39339da278
commit a6559e5149
3 changed files with 31 additions and 0 deletions

View file

@ -9,6 +9,9 @@
/*
* Global styles.
*/
img.print-logo {
max-height: 120px;
}
body.print-body .form-control {
border: 0;
box-shadow: none;

View file

@ -28,6 +28,31 @@
print '<div class="print-message">'. $print['message'] .'</div>';
} ?>
<?php
global $conf;
if (!empty($conf['print_logo_aux']) && $conf['print_logo_aux']) {
if ($print['node']->type == 'stormorganization' || $print['node']->type == 'stormproject') {
$nid = $print['node']->nid;
} elseif (!empty($print['node']->project_nid)) {
$nid = $print['node']->project_nid;
} elseif (!empty($print['node']->organization_nid)) {
$nid = $print['node']->organization_nid;
}
if (!empty($nid)) {
$node = node_load($nid);
if ($node->type == 'stormorganization' && !empty($node->field_stormorganization_image[0]['filename'])) {
$img = 'organizations/' . $node->field_stormorganization_image[0]['filename'];
}
elseif (!empty($node->field_stormproject_image[0]['filename'])) {
$img = 'projects/' . $node->field_stormproject_image[0]['filename'];
}
if (!empty($img)) {
$lang = $print['language'] != 'es' ? '/' . $print['language'] : '';
$print['logo'] = '<img src="' . "$lang/system/files/$img" . '" alt="' . $node->title . '" class="print-logo" id="logo" />';
}
}
} ?>
<div class="print-logo"><?php print $print['logo']; ?></div>
<hr class="print-hr" />