Browse Source

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

Alex Aragon 8 years ago
parent
commit
ad743cda89

+ 23 - 3
app/Resources/public/css/print.css

@@ -500,19 +500,19 @@ padding-top: 0px;	padding-right: 0px;	padding-bottom: 0px;	padding-left: 0px;}
 	text-align: left;
 }
 .data_table tr.row_odd {
-	background-color: #fafafa;	
+	background-color: #fafafa;
 }
 .data_table tr.row_odd:hover, .data_table tr.row_even:hover {
 	background-color: #f0f0f0;
 }
 .data_table tr.row_even {
-	background-color: #fff;	
+	background-color: #fff;
 }
 .data_table td .highlight {
     font-weight: bold;
 }
 .data_table td {
-	padding: 5px;	
+	padding: 5px;
 	border-bottom: 1px solid #b0b0b0;
 	border-right: 1px dotted #e1e1e1;
 	border-left: 1px dotted #e1e1e1;
@@ -671,3 +671,23 @@ div.system_announcement_content {
 .print_invisible {
 	display:none;
 }
+
+/* New print CSS */
+
+table th,
+table td {
+	padding: 5px;
+}
+table.full-width {
+	width: 100%;
+}
+table.border-thin,
+table.border-thin th,
+table.border-thin td {
+	border: 1px solid #000;
+	border-collapse: collapse;
+}
+
+.text-center {
+	text-align: center;
+}

+ 0 - 1
main/admin/teacher_time_report.php

@@ -299,7 +299,6 @@ if (isset($_GET['export'])) {
     switch ($_GET['export']) {
         case 'pdf':
             $params = array(
-                'add_signatures' => false,
                 'filename' => $fileName,
                 'pdf_title' => "$reportTitle - $reportSubTitle",
                 'pdf_description' => get_lang('TeacherTimeReport'),

+ 1 - 1
main/attendance/attendance_controller.php

@@ -599,7 +599,7 @@ class AttendanceController
             'filename' => get_lang('Attendance').'-'.api_get_local_time(),
             'pdf_title' => $courseInfo['title'],
             'course_code' => $courseInfo['code'],
-            'add_signatures' => true,
+            'add_signatures' => ['Drh', 'Teacher', 'Date'],
             'orientation' => 'landscape',
             'pdf_teachers' => $teacherName,
             'pdf_course_category' => $courseCategory['name'],

+ 20 - 35
main/course_progress/thematic_controller.php

@@ -230,7 +230,7 @@ class ThematicController
                     $params = array(
                         'filename' => get_lang('Thematic').'-'.api_get_local_time(),
                         'pdf_title' => get_lang('Thematic'),
-                        'add_signatures' => true,
+                        'add_signatures' => ['Drh', 'Teacher', 'Date'],
                         'format' => 'A4-L',
                         'orientation' => 'L'
                     );
@@ -238,41 +238,26 @@ class ThematicController
                     break;
                 case 'export_single_thematic':
                     $theme = $thematic->get_thematic_list($thematic_id);
-                    $table = array();
-                    $table[] = array(
-                        get_lang('Thematic'),
-                        get_lang('ThematicPlan'),
-                        get_lang('ThematicAdvance')
-                    );
-                    $data = $thematic->get_thematic_plan_data($theme['id']);
-                    $plan_html = null;
-                    if (!empty($data)) {
-                        foreach ($data as $plan) {
-                            if (empty($plan['description'])) {
-                                continue;
-                            }
-
-                            $plan_html .= '<h6>'.$plan['title'].'</h6>'.$plan['description'].'<br />';
-                        }
-                    }
-                    $data = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
-                    $advance_html = null;
-                    if (!empty($data)) {
-                        foreach ($data as $advance) {
-                            $advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG)
-                                .' ('.$advance['duration'].' '.get_lang('HourShort').')'
-                                .'<br />'.$advance['content'].'<br />';
-                        }
-                    }
-                    $table[] = array($theme['title'], $plan_html, $advance_html);
-                    $params = array(
-                        'filename' => get_lang('Thematic').'-'.api_get_local_time(),
-                        'pdf_title' => get_lang('Thematic'),
-                        'add_signatures' => true,
-                        'format' => 'A4-L',
-                        'orientation' => 'L'
+                    $plans = $thematic->get_thematic_plan_data($theme['id']);
+                    $advances = $thematic->get_thematic_advance_by_thematic_id($theme['id']);
+
+                    $view = new Template('', false, false, false, true, false, false);
+                    $view->assign('theme', $theme);
+                    $view->assign('plans', $plans);
+                    $view->assign('advances', $advances);
+
+                    $template = $view->get_template('course_progress/pdf_single_thematic.tpl');
+
+                    Export::export_html_to_pdf(
+                        $view->fetch($template),
+                        [
+                            'filename' => get_lang('Thematic').'-'.api_get_local_time(),
+                            'pdf_title' => get_lang('Thematic'),
+                            'add_signatures' => ['Drh', 'Teacher', 'Date'],
+                            'format' => 'A4-L',
+                            'orientation' => 'L'
+                        ]
                     );
-                    Export::export_table_pdf($table, $params);
                     break;
                 case 'moveup':
                     $thematic->move_thematic('up', $thematic_id);

+ 0 - 1
main/gradebook/gradebook_display_summary.php

@@ -61,7 +61,6 @@ switch ($action) {
             'course_info' => '',
             'pdf_date' => '',
             'course_code' => api_get_course_id(),
-            'add_signatures' => false,
             'student_info' => null,
             'show_grade_generated_date' => true,
             'show_real_course_teachers' => false,

+ 0 - 1
main/gradebook/index.php

@@ -950,7 +950,6 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null,true))
                         'session_info' => '',
                         'course_info' => '',
                         'pdf_date' => '',
-                        'add_signatures' => false,
                         'student_info' => api_get_user_info(),
                         'show_grade_generated_date' => true,
                         'show_real_course_teachers' => false,

+ 1 - 2
main/gradebook/lib/GradebookUtils.php

@@ -958,7 +958,7 @@ class GradebookUtils
             'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(),
             'pdf_title' => $title,
             'course_code' => $course_code,
-            'add_signatures' => true
+            'add_signatures' => ['Drh', 'Teacher', 'Date']
         );
 
         $page_format = $params['orientation'] == 'landscape' ? 'A4-L' : 'A4';
@@ -1419,7 +1419,6 @@ class GradebookUtils
             'course_info' => '',
             'pdf_date' => '',
             'course_code' => api_get_course_id(),
-            'add_signatures' => false,
             'student_info' => $userInfo,
             'show_grade_generated_date' => true,
             'show_real_course_teachers' => false,

+ 1 - 1
main/inc/lib/pdf.lib.php

@@ -48,7 +48,7 @@ class PDF
         $this->params['course_info'] = isset($params['course_info']) ? $params['course_info'] : api_get_course_info();
         $this->params['session_info'] = isset($params['session_info']) ? $params['session_info'] : api_get_session_info(api_get_session_id());
         $this->params['course_code'] = isset($params['course_code']) ? $params['course_code'] : api_get_course_id();
-        $this->params['add_signatures'] = isset($params['add_signatures']) ? $params['add_signatures'] : false;
+        $this->params['add_signatures'] = isset($params['add_signatures']) ? $params['add_signatures'] : [];
         $this->params['show_real_course_teachers'] = isset($params['show_real_course_teachers']) ? $params['show_real_course_teachers'] : false;
         $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;

+ 4 - 0
main/inc/lib/pear/HTML/Table/Storage.php

@@ -838,6 +838,10 @@ class HTML_Table_Storage extends HTML_Common
     {
         $colspan = isset($attributes['colspan']) ? $attributes['colspan'] : 1;
         $rowspan = isset($attributes['rowspan']) ? $attributes['rowspan'] : 1;
+        if (!is_numeric($row) or !is_numeric($col)) {
+            //throw new Exception('Row or column index is not numerical');
+            return;
+        }
         if (($row + $rowspan - 1) >= $this->_rows) {
             if ($this->_autoGrow) {
                 $this->_rows = $row + $rowspan;

+ 31 - 0
main/template/default/course_progress/pdf_single_thematic.tpl

@@ -0,0 +1,31 @@
+<table class="full-width border-thin">
+    <thead>
+    <tr>
+        <th>{{ 'Thematic'|get_lang }}</th>
+        <th>{{ 'ThematicPlan'|get_lang }}</th>
+        <th>{{ 'ThematicAdvance'|get_lang }}</th>
+    </tr>
+    </thead>
+    <tbody>
+    <tr>
+        <td>
+            <h2>{{ theme.title }}</h2>
+            {{ theme.content }}
+        </td>
+        <td>
+            {% for plan in plans %}
+                <h3>{{ plan.title }}</h3>
+                {{ plan.description }}
+            {% endfor %}
+        </td>
+        <td>
+            {% for advance in advances %}
+                <p>
+                    <strong>{{ advance.start_date|local_format_date(2) ~ ' (' ~ advance.duration ~ 'HourShort'|get_lang ~ ') ' }}</strong>
+                </p>
+                {{ advance.content }}
+            {% endfor %}
+        </td>
+    </tr>
+    </tbody>
+</table>

+ 9 - 17
main/template/default/export/table_pdf.tpl

@@ -81,27 +81,19 @@
 
 {{ pdf_content }}
 
-{% if add_signatures == true %}
+{% if not add_signatures is empty %}
     <br />
     <br />
 
-    <table style="text-align:center" width="100%">
+    <table class="full-width">
         <tr>
-            <td>
-                _____________________________
-                <br />
-                {{ "Drh" | get_lang }}
-            </td>
-            <td>
-                _____________________________
-                <br />
-                {{ "Teacher" | get_lang }}
-            </td>
-            <td>
-                _____________________________
-                <br />
-                {{ "Date" | get_lang }}
-            </td>
+            {% for signature in add_signatures %}
+                <td class="text-center">
+                    _____________________________
+                    <br />
+                    {{ signature|get_lang }}
+                </td>
+            {% endfor %}
         </tr>
     </table>
 {% endif %}

+ 0 - 1
main/user/user.php

@@ -397,7 +397,6 @@ if (api_is_allowed_to_edit(null, true)) {
                             array('style' => 'width:500px')
                         );
                         $params = array(
-                            'add_signatures' => false,
                             'filename' => $fileName,
                             'pdf_title' => $pdfTitle,
                             'header_attributes' => $header_attributes

+ 0 - 1
main/work/work.lib.php

@@ -5255,7 +5255,6 @@ function exportAllStudentWorkFromPublication(
                         'filename' => $workData['title'] . '_' . api_get_local_time(),
                         'pdf_title' => api_replace_dangerous_char($workData['title']),
                         'course_code' => $courseInfo['code'],
-                        'add_signatures' => false
                     );
                     $pdf = new PDF('A4', null, $params);
                     $pdf->html_to_pdf_with_template($content);