Browse Source

Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

Angel Fernando Quiroz Campos 7 years ago
parent
commit
1e4d41d134
1 changed files with 10 additions and 3 deletions
  1. 10 3
      main/inc/lib/pdf.lib.php

+ 10 - 3
main/inc/lib/pdf.lib.php

@@ -53,7 +53,10 @@ class PDF
         $this->params['student_info'] = isset($params['student_info']) ? $params['student_info'] : false;
         $this->params['show_grade_generated_date'] = isset($params['show_grade_generated_date']) ? $params['show_grade_generated_date'] : false;
         $this->params['show_teacher_as_myself'] = isset($params['show_teacher_as_myself']) ? $params['show_teacher_as_myself'] : true;
-        $this->params['pdf_date'] = isset($params['pdf_date']) ? $params['pdf_date'] : api_format_date(api_get_local_time(), DATE_TIME_FORMAT_LONG);
+        $localTime = api_get_local_time();
+        $this->params['pdf_date'] = isset($params['pdf_date']) ? $params['pdf_date'] : api_format_date($localTime, DATE_TIME_FORMAT_LONG);
+        $this->params['pdf_date_only'] = isset($params['pdf_date']) ? $params['pdf_date'] : api_format_date($localTime, DATE_FORMAT_LONG);
+
 
         $this->pdf = new mPDF(
             'UTF-8',
@@ -127,6 +130,7 @@ class PDF
         $tpl->assign('pdf_course_info', $this->params['course_info']);
         $tpl->assign('pdf_session_info', $this->params['session_info']);
         $tpl->assign('pdf_date', $this->params['pdf_date']);
+        $tpl->assign('pdf_date_only', $this->params['pdf_date_only']);
         $tpl->assign('pdf_teachers', $teacher_list);
         $tpl->assign('pdf_title', $this->params['pdf_title']);
         $tpl->assign('pdf_student_info', $this->params['student_info']);
@@ -138,8 +142,11 @@ class PDF
         $html = $tpl->fetch($tableTemplate);
         $html = api_utf8_encode($html);
 
-        $css_file = api_get_path(SYS_CSS_PATH).'/print.css';
-        $css = file_exists($css_file) ? @file_get_contents($css_file) : '';
+        $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_get_contents($css_file);
 
         $html = self::content_to_pdf(
             $html,