Passed
Push — 1.10.x ( 767d99...288426 )
by Yannick
44:51
created
main/inc/lib/event_email_template.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 class EventEmailTemplate extends Model
8 8
 {
9 9
     public $table;
10
-    public $columns = array('id', 'message','subject','event_type_name','activated');
10
+    public $columns = array('id', 'message', 'subject', 'event_type_name', 'activated');
11 11
 
12 12
     /**
13 13
      * Constructor
14 14
      */
15 15
 	public function __construct()
16 16
     {
17
-        $this->table =  Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
17
+        $this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
18 18
 	}
19 19
 
20 20
     public function get_all($where_conditions = array())
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		// action links
35 35
 		$content = Display::actions(array(
36 36
                 array(
37
-                    'url' => 'event_type.php' ,
37
+                    'url' => 'event_type.php',
38 38
                     'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM)
39 39
                  )
40 40
             )
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     public function get_count()
116 116
     {
117
-        $row = Database::select('count(*) as count', $this->table, array(),'first');
117
+        $row = Database::select('count(*) as count', $this->table, array(), 'first');
118 118
 
119 119
         return $row['count'];
120 120
     }
Please login to merge, or discard this patch.
main/inc/lib/myspace.lib.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=course', 'content' => get_lang('DisplayCourseOverview')),
26 26
             array('url' => api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin', 'content' => get_lang('LPQuestionListResults')),
27 27
             array('url' => api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin', 'content' => get_lang('LPExerciseResultsBySession')),
28
-            ['url' => api_get_path(WEB_CODE_PATH) . 'mySpace/admin_view.php?display=accessoverview', 'content' => get_lang('DisplayAccessOverview') . ' (' . get_lang('Beta') . ')']
28
+            ['url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=accessoverview', 'content' => get_lang('DisplayAccessOverview').' ('.get_lang('Beta').')']
29 29
         );
30 30
 
31 31
         return Display :: actions($actions, null);
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public static function getTopMenu()
35 35
     {
36 36
         $menu_items = array();
37
-        $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
37
+        $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php");
38 38
         $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher');
39 39
         $menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), '#');
40 40
         $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $session_id  = intval($session_id);
105 105
 
106 106
         $sql = 'SELECT login_course_date, logout_course_date
107
-                FROM ' . $tbl_track_course . '
107
+                FROM ' . $tbl_track_course.'
108 108
                 WHERE
109 109
                     user_id = '.$user_id.' AND
110 110
                     c_id = '.$courseId.' AND
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         foreach ($course_list as $course_item) {
144 144
             $courseInfo = api_get_course_info($course_item['code']);
145 145
             $courseId = $courseInfo['real_id'];
146
-            $new_course_list[] =  '"'.$courseId.'"';
146
+            $new_course_list[] = '"'.$courseId.'"';
147 147
         }
148 148
         $course_list = implode(', ', $new_course_list);
149 149
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             return false;
152 152
         }
153 153
         $sql = 'SELECT login_course_date, logout_course_date, c_id
154
-                FROM ' . $tbl_track_course . '
154
+                FROM ' . $tbl_track_course.'
155 155
                 WHERE
156 156
                     user_id = '.$user_id.' AND
157 157
                     c_id IN ('.$course_list.') AND
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             // student score
230 230
             $avg_score = Tracking :: get_avg_student_score($user_id, $courseCode);
231 231
             if (is_numeric($avg_score)) {
232
-                $avg_score = round($avg_score,2);
232
+                $avg_score = round($avg_score, 2);
233 233
             } else {
234 234
                 $$avg_score = '-';
235 235
             }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
267 267
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
268
-        $t_head .=      '<tr>';
268
+        $t_head .= '<tr>';
269 269
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
270 270
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
271 271
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         $addparams = array('view' => 'admin', 'display' => 'user');
285 285
 
286
-        $table = new SortableTable('tracking_user_overview', array('MySpace','get_number_of_users_tracking_overview'), array('MySpace','get_user_data_tracking_overview'), 0);
286
+        $table = new SortableTable('tracking_user_overview', array('MySpace', 'get_number_of_users_tracking_overview'), array('MySpace', 'get_user_data_tracking_overview'), 0);
287 287
         $table->additional_parameters = $addparams;
288 288
 
289 289
         $table->set_header(0, get_lang('OfficialCode'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         }
297 297
         $table->set_header(3, get_lang('LoginName'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
298 298
         $table->set_header(4, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
299
-        $table->set_column_filter(4, array('MySpace','course_info_tracking_filter'));
299
+        $table->set_column_filter(4, array('MySpace', 'course_info_tracking_filter'));
300 300
         $table->display();
301 301
     }
302 302
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         $table -> set_header(7, get_lang('Sessions'), false);
342 342
 
343 343
         if ($is_western_name_order) {
344
-            $csv_header[] = array (
344
+            $csv_header[] = array(
345 345
                 get_lang('FirstName', ''),
346 346
                 get_lang('LastName', ''),
347 347
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                 get_lang('NumberOfSessions', '')
352 352
             );
353 353
         } else {
354
-            $csv_header[] = array (
354
+            $csv_header[] = array(
355 355
                 get_lang('LastName', ''),
356 356
                 get_lang('FirstName', ''),
357 357
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 
492 492
         if ($tracking_column != 3) {
493 493
             if ($tracking_direction == 'DESC') {
494
-                usort($all_datas, array('MySpace','rsort_users'));
494
+                usort($all_datas, array('MySpace', 'rsort_users'));
495 495
             } else {
496
-                usort($all_datas, array('MySpace','sort_users'));
496
+                usort($all_datas, array('MySpace', 'sort_users'));
497 497
             }
498 498
         }
499 499
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         /**
553 553
          * Column config
554 554
          */
555
-        $column_model   = array(
555
+        $column_model = array(
556 556
             array(
557 557
                 'name' => 'username',
558 558
                 'index' => 'username',
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 
594 594
         $action_links = '';
595 595
         // jqgrid will use this URL to do the selects
596
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
596
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
597 597
 
598 598
         //Table Id
599 599
         $tableId = 'lpProgress';
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
             true
616 616
         );
617 617
 
618
-        $return = '<script>$(function() {'. $table .
618
+        $return = '<script>$(function() {'.$table.
619 619
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
620 620
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
621 621
                        caption:"",
622
-                       title:"' . get_lang('ExportExcel') . '",
622
+                       title:"' . get_lang('ExportExcel').'",
623 623
                        onClickButton : function () {
624 624
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
625 625
                        }
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         /**
670 670
          * Column config
671 671
          */
672
-        $column_model   = array(
672
+        $column_model = array(
673 673
             array('name'=>'session', 'index'=>'session', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
674 674
             array('name'=>'exercise_id', 'index'=>'exercise_id', 'align'=>'left', 'search' => 'true'),
675 675
             array('name'=>'quiz_title', 'index'=>'quiz_title', 'align'=>'left', 'search' => 'true'),
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
         //get dynamic column names
687 687
 
688 688
         // jqgrid will use this URL to do the selects
689
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id=' . $sessionId . '&course_id=' . $courseId  . '&exercise_id=' . $exerciseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
689
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id='.$sessionId.'&course_id='.$courseId.'&exercise_id='.$exerciseId.'&date_to='.$date_to.'&date_from='.$date_from;
690 690
 
691 691
         // Autowidth
692 692
         $extra_params['autowidth'] = 'true';
@@ -697,11 +697,11 @@  discard block
 block discarded – undo
697 697
         $tableId = 'exerciseProgressOverview';
698 698
         $table = Display::grid_js($tableId, $url, $columns, $column_model, $extra_params, array(), '', true);
699 699
 
700
-        $return = '<script>$(function() {'. $table .
700
+        $return = '<script>$(function() {'.$table.
701 701
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
702 702
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
703 703
                        caption:"",
704
-                       title:"' . get_lang('ExportExcel') . '",
704
+                       title:"' . get_lang('ExportExcel').'",
705 705
                        onClickButton : function () {
706 706
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
707 707
                        }
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
 
788 788
                     $column[] = $title;
789 789
                     $column_model[] = array(
790
-                        'name' => 'exer' . $i,
791
-                        'index' => 'exer' . $i,
790
+                        'name' => 'exer'.$i,
791
+                        'index' => 'exer'.$i,
792 792
                         'align' => 'center',
793 793
                         'search' => 'true',
794 794
                         'wrap_cell' => "true"
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 
801 801
         //end get dynamic column names
802 802
         // jqgrid will use this URL to do the selects
803
-        $url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_exercise_grade&session_id=' . $sessionId . '&course_id=' . $courseId;
803
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_grade&session_id='.$sessionId.'&course_id='.$courseId;
804 804
 
805 805
         // Autowidth
806 806
         $extra_params['autowidth'] = 'true';
@@ -811,13 +811,13 @@  discard block
 block discarded – undo
811 811
         $tableId = 'exerciseGradeOverview';
812 812
         $table = Display::grid_js($tableId, $url, $column, $column_model, $extra_params, array(), '', true);
813 813
 
814
-        $return = '<script>$(function() {' . $table .
815
-            'jQuery("#' . $tableId . '").jqGrid("navGrid","#' . $tableId . '_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
816
-                jQuery("#' . $tableId . '").jqGrid("navButtonAdd","#' . $tableId . '_pager",{
814
+        $return = '<script>$(function() {'.$table.
815
+            'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
816
+                jQuery("#' . $tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
817 817
                        caption:"",
818
-                       title:"' . get_lang('ExportExcel') . '",
818
+                       title:"' . get_lang('ExportExcel').'",
819 819
                        onClickButton : function () {
820
-                           jQuery("#' . $tableId . '").jqGrid("excelExport",{"url":"' . $url . '&export_format=xls"});
820
+                           jQuery("#' . $tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
821 821
                        }
822 822
                 });
823 823
             });</script>';
@@ -850,10 +850,10 @@  discard block
 block discarded – undo
850 850
         /**
851 851
          * Column config
852 852
          */
853
-        $column_model   = array(
854
-            array('name'=>'username',   'index'=>'username',    'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
855
-            array('name'=>'firstname',  'index'=>'firstname',   'align'=>'left', 'search' => 'true'),
856
-            array('name'=>'lastname',   'index'=>'lastname',    'align'=>'left', 'search' => 'true'),
853
+        $column_model = array(
854
+            array('name'=>'username', 'index'=>'username', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
855
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left', 'search' => 'true'),
856
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left', 'search' => 'true'),
857 857
         );
858 858
         //get dinamic column names
859 859
         foreach ($questions as $question_id => $question) {
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
         $action_links = '';
870 870
 
871 871
         // jqgrid will use this URL to do the selects
872
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id=' . $sessionId . '&course_id=' . $courseId . '&survey_id=' . $surveyId . '&date_to=' . $date_to . '&date_from=' . $date_from;
872
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id='.$sessionId.'&course_id='.$courseId.'&survey_id='.$surveyId.'&date_to='.$date_to.'&date_from='.$date_from;
873 873
 
874 874
         // Table Id
875 875
         $tableId = 'lpProgress';
@@ -891,11 +891,11 @@  discard block
 block discarded – undo
891 891
             true
892 892
         );
893 893
 
894
-        $return = '<script>$(function() {'. $table .
894
+        $return = '<script>$(function() {'.$table.
895 895
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
896 896
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
897 897
                        caption:"",
898
-                       title:"' . get_lang('ExportExcel') . '",
898
+                       title:"' . get_lang('ExportExcel').'",
899 899
                        onClickButton : function () {
900 900
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
901 901
                        }
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
      * Display a sortable table that contains an overview off all the progress of the user in a session
911 911
      * @author César Perales <[email protected]>, Beeznest Team
912 912
      */
913
-    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0,  $date_from, $date_to)
913
+    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0, $date_from, $date_to)
914 914
     {
915 915
         //The order is important you need to check the the $column variable in the model.ajax.php file
916 916
         $columns = array(
@@ -960,55 +960,55 @@  discard block
 block discarded – undo
960 960
         );
961 961
 
962 962
         //Column config
963
-        $column_model   = array(
964
-            array('name'=>'lastname',   'index'=>'lastname',     'align'=>'left'),
965
-            array('name'=>'firstname',  'index'=>'firstname',    'align'=>'left'),
966
-            array('name'=>'username',   'index'=>'username',     'align'=>'left'),
963
+        $column_model = array(
964
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left'),
965
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left'),
966
+            array('name'=>'username', 'index'=>'username', 'align'=>'left'),
967 967
             #array('name'=>'profile',   'index'=>'username',     'align'=>'left'),
968
-            array('name'=>'total',      'index'=>'total',        'align'=>'left'),
969
-            array('name'=>'courses',    'index'=>'courses',      'align'=>'left', 'sortable' => 'false'),
970
-            array('name'=>'lessons',    'index'=>'lessons',      'align'=>'left', 'sortable' => 'false'),
971
-            array('name'=>'exercises',  'index'=>'exercises',    'align'=>'left', 'sortable' => 'false'),
972
-            array('name'=>'forums',     'index'=>'forums',       'align'=>'left', 'sortable' => 'false'),
973
-            array('name'=>'homeworks',  'index'=>'homeworks',    'align'=>'left', 'sortable' => 'false'),
974
-            array('name'=>'wikis',      'index'=>'wikis',        'align'=>'left', 'sortable' => 'false'),
975
-            array('name'=>'surveys',    'index'=>'surveys',      'align'=>'left', 'sortable' => 'false'),
968
+            array('name'=>'total', 'index'=>'total', 'align'=>'left'),
969
+            array('name'=>'courses', 'index'=>'courses', 'align'=>'left', 'sortable' => 'false'),
970
+            array('name'=>'lessons', 'index'=>'lessons', 'align'=>'left', 'sortable' => 'false'),
971
+            array('name'=>'exercises', 'index'=>'exercises', 'align'=>'left', 'sortable' => 'false'),
972
+            array('name'=>'forums', 'index'=>'forums', 'align'=>'left', 'sortable' => 'false'),
973
+            array('name'=>'homeworks', 'index'=>'homeworks', 'align'=>'left', 'sortable' => 'false'),
974
+            array('name'=>'wikis', 'index'=>'wikis', 'align'=>'left', 'sortable' => 'false'),
975
+            array('name'=>'surveys', 'index'=>'surveys', 'align'=>'left', 'sortable' => 'false'),
976 976
             //Lessons
977
-            array('name'=>'lessons_total',    'index'=>'lessons_total',      'align'=>'center', 'sortable' => 'false'),
978
-            array('name'=>'lessons_done',     'index'=>'lessons_done',       'align'=>'center', 'sortable' => 'false'),
979
-            array('name'=>'lessons_left',     'index'=>'lessons_left',       'align'=>'center', 'sortable' => 'false'),
980
-            array('name'=>'lessons_progress', 'index'=>'lessons_progress',   'align'=>'center', 'sortable' => 'false'),
977
+            array('name'=>'lessons_total', 'index'=>'lessons_total', 'align'=>'center', 'sortable' => 'false'),
978
+            array('name'=>'lessons_done', 'index'=>'lessons_done', 'align'=>'center', 'sortable' => 'false'),
979
+            array('name'=>'lessons_left', 'index'=>'lessons_left', 'align'=>'center', 'sortable' => 'false'),
980
+            array('name'=>'lessons_progress', 'index'=>'lessons_progress', 'align'=>'center', 'sortable' => 'false'),
981 981
             //Exercises
982
-            array('name'=>'exercises_total',    'index'=>'exercises_total',      'align'=>'center', 'sortable' => 'false'),
983
-            array('name'=>'exercises_done',     'index'=>'exercises_done',       'align'=>'center', 'sortable' => 'false'),
984
-            array('name'=>'exercises_left',     'index'=>'exercises_left',       'align'=>'center', 'sortable' => 'false'),
985
-            array('name'=>'exercises_progress', 'index'=>'exercises_progress',   'align'=>'center', 'sortable' => 'false'),
982
+            array('name'=>'exercises_total', 'index'=>'exercises_total', 'align'=>'center', 'sortable' => 'false'),
983
+            array('name'=>'exercises_done', 'index'=>'exercises_done', 'align'=>'center', 'sortable' => 'false'),
984
+            array('name'=>'exercises_left', 'index'=>'exercises_left', 'align'=>'center', 'sortable' => 'false'),
985
+            array('name'=>'exercises_progress', 'index'=>'exercises_progress', 'align'=>'center', 'sortable' => 'false'),
986 986
             //Assignments
987
-            array('name'=>'forums_total',    'index'=>'forums_total',        'align'=>'center', 'sortable' => 'false'),
988
-            array('name'=>'forums_done',     'index'=>'forums_done',         'align'=>'center', 'sortable' => 'false'),
989
-            array('name'=>'forums_left',     'index'=>'forums_left',         'align'=>'center', 'sortable' => 'false'),
990
-            array('name'=>'forums_progress', 'index'=>'forums_progress',     'align'=>'center', 'sortable' => 'false'),
987
+            array('name'=>'forums_total', 'index'=>'forums_total', 'align'=>'center', 'sortable' => 'false'),
988
+            array('name'=>'forums_done', 'index'=>'forums_done', 'align'=>'center', 'sortable' => 'false'),
989
+            array('name'=>'forums_left', 'index'=>'forums_left', 'align'=>'center', 'sortable' => 'false'),
990
+            array('name'=>'forums_progress', 'index'=>'forums_progress', 'align'=>'center', 'sortable' => 'false'),
991 991
             //Assignments
992
-            array('name'=>'assigments_total',    'index'=>'assigments_total',        'align'=>'center', 'sortable' => 'false'),
993
-            array('name'=>'assigments_done',     'index'=>'assigments_done',         'align'=>'center', 'sortable' => 'false'),
994
-            array('name'=>'assigments_left',     'index'=>'assigments_left',         'align'=>'center', 'sortable' => 'false'),
995
-            array('name'=>'assigments_progress', 'index'=>'assigments_progress',     'align'=>'center', 'sortable' => 'false'),
992
+            array('name'=>'assigments_total', 'index'=>'assigments_total', 'align'=>'center', 'sortable' => 'false'),
993
+            array('name'=>'assigments_done', 'index'=>'assigments_done', 'align'=>'center', 'sortable' => 'false'),
994
+            array('name'=>'assigments_left', 'index'=>'assigments_left', 'align'=>'center', 'sortable' => 'false'),
995
+            array('name'=>'assigments_progress', 'index'=>'assigments_progress', 'align'=>'center', 'sortable' => 'false'),
996 996
             //Assignments
997
-            array('name'=>'wiki_total',         'index'=>'wiki_total',       'align'=>'center', 'sortable' => 'false'),
998
-            array('name'=>'wiki_revisions',     'index'=>'wiki_revisions',   'align'=>'center', 'sortable' => 'false'),
999
-            array('name'=>'wiki_read',          'index'=>'wiki_read',        'align'=>'center', 'sortable' => 'false'),
1000
-            array('name'=>'wiki_unread',        'index'=>'wiki_unread',      'align'=>'center', 'sortable' => 'false'),
1001
-            array('name'=>'wiki_progress',      'index'=>'wiki_progress',    'align'=>'center', 'sortable' => 'false'),
997
+            array('name'=>'wiki_total', 'index'=>'wiki_total', 'align'=>'center', 'sortable' => 'false'),
998
+            array('name'=>'wiki_revisions', 'index'=>'wiki_revisions', 'align'=>'center', 'sortable' => 'false'),
999
+            array('name'=>'wiki_read', 'index'=>'wiki_read', 'align'=>'center', 'sortable' => 'false'),
1000
+            array('name'=>'wiki_unread', 'index'=>'wiki_unread', 'align'=>'center', 'sortable' => 'false'),
1001
+            array('name'=>'wiki_progress', 'index'=>'wiki_progress', 'align'=>'center', 'sortable' => 'false'),
1002 1002
             //Surveys
1003
-            array('name'=>'surveys_total',    'index'=>'surveys_total',      'align'=>'center', 'sortable' => 'false'),
1004
-            array('name'=>'surveys_done',     'index'=>'surveys_done',       'align'=>'center', 'sortable' => 'false'),
1005
-            array('name'=>'surveys_left',     'index'=>'surveys_left',       'align'=>'center', 'sortable' => 'false'),
1006
-            array('name'=>'surveys_progress', 'index'=>'surveys_progress',   'align'=>'center', 'sortable' => 'false'),
1003
+            array('name'=>'surveys_total', 'index'=>'surveys_total', 'align'=>'center', 'sortable' => 'false'),
1004
+            array('name'=>'surveys_done', 'index'=>'surveys_done', 'align'=>'center', 'sortable' => 'false'),
1005
+            array('name'=>'surveys_left', 'index'=>'surveys_left', 'align'=>'center', 'sortable' => 'false'),
1006
+            array('name'=>'surveys_progress', 'index'=>'surveys_progress', 'align'=>'center', 'sortable' => 'false'),
1007 1007
         );
1008 1008
 
1009 1009
         $action_links = '';
1010 1010
         // jqgrid will use this URL to do the selects
1011
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
1011
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
1012 1012
 
1013 1013
         //Table Id
1014 1014
         $tableId = 'progressOverview';
@@ -1068,11 +1068,11 @@  discard block
 block discarded – undo
1068 1068
             true
1069 1069
         );
1070 1070
 
1071
-        $return = '<script>$(function() {'. $table .
1071
+        $return = '<script>$(function() {'.$table.
1072 1072
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
1073 1073
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
1074 1074
                        caption:"",
1075
-                       title:"' . get_lang('ExportExcel') . '",
1075
+                       title:"' . get_lang('ExportExcel').'",
1076 1076
                        onClickButton : function () {
1077 1077
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
1078 1078
                        }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                 // adding the fields that are checked to the session
1133 1133
                 $message = '';
1134 1134
                 foreach ($values as $field_ids => $value) {
1135
-                    if ($value == 1 && strstr($field_ids,'extra_export_field')) {
1135
+                    if ($value == 1 && strstr($field_ids, 'extra_export_field')) {
1136 1136
                         $_SESSION['additional_export_fields'][] = str_replace('extra_export_field', '', $field_ids);
1137 1137
                     }
1138 1138
                 }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
                 // Displaying a feedback message
1148 1148
                 if (!empty($_SESSION['additional_export_fields'])) {
1149 1149
                     Display::display_confirmation_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>', false);
1150
-                } else  {
1150
+                } else {
1151 1151
                     Display::display_confirmation_message(get_lang('NoAdditionalFieldsWillBeExported'), false);
1152 1152
                 }
1153 1153
             } else {
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
     {
1176 1176
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1177 1177
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1178
-        $t_head .=      '<tr>';
1178
+        $t_head .= '<tr>';
1179 1179
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1180 1180
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
1181 1181
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgCourseScore'), 6, true).'</span></th>';
@@ -1192,13 +1192,13 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
         $addparams = array('view' => 'admin', 'display' => 'courseoverview');
1194 1194
 
1195
-        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace','get_course_data_tracking_overview'), 1);
1195
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace', 'get_course_data_tracking_overview'), 1);
1196 1196
         $table->additional_parameters = $addparams;
1197 1197
 
1198 1198
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
1199 1199
         $table->set_header(1, get_lang('Course'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
1200 1200
         $table->set_header(2, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
1201
-        $table->set_column_filter(2, array('MySpace','course_tracking_filter'));
1201
+        $table->set_column_filter(2, array('MySpace', 'course_tracking_filter'));
1202 1202
         $table->display();
1203 1203
     }
1204 1204
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
         $sql .= " ORDER BY col$column $direction ";
1235 1235
         $sql .= " LIMIT $from,$number_of_items";
1236 1236
         $result = Database::query($sql);
1237
-        $return = array ();
1237
+        $return = array();
1238 1238
         while ($course = Database::fetch_row($result)) {
1239 1239
             $return[] = $course;
1240 1240
         }
@@ -1287,18 +1287,18 @@  discard block
 block discarded – undo
1287 1287
             $progress += $progress_tmp[0];
1288 1288
             $nb_progress_lp += $progress_tmp[1];
1289 1289
             $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1290
-            if(is_array($score_tmp)) {
1290
+            if (is_array($score_tmp)) {
1291 1291
                 $score += $score_tmp[0];
1292 1292
                 $nb_score_lp += $score_tmp[1];
1293 1293
             }
1294 1294
             $nb_messages += Tracking::count_student_messages($row->user_id, $course_code);
1295 1295
             $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1296 1296
             $last_login_date_tmp = Tracking :: get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1297
-            if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1297
+            if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1298 1298
                 $last_login_date = $last_login_date_tmp;
1299
-            } else if($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1299
+            } else if ($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1300 1300
                 // Find the max and assign it to first_login_date
1301
-                if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1301
+                if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1302 1302
                     $last_login_date = $last_login_date_tmp;
1303 1303
                 }
1304 1304
             }
@@ -1308,27 +1308,27 @@  discard block
 block discarded – undo
1308 1308
             $total_score_possible += $exercise_results_tmp['score_possible'];
1309 1309
             $total_questions_answered += $exercise_results_tmp['questions_answered'];
1310 1310
         }
1311
-        if($nb_progress_lp > 0) {
1311
+        if ($nb_progress_lp > 0) {
1312 1312
             $avg_progress = round($progress / $nb_progress_lp, 2);
1313 1313
         } else {
1314 1314
             $avg_progress = 0;
1315 1315
         }
1316
-        if($nb_score_lp > 0) {
1316
+        if ($nb_score_lp > 0) {
1317 1317
             $avg_score = round($score / $nb_score_lp, 2);
1318 1318
         } else {
1319 1319
             $avg_score = '-';
1320 1320
         }
1321
-        if($last_login_date) {
1321
+        if ($last_login_date) {
1322 1322
             $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1323 1323
         } else {
1324 1324
             $last_login_date = '-';
1325 1325
         }
1326
-        if($total_score_possible > 0) {
1326
+        if ($total_score_possible > 0) {
1327 1327
             $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1328 1328
         } else {
1329 1329
             $total_score_percentage = 0;
1330 1330
         }
1331
-        if($total_score_percentage > 0) {
1331
+        if ($total_score_percentage > 0) {
1332 1332
             $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1333 1333
         } else {
1334 1334
             $total_score = '-';
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                 $progress += $progress_tmp[0];
1437 1437
                 $nb_progress_lp += $progress_tmp[1];
1438 1438
                 $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1439
-                if(is_array($score_tmp)) {
1439
+                if (is_array($score_tmp)) {
1440 1440
                     $score += $score_tmp[0];
1441 1441
                     $nb_score_lp += $score_tmp[1];
1442 1442
                 }
@@ -1444,11 +1444,11 @@  discard block
 block discarded – undo
1444 1444
                 $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1445 1445
 
1446 1446
                 $last_login_date_tmp = Tracking::get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1447
-                if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1447
+                if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1448 1448
                     $last_login_date = $last_login_date_tmp;
1449
-                } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1449
+                } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1450 1450
                     // Find the max and assign it to first_login_date
1451
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1451
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1452 1452
                         $last_login_date = $last_login_date_tmp;
1453 1453
                     }
1454 1454
                 }
@@ -1458,22 +1458,22 @@  discard block
 block discarded – undo
1458 1458
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1459 1459
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1460 1460
             }
1461
-            if($nb_progress_lp > 0) {
1461
+            if ($nb_progress_lp > 0) {
1462 1462
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1463 1463
             } else {
1464 1464
                 $avg_progress = 0;
1465 1465
             }
1466
-            if($nb_score_lp > 0) {
1466
+            if ($nb_score_lp > 0) {
1467 1467
                 $avg_score = round($score / $nb_score_lp, 2);
1468 1468
             } else {
1469 1469
                 $avg_score = '-';
1470 1470
             }
1471
-            if($last_login_date) {
1471
+            if ($last_login_date) {
1472 1472
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1473 1473
             } else {
1474 1474
                 $last_login_date = '-';
1475 1475
             }
1476
-            if($total_score_possible > 0) {
1476
+            if ($total_score_possible > 0) {
1477 1477
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1478 1478
             } else {
1479 1479
                 $total_score_percentage = 0;
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
     {
1510 1510
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1511 1511
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1512
-        $t_head .=      '<tr>';
1512
+        $t_head .= '<tr>';
1513 1513
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
1514 1514
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1515 1515
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
         $addparams = array('view' => 'admin', 'display' => 'sessionoverview');
1529 1529
 
1530
-        $table = new SortableTable('tracking_session_overview', array('MySpace','get_total_number_sessions'), array('MySpace','get_session_data_tracking_overview'), 1);
1530
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_sessions'), array('MySpace', 'get_session_data_tracking_overview'), 1);
1531 1531
         $table->additional_parameters = $addparams;
1532 1532
 
1533 1533
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
         $sql .= " ORDER BY col$column $direction ";
1567 1567
         $sql .= " LIMIT $from,$number_of_items";
1568 1568
         $result = Database::query($sql);
1569
-        $return = array ();
1569
+        $return = array();
1570 1570
         while ($session = Database::fetch_row($result)) {
1571 1571
             $return[] = $session;
1572 1572
         }
@@ -1655,10 +1655,10 @@  discard block
 block discarded – undo
1655 1655
                 if ($last_login_date_tmp != false && $last_login_date == false) {
1656 1656
                     // TODO: To be cleaned.
1657 1657
                     $last_login_date = $last_login_date_tmp;
1658
-                } else if($last_login_date_tmp != false && $last_login_date != false) {
1658
+                } else if ($last_login_date_tmp != false && $last_login_date != false) {
1659 1659
                     // TODO: Repeated previous condition! To be cleaned.
1660 1660
                     // Find the max and assign it to first_login_date
1661
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1661
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1662 1662
                         $last_login_date = $last_login_date_tmp;
1663 1663
                     }
1664 1664
                 }
@@ -1668,27 +1668,27 @@  discard block
 block discarded – undo
1668 1668
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1669 1669
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1670 1670
             }
1671
-            if($nb_progress_lp > 0) {
1671
+            if ($nb_progress_lp > 0) {
1672 1672
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1673 1673
             } else {
1674 1674
                 $avg_progress = 0;
1675 1675
             }
1676
-            if($nb_score_lp > 0) {
1676
+            if ($nb_score_lp > 0) {
1677 1677
                 $avg_score = round($score / $nb_score_lp, 2);
1678 1678
             } else {
1679 1679
                 $avg_score = '-';
1680 1680
             }
1681
-            if($last_login_date) {
1681
+            if ($last_login_date) {
1682 1682
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1683 1683
             } else {
1684 1684
                 $last_login_date = '-';
1685 1685
             }
1686
-            if($total_score_possible > 0) {
1686
+            if ($total_score_possible > 0) {
1687 1687
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1688 1688
             } else {
1689 1689
                 $total_score_percentage = 0;
1690 1690
             }
1691
-            if($total_score_percentage > 0) {
1691
+            if ($total_score_percentage > 0) {
1692 1692
                 $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1693 1693
             } else {
1694 1694
                 $total_score = '-';
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
                 $total_score_obtained = 0;
1800 1800
                 $total_score_possible = 0;
1801 1801
                 $total_questions_answered = 0;
1802
-                while($row_user = Database::fetch_object($result_users)) {
1802
+                while ($row_user = Database::fetch_object($result_users)) {
1803 1803
                     // get time spent in the course and session
1804 1804
                     $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id);
1805 1805
                     $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true);
@@ -1828,11 +1828,11 @@  discard block
 block discarded – undo
1828 1828
                         $session_id,
1829 1829
                         false
1830 1830
                     );
1831
-                    if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1831
+                    if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1832 1832
                         $last_login_date = $last_login_date_tmp;
1833
-                    } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1833
+                    } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1834 1834
                         // Find the max and assign it to first_login_date
1835
-                        if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1835
+                        if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1836 1836
                             $last_login_date = $last_login_date_tmp;
1837 1837
                         }
1838 1838
                     }
@@ -1842,27 +1842,27 @@  discard block
 block discarded – undo
1842 1842
                     $total_score_possible += $exercise_results_tmp['score_possible'];
1843 1843
                     $total_questions_answered += $exercise_results_tmp['questions_answered'];
1844 1844
                 }
1845
-                if($nb_progress_lp > 0) {
1845
+                if ($nb_progress_lp > 0) {
1846 1846
                     $avg_progress = round($progress / $nb_progress_lp, 2);
1847 1847
                 } else {
1848 1848
                     $avg_progress = 0;
1849 1849
                 }
1850
-                if($nb_score_lp > 0) {
1850
+                if ($nb_score_lp > 0) {
1851 1851
                     $avg_score = round($score / $nb_score_lp, 2);
1852 1852
                 } else {
1853 1853
                     $avg_score = '-';
1854 1854
                 }
1855
-                if($last_login_date) {
1855
+                if ($last_login_date) {
1856 1856
                     $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1857 1857
                 } else {
1858 1858
                     $last_login_date = '-';
1859 1859
                 }
1860
-                if($total_score_possible > 0) {
1860
+                if ($total_score_possible > 0) {
1861 1861
                     $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1862 1862
                 } else {
1863 1863
                     $total_score_percentage = 0;
1864 1864
                 }
1865
-                if($total_score_percentage > 0) {
1865
+                if ($total_score_percentage > 0) {
1866 1866
                     $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1867 1867
                 } else {
1868 1868
                     $total_score = '-';
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
             FROM '.Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES)."
1913 1913
             WHERE c_id = ' . $courseId . '
1914 1914
             AND exe_user_id = '".intval($user_id)."'";
1915
-        if($session_id !== false) {
1915
+        if ($session_id !== false) {
1916 1916
             $sql .= " AND session_id = '".$session_id."' ";
1917 1917
         }
1918 1918
         $result = Database::query($sql);
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
         while ($row = Database::fetch_array($result)) {
1923 1923
             $score_obtained += $row['exe_result'];
1924 1924
             $score_possible += $row['exe_weighting'];
1925
-            $questions_answered ++;
1925
+            $questions_answered++;
1926 1926
         }
1927 1927
 
1928 1928
         if ($score_possible != 0) {
@@ -2043,9 +2043,9 @@  discard block
 block discarded – undo
2043 2043
                     }
2044 2044
                 }
2045 2045
                 // time spent in the course
2046
-                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course ($user[4], $courseId));
2046
+                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $courseId));
2047 2047
                 // student progress in course
2048
-                $csv_row[] = round(Tracking::get_avg_student_progress ($user[4], $row[0]), 2);
2048
+                $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2);
2049 2049
                 // student score
2050 2050
                 $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2);
2051 2051
                 // student tes score
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
                 // student messages
2054 2054
                 $csv_row[] = Tracking::count_student_messages($user[4], $row[0]);
2055 2055
                 // student assignments
2056
-                $csv_row[] = Tracking::count_student_assignments ($user[4], $row[0]);
2056
+                $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]);
2057 2057
                 // student exercises results
2058 2058
                 $exercises_results = MySpace::exercises_results($user[4], $row[0]);
2059 2059
                 $csv_row[] = $exercises_results['score_obtained'];
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
                 $csv_row[] = $exercises_results['questions_answered'];
2062 2062
                 $csv_row[] = $exercises_results['percentage'];
2063 2063
                 // first connection
2064
-                $csv_row[] = Tracking::get_first_connection_date_on_the_course ($user[4], $courseId);
2064
+                $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $courseId);
2065 2065
                 // last connection
2066 2066
                 $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $courseInfo));
2067 2067
 
@@ -2095,9 +2095,9 @@  discard block
 block discarded – undo
2095 2095
         // get all courses with limit
2096 2096
         $sql = "SELECT course.code as col1, course.title as col2
2097 2097
                 FROM $tbl_course course
2098
-                WHERE course.code IN (".implode(',',$courses_code).")";
2098
+                WHERE course.code IN (".implode(',', $courses_code).")";
2099 2099
 
2100
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2100
+        if (!in_array($direction, array('ASC', 'DESC'))) $direction = 'ASC';
2101 2101
 
2102 2102
         $column = intval($column);
2103 2103
         $from = intval($from);
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
             $table_row[] = $avg_assignments_in_course;
2167 2167
 
2168 2168
             //set the "from" value to know if I access the Reporting by the chamilo tab or the course link
2169
-            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq=' .$course_code.'&from=myspace&id_session='.$session_id.'">
2169
+            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'">
2170 2170
                              <img src="'.api_get_path(WEB_IMG_PATH).'icons/22/2rightarrow.png" border="0" /></a>
2171 2171
                             </center>';
2172 2172
             $csv_content[] = array(
@@ -2174,7 +2174,7 @@  discard block
 block discarded – undo
2174 2174
                 $nb_students_in_course,
2175 2175
                 $avg_time_spent_in_course,
2176 2176
                 is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%',
2177
-                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course ,
2177
+                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course,
2178 2178
                 is_null($avg_score_in_exercise) ? null : $avg_score_in_exercise.'%',
2179 2179
                 $avg_messages_in_course,
2180 2180
                 $avg_assignments_in_course,
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
         $sql .= " ORDER BY col$column $direction ";
2243 2243
         $sql .= " LIMIT $from,$number_of_items";
2244 2244
         $result = Database::query($sql);
2245
-        $return = array ();
2245
+        $return = array();
2246 2246
         while ($user = Database::fetch_row($result)) {
2247 2247
             $return[] = $user;
2248 2248
         }
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
                     $i++;
2298 2298
                 }
2299 2299
             }
2300
-            $username_array = array('username' => $desired_username , 'sufix' => $sufix);
2300
+            $username_array = array('username' => $desired_username, 'sufix' => $sufix);
2301 2301
             return $username_array;
2302 2302
         } else {
2303 2303
             $username_array = array('username' => $username, 'sufix' => '');
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
         foreach ($users as $index => $user) {
2572 2572
             $userid = $user['id'];
2573 2573
             $sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at)
2574
-                           VALUES ('$id_session','$userid', '" . api_get_utc_datetime() . "')";
2574
+                           VALUES ('$id_session','$userid', '".api_get_utc_datetime()."')";
2575 2575
             Database::query($sql_insert);
2576 2576
             $user['added_at_session'] = 1;
2577 2577
             $new_users[] = $user;
@@ -2605,10 +2605,10 @@  discard block
 block discarded – undo
2605 2605
                 );
2606 2606
                 $userInfo = api_get_user_info($user['id']);
2607 2607
 
2608
-                if (($user['added_at_platform'] == 1  && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2608
+                if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2609 2609
                     if ($user['added_at_platform'] == 1) {
2610 2610
                         $addedto = get_lang('UserCreatedPlatform');
2611
-                    } else  {
2611
+                    } else {
2612 2612
                         $addedto = '          ';
2613 2613
                     }
2614 2614
 
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
         global $current_tag;
2672 2672
         switch ($data) {
2673 2673
             case 'Contact' :
2674
-                $user = array ();
2674
+                $user = array();
2675 2675
                 break;
2676 2676
             default :
2677 2677
                 $current_tag = $data;
@@ -2718,9 +2718,9 @@  discard block
 block discarded – undo
2718 2718
         global $current_value;
2719 2719
         global $user;
2720 2720
         global $users;
2721
-        $users = array ();
2721
+        $users = array();
2722 2722
         $parser = xml_parser_create('UTF-8');
2723
-        xml_set_element_handler($parser, array('MySpace','element_start'), array('MySpace','element_end'));
2723
+        xml_set_element_handler($parser, array('MySpace', 'element_start'), array('MySpace', 'element_end'));
2724 2724
         xml_set_character_data_handler($parser, "character_data");
2725 2725
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
2726 2726
         xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
             get_lang('SearchCourse'),
2767 2767
             $courseList,
2768 2768
             [
2769
-                'url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query([
2769
+                'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?'.http_build_query([
2770 2770
                     'a' => 'search_course_by_session_all',
2771 2771
                     'session_id' => $sessionId
2772 2772
                 ])
@@ -2785,7 +2785,7 @@  discard block
 block discarded – undo
2785 2785
                             course_id: $('#course_id').val() || 0
2786 2786
                         });
2787 2787
 
2788
-                        return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params;
2788
+                        return '" . api_get_path(WEB_AJAX_PATH)."session.ajax.php?' + params;
2789 2789
                     }
2790 2790
                 "
2791 2791
             ]
@@ -2816,7 +2816,7 @@  discard block
 block discarded – undo
2816 2816
                             course_id: $('#course_id').val()
2817 2817
                         });
2818 2818
 
2819
-                        return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params;
2819
+                        return '" . api_get_path(WEB_AJAX_PATH)."course.ajax.php?' + params;
2820 2820
                     }
2821 2821
                 "
2822 2822
             ]
@@ -2842,8 +2842,8 @@  discard block
 block discarded – undo
2842 2842
         if ($form->validate()) {
2843 2843
             $table = new SortableTable(
2844 2844
                 'tracking_access_overview',
2845
-                ['MySpace','getNumberOfRrackingAccessOverview'],
2846
-                ['MySpace','getUserDataAccessTrackingOverview'],
2845
+                ['MySpace', 'getNumberOfRrackingAccessOverview'],
2846
+                ['MySpace', 'getUserDataAccessTrackingOverview'],
2847 2847
                 0
2848 2848
             );
2849 2849
             $table->additional_parameters = $form->exportValues();
@@ -2904,7 +2904,7 @@  discard block
 block discarded – undo
2904 2904
                     " : "
2905 2905
                         u.lastname AS col2,
2906 2906
                         u.firstname AS col3,
2907
-                " ) . "
2907
+                " )."
2908 2908
                 a.logout_course_date,
2909 2909
                 c.title, 
2910 2910
                 c.code, 
@@ -2915,7 +2915,7 @@  discard block
 block discarded – undo
2915 2915
 
2916 2916
         if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
2917 2917
             $sessionId = intval($_GET['session_id']);
2918
-            $sql .= " WHERE a.session_id = " . $sessionId;
2918
+            $sql .= " WHERE a.session_id = ".$sessionId;
2919 2919
         }
2920 2920
 
2921 2921
         $sql .= " ORDER BY col$column $orderDirection ";
@@ -2976,14 +2976,14 @@  discard block
 block discarded – undo
2976 2976
 function get_stats($user_id, $courseId, $start_date = null, $end_date = null)
2977 2977
 {
2978 2978
     // Database table definitions
2979
-    $tbl_track_course   = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2979
+    $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2980 2980
 
2981 2981
     $course_info = api_get_course_info_by_id($courseId);
2982 2982
     if (!empty($course_info)) {
2983 2983
         $strg_sd    = "";
2984 2984
         $strg_ed    = "";
2985
-        if ($start_date != null && $end_date != null){
2986
-            $end_date = add_day_to( $end_date );
2985
+        if ($start_date != null && $end_date != null) {
2986
+            $end_date = add_day_to($end_date);
2987 2987
             $strg_sd = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
2988 2988
             $strg_ed = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
2989 2989
         }
@@ -2991,10 +2991,10 @@  discard block
 block discarded – undo
2991 2991
                 SEC_TO_TIME(avg(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg,
2992 2992
                 SEC_TO_TIME(sum(time_to_sec(timediff(logout_course_date,login_course_date)))) as total,
2993 2993
                 count(user_id) as times
2994
-                FROM ' . $tbl_track_course . '
2994
+                FROM ' . $tbl_track_course.'
2995 2995
                 WHERE
2996
-                    user_id = ' . intval($user_id) . ' AND
2997
-                    c_id = ' . intval($courseId) . ' '.$strg_sd.' '.$strg_ed.' '.'
2996
+                    user_id = ' . intval($user_id).' AND
2997
+                    c_id = ' . intval($courseId).' '.$strg_sd.' '.$strg_ed.' '.'
2998 2998
                 ORDER BY login_course_date ASC';
2999 2999
 
3000 3000
         $rs = Database::query($sql);
@@ -3012,7 +3012,7 @@  discard block
 block discarded – undo
3012 3012
 }
3013 3013
 
3014 3014
 function add_day_to($end_date) {
3015
-    $foo_date = strtotime( $end_date );
3015
+    $foo_date = strtotime($end_date);
3016 3016
     $foo_date = strtotime(" +1 day", $foo_date);
3017 3017
     $foo_date = date("Y-m-d", $foo_date);
3018 3018
     return $foo_date;
@@ -3072,7 +3072,7 @@  discard block
 block discarded – undo
3072 3072
  * @version OCT-22- 2010
3073 3073
  * @return array
3074 3074
  */
3075
-function convert_to_array($sql_result){
3075
+function convert_to_array($sql_result) {
3076 3076
     $result_to_print = '<table>';
3077 3077
     foreach ($sql_result as $key => $data) {
3078 3078
         $result_to_print .= '<tr><td>'.date('d-m-Y (H:i:s)', $data['login']).'</td><td>'.api_time_to_hms($data['logout'] - $data['login']).'</tr></td>'."\n";
@@ -3091,7 +3091,7 @@  discard block
 block discarded – undo
3091 3091
  * @version OCT-22- 2010
3092 3092
  * @return string
3093 3093
  */
3094
-function convert_to_string($sql_result){
3094
+function convert_to_string($sql_result) {
3095 3095
     $result_to_print = '<table>';
3096 3096
     if (!empty($sql_result)) {
3097 3097
         foreach ($sql_result as $key => $data) {
@@ -3116,18 +3116,18 @@  discard block
 block discarded – undo
3116 3116
  */
3117 3117
 function grapher($sql_result, $start_date, $end_date, $type = "")
3118 3118
 {
3119
-    if (empty($start_date)) { $start_date =""; }
3120
-    if (empty($end_date)) { $end_date =""; }
3121
-    if ($type == ""){ $type = 'day'; }
3122
-    $main_year  = $main_month_year = $main_day = array();
3119
+    if (empty($start_date)) { $start_date = ""; }
3120
+    if (empty($end_date)) { $end_date = ""; }
3121
+    if ($type == "") { $type = 'day'; }
3122
+    $main_year = $main_month_year = $main_day = array();
3123 3123
     // get last 8 days/months
3124 3124
     $last_days      = 5;
3125 3125
     $last_months    = 3;
3126 3126
     for ($i = $last_days; $i >= 0; $i--) {
3127
-        $main_day[date ('d-m-Y', mktime () - $i * 3600 * 24)] = 0;
3127
+        $main_day[date('d-m-Y', mktime() - $i * 3600 * 24)] = 0;
3128 3128
     }
3129 3129
     for ($i = $last_months; $i >= 0; $i--) {
3130
-        $main_month_year[date ('m-Y', mktime () - $i * 30 * 3600 * 24)] = 0;
3130
+        $main_month_year[date('m-Y', mktime() - $i * 30 * 3600 * 24)] = 0;
3131 3131
     }
3132 3132
 
3133 3133
     $i = 0;
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
         /* Create and populate the pData object */
3164 3164
         $myData = new pData();
3165 3165
         $myData->addPoints($main_date, 'Serie1');
3166
-        if (count($main_date)!= 1) {
3166
+        if (count($main_date) != 1) {
3167 3167
             $myData->addPoints($labels, 'Labels');
3168 3168
             $myData->setSerieDescription('Labels', 'Months');
3169 3169
             $myData->setAbscissa('Labels');
@@ -3171,7 +3171,7 @@  discard block
 block discarded – undo
3171 3171
         $myData->setSerieWeight('Serie1', 1);
3172 3172
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
3173 3173
         $myData->setAxisName(0, get_lang('Minutes'));
3174
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
3174
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
3175 3175
 
3176 3176
         // Cache definition
3177 3177
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -3180,9 +3180,9 @@  discard block
 block discarded – undo
3180 3180
 
3181 3181
         if ($myCache->isInCache($chartHash)) {
3182 3182
             //if we already created the img
3183
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3183
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3184 3184
             $myCache->saveFromCache($chartHash, $imgPath);
3185
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3185
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3186 3186
         } else {
3187 3187
             /* Define width, height and angle */
3188 3188
             $mainWidth = 760;
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
             /* Set the default font */
3212 3212
             $myPicture->setFontProperties(
3213 3213
                 array(
3214
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3214
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3215 3215
                     "FontSize" => 10)
3216 3216
             );
3217 3217
             /* Write the chart title */
@@ -3228,7 +3228,7 @@  discard block
 block discarded – undo
3228 3228
             /* Set the default font */
3229 3229
             $myPicture->setFontProperties(
3230 3230
                 array(
3231
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3231
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3232 3232
                     "FontSize" => 8
3233 3233
                 )
3234 3234
             );
@@ -3270,7 +3270,7 @@  discard block
 block discarded – undo
3270 3270
             /* Draw the line chart */
3271 3271
             $myPicture->setFontProperties(
3272 3272
                 array(
3273
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3273
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3274 3274
                     "FontSize" => 10
3275 3275
                 )
3276 3276
             );
@@ -3289,15 +3289,15 @@  discard block
 block discarded – undo
3289 3289
 
3290 3290
             /* Write and save into cache */
3291 3291
             $myCache->writeToCache($chartHash, $myPicture);
3292
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3292
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3293 3293
             $myCache->saveFromCache($chartHash, $imgPath);
3294
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3294
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3295 3295
         }
3296
-        $html = '<img src="' . $imgPath . '">';
3296
+        $html = '<img src="'.$imgPath.'">';
3297 3297
 
3298 3298
         return $html;
3299 3299
     } else {
3300
-        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>','UTF-8');
3300
+        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>', 'UTF-8');
3301 3301
 
3302 3302
         return $foo_img;
3303 3303
     }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/dompdf_config.inc.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 /**
62 62
  * The location of the DOMPDF include directory
63 63
  */
64
-define("DOMPDF_INC_DIR", DOMPDF_DIR . "/include");
64
+define("DOMPDF_INC_DIR", DOMPDF_DIR."/include");
65 65
 
66 66
 /**
67 67
  * The location of the DOMPDF lib directory
68 68
  */
69
-define("DOMPDF_LIB_DIR", DOMPDF_DIR . "/lib");
69
+define("DOMPDF_LIB_DIR", DOMPDF_DIR."/lib");
70 70
 
71 71
 //FIXME: Some function definitions rely on the constants defined by DOMPDF. However, might this location prove problematic?
72
-require_once(DOMPDF_INC_DIR . "/functions.inc.php");
72
+require_once(DOMPDF_INC_DIR."/functions.inc.php");
73 73
 
74 74
 /**
75 75
  * The location of the DOMPDF font directory
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  *
100 100
  * *Please note the trailing slash.*
101 101
  */
102
-define("DOMPDF_FONT_DIR", DOMPDF_DIR . "/lib/fonts/");
102
+define("DOMPDF_FONT_DIR", DOMPDF_DIR."/lib/fonts/");
103 103
 
104 104
 /**
105 105
  * The location of the DOMPDF font cache directory
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
  * @link http://ttf2pt1.sourceforge.net/
173 173
  */
174 174
 if (!defined("TTF2AFM")) {
175
-  define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1");
175
+  define("TTF2AFM", DOMPDF_LIB_DIR."/ttf2ufm/ttf2ufm-src/ttf2pt1");
176 176
   //define("TTF2AFM", "/usr/bin/ttf2pt1");
177 177
 }
178 178
 
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
  * @param string $class
345 345
  */
346 346
 function DOMPDF_autoload($class) {
347
-  $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
347
+  $filename = DOMPDF_INC_DIR."/".mb_strtolower($class).".cls.php";
348 348
   
349
-  if ( is_file($filename) )
349
+  if (is_file($filename))
350 350
     require_once($filename);
351 351
 }
352 352
 
353
-if ( function_exists("spl_autoload_register") ) {
353
+if (function_exists("spl_autoload_register")) {
354 354
 
355 355
    spl_autoload_register("DOMPDF_autoload");
356 356
 
357
-} else if ( !function_exists("__autoload") ) {
357
+} else if (!function_exists("__autoload")) {
358 358
   /**
359 359
    * Default __autoload() function
360 360
    *
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
  * the browser cache and the premature output prevents setting of the mime type.
417 417
  */
418 418
 if (!defined('DEBUGPNG')) {
419
-  define('DEBUGPNG',0);
419
+  define('DEBUGPNG', 0);
420 420
 }
421 421
 if (!defined('DEBUGKEEPTEMP')) {
422
-  define('DEBUGKEEPTEMP',0);
422
+  define('DEBUGKEEPTEMP', 0);
423 423
 }
424 424
 if (!defined('DEBUGCSS')) {
425
-  define('DEBUGCSS',0);
425
+  define('DEBUGCSS', 0);
426 426
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/dompdf.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     " -h\t\tShow this message\n".
79 79
     " -l\t\tlist available paper sizes\n".
80 80
     " -p size\tpaper size; something like 'letter', 'A4', 'legal', etc.  The default is\n".
81
-    "   \t\t'" . DOMPDF_DEFAULT_PAPER_SIZE . "'\n".
81
+    "   \t\t'".DOMPDF_DEFAULT_PAPER_SIZE."'\n".
82 82
     " -o orientation\teither 'portrait' or 'landscape'.  Default is 'portrait'.\n".
83 83
     " -b path\tset the 'document root' of the html_file.  Relative urls (for \n".
84 84
     "        \tstylesheets) are resolved using this directory.  Default is the \n".
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
   $opts = array();
98 98
 
99
-  if ( $_SERVER["argc"] == 1 )
99
+  if ($_SERVER["argc"] == 1)
100 100
     return $opts;
101 101
 
102 102
   $i = 1;
@@ -116,30 +116,30 @@  discard block
 block discarded – undo
116 116
       break;
117 117
 
118 118
     case "-p":
119
-      if ( !isset($_SERVER["argv"][$i+1]) )
119
+      if (!isset($_SERVER["argv"][$i + 1]))
120 120
         die("-p switch requires a size parameter\n");
121
-      $opts["p"] = $_SERVER["argv"][$i+1];
121
+      $opts["p"] = $_SERVER["argv"][$i + 1];
122 122
       $i += 2;
123 123
       break;
124 124
 
125 125
     case "-o":
126
-      if ( !isset($_SERVER["argv"][$i+1]) )
126
+      if (!isset($_SERVER["argv"][$i + 1]))
127 127
         die("-o switch requires an orientation parameter\n");
128
-      $opts["o"] = $_SERVER["argv"][$i+1];
128
+      $opts["o"] = $_SERVER["argv"][$i + 1];
129 129
       $i += 2;
130 130
       break;
131 131
 
132 132
     case "-b":
133
-      if ( !isset($_SERVER["argv"][$i+1]) )
133
+      if (!isset($_SERVER["argv"][$i + 1]))
134 134
         die("-b switch requires a path parameter\n");
135
-      $opts["b"] = $_SERVER["argv"][$i+1];
135
+      $opts["b"] = $_SERVER["argv"][$i + 1];
136 136
       $i += 2;
137 137
       break;
138 138
 
139 139
     case "-f":
140
-      if ( !isset($_SERVER["argv"][$i+1]) )
140
+      if (!isset($_SERVER["argv"][$i + 1]))
141 141
         die("-f switch requires a filename parameter\n");
142
-      $opts["f"] = $_SERVER["argv"][$i+1];
142
+      $opts["f"] = $_SERVER["argv"][$i + 1];
143 143
       $i += 2;
144 144
       break;
145 145
 
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
       break;
155 155
 
156 156
     case "-t":
157
-      if ( !isset($_SERVER['argv'][$i + 1]) )
157
+      if (!isset($_SERVER['argv'][$i + 1]))
158 158
         die("-t switch requires a comma separated list of types\n");
159
-      $opts["t"] = $_SERVER['argv'][$i+1];
159
+      $opts["t"] = $_SERVER['argv'][$i + 1];
160 160
       $i += 2;
161 161
       break;
162 162
 
@@ -177,61 +177,61 @@  discard block
 block discarded – undo
177 177
 
178 178
 $sapi = php_sapi_name();
179 179
 
180
-switch ( $sapi ) {
180
+switch ($sapi) {
181 181
 
182 182
  case "cli":
183 183
 
184 184
   $opts = getoptions();
185 185
 
186
-  if ( isset($opts["h"]) || (!isset($opts["filename"]) && !isset($opts["l"])) ) {
186
+  if (isset($opts["h"]) || (!isset($opts["filename"]) && !isset($opts["l"]))) {
187 187
     dompdf_usage();
188 188
     exit;
189 189
   }
190 190
 
191
-  if ( isset($opts["l"]) ) {
191
+  if (isset($opts["l"])) {
192 192
     echo "\nUnderstood paper sizes:\n";
193 193
 
194 194
     foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size)
195
-      echo "  " . mb_strtoupper($size) . "\n";
195
+      echo "  ".mb_strtoupper($size)."\n";
196 196
     exit;
197 197
   }
198 198
   $file = $opts["filename"];
199 199
 
200
-  if ( isset($opts["p"]) )
200
+  if (isset($opts["p"]))
201 201
     $paper = $opts["p"];
202 202
   else
203 203
     $paper = DOMPDF_DEFAULT_PAPER_SIZE;
204 204
 
205
-  if ( isset($opts["o"]) )
205
+  if (isset($opts["o"]))
206 206
     $orientation = $opts["o"];
207 207
   else
208 208
     $orientation = "portrait";
209 209
 
210
-  if ( isset($opts["b"]) )
210
+  if (isset($opts["b"]))
211 211
     $base_path = $opts["b"];
212 212
 
213
-  if ( isset($opts["f"]) )
213
+  if (isset($opts["f"]))
214 214
     $outfile = $opts["f"];
215 215
   else {
216
-    if ( $file === "-" )
216
+    if ($file === "-")
217 217
       $outfile = "dompdf_out.pdf";
218 218
     else
219
-      $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf";
219
+      $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file).".pdf";
220 220
   }
221 221
 
222
-  if ( isset($opts["v"]) )
222
+  if (isset($opts["v"]))
223 223
     $_dompdf_show_warnings = true;
224 224
 
225
-  if ( isset($opts["d"]) ) {
225
+  if (isset($opts["d"])) {
226 226
     $_dompdf_show_warnings = true;
227 227
     $_dompdf_debug = true;
228 228
   }
229 229
 
230
-  if ( isset($opts['t']) ) {
231
-    $arr = split(',',$opts['t']);
230
+  if (isset($opts['t'])) {
231
+    $arr = split(',', $opts['t']);
232 232
     $types = array();
233 233
     foreach ($arr as $type)
234
-      $types[ trim($type) ] = 1;
234
+      $types[trim($type)] = 1;
235 235
     $_DOMPDF_DEBUG_TYPES = $types;
236 236
   }
237 237
   
@@ -241,31 +241,31 @@  discard block
 block discarded – undo
241 241
 
242 242
  default:
243 243
 
244
- 	if ( isset($_GET["input_file"]) )
244
+ 	if (isset($_GET["input_file"]))
245 245
  		$file = basename(rawurldecode($_GET["input_file"]));
246 246
  	else
247 247
  		throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable).");
248 248
  		
249
- 	if ( isset($_GET["paper"]) )
249
+ 	if (isset($_GET["paper"]))
250 250
  		$paper = rawurldecode($_GET["paper"]);
251 251
  	else
252 252
  		$paper = DOMPDF_DEFAULT_PAPER_SIZE;
253 253
  		
254
- 	if ( isset($_GET["orientation"]) )
254
+ 	if (isset($_GET["orientation"]))
255 255
  		$orientation = rawurldecode($_GET["orientation"]);
256 256
  	else
257 257
  		$orientation = "portrait";
258 258
  		
259
- 	if ( isset($_GET["base_path"]) )
259
+ 	if (isset($_GET["base_path"]))
260 260
  		$base_path = rawurldecode($_GET["base_path"]);
261 261
  		
262 262
  		
263 263
  		$outfile = "dompdf_out.pdf"; # Don't allow them to set the output file
264 264
  		$save_file = false; # Don't save the file
265
- 		$file = $base_path . $file; # Set the input file
265
+ 		$file = $base_path.$file; # Set the input file
266 266
 
267 267
  		/* Check to see if the input file and base path = www/test */
268
- 		if($base_path !== "www/test/")
268
+ 		if ($base_path !== "www/test/")
269 269
  			throw new DOMPDF_Exception("Access to dompdf.php via non-cli SAPI has been deprecated due to security concerns.  Please use the dompdf class directly.");
270 270
 
271 271
    break;
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 
274 274
 $dompdf = new DOMPDF();
275 275
 
276
-if ( $file === "-" ) {
276
+if ($file === "-") {
277 277
   $str = "";
278
-  while ( !feof(STDIN) )
278
+  while (!feof(STDIN))
279 279
     $str .= fread(STDIN, 4096);
280 280
 
281 281
   $dompdf->load_html($str);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 } else
284 284
   $dompdf->load_html_file($file);
285 285
 
286
-if ( isset($base_path) ) {
286
+if (isset($base_path)) {
287 287
   $dompdf->set_base_path($base_path);
288 288
 }
289 289
 
@@ -291,33 +291,33 @@  discard block
 block discarded – undo
291 291
 
292 292
 $dompdf->render();
293 293
 
294
-if ( $_dompdf_show_warnings ) {
294
+if ($_dompdf_show_warnings) {
295 295
   global $_dompdf_warnings;
296 296
   foreach ($_dompdf_warnings as $msg)
297
-    echo $msg . "\n";
297
+    echo $msg."\n";
298 298
   echo $dompdf->get_canvas()->get_cpdf()->messages;
299 299
   flush();
300 300
 }
301 301
 
302
-if ( $save_file ) {
302
+if ($save_file) {
303 303
 //   if ( !is_writable($outfile) )
304 304
 //     throw new DOMPDF_Exception("'$outfile' is not writable.");
305
-  if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" )
305
+  if (strtolower(DOMPDF_PDF_BACKEND) === "gd")
306 306
     $outfile = str_replace(".pdf", ".png", $outfile);
307 307
 
308 308
   list($proto, $host, $path, $file) = explode_url($outfile);
309
-  if ( $proto != "" ) // i.e. not file://
309
+  if ($proto != "") // i.e. not file://
310 310
     $outfile = $file; // just save it locally, FIXME? could save it like wget: ./host/basepath/file
311 311
 
312
-  $outfile = realpath(dirname($outfile)) . DIRECTORY_SEPARATOR . basename($outfile);
312
+  $outfile = realpath(dirname($outfile)).DIRECTORY_SEPARATOR.basename($outfile);
313 313
 
314
-  if ( strpos($outfile, DOMPDF_CHROOT) !== 0 )
314
+  if (strpos($outfile, DOMPDF_CHROOT) !== 0)
315 315
     throw new DOMPDF_Exception("Permission denied.");
316 316
 
317
-  file_put_contents($outfile, $dompdf->output( array("compress" => 0) ));
317
+  file_put_contents($outfile, $dompdf->output(array("compress" => 0)));
318 318
   exit(0);
319 319
 }
320 320
 
321
-if ( !headers_sent() ) {
321
+if (!headers_sent()) {
322 322
   $dompdf->stream($outfile);
323 323
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/www/examples.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 exit;
3 3
 require_once("../dompdf_config.inc.php");
4
-if ( isset( $_POST["html"] ) ) {
4
+if (isset($_POST["html"])) {
5 5
 
6
-  if ( get_magic_quotes_gpc() )
6
+  if (get_magic_quotes_gpc())
7 7
     $_POST["html"] = stripslashes($_POST["html"]);
8 8
   
9 9
   $dompdf = new DOMPDF();
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 //echo '<li>['.$_SERVER["PHP_SELF"].']</li>';
42 42
 $dompdf = dirname(dirname($_SERVER["PHP_SELF"]));
43 43
 //echo '<li>['.$dompdf.']</li>';
44
-if ( $dompdf == '/' || $dompdf == '\\') {
44
+if ($dompdf == '/' || $dompdf == '\\') {
45 45
   $dompdf = '';
46 46
 }
47 47
 //echo '<li>['.$dompdf.']</li>';
48
-$dompdf .= "/dompdf.php?base_path=" . rawurlencode("www/test/");
48
+$dompdf .= "/dompdf.php?base_path=".rawurlencode("www/test/");
49 49
 //echo '<li>['.$dompdf.']</li>';
50
-foreach ( $test_files as $file ) {
50
+foreach ($test_files as $file) {
51 51
   $file = basename($file);
52
-  $arrow = "images/arrow_0" . rand(1, 6) . ".gif";  
52
+  $arrow = "images/arrow_0".rand(1, 6).".gif";  
53 53
   echo "<li style=\"list-style-image: url('$arrow');\">\n";
54 54
   echo $file;
55
-  echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("$file") .  "\">PDF</a>]\n";
55
+  echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=".rawurlencode("$file")."\">PDF</a>]\n";
56 56
   echo "</li>\n";
57 57
 }
58 58
 ?>
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 <p>Enter your html snippet in the text box below to see it rendered as a
64 64
 PDF: (Note by default, remote stylesheets, images &amp; are disabled.)</p>
65 65
 
66
-<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
66
+<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
67 67
 <div>
68 68
 <p>Paper size and orientaion:
69 69
 <select name="paper">
70 70
 <?php
71
-foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size )
72
-  echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n";
71
+foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size)
72
+  echo "<option ".($size == "letter" ? "selected " : "")."value=\"$size\">$size</option>\n";
73 73
 ?>
74 74
 </select>
75 75
 <select name="orientation">
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/www/head.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 function li_arrow() {
3
-  return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">';  
3
+  return '<li style="list-style-image: url(\'images/arrow_0'.rand(1, 6).'.gif\');">';  
4 4
 }
5 5
 function li_star() {
6
-  return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">';  
6
+  return '<li style="list-style-image: url(\'images/star_0'.rand(1, 5).'.gif\');">';  
7 7
 }
8 8
 ?>
9
-<?php echo '<?' . 'xml version="1.0" encoding="iso-8859-1"?' . '>'; ?>
9
+<?php echo '<?'.'xml version="1.0" encoding="iso-8859-1"?'.'>'; ?>
10 10
 <!DOCTYPE html
11 11
   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
12 12
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 <head>
15 15
 <title>dompdf - The PHP 5 HTML to PDF Converter</title>
16 16
 <link rel="stylesheet" href="style.css" type="text/css"/>
17
-<link rel="SHORTCUT ICON" href="http://<?php echo $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]);?>/images/favicon.ico"/>
17
+<link rel="SHORTCUT ICON" href="http://<?php echo $_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"]); ?>/images/favicon.ico"/>
18 18
 </head>
19 19
 
20 20
 <body>
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/inline_positioner.cls.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 
65 65
     // End debugging
66 66
 
67
-    if ( !$p )
67
+    if (!$p)
68 68
       throw new DOMPDF_Exception("No block-level parent found.  Not good.");
69 69
 
70 70
     $line = $p->get_current_line();
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/image_cache.cls.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     $parsed_url = explode_url($url);
86 86
 
87
-    $DEBUGPNG=DEBUGPNG; //=DEBUGPNG; Allow override of global setting for ad hoc debug
87
+    $DEBUGPNG = DEBUGPNG; //=DEBUGPNG; Allow override of global setting for ad hoc debug
88 88
     $full_url_dbg = '';
89 89
     
90 90
     //debugpng
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
     $remote = ($proto != "" && $proto !== "file://");
94 94
     $remote = $remote || ($parsed_url['protocol'] != "");
95 95
 
96
-    if ( !DOMPDF_ENABLE_REMOTE && $remote ) {
97
-      $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
96
+    if (!DOMPDF_ENABLE_REMOTE && $remote) {
97
+      $resolved_url = DOMPDF_LIB_DIR."/res/broken_image.png";
98 98
       $ext = "png";
99 99
 
100 100
       //debugpng
101 101
       if ($DEBUGPNG) $full_url_dbg = '(blockedremote)';
102 102
 
103
-    } else if ( DOMPDF_ENABLE_REMOTE && $remote ) {
103
+    } else if (DOMPDF_ENABLE_REMOTE && $remote) {
104 104
       // Download remote files to a temporary directory
105 105
       $full_url = build_url($proto, $host, $base_path, $url);
106 106
 
107
-      if ( isset(self::$_cache[$full_url]) ) {
108
-        list($resolved_url,$ext) = self::$_cache[$full_url];
107
+      if (isset(self::$_cache[$full_url])) {
108
+        list($resolved_url, $ext) = self::$_cache[$full_url];
109 109
 
110 110
         //debugpng
111 111
         if ($DEBUGPNG) $full_url_dbg = $full_url.'(cache)';
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 
115 115
         $resolved_url = tempnam(DOMPDF_TEMP_DIR, "ca_dompdf_img_");
116 116
         //debugpng
117
-        if ($DEBUGPNG) echo $resolved_url . "\n";
117
+        if ($DEBUGPNG) echo $resolved_url."\n";
118 118
 
119 119
         $old_err = set_error_handler("record_warnings");
120 120
         $image = file_get_contents($full_url);
121 121
         restore_error_handler();
122 122
 
123
-        if ( strlen($image) == 0 ) {
123
+        if (strlen($image) == 0) {
124 124
           //target image not found
125
-          $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
125
+          $resolved_url = DOMPDF_LIB_DIR."/res/broken_image.png";
126 126
           $ext = "png";
127 127
 
128 128
           //debugpng
@@ -140,24 +140,24 @@  discard block
 block discarded – undo
140 140
         //Therefore get image type from the content
141 141
 
142 142
         $imagedim = getimagesize($resolved_url);
143
-        if( $imagedim[2] >= 1 && $imagedim[2] <=3 && $imagedim[0] && $imagedim[1] ) {
143
+        if ($imagedim[2] >= 1 && $imagedim[2] <= 3 && $imagedim[0] && $imagedim[1]) {
144 144
         //target image is valid
145 145
 
146
-        $imagetypes = array('','gif','jpeg','png','swf');
146
+        $imagetypes = array('', 'gif', 'jpeg', 'png', 'swf');
147 147
         $ext = $imagetypes[$imagedim[2]];
148
-        if ( rename($resolved_url,$resolved_url.'.'.$ext) ) {
148
+        if (rename($resolved_url, $resolved_url.'.'.$ext)) {
149 149
           $resolved_url .= '.'.$ext;
150 150
         }
151 151
  
152 152
  		//Don't put replacement image into cache - otherwise it will be deleted on cache cleanup.
153 153
  		//Only execute on successfull caching of remote image.
154
-        self::$_cache[$full_url] = array($resolved_url,$ext);
154
+        self::$_cache[$full_url] = array($resolved_url, $ext);
155 155
 
156 156
         } else {
157 157
           //target image is not valid.
158 158
           unlink($resolved_url);
159 159
           
160
-          $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
160
+          $resolved_url = DOMPDF_LIB_DIR."/res/broken_image.png";
161 161
           $ext = "png";
162 162
         }
163 163
         }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
       $resolved_url = build_url($proto, $host, $base_path, $url);
170 170
       if ($DEBUGPNG) print 'build_url('.$proto.','.$host.','.$base_path.','.$url.')('.$resolved_url.')';
171 171
 
172
-      if ( !preg_match("/.*\.(\w+)/",$url,$match) ) {
172
+      if (!preg_match("/.*\.(\w+)/", $url, $match)) {
173 173
         //debugpng
174 174
         if ($DEBUGPNG) print '[resolve_url exception '.$url.']';
175 175
           throw new DOMPDF_Exception("Unknown image type: $url.");
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 
183 183
     }
184 184
 
185
-    if ( !is_readable($resolved_url) || !filesize($resolved_url) ) {
185
+    if (!is_readable($resolved_url) || !filesize($resolved_url)) {
186 186
 
187 187
       //debugpng
188 188
       if ($DEBUGPNG) $full_url_dbg .= '(nocache'.$resolved_url.')';
189 189
 
190
-      $_dompdf_warnings[] = "File " .$resolved_url . " is not readable or is an empty file.\n";
191
-      $resolved_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
190
+      $_dompdf_warnings[] = "File ".$resolved_url." is not readable or is an empty file.\n";
191
+      $resolved_url = DOMPDF_LIB_DIR."/res/broken_image.png";
192 192
       $ext = "png";
193 193
     }
194 194
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
    * or converted)
204 204
    */
205 205
   static function clear() {
206
-    if ( count(self::$_cache) ) {
206
+    if (count(self::$_cache)) {
207 207
       while ($entry = array_shift(self::$_cache)) {
208 208
         list($file, $ext) = $entry;
209 209
         //debugpng
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/pdf/include/frame.cls.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
     $this->_decorator = null;
173 173
 
174
-    $this->set_id( self::$ID_COUNTER++ );
174
+    $this->set_id(self::$ID_COUNTER++);
175 175
   }
176 176
 
177 177
   /**
@@ -181,29 +181,29 @@  discard block
 block discarded – undo
181 181
    */
182 182
   function dispose($recursive = false) {
183 183
 
184
-    if ( $recursive ) {
185
-      while ( $child = $this->_first_child )
184
+    if ($recursive) {
185
+      while ($child = $this->_first_child)
186 186
         $child->dispose(true);
187 187
     }
188 188
 
189 189
     // Remove this frame from the tree
190
-    if ( $this->_prev_sibling ) {
190
+    if ($this->_prev_sibling) {
191 191
       $this->_prev_sibling->_next_sibling = $this->_next_sibling;      
192 192
     }
193 193
 
194
-    if ( $this->_next_sibling ) {
194
+    if ($this->_next_sibling) {
195 195
       $this->_next_sibling->_prev_sibling = $this->_prev_sibling;
196 196
     }
197 197
 
198
-    if ( $this->_parent && $this->_parent->_first_child === $this ) {
198
+    if ($this->_parent && $this->_parent->_first_child === $this) {
199 199
       $this->_parent->_first_child = $this->_next_sibling;
200 200
     }
201 201
 
202
-    if ( $this->_parent && $this->_parent->_last_child === $this ) {
202
+    if ($this->_parent && $this->_parent->_last_child === $this) {
203 203
       $this->_parent->_last_child = $this->_prev_sibling;
204 204
     }
205 205
 
206
-    if ( $this->_parent ) {
206
+    if ($this->_parent) {
207 207
       $this->_parent->get_node()->removeChild($this->_node);
208 208
     }
209 209
 
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
   
247 247
   // Layout property accessors
248 248
   function get_containing_block($i = null) {
249
-    if ( isset($i) )
249
+    if (isset($i))
250 250
       return $this->_containing_block[$i];    
251 251
     return $this->_containing_block;
252 252
   }
253 253
   
254 254
   function get_position($i = null) {
255
-    if ( isset($i) )
255
+    if (isset($i))
256 256
       return $this->_position[$i];
257 257
     return array($this->_position["x"],
258 258
                  $this->_position["y"],
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
     // We can only set attributes of DOMElement objects (nodeType == 1).
355 355
     // Since these are the only objects that we can assign CSS rules to,
356 356
     // this shortcoming is okay.
357
-    if ( $this->_node->nodeType == 1)
357
+    if ($this->_node->nodeType == 1)
358 358
       $this->_node->setAttribute("frame_id", $id);
359 359
   }
360 360
 
361 361
   function set_style(Style $style) {
362
-    if ( is_null($this->_style) )
362
+    if (is_null($this->_style))
363 363
       $this->_original_style = clone $style;
364 364
     
365 365
     $this->_style = $style;
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
   }
371 371
   
372 372
   function set_containing_block($x = null, $y = null, $w = null, $h = null) {
373
-    if ( is_array($x) ){
374
-  		foreach($x AS $key => $val){
373
+    if (is_array($x)) {
374
+  		foreach ($x AS $key => $val) {
375 375
 			$$key = $val;
376 376
 		}
377 377
     }
@@ -399,15 +399,15 @@  discard block
 block discarded – undo
399 399
   }
400 400
 
401 401
   function set_position($x = null, $y = null) {
402
-    if ( is_array($x) )
402
+    if (is_array($x))
403 403
       extract($x);
404 404
     
405
-    if ( is_numeric($x) ) {
405
+    if (is_numeric($x)) {
406 406
       $this->_position[0] = $x;
407 407
       $this->_position["x"] = $x;
408 408
     }
409 409
 
410
-    if ( is_numeric($y) ) {
410
+    if (is_numeric($y)) {
411 411
       $this->_position[1] = $y;
412 412
       $this->_position["y"] = $y;
413 413
     }
@@ -417,18 +417,18 @@  discard block
 block discarded – undo
417 417
 
418 418
   function prepend_child(Frame $child, $update_node = true) {
419 419
 
420
-    if ( $update_node ) 
420
+    if ($update_node) 
421 421
       $this->_node->insertBefore($child->_node, $this->_first_child ? $this->_first_child->_node : null);
422 422
 
423 423
     // Remove the child from its parent
424
-    if ( $child->_parent )
424
+    if ($child->_parent)
425 425
       $child->_parent->remove_child($child, false);
426 426
     
427 427
     $child->_parent = $this;
428 428
     $child->_prev_sibling = null;
429 429
     
430 430
     // Handle the first child
431
-    if ( !$this->_first_child ) {
431
+    if (!$this->_first_child) {
432 432
       $this->_first_child = $child;
433 433
       $this->_last_child = $child;
434 434
       $child->_next_sibling = null;
@@ -444,18 +444,18 @@  discard block
 block discarded – undo
444 444
   
445 445
   function append_child(Frame $child, $update_node = true) {
446 446
 
447
-    if ( $update_node ) 
447
+    if ($update_node) 
448 448
       $this->_node->appendChild($child->_node);
449 449
 
450 450
     // Remove the child from its parent
451
-    if ( $child->_parent )
451
+    if ($child->_parent)
452 452
       $child->_parent->remove_child($child, false);
453 453
 
454 454
     $child->_parent = $this;
455 455
     $child->_next_sibling = null;
456 456
     
457 457
     // Handle the first child
458
-    if ( !$this->_last_child ) {
458
+    if (!$this->_last_child) {
459 459
       $this->_first_child = $child;
460 460
       $this->_last_child = $child;
461 461
       $child->_prev_sibling = null;
@@ -472,32 +472,32 @@  discard block
 block discarded – undo
472 472
   // Inserts a new child immediately before the specified frame
473 473
   function insert_child_before(Frame $new_child, Frame $ref, $update_node = true) {
474 474
 
475
-    if ( $ref === $this->_first_child ) {
475
+    if ($ref === $this->_first_child) {
476 476
       $this->prepend_child($new_child, $update_node);
477 477
       return;
478 478
     }
479 479
 
480
-    if ( is_null($ref) ) {
480
+    if (is_null($ref)) {
481 481
       $this->append_child($new_child, $update_node);
482 482
       return;
483 483
     }
484 484
     
485
-    if ( $ref->_parent !== $this )
485
+    if ($ref->_parent !== $this)
486 486
       throw new DOMPDF_Exception("Reference child is not a child of this node.");
487 487
 
488 488
     // Update the node    
489
-    if ( $update_node )
489
+    if ($update_node)
490 490
       $this->_node->insertBefore($new_child->_node, $ref->_node);
491 491
 
492 492
     // Remove the child from its parent
493
-    if ( $new_child->_parent )
493
+    if ($new_child->_parent)
494 494
       $new_child->_parent->remove_child($new_child, false);
495 495
     
496 496
     $new_child->_parent = $this;
497 497
     $new_child->_next_sibling = $ref;
498 498
     $new_child->_prev_sibling = $ref->_prev_sibling;
499 499
 
500
-    if ( $ref->_prev_sibling )
500
+    if ($ref->_prev_sibling)
501 501
       $ref->_prev_sibling->_next_sibling = $new_child;
502 502
     
503 503
     $ref->_prev_sibling = $new_child;
@@ -506,22 +506,22 @@  discard block
 block discarded – undo
506 506
   // Inserts a new child immediately after the specified frame
507 507
   function insert_child_after(Frame $new_child, Frame $ref, $update_node = true) {    
508 508
 
509
-    if ( $ref === $this->_last_child ) {
509
+    if ($ref === $this->_last_child) {
510 510
       $this->append_child($new_child, $update_node);
511 511
       return;
512 512
     }
513 513
 
514
-    if ( is_null($ref) ) {
514
+    if (is_null($ref)) {
515 515
       $this->prepend_child($new_child, $update_node);
516 516
       return;
517 517
     }
518 518
     
519
-    if ( $ref->_parent !== $this )
519
+    if ($ref->_parent !== $this)
520 520
       throw new DOMPDF_Exception("Reference child is not a child of this node.");
521 521
 
522 522
     // Update the node
523
-    if ( $update_node ) {
524
-      if ( $ref->_next_sibling ) {
523
+    if ($update_node) {
524
+      if ($ref->_next_sibling) {
525 525
         $next_node = $ref->_next_sibling->_node;
526 526
         $this->_node->insertBefore($new_child->_node, $next_node);
527 527
       } else {
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
     }
531 531
     
532 532
     // Remove the child from its parent
533
-    if ( $new_child->_parent)
533
+    if ($new_child->_parent)
534 534
       $new_child->_parent->remove_child($new_child, false);
535 535
     
536 536
     $new_child->_parent = $this;
537 537
     $new_child->_prev_sibling = $ref;
538 538
     $new_child->_next_sibling = $ref->_next_sibling;
539 539
 
540
-    if ( $ref->_next_sibling ) 
540
+    if ($ref->_next_sibling) 
541 541
       $ref->_next_sibling->_prev_sibling = $new_child;
542 542
 
543 543
     $ref->_next_sibling = $new_child;
@@ -546,22 +546,22 @@  discard block
 block discarded – undo
546 546
 
547 547
   function remove_child(Frame $child, $update_node = true) {
548 548
 
549
-    if ( $child->_parent !== $this )
549
+    if ($child->_parent !== $this)
550 550
       throw new DOMPDF_Exception("Child not found in this frame");
551 551
 
552
-    if ( $update_node )
552
+    if ($update_node)
553 553
       $this->_node->removeChild($child->_node);
554 554
     
555
-    if ( $child === $this->_first_child )
555
+    if ($child === $this->_first_child)
556 556
       $this->_first_child = $child->_next_sibling;
557 557
 
558
-    if ( $child === $this->_last_child )
558
+    if ($child === $this->_last_child)
559 559
       $this->_last_child = $child->_prev_sibling;
560 560
 
561
-    if ( $child->_prev_sibling )
561
+    if ($child->_prev_sibling)
562 562
       $child->_prev_sibling->_next_sibling = $child->_next_sibling;
563 563
 
564
-    if ( $child->_next_sibling )
564
+    if ($child->_next_sibling)
565 565
       $child->_next_sibling->_prev_sibling = $child->_prev_sibling;    
566 566
 
567 567
     $child->_next_sibling = null;
@@ -582,68 +582,68 @@  discard block
 block discarded – undo
582 582
 //       return "";
583 583
     
584 584
     
585
-    $str = "<b>" . $this->_node->nodeName . ":</b><br/>";
585
+    $str = "<b>".$this->_node->nodeName.":</b><br/>";
586 586
     //$str .= spl_object_hash($this->_node) . "<br/>";
587
-    $str .= "Id: " .$this->get_id() . "<br/>";
588
-    $str .= "Class: " .get_class($this) . "<br/>";
587
+    $str .= "Id: ".$this->get_id()."<br/>";
588
+    $str .= "Class: ".get_class($this)."<br/>";
589 589
     
590
-    if ( $this->_node->nodeName === "#text" ) {
590
+    if ($this->_node->nodeName === "#text") {
591 591
       $tmp = htmlspecialchars($this->_node->nodeValue);
592
-      $str .= "<pre>'" .  mb_substr($tmp,0,70) .
593
-        (mb_strlen($tmp) > 70 ? "..." : "") . "'</pre>";
592
+      $str .= "<pre>'".mb_substr($tmp, 0, 70).
593
+        (mb_strlen($tmp) > 70 ? "..." : "")."'</pre>";
594 594
     }
595
-    if ( $this->_parent )
596
-      $str .= "\nParent:" . $this->_parent->_node->nodeName .
597
-        " (" . spl_object_hash($this->_parent->_node) . ") " .
595
+    if ($this->_parent)
596
+      $str .= "\nParent:".$this->_parent->_node->nodeName.
597
+        " (".spl_object_hash($this->_parent->_node).") ".
598 598
         "<br/>";
599 599
 
600
-    if ( $this->_prev_sibling )
601
-      $str .= "Prev: " . $this->_prev_sibling->_node->nodeName .
602
-        " (" . spl_object_hash($this->_prev_sibling->_node) . ") " .
600
+    if ($this->_prev_sibling)
601
+      $str .= "Prev: ".$this->_prev_sibling->_node->nodeName.
602
+        " (".spl_object_hash($this->_prev_sibling->_node).") ".
603 603
         "<br/>";
604 604
 
605
-    if ( $this->_next_sibling )
606
-      $str .= "Next: " . $this->_next_sibling->_node->nodeName .
607
-        " (" . spl_object_hash($this->_next_sibling->_node) . ") " .
605
+    if ($this->_next_sibling)
606
+      $str .= "Next: ".$this->_next_sibling->_node->nodeName.
607
+        " (".spl_object_hash($this->_next_sibling->_node).") ".
608 608
         "<br/>";
609 609
 
610 610
     $d = $this->get_decorator();
611 611
     while ($d && $d != $d->get_decorator()) {
612
-      $str .= "Decorator: " . get_class($d) . "<br/>";
612
+      $str .= "Decorator: ".get_class($d)."<br/>";
613 613
       $d = $d->get_decorator();
614 614
     }
615 615
 
616
-    $str .= "Position: " . pre_r($this->_position, true);
617
-    $str .= "\nContaining block: " . pre_r($this->_containing_block, true);
618
-    $str .= "\nMargin width: " . pre_r($this->get_margin_width(), true);
619
-    $str .= "\nMargin height: " . pre_r($this->get_margin_height(), true);
616
+    $str .= "Position: ".pre_r($this->_position, true);
617
+    $str .= "\nContaining block: ".pre_r($this->_containing_block, true);
618
+    $str .= "\nMargin width: ".pre_r($this->get_margin_width(), true);
619
+    $str .= "\nMargin height: ".pre_r($this->get_margin_height(), true);
620 620
     
621
-    $str .= "\nStyle: <pre>". $this->_style->__toString() . "</pre>";
621
+    $str .= "\nStyle: <pre>".$this->_style->__toString()."</pre>";
622 622
 
623
-    if ( $this->_decorator instanceof Block_Frame_Decorator ) {
623
+    if ($this->_decorator instanceof Block_Frame_Decorator) {
624 624
       $str .= "Lines:<pre>";
625 625
       foreach ($this->_decorator->get_lines() as $line) {
626 626
         foreach ($line["frames"] as $frame) {
627 627
           if ($frame instanceof Text_Frame_Decorator) {
628 628
             $str .= "\ntext: ";          
629
-            $str .= "'". htmlspecialchars($frame->get_text()) ."'";
629
+            $str .= "'".htmlspecialchars($frame->get_text())."'";
630 630
           } else {
631
-            $str .= "\nBlock: " . $frame->get_node()->nodeName . " (" . spl_object_hash($frame->get_node()) . ")";
631
+            $str .= "\nBlock: ".$frame->get_node()->nodeName." (".spl_object_hash($frame->get_node()).")";
632 632
           }
633 633
         }
634 634
         
635 635
         $str .=
636 636
           //"\ncount => " . $line["count"] . "\n".
637
-          "\ny => " . $line["y"] . "\n" .
638
-          "w => " . $line["w"] . "\n" .
639
-          "h => " . $line["h"] . "\n";
637
+          "\ny => ".$line["y"]."\n".
638
+          "w => ".$line["w"]."\n".
639
+          "h => ".$line["h"]."\n";
640 640
       }
641 641
       $str .= "</pre>";
642 642
     }
643 643
     $str .= "\n";
644
-    if ( php_sapi_name() === "cli" )
645
-      $str = strip_tags(str_replace(array("<br/>","<b>","</b>"),
646
-                                    array("\n","",""),
644
+    if (php_sapi_name() === "cli")
645
+      $str = strip_tags(str_replace(array("<br/>", "<b>", "</b>"),
646
+                                    array("\n", "", ""),
647 647
                                     $str));
648 648
     
649 649
     return $str;
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
   }
694 694
 
695 695
   function valid() {
696
-    return isset($this->_cur);// && ($this->_cur->get_prev_sibling() === $this->_prev);
696
+    return isset($this->_cur); // && ($this->_cur->get_prev_sibling() === $this->_prev);
697 697
   }
698 698
   function key() { return $this->_num; }
699 699
   function current() { return $this->_cur; }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
   function next() {
702 702
 
703 703
     $ret = $this->_cur;
704
-    if ( !$ret )
704
+    if (!$ret)
705 705
       return null;
706 706
     
707 707
     $this->_cur = $this->_cur->get_next_sibling();
@@ -758,13 +758,13 @@  discard block
 block discarded – undo
758 758
     $b = end($this->_stack);
759 759
     
760 760
     // Pop last element
761
-    unset($this->_stack[ key($this->_stack) ]);
761
+    unset($this->_stack[key($this->_stack)]);
762 762
     $this->_num++;
763 763
     
764 764
     // Push all children onto the stack in reverse order
765
-    if ( $c = $b->get_last_child() ) {
765
+    if ($c = $b->get_last_child()) {
766 766
       $this->_stack[] = $c;
767
-      while ( $c = $c->get_prev_sibling() )
767
+      while ($c = $c->get_prev_sibling())
768 768
         $this->_stack[] = $c;
769 769
     }
770 770
     return $b;
Please login to merge, or discard this patch.