fix css print base

pull/3151/head
Alex Aragón 6 years ago
parent 35db8c5f11
commit 7ce6d527d6
  1. 101
      app/Resources/public/css/print.css
  2. 36
      main/inc/lib/pdf.lib.php
  3. 2
      main/mySpace/access_details_session.php

@ -4,7 +4,7 @@ body {
color: #000;
margin: 0;
padding: 0;
background-color: #fff;
font-family: "Arial", serif;
}
img {
@ -93,3 +93,102 @@ table.table td {
border: 1px solid #555;
border-collapse: collapse;
}
/* print table pdf */
.data_table{
width: 100%;
padding: 0;
border: 1px solid #b5cae7;
border-spacing: 0;
margin: 0 0 18px;
}
.data_table td {
padding: 5px;
border-bottom: 1px solid #b5cae7;
border-right: 1px solid #b5cae7;
border-top: 1px solid #b5cae7;
text-align: left;
font-size: 12px;
color: #666666;
}
.data_table th, .data_table td {
line-height: 18px;
padding: 10px;
}
.data_table th {
padding: 8px 10px;
font-weight: bold;
background-color: #eef5fa;
border-bottom: 2px solid #b5cae7;
color: #4171b5;
}
.data_table th a {
color: #333;
}
.data_table_no_border {
border-collapse: collapse;
border-spacing: 0;
font-size: 12px;
margin-bottom: 15px;
margin-top: 8px;
text-align: left;
width: 100%;
}
.data_table_no_border td {
line-height: normal;
padding: 6px;
text-align: left;
vertical-align: middle;
}
.data_table tr.row_odd {
background-color: #F9F9F9;
}
.data-title .page-header{
color: #000;
font-weight: bold;
border-bottom: 1px solid #b5cae7;
}
.date-calendar .page-header{
color: #000;
font-weight: bold;
border-bottom: 1px solid #b5cae7;
border-top: 1px solid #b5cae7;
text-align: center;
background-color: #EDEDED;
padding-top: 10px;
border-radis: 10px;
}
.table_print{
width: 100%;
padding: 0;
border: 1px solid #CEE0CC;
border-spacing: 0;
margin: 0 0 18px;
background-color: #F3FFE6;
}
.table_print td {
padding: 5px;
border-bottom: 1px solid #CEE0CC;
border-right: 1px solid #CEE0CC;
border-top: 1px solid #CEE0CC;
text-align: left;
font-size: 12px;
color: #666666;
}
.table_print th, .table_print td {
line-height: 18px;
padding: 10px;
}
.table_print th {
padding: 8px 10px;
font-weight: bold;
background-color: #CEE0CC;
border-bottom: 2px solid #4F7849;
color: #4F7849;
}

@ -155,7 +155,7 @@ class PDF
$css_file = api_get_path(SYS_CSS_PATH).'themes/'.$tpl->theme.'/print.css';
if (!file_exists($css_file)) {
$css_file = api_get_path(SYS_CSS_PATH).'print.css';
$css_file = api_get_path(SYS_CSS_PATH).'/print.css';
}
$css = file_get_contents($css_file);
@ -499,21 +499,17 @@ class PDF
}
if ($addDefaultCss) {
$basicStyles = [
api_get_path(SYS_PATH).'web/assets/bootstrap/dist/css/bootstrap.min.css',
api_get_path(SYS_PATH).'web/css/base.css',
api_get_path(SYS_PATH).'web/css/themes/'.api_get_visual_theme().'/default.css',
api_get_path(SYS_PATH).'web/css/themes/'.api_get_visual_theme().'/print.css',
];
foreach ($basicStyles as $style) {
if (file_exists($style)) {
$cssContent = file_get_contents($style);
try {
$this->pdf->WriteHTML($cssContent, 1);
} catch (MpdfException $e) {
error_log($e);
}
}
$css_file = api_get_path(SYS_CSS_PATH).'themes/'.api_get_visual_theme().'/print.css';
if (!file_exists($css_file)) {
$css_file = api_get_path(SYS_CSS_PATH).'/print.css';
}
$cssContent = file_get_contents($css_file);
try {
$this->pdf->WriteHTML($cssContent, 1);
} catch (MpdfException $e) {
error_log($e);
}
}
@ -903,20 +899,20 @@ class PDF
/**
* @param string $theme
*
* @param bool $fullPage
* @throws MpdfException
*/
public function setBackground($theme)
public function setBackground($theme, $fullPage = false)
{
$themeName = empty($theme) ? api_get_visual_theme() : $theme;
$themeDir = \Template::getThemeDir($themeName);
$customLetterhead = $themeDir.'images/letterhead.png';
$urlPathLetterhead = api_get_path(SYS_CSS_PATH).$customLetterhead;
$urlWebLetterhead = '#FFFFFF';
$fullPage = false;
if (file_exists($urlPathLetterhead)) {
$fullPage = true;
$urlWebLetterhead = 'url('.api_get_path(WEB_CSS_PATH).$customLetterhead.')';
} else {
$urlWebLetterhead = 'url('.api_get_path(WEB_CSS_PATH).'themes/chamilo/images/letterhead.png)';
}
if ($fullPage) {

@ -517,7 +517,7 @@ if ($formByDay->validate()) {
];
$pdfName = api_strtoupper($userInfo['lastname'].'_'.$userInfo['firstname']).'_'.api_get_local_time();
@$pdf = new PDF('A4', $params['orientation'], $params);
@$pdf->setBackground($tpl->theme);
@$pdf->setBackground($tpl->theme, true);
@$pdf->content_to_pdf(
$content,
'',

Loading…
Cancel
Save