Browse Source

Fix pdf template, change top and bottom values

Remove use of global
jmontoyaa 7 years ago
parent
commit
cda36386ca
2 changed files with 13 additions and 16 deletions
  1. 8 9
      main/inc/lib/pdf.lib.php
  2. 5 7
      main/template/default/export/table_pdf.tpl

+ 8 - 9
main/inc/lib/pdf.lib.php

@@ -40,8 +40,8 @@ class PDF
 
         $params['left'] = isset($params['left']) ? $params['left'] : 15;
         $params['right'] = isset($params['right']) ? $params['right'] : 15;
-        $params['top'] = isset($params['top']) ? $params['top'] : 20;
-        $params['bottom'] = isset($params['bottom']) ? $params['bottom'] : 15;
+        $params['top'] = isset($params['top']) ? $params['top'] : 30;
+        $params['bottom'] = isset($params['bottom']) ? $params['bottom'] : 30;
 
         $this->params['filename'] = isset($params['filename']) ? $params['filename'] : api_get_local_time();
         $this->params['pdf_title'] = isset($params['pdf_title']) ? $params['pdf_title'] : get_lang('Untitled');
@@ -410,7 +410,7 @@ class PDF
         $fileToSave = null,
         $returnHtml = false
     ) {
-        global $_configuration;
+        $urlAppend = api_get_configuration_value('url_append');
 
         if (empty($document_html)) {
             return false;
@@ -436,7 +436,7 @@ class PDF
         $document_html = str_replace('../../', '', $document_html);
         $document_html = str_replace('../', '', $document_html);
         $document_html = str_replace(
-            (empty($_configuration['url_append']) ? '' : $_configuration['url_append'].'/').'courses/'.$course_code.'/document/',
+            (empty($urlAppend) ? '' : $urlAppend.'/').'courses/'.$course_code.'/document/',
             '',
             $document_html
         );
@@ -460,7 +460,6 @@ class PDF
                                 $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed);
                                 $new_path = $document_path.$old_src_fixed;
                                 $document_html = str_replace($old_src, $new_path, $document_html);
-
                             }
                         }
                     }
@@ -633,9 +632,9 @@ class PDF
      */
     public function set_header($course_data)
     {
-        $this->pdf->defaultheaderfontsize   = 10; // in pts
-        $this->pdf->defaultheaderfontstyle  = 'BI'; // blank, B, I, or BI
-        $this->pdf->defaultheaderline       = 1; // 1 to include line below header/above footer
+        $this->pdf->defaultheaderfontsize = 10; // in pts
+        $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI
+        $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer
 
         $userId = api_get_user_id();
 
@@ -653,7 +652,7 @@ class PDF
                     $teachers = api_get_person_name($teacher['firstname'], $teacher['lastname']);
                 }
             }
-            
+
             $organization = ChamiloApi::getPlatformLogo();
             // Use custom logo image.
             $pdfLogo = api_get_setting('pdf_logo_header');

+ 5 - 7
main/template/default/export/table_pdf.tpl

@@ -1,5 +1,3 @@
-<br>
-<br>
 <h2 align="center"> {{ pdf_title }} </h2>
 
 {% if pdf_description %}
@@ -7,12 +5,11 @@
     <br /><br />
 {% endif %}
 
-
 <table align="center" width="100%" class="full-width border-thin">
     {% if pdf_student_info %}
     <tr>
         <td style="background-color: #E5E5E5; text-align: left; width:130px; ">
-            <strong>{{ "Student" | get_lang }}:</strong>  
+            <strong>{{ "Student" | get_lang }}:</strong>
         </td>
         <td>
             {{ pdf_student_info.complete_name }}
@@ -46,7 +43,7 @@
         {% if pdf_session_info.access_start_date != '' and pdf_session_info.access_end_date is not empty and pdf_session_info.access_end_date != '0000-00-00' %}
         <tr>
             <td style="background-color: #E5E5E5; text-align: left; width:130px;">
-                <strong>{{ "PeriodToDisplay" | get_lang }}:</strong> 
+                <strong>{{ "PeriodToDisplay" | get_lang }}:</strong>
             </td>
             <td>
                 {{ "FromDateXToDateY"| get_lang | format(pdf_session_info.access_start_date, pdf_session_info.access_end_date ) }}
@@ -58,7 +55,7 @@
     {% if pdf_course_info %}
     <tr>
         <td style="background-color: #E5E5E5; text-align: left; width:130px;">
-            <strong>{{ "Course" | get_lang }}:</strong> 
+            <strong>{{ "Course" | get_lang }}:</strong>
         </td>
         <td>
             {{ pdf_course_info.title }} ({{ pdf_course_info.code }})
@@ -75,7 +72,7 @@
     {% if pdf_date %}
     <tr>
         <td style="background-color: #E5E5E5; text-align: left; width:130px;">
-            <strong>{{ "Date" | get_lang }}:</strong> 
+            <strong>{{ "Date" | get_lang }}:</strong>
         </td>
         <td>
             {{ pdf_date }}
@@ -83,6 +80,7 @@
     </tr>
     {% endif %}
 </table>
+<br />
 
 {% if show_grade_generated_date == true %}
 <h5 align="right">