Completed
Push — 1.10.x ( d9ba33...49fa3c )
by Julito
35:26
created
main/work/work.lib.php 2 patches
Doc Comments   +16 added lines, -15 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
  * Create a group of select from a date
159 159
  * @param FormValidator $form
160 160
  * @param string $prefix
161
- * @return array
161
+ * @return HTML_QuickForm_element[]
162 162
  */
163 163
 function create_group_date_select($form, $prefix = '')
164 164
 {
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
  * @author Bert Vanderkimpen
753 753
  * @author Yannick Warnier <[email protected]> Adaptation for work tool
754 754
  * @param   string $base_work_dir Base work dir (.../work)
755
- * @param   string $desiredDirName complete path of the desired name
755
+ * @param   string $desired_dir_name complete path of the desired name
756 756
  *
757 757
  * @return  string actual directory name if it succeeds, boolean false otherwise
758 758
  */
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 /**
775 775
  * Delete a work-tool directory
776 776
  * @param   int  $id work directory id to delete
777
- * @return  integer -1 on error
777
+ * @return  boolean|null -1 on error
778 778
  */
779 779
 function deleteDirWork($id)
780 780
 {
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
  * Update the url of a dir in the student_publication table
918 918
  * @param  array $work_data work original data
919 919
  * @param  string $newPath Example: "folder1"
920
- * @return bool
920
+ * @return boolean|null
921 921
  */
922 922
 function updateDirName($work_data, $newPath)
923 923
 {
@@ -974,6 +974,7 @@  discard block
 block discarded – undo
974 974
 /**
975 975
  * Transform an all directory structure (only directories) in an array
976 976
  * @param   string path of the directory
977
+ * @param string $directory
977 978
  * @return  array the directory structure into an array
978 979
  * @author  Julio Montoya Dokeos
979 980
  * @version April 2008
@@ -1043,7 +1044,7 @@  discard block
 block discarded – undo
1043 1044
  * @param   string the path of the directory
1044 1045
  * @param   boolean true if we want the total quantity of files
1045 1046
  * include in others child directories, false only  files in the directory
1046
- * @return  array the first element is an integer with the number of files
1047
+ * @return  integer[] the first element is an integer with the number of files
1047 1048
  * in the folder, the second element is the number of directories
1048 1049
  * @author  Julio Montoya
1049 1050
  * @version April 2008
@@ -2318,7 +2319,7 @@  discard block
 block discarded – undo
2318 2319
 }
2319 2320
 
2320 2321
 /**
2321
- * @param $name
2322
+ * @param string $name
2322 2323
  * @param $values
2323 2324
  * @param string $checked
2324 2325
  * @return string
@@ -2844,7 +2845,7 @@  discard block
 block discarded – undo
2844 2845
  * @param int $userId
2845 2846
  * @param int $workId
2846 2847
  * @param int $courseId
2847
- * @return bool
2848
+ * @return boolean|null
2848 2849
  */
2849 2850
 function allowOnlySubscribedUser($userId, $workId, $courseId)
2850 2851
 {
@@ -3121,6 +3122,7 @@  discard block
 block discarded – undo
3121 3122
  * @param int $parentId
3122 3123
  * @param array $courseInfo
3123 3124
  * @param int $sessionId
3125
+ * @param integer $userId
3124 3126
  * @return int
3125 3127
  */
3126 3128
 function getLastWorkStudentFromParentByUser(
@@ -3757,12 +3759,11 @@  discard block
 block discarded – undo
3757 3759
 
3758 3760
 /**
3759 3761
  * Creates a new task (directory) in the assignment tool
3760
- * @param array $params
3761 3762
  * @param int $user_id
3762 3763
  * @param array $courseInfo
3763 3764
  * @param int $group_id
3764 3765
  * @param int $session_id
3765
- * @return bool|int
3766
+ * @return string|false
3766 3767
  * @note $params can have the following elements, but should at least have the 2 first ones: (
3767 3768
  *       'new_dir' => 'some-name',
3768 3769
  *       'description' => 'some-desc',
@@ -4258,7 +4259,7 @@  discard block
 block discarded – undo
4258 4259
 }
4259 4260
 
4260 4261
 /**
4261
- * @return array
4262
+ * @return string[]
4262 4263
  */
4263 4264
 function getUploadDocumentType()
4264 4265
 {
@@ -4630,7 +4631,7 @@  discard block
 block discarded – undo
4630 4631
  * @param int Session ID
4631 4632
  * @param $correction
4632 4633
  *
4633
- * @return array|bool
4634
+ * @return boolean
4634 4635
  */
4635 4636
 function getFileContents($id, $course_info, $sessionId = 0, $correction = false)
4636 4637
 {
@@ -4748,7 +4749,7 @@  discard block
 block discarded – undo
4748 4749
  * @param int $userId
4749 4750
  * @param array $courseInfo
4750 4751
  * @param string $format
4751
- * @return bool
4752
+ * @return false|null
4752 4753
  */
4753 4754
 function exportAllWork($userId, $courseInfo, $format = 'pdf')
4754 4755
 {
@@ -4796,7 +4797,7 @@  discard block
 block discarded – undo
4796 4797
  * @param array $courseInfo
4797 4798
  * @param int $sessionId
4798 4799
  * @param string $format
4799
- * @return bool
4800
+ * @return false|null
4800 4801
  */
4801 4802
 function exportAllStudentWorkFromPublication(
4802 4803
     $workId,
@@ -4934,7 +4935,7 @@  discard block
 block discarded – undo
4934 4935
  * Downloads all user files per user
4935 4936
  * @param int $userId
4936 4937
  * @param array $courseInfo
4937
- * @return bool
4938
+ * @return false|null
4938 4939
  */
4939 4940
 function downloadAllFilesPerUser($userId, $courseInfo)
4940 4941
 {
@@ -5048,7 +5049,7 @@  discard block
 block discarded – undo
5048 5049
 /**
5049 5050
  * @param array $courseInfo
5050 5051
  * @param int $workId
5051
- * @return bool
5052
+ * @return boolean|null
5052 5053
  */
5053 5054
 function protectWork($courseInfo, $workId)
5054 5055
 {
Please login to merge, or discard this patch.
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 
36 36
     if (!empty($id)) {
37 37
         $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&id='.$my_back_id.'">'.
38
-            Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
38
+            Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
39 39
     }
40 40
 
41 41
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
42 42
         // Create dir
43 43
         if (empty($id)) {
44 44
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=create_dir&origin='.$origin.'&gradebook='.$gradebook.'">';
45
-            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'),'',ICON_SIZE_MEDIUM).'</a>';
45
+            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'), '', ICON_SIZE_MEDIUM).'</a>';
46 46
         }
47 47
         if (empty($id)) {
48 48
             // Options
49 49
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=settings&origin='.$origin.'&gradebook='.$gradebook.'">';
50
-            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'),'',ICON_SIZE_MEDIUM).'</a>';
50
+            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'), '', ICON_SIZE_MEDIUM).'</a>';
51 51
         }
52
-        $display_output .= '<a id="open-view-list" href="#">' . Display::return_icon('listwork.png', get_lang('ViewStudents'),'',ICON_SIZE_MEDIUM) . '</a>';
52
+        $display_output .= '<a id="open-view-list" href="#">'.Display::return_icon('listwork.png', get_lang('ViewStudents'), '', ICON_SIZE_MEDIUM).'</a>';
53 53
 
54 54
     }
55 55
 
56 56
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath' && api_is_allowed_to_session_edit(false, true)) {
57 57
         // Delete all files
58
-        if (api_get_setting('permanently_remove_deleted_files') == 'true'){
58
+        if (api_get_setting('permanently_remove_deleted_files') == 'true') {
59 59
             $message = get_lang('ConfirmYourChoiceDeleteAllfiles');
60 60
         } else {
61 61
             $message = get_lang('ConfirmYourChoice');
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function two_digits($number)
114 114
 {
115
-    $number = (int)$number;
115
+    $number = (int) $number;
116 116
     return ($number < 10) ? '0'.$number : $number;
117 117
 }
118 118
 
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
     );
548 548
 
549 549
     $columnModel = array(
550
-        array('name'=>'type', 'index'=>'type', 'width'=>'30',   'align'=>'center', 'sortable' => 'false'),
551
-        array('name'=>'title', 'index'=>'title', 'width'=>'250',   'align'=>'left'),
552
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80',  'align'=>'center', 'sortable'=>'false'),
553
-        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80',  'align'=>'center'),
554
-        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125',  'align'=>'center'),
550
+        array('name'=>'type', 'index'=>'type', 'width'=>'30', 'align'=>'center', 'sortable' => 'false'),
551
+        array('name'=>'title', 'index'=>'title', 'width'=>'250', 'align'=>'left'),
552
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80', 'align'=>'center', 'sortable'=>'false'),
553
+        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80', 'align'=>'center'),
554
+        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125', 'align'=>'center'),
555 555
     );
556 556
 
557 557
     if ($courseInfo['show_score'] == 0) {
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
 {
589 589
     $columnModel = array(
590 590
         array('name'=>'type', 'index'=>'type', 'width'=>'35', 'align'=>'center', 'sortable' => 'false'),
591
-        array('name'=>'title', 'index'=>'title',  'width'=>'300',   'align'=>'left', 'wrap_cell' => "true"),
592
-        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125',  'align'=>'center'),
593
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125',  'align'=>'center'),
594
-        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110',  'align'=>'center'),
591
+        array('name'=>'title', 'index'=>'title', 'width'=>'300', 'align'=>'left', 'wrap_cell' => "true"),
592
+        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125', 'align'=>'center'),
593
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125', 'align'=>'center'),
594
+        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110', 'align'=>'center'),
595 595
         array('name'=>'actions', 'index'=>'actions', 'width'=>'110', 'align'=>'left', 'sortable'=>'false')
596 596
     );
597 597
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
         return false;
794 794
     }
795 795
 
796
-    $base_work_dir = api_get_path(SYS_COURSE_PATH) .$_course['path'].'/work';
796
+    $base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work';
797 797
     $work_data_url = $base_work_dir.$work_data['url'];
798 798
     $check = Security::check_abs_path($work_data_url.'/', $base_work_dir.'/');
799 799
 
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 function get_work_path($id)
864 864
 {
865 865
     $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
866
-    $course_id  = api_get_course_int_id();
866
+    $course_id = api_get_course_int_id();
867 867
     $sql = 'SELECT url FROM '.$table.'
868 868
             WHERE c_id = '.$course_id.' AND id='.intval($id);
869 869
     $res = Database::query($sql);
@@ -984,9 +984,9 @@  discard block
 block discarded – undo
984 984
     if ($handle = @opendir($directory)) {
985 985
         while (false !== ($file = readdir($handle))) {
986 986
             if ($file != '.' && $file != '..') {
987
-                if (is_dir($directory. '/' . $file)) {
988
-                    $array_items = array_merge($array_items, directory_to_array($directory. '/' . $file));
989
-                    $file = $directory . '/' . $file;
987
+                if (is_dir($directory.'/'.$file)) {
988
+                    $array_items = array_merge($array_items, directory_to_array($directory.'/'.$file));
989
+                    $file = $directory.'/'.$file;
990 990
                     $array_items[] = preg_replace("/\/\//si", '/', $file);
991 991
                 }
992 992
             }
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
1020 1020
 
1021
-    for($i = 0; $i < count($only_dir); $i++) {
1021
+    for ($i = 0; $i < count($only_dir); $i++) {
1022 1022
         $url = $only_dir[$i];
1023 1023
 
1024 1024
         $params = [
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
             if (is_dir($path_dir.'/'.$entry)) {
1059 1059
                 $count_dir++;
1060 1060
                 if ($recurse) {
1061
-                    $count += count_dir($path_dir . '/' . $entry, $recurse);
1061
+                    $count += count_dir($path_dir.'/'.$entry, $recurse);
1062 1062
                 }
1063 1063
             } else {
1064 1064
                 $count++;
@@ -1323,11 +1323,11 @@  discard block
 block discarded – undo
1323 1323
         $courseInfo
1324 1324
     );
1325 1325
 
1326
-    if (!in_array($direction, array('asc','desc'))) {
1326
+    if (!in_array($direction, array('asc', 'desc'))) {
1327 1327
         $direction = 'desc';
1328 1328
     }
1329 1329
     if (!empty($where_condition)) {
1330
-        $where_condition = ' AND ' . $where_condition;
1330
+        $where_condition = ' AND '.$where_condition;
1331 1331
     }
1332 1332
 
1333 1333
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
         $direction = 'desc';
1471 1471
     }
1472 1472
     if (!empty($where_condition)) {
1473
-        $where_condition = ' AND ' . $where_condition;
1473
+        $where_condition = ' AND '.$where_condition;
1474 1474
     }
1475 1475
 
1476 1476
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
             );
1529 1529
 
1530 1530
             $work['amount'] = Display::label(
1531
-                $countUniqueAttempts . '/' .
1531
+                $countUniqueAttempts.'/'.
1532 1532
                 $totalUsers,
1533 1533
                 'success'
1534 1534
             );
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
                         array(),
1578 1578
                         ICON_SIZE_SMALL
1579 1579
                     ),
1580
-                    api_get_path(WEB_CODE_PATH) . 'work/downloadfolder.inc.php?id=' . $workId . '&' . api_get_cidreq()
1580
+                    api_get_path(WEB_CODE_PATH).'work/downloadfolder.inc.php?id='.$workId.'&'.api_get_cidreq()
1581 1581
                 );
1582 1582
             } else {
1583 1583
                 $downloadLink = Display::url(
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
     $userCondition = " AND u.user_id = $studentId ";
1662 1662
     $sessionCondition = " AND w.session_id = $sessionId ";
1663 1663
     $workCondition = " AND w_rel.work_id = $workId";
1664
-    $workParentCondition  = " AND w.parent_id = $workId";
1664
+    $workParentCondition = " AND w.parent_id = $workId";
1665 1665
 
1666 1666
     $sql = "(
1667 1667
                 $select1 FROM $userTable u
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
         }
1770 1770
 
1771 1771
         if ($allowEdition && !empty($itemId)) {
1772
-            $deleteLink  = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1772
+            $deleteLink = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1773 1773
         } else {
1774 1774
             $deleteLink = null;
1775 1775
         }
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
     $start = intval($start);
1851 1851
     $limit = intval($limit);
1852 1852
 
1853
-    if (!in_array($direction, array('asc','desc'))) {
1853
+    if (!in_array($direction, array('asc', 'desc'))) {
1854 1854
         $direction = 'desc';
1855 1855
     }
1856 1856
 
@@ -1918,13 +1918,13 @@  discard block
 block discarded – undo
1918 1918
         $work_assignment = get_work_assignment_by_id($work_id);
1919 1919
 
1920 1920
         if (!empty($studentId)) {
1921
-            $where_condition.= " AND u.user_id = ".intval($studentId);
1921
+            $where_condition .= " AND u.user_id = ".intval($studentId);
1922 1922
         }
1923 1923
 
1924 1924
         $sql = " $select
1925 1925
                 FROM $work_condition  $user_condition
1926 1926
                 WHERE $extra_conditions $where_condition $condition_session
1927
-                    AND u.status != " . INVITEE . "
1927
+                    AND u.status != ".INVITEE."
1928 1928
                 ORDER BY $column $direction";
1929 1929
 
1930 1930
         if (!empty($start) && !empty($limit)) {
@@ -1981,7 +1981,7 @@  discard block
 block discarded – undo
1981 1981
                     $qualification_string = Display::label('-');
1982 1982
                 } else {
1983 1983
                     $label = 'info';
1984
-                    $relativeScore = $work['qualification']/$work_data['qualification'];
1984
+                    $relativeScore = $work['qualification'] / $work_data['qualification'];
1985 1985
                     if ($relativeScore < 0.5) {
1986 1986
                         $label = 'important';
1987 1987
                     } elseif ($relativeScore < 0.75) {
@@ -2037,10 +2037,10 @@  discard block
 block discarded – undo
2037 2037
                 // If URL is present then there's a file to download keep BC.
2038 2038
                 if ($work['contains_file'] || !empty($work['url'])) {
2039 2039
                     $link_to_download = '<a href="'.$url.'download.php?id='.$item_id.'&'.api_get_cidreq().'">'.
2040
-                        Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
2040
+                        Display::return_icon('save.png', get_lang('Save'), array(), ICON_SIZE_SMALL).'</a> ';
2041 2041
                 }
2042 2042
 
2043
-                $send_to = Portfolio::share('work', $work['id'],  array('style' => 'white-space:nowrap;'));
2043
+                $send_to = Portfolio::share('work', $work['id'], array('style' => 'white-space:nowrap;'));
2044 2044
 
2045 2045
                 $feedback = null;
2046 2046
                 $count = getWorkCommentCount($item_id, $course_info);
@@ -2056,8 +2056,8 @@  discard block
 block discarded – undo
2056 2056
                 $work['qualification_only'] = $qualification_string;
2057 2057
 
2058 2058
                 $work['sent_date_from_db'] = $work['sent_date'];
2059
-                $work['sent_date'] = '<div class="date-time">' .
2060
-                        api_get_local_time($work['sent_date']) . ' ' . $add_string . ' </div>';
2059
+                $work['sent_date'] = '<div class="date-time">'.
2060
+                        api_get_local_time($work['sent_date']).' '.$add_string.' </div>';
2061 2061
 
2062 2062
                 // Actions.
2063 2063
                 $correction = '';
@@ -2075,8 +2075,8 @@  discard block
 block discarded – undo
2075 2075
                         Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a> ';
2076 2076
 
2077 2077
                     if ($unoconv && empty($work['contains_file'])) {
2078
-                        $action .=  '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2079
-                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'),array(), ICON_SIZE_SMALL).'</a> ';
2078
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2079
+                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'), array(), ICON_SIZE_SMALL).'</a> ';
2080 2080
                     }
2081 2081
 
2082 2082
                     $correction = '
@@ -2118,9 +2118,9 @@  discard block
 block discarded – undo
2118 2118
 
2119 2119
                     if ($locked) {
2120 2120
                         if ($qualification_exists) {
2121
-                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL);
2121
+                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'), array(), ICON_SIZE_SMALL);
2122 2122
                         } else {
2123
-                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'),array(), ICON_SIZE_SMALL);
2123
+                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'), array(), ICON_SIZE_SMALL);
2124 2124
                         }
2125 2125
                     } else {
2126 2126
                         if ($qualification_exists) {
@@ -2134,45 +2134,45 @@  discard block
 block discarded – undo
2134 2134
 
2135 2135
                     if ($work['contains_file']) {
2136 2136
                         if ($locked) {
2137
-                            $action .= Display::return_icon('move_na.png', get_lang('Move'),array(), ICON_SIZE_SMALL);
2137
+                            $action .= Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
2138 2138
                         } else {
2139 2139
                             $action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=move&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Move').'">'.
2140
-                                Display::return_icon('move.png', get_lang('Move'),array(), ICON_SIZE_SMALL).'</a>';
2140
+                                Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
2141 2141
                         }
2142 2142
                     }
2143 2143
 
2144 2144
                     if ($work['accepted'] == '1') {
2145 2145
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_invisible&item_id='.$item_id.'" title="'.get_lang('Invisible').'" >'.
2146
-                            Display::return_icon('visible.png', get_lang('Invisible'),array(), ICON_SIZE_SMALL).'</a>';
2146
+                            Display::return_icon('visible.png', get_lang('Invisible'), array(), ICON_SIZE_SMALL).'</a>';
2147 2147
                     } else {
2148 2148
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_visible&item_id='.$item_id.'" title="'.get_lang('Visible').'" >'.
2149
-                            Display::return_icon('invisible.png', get_lang('Visible'),array(), ICON_SIZE_SMALL).'</a> ';
2149
+                            Display::return_icon('invisible.png', get_lang('Visible'), array(), ICON_SIZE_SMALL).'</a> ';
2150 2150
                     }
2151 2151
 
2152 2152
                     if ($locked) {
2153 2153
                         $action .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
2154 2154
                     } else {
2155
-                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2156
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2155
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2156
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2157 2157
                     }
2158 2158
                 } elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) {
2159 2159
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2160
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2160
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2161 2161
 
2162 2162
                     if (api_get_course_setting('student_delete_own_publication') == 1) {
2163 2163
                         if (api_is_allowed_to_session_edit(false, true)) {
2164 2164
                             $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
2165
-                                Display::return_icon('edit.png', get_lang('Comment'),array(), ICON_SIZE_SMALL).'</a>';
2165
+                                Display::return_icon('edit.png', get_lang('Comment'), array(), ICON_SIZE_SMALL).'</a>';
2166 2166
                         }
2167
-                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2168
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2167
+                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2168
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2169 2169
                     } else {
2170
-                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2170
+                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2171 2171
                     }
2172 2172
                 } else {
2173 2173
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2174
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2175
-                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2174
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2175
+                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2176 2176
                 }
2177 2177
 
2178 2178
                 // Status.
@@ -2205,7 +2205,7 @@  discard block
 block discarded – undo
2205 2205
     $_course = api_get_course_info();
2206 2206
     $task_id = $task_data['id'];
2207 2207
     $task_title = !empty($task_data['title']) ? $task_data['title'] : basename($task_data['url']);
2208
-    $subject = '[' . api_get_setting('siteName') . '] ';
2208
+    $subject = '['.api_get_setting('siteName').'] ';
2209 2209
 
2210 2210
     // The body can be as long as you wish, and any combination of text and variables
2211 2211
     $content = get_lang('ReminderToSubmitPendingTask')."\n".get_lang('CourseName').' : '.$_course['name']."\n";
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
     $mails_sent_to = array();
2217 2217
     foreach ($list_users as $user) {
2218 2218
         $name_user = api_get_person_name($user[1], $user[0], null, PERSON_NAME_EMAIL_ADDRESS);
2219
-        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]) .", \n\n";
2219
+        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]).", \n\n";
2220 2220
         $body      = $dear_line.$content;
2221 2221
         MessageManager::send_message($user[3], $subject, $body);
2222 2222
         $mails_sent_to[] = $name_user;
@@ -2245,22 +2245,22 @@  discard block
 block discarded – undo
2245 2245
     } else {
2246 2246
         $students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
2247 2247
     }
2248
-    $emailsubject = '[' . api_get_setting('siteName') . '] '.get_lang('HomeworkCreated');
2248
+    $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('HomeworkCreated');
2249 2249
     $currentUser = api_get_user_info(api_get_user_id());
2250 2250
     if (!empty($students)) {
2251
-        foreach($students as $student) {
2251
+        foreach ($students as $student) {
2252 2252
             $user_info = api_get_user_info($student["user_id"]);
2253
-            if(!empty($user_info["mail"])) {
2253
+            if (!empty($user_info["mail"])) {
2254 2254
                 $name_user = api_get_person_name(
2255 2255
                     $user_info["firstname"],
2256 2256
                     $user_info["lastname"],
2257 2257
                     null,
2258 2258
                     PERSON_NAME_EMAIL_ADDRESS
2259 2259
                 );
2260
-                $link = api_get_path(WEB_CODE_PATH) . 'work/work_list_all.php?' . api_get_cidreq() . '&id=' . $workId;
2260
+                $link = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId;
2261 2261
                 $emailbody = get_lang('Dear')." ".$name_user.",\n\n";
2262 2262
                 $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$courseCode.". "."\n\n".
2263
-                    '<a href="'. $link . '">' . get_lang('PleaseCheckHomeworkPage') . '</a>';
2263
+                    '<a href="'.$link.'">'.get_lang('PleaseCheckHomeworkPage').'</a>';
2264 2264
                 $emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
2265 2265
 
2266 2266
                 $additionalParameters = array(
@@ -2302,7 +2302,7 @@  discard block
 block discarded – undo
2302 2302
     $url = Database::escape_string($url);
2303 2303
     $sql = "SELECT id FROM $work_table WHERE url='$url'";
2304 2304
     $result = Database::query($sql);
2305
-    if (Database::num_rows($result)> 0) {
2305
+    if (Database::num_rows($result) > 0) {
2306 2306
         $row = Database::fetch_row($result);
2307 2307
         if (empty($row)) {
2308 2308
             return false;
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 {
2325 2325
     $output = '<select name="'.$name.'" id="'.$name.'">';
2326 2326
     foreach ($values as $key => $value) {
2327
-        $output .= '<option value="'.$key.'" '.(($checked==$key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2327
+        $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2328 2328
     }
2329 2329
     $output .= '</select>';
2330 2330
     return $output;
@@ -2338,9 +2338,9 @@  discard block
 block discarded – undo
2338 2338
  */
2339 2339
 function make_checkbox($name, $checked = '', $label = null)
2340 2340
 {
2341
-    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked))?'checked="checked"':'').'/>';
2341
+    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked)) ? 'checked="checked"' : '').'/>';
2342 2342
     if (!empty($label)) {
2343
-        $check .="<label for ='$name'>$label</label>";
2343
+        $check .= "<label for ='$name'>$label</label>";
2344 2344
     }
2345 2345
     return $check;
2346 2346
 }
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
     }
2495 2495
 
2496 2496
     if (!empty($studentId)) {
2497
-        $sql_users.= " AND u.user_id = ".intval($studentId);
2497
+        $sql_users .= " AND u.user_id = ".intval($studentId);
2498 2498
     }
2499 2499
 
2500 2500
     $group_id = api_get_group_id();
@@ -2504,7 +2504,7 @@  discard block
 block discarded – undo
2504 2504
     if ($group_id) {
2505 2505
         $group_user_list = GroupManager::get_subscribed_users($group_id);
2506 2506
         if (!empty($group_user_list)) {
2507
-            foreach($group_user_list as $group_user) {
2507
+            foreach ($group_user_list as $group_user) {
2508 2508
                 $new_group_user_list[] = $group_user['user_id'];
2509 2509
             }
2510 2510
         }
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
 function getWorkComments($work)
2926 2926
 {
2927 2927
     $commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT);
2928
-    $userTable= Database::get_main_table(TABLE_MAIN_USER);
2928
+    $userTable = Database::get_main_table(TABLE_MAIN_USER);
2929 2929
 
2930 2930
     $courseId = intval($work['c_id']);
2931 2931
     $workId = intval($work['id']);
@@ -3608,7 +3608,7 @@  discard block
 block discarded – undo
3608 3608
             null,
3609 3609
             PERSON_NAME_EMAIL_ADDRESS
3610 3610
         );
3611
-        $subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3611
+        $subject = "[".api_get_setting('siteName')."] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3612 3612
         foreach ($user_list as $user_data) {
3613 3613
             $to_user_id = $user_data['user_id'];
3614 3614
             $user_info = api_get_user_info($to_user_id);
@@ -3691,7 +3691,7 @@  discard block
 block discarded – undo
3691 3691
 
3692 3692
     $title = $values['title'];
3693 3693
     $description = $values['description'];
3694
-    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']): 0;
3694
+    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']) : 0;
3695 3695
 
3696 3696
     $saveWork = true;
3697 3697
     $message = null;
@@ -4080,8 +4080,8 @@  discard block
 block discarded – undo
4080 4080
                     LINK_STUDENTPUBLICATION,
4081 4081
                     $workId,
4082 4082
                     $params['new_dir'],
4083
-                    (float)$params['weight'],
4084
-                    (float)$params['qualification'],
4083
+                    (float) $params['weight'],
4084
+                    (float) $params['qualification'],
4085 4085
                     $params['description'],
4086 4086
                     1,
4087 4087
                     api_get_session_id()
@@ -4341,15 +4341,15 @@  discard block
 block discarded – undo
4341 4341
     // changing the tool setting: is a student allowed to delete his/her own document
4342 4342
 
4343 4343
     // counting the number of occurrences of this setting (if 0 => add, if 1 => update)
4344
-    $query = "SELECT * FROM " . $table_course_setting . "
4344
+    $query = "SELECT * FROM ".$table_course_setting."
4345 4345
               WHERE c_id = $courseId AND variable = 'student_delete_own_publication'";
4346 4346
 
4347 4347
     $result = Database::query($query);
4348 4348
     $number_of_setting = Database::num_rows($result);
4349 4349
 
4350 4350
     if ($number_of_setting == 1) {
4351
-        $query = "UPDATE " . $table_course_setting . " SET
4352
-                  value='" . Database::escape_string($studentDeleteOwnPublication) . "'
4351
+        $query = "UPDATE ".$table_course_setting." SET
4352
+                  value='" . Database::escape_string($studentDeleteOwnPublication)."'
4353 4353
                   WHERE variable = 'student_delete_own_publication' AND c_id = $courseId";
4354 4354
         Database::query($query);
4355 4355
     } else {
@@ -4388,9 +4388,9 @@  discard block
 block discarded – undo
4388 4388
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
4389 4389
     $item_id = intval($item_id);
4390 4390
     $course_id = $course_info['real_id'];
4391
-    $sql = "UPDATE  " . $work_table . "
4391
+    $sql = "UPDATE  ".$work_table."
4392 4392
             SET accepted = 0
4393
-            WHERE c_id = $course_id AND id = '" . $item_id . "'";
4393
+            WHERE c_id = $course_id AND id = '".$item_id."'";
4394 4394
     Database::query($sql);
4395 4395
     api_item_property_update(
4396 4396
         $course_info,
@@ -4534,7 +4534,7 @@  discard block
 block discarded – undo
4534 4534
                 $courseCode,
4535 4535
                 $sessionId,
4536 4536
                 $limitString,
4537
-                $orderBy ,
4537
+                $orderBy,
4538 4538
                 STUDENT,
4539 4539
                 $getCount
4540 4540
             );
@@ -4871,8 +4871,8 @@  discard block
 block discarded – undo
4871 4871
     if (!empty($sessionId)) {
4872 4872
         $sessionInfo = api_get_session_info($sessionId);
4873 4873
         if (!empty($sessionInfo)) {
4874
-            $header .= ' - ' . $sessionInfo['name'];
4875
-            $header .= '<br />' . $sessionInfo['description'];
4874
+            $header .= ' - '.$sessionInfo['name'];
4875
+            $header .= '<br />'.$sessionInfo['description'];
4876 4876
             $teachers = SessionManager::getCoachesByCourseSessionToString(
4877 4877
                 $sessionId,
4878 4878
                 $courseInfo['real_id']
@@ -4888,12 +4888,12 @@  discard block
 block discarded – undo
4888 4888
     $expiresOn = null;
4889 4889
 
4890 4890
     if (!empty($assignment) && isset($assignment['expires_on'])) {
4891
-        $content .= '<br /><strong>' . get_lang('ExpirationDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
4891
+        $content .= '<br /><strong>'.get_lang('ExpirationDate').'</strong>: '.api_get_local_time($assignment['expires_on']);
4892 4892
         $expiresOn = api_get_local_time($assignment['expires_on']);
4893 4893
     }
4894 4894
 
4895 4895
     if (!empty($workData['description'])) {
4896
-        $content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
4896
+        $content .= '<br /><strong>'.get_lang('Description').'</strong>: '.$workData['description'];
4897 4897
     }
4898 4898
 
4899 4899
     $workList = get_work_user_list(null, null, null, null, $workId);
@@ -4914,7 +4914,7 @@  discard block
 block discarded – undo
4914 4914
                 );
4915 4915
 
4916 4916
                 $column = 0;
4917
-                foreach($headers as $header) {
4917
+                foreach ($headers as $header) {
4918 4918
                     $table->setHeaderContents(0, $column, $header);
4919 4919
                     $column++;
4920 4920
                 }
@@ -4962,7 +4962,7 @@  discard block
 block discarded – undo
4962 4962
 
4963 4963
                 if (!empty($content)) {
4964 4964
                     $params = array(
4965
-                        'filename' => $workData['title'] . '_' . api_get_local_time(),
4965
+                        'filename' => $workData['title'].'_'.api_get_local_time(),
4966 4966
                         'pdf_title' => api_replace_dangerous_char($workData['title']),
4967 4967
                         'course_code' => $courseInfo['code'],
4968 4968
                         'add_signatures' => false
@@ -4993,7 +4993,7 @@  discard block
 block discarded – undo
4993 4993
     $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
4994 4994
     $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work/';
4995 4995
 
4996
-    $zip  = new PclZip($tempZipFile);
4996
+    $zip = new PclZip($tempZipFile);
4997 4997
 
4998 4998
     $workPerUser = getWorkPerUser($userId);
4999 4999
 
Please login to merge, or discard this patch.