Completed
Pull Request — 1.10.x (#1244)
by
unknown
42:26
created
main/plagiarism/compilatio/compilatio_ajax.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
 
6 6
     if (isset($_GET['workid'])) {
7 7
         $compTable = Database::get_course_table("plagiarism_compilatio_docs");
8
-        $workIdList = $_GET['workid'];	// list of workid separate by the :
8
+        $workIdList = $_GET['workid']; // list of workid separate by the :
9 9
         $result = "";
10
-        $tabWorkId =  split("a", $workIdList);
11
-        for ($i=0; $i < count($tabWorkId); $i++) {
10
+        $tabWorkId = split("a", $workIdList);
11
+        for ($i = 0; $i < count($tabWorkId); $i++) {
12 12
             if (is_numeric($tabWorkId[$i])) {
13 13
                 $result .= giveWorkIdState($tabWorkId[$i]);
14 14
             }
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
         $compi = Database::fetch_object($compiSqlResult);
42 42
         if (isset($compi->compilatio_id)) {
43 43
             $actionCompilatio = "";
44
-            if(isMd5($compi->compilatio_id)) {
44
+            if (isMd5($compi->compilatio_id)) {
45 45
                 // if compilatio_id is a hash md5, we call the function of the compilatio's webservice who return the document's status
46 46
 
47 47
                 $soapRes = $compilatio->getDoc($compi->compilatio_id);
48 48
                 $status = '';
49
-                if(isset($soapRes->documentStatus)) {
49
+                if (isset($soapRes->documentStatus)) {
50 50
                     $status = $soapRes->documentStatus->status;
51 51
                 }
52 52
             } else {
53 53
                 // if the compilatio's hash is not a valide hash md5, we return à specific status (cf : IsInCompilatio() )
54
-                $status="NOT_IN_COMPILATIO";
54
+                $status = "NOT_IN_COMPILATIO";
55 55
                 $actionCompilatio = "<div style='font-style:italic'>"
56 56
                     . get_lang('compilatioDocumentTextNotImage')
57 57
                     . "<br/>"
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                 $urlRapport = $compilatio->getReportUrl($compi->compilatio_id);
64 64
                 $actionCompilatio .= getPomprankBarv31(
65 65
                         $soapRes->documentStatus->indice,
66
-                        10 ,
66
+                        10,
67 67
                         35,
68 68
                         $compilatioImgFolder,
69 69
                         $text
@@ -91,29 +91,29 @@  discard block
 block discarded – undo
91 91
                 );
92 92
             }
93 93
             elseif ($status == "ANALYSE_IN_QUEUE") {
94
-                $actionCompilatio.="<img src='"
94
+                $actionCompilatio .= "<img src='"
95 95
                     . $compilatioImgFolder
96 96
                     . "/ajax-loader2.gif' style='margin-right:10px;' />"
97 97
                     . get_lang('compilatioAwaitingAnalysis');
98 98
             } elseif ($status == "BAD_FILETYPE") {
99
-                $actionCompilatio.= "<div style='font-style:italic'>"
99
+                $actionCompilatio .= "<div style='font-style:italic'>"
100 100
                     . get_lang('compilatioFileisnotsupported')
101 101
                     . "<br/>"
102 102
                     . get_lang('compilatioProtectedPdfVerification')
103 103
                     . "</div>";
104 104
             } elseif ($status == "BAD_FILESIZE") {
105
-                $actionCompilatio.=  "<div style='font-style:italic'>"
105
+                $actionCompilatio .= "<div style='font-style:italic'>"
106 106
                     . get_lang('compilatioTooHeavyDocument')
107 107
                     . "</div>";
108 108
             } elseif ($status != "NOT_IN_COMPILATIO") {
109
-                $actionCompilatio.= "<div style='font-style:italic'>"
109
+                $actionCompilatio .= "<div style='font-style:italic'>"
110 110
                     . get_lang('compilatioMomentarilyUnavailableResult')
111 111
                     . " : [ "
112 112
                     . $status
113 113
                     . "].</div>";
114 114
             }
115 115
         }
116
-        $result = $workId . "|" . $actionCompilatio . "|" . $status . "|";
116
+        $result = $workId."|".$actionCompilatio."|".$status."|";
117 117
 
118 118
         return $result;
119 119
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,7 @@
 block discarded – undo
89 89
                     $compilatioImgFolder,
90 90
                     $text
91 91
                 );
92
-            }
93
-            elseif ($status == "ANALYSE_IN_QUEUE") {
92
+            } elseif ($status == "ANALYSE_IN_QUEUE") {
94 93
                 $actionCompilatio.="<img src='"
95 94
                     . $compilatioImgFolder
96 95
                     . "/ajax-loader2.gif' style='margin-right:10px;' />"
Please login to merge, or discard this patch.
main/inc/ajax/model.ajax.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 $action = $_GET['a'];
12 12
 $page = intval($_REQUEST['page']); //page
13 13
 $limit = intval($_REQUEST['rows']); //quantity of rows
14
-$sidx = $_REQUEST['sidx'];         //index (field) to filter
15
-$sord = $_REQUEST['sord'];         //asc or desc
14
+$sidx = $_REQUEST['sidx']; //index (field) to filter
15
+$sord = $_REQUEST['sord']; //asc or desc
16 16
 
17 17
 if (strpos(strtolower($sidx), 'asc') !== false) {
18 18
     $sidx = str_replace(array('asc', ','), '', $sidx);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     $sord = 'desc';
25 25
 }
26 26
 
27
-if (!in_array($sord, array('asc','desc'))) {
27
+if (!in_array($sord, array('asc', 'desc'))) {
28 28
     $sord = 'desc';
29 29
 }
30 30
 
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
 function getWhereClause($col, $oper, $val)
65 65
 {
66 66
     $ops = array(
67
-        'eq' => '=',        //equal
68
-        'ne' => '<>',       //not equal
69
-        'lt' => '<',        //less than
70
-        'le' => '<=',       //less than or equal
71
-        'gt' => '>',        //greater than
72
-        'ge' => '>=',       //greater than or equal
73
-        'bw' => 'LIKE',     //begins with
67
+        'eq' => '=', //equal
68
+        'ne' => '<>', //not equal
69
+        'lt' => '<', //less than
70
+        'le' => '<=', //less than or equal
71
+        'gt' => '>', //greater than
72
+        'ge' => '>=', //greater than or equal
73
+        'bw' => 'LIKE', //begins with
74 74
         'bn' => 'NOT LIKE', //doesn't begin with
75
-        'in' => 'LIKE',     //is in
75
+        'in' => 'LIKE', //is in
76 76
         'ni' => 'NOT LIKE', //is not in
77
-        'ew' => 'LIKE',     //ends with
77
+        'ew' => 'LIKE', //ends with
78 78
         'en' => 'NOT LIKE', //doesn't end with
79
-        'cn' => 'LIKE',     //contains
79
+        'cn' => 'LIKE', //contains
80 80
         'nc' => 'NOT LIKE'  //doesn't contain
81 81
     );
82 82
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 
101 101
 // If there is no search request sent by jqgrid, $where should be empty
102 102
 $whereCondition = null;
103
-$operation = isset($_REQUEST['oper'])  ? $_REQUEST['oper']  : false;
104
-$exportFormat = isset($_REQUEST['export_format'])  ? $_REQUEST['export_format']  : 'csv';
105
-$searchField = isset($_REQUEST['searchField'])  ? $_REQUEST['searchField']  : false;
106
-$searchOperator = isset($_REQUEST['searchOper'])   ? $_REQUEST['searchOper']   : false;
103
+$operation = isset($_REQUEST['oper']) ? $_REQUEST['oper'] : false;
104
+$exportFormat = isset($_REQUEST['export_format']) ? $_REQUEST['export_format'] : 'csv';
105
+$searchField = isset($_REQUEST['searchField']) ? $_REQUEST['searchField'] : false;
106
+$searchOperator = isset($_REQUEST['searchOper']) ? $_REQUEST['searchOper'] : false;
107 107
 $searchString = isset($_REQUEST['searchString']) ? $_REQUEST['searchString'] : false;
108 108
 $search = isset($_REQUEST['_search']) ? $_REQUEST['_search'] : false;
109 109
 $forceSearch = isset($_REQUEST['_force_search']) ? $_REQUEST['_force_search'] : false;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             foreach ($filters->rules as $key => $rule) {
168 168
                 $whereCondition .= getWhereClause($rule->field, $rule->op, $rule->data);
169 169
 
170
-                if ($counter < count($filters->rules) -1) {
170
+                if ($counter < count($filters->rules) - 1) {
171 171
                     $whereCondition .= $filters->groupOp;
172 172
                 }
173 173
                 $counter++;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
         $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
203 203
         $courseCodeList = array();
204
-        $userIdList  = array();
204
+        $userIdList = array();
205 205
         $sessionIdList = [];
206 206
         $searchByGroups = false;
207 207
         if (api_is_drh()) {
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 $total_pages = 0;
555 555
 if ($count > 0) {
556 556
     if (!empty($limit)) {
557
-        $total_pages = ceil((float)$count/(float)$limit);
557
+        $total_pages = ceil((float) $count / (float) $limit);
558 558
     }
559 559
 }
560 560
 if ($page > $total_pages) {
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
                 $plagiarismColumns = array('compilatio');
813 813
             }
814 814
         }
815
-        if (isset($_GET['type'])  && $_GET['type'] == 'simple') {
815
+        if (isset($_GET['type']) && $_GET['type'] == 'simple') {
816 816
             $columns = array(
817 817
                 //'type',
818 818
                 'firstname',
@@ -847,14 +847,14 @@  discard block
 block discarded – undo
847 847
                 $plagiarismColumns = array('compilatio');
848 848
             }
849 849
         }
850
-        if (isset($_GET['type'])  && $_GET['type'] == 'simple') {
850
+        if (isset($_GET['type']) && $_GET['type'] == 'simple') {
851 851
             $columns = array(
852
-                'type', 'firstname', 'lastname',  'title', 'qualification', 'sent_date', 'qualificator_id'
852
+                'type', 'firstname', 'lastname', 'title', 'qualification', 'sent_date', 'qualificator_id'
853 853
             );
854 854
             $columns = array_merge($columns, $plagiarismColumns);
855 855
             $columns[] = 'actions';
856 856
         } else {
857
-            $columns = array('type', 'firstname', 'lastname',  'title', 'sent_date');
857
+            $columns = array('type', 'firstname', 'lastname', 'title', 'sent_date');
858 858
             $columns = array_merge($columns, $plagiarismColumns);
859 859
             $columns[] = 'actions';
860 860
         }
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
                 $plagiarismColumns = array('compilatio');
869 869
             }
870 870
         }
871
-        if (isset($_GET['type'])  && $_GET['type'] == 'simple') {
871
+        if (isset($_GET['type']) && $_GET['type'] == 'simple') {
872 872
             $columns = array(
873 873
                 'type', 'title', 'qualification', 'sent_date', 'qualificator_id'
874 874
             );
@@ -900,10 +900,10 @@  discard block
 block discarded – undo
900 900
     case 'get_exercise_results':
901 901
         $course = api_get_course_info();
902 902
         // Used inside ExerciseLib::get_exam_results_data()
903
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
903
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
904 904
         if ($is_allowedToEdit || api_is_student_boss()) {
905 905
             $columns = array(
906
-                'firstname', 'lastname', 'username', 'group_name', 'exe_duration', 'start_date', 'exe_date', 'score',  'user_ip', 'status', 'lp', 'actions'
906
+                'firstname', 'lastname', 'username', 'group_name', 'exe_duration', 'start_date', 'exe_date', 'score', 'user_ip', 'status', 'lp', 'actions'
907 907
             );
908 908
             $officialCodeInList = api_get_setting('show_official_code_exercise_result_list');
909 909
             if ($officialCodeInList === 'true') {
@@ -914,11 +914,11 @@  discard block
 block discarded – undo
914 914
         break;
915 915
     case 'get_hotpotatoes_exercise_results':
916 916
         $course = api_get_course_info();
917
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
917
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
918 918
         if (api_is_allowed_to_edit()) {
919
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
919
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
920 920
         } else {
921
-            $columns = array('exe_date',  'score', 'actions');
921
+            $columns = array('exe_date', 'score', 'actions');
922 922
         }
923 923
         $result = ExerciseLib::get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
924 924
         break;
@@ -944,12 +944,12 @@  discard block
 block discarded – undo
944 944
         break;
945 945
     case 'get_hotpotatoes_exercise_results':
946 946
         $course = api_get_course_info();
947
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
947
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
948 948
 
949 949
         if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
950
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
950
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
951 951
         } else {
952
-            $columns = array('exe_date',  'score', 'actions');
952
+            $columns = array('exe_date', 'score', 'actions');
953 953
         }
954 954
         $result = ExerciseLib::get_exam_results_hotpotatoes_data($start, $limit, $sidx, $sord, $hotpot_path, $whereCondition);
955 955
         break;
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
             );
979 979
         }
980 980
 
981
-        $columns =  array(
981
+        $columns = array(
982 982
             'name',
983 983
             'date',
984 984
             'course_per_session',
@@ -1014,11 +1014,11 @@  discard block
 block discarded – undo
1014 1014
                 $detailButtons = [];
1015 1015
                 $detailButtons[] = Display::url(
1016 1016
                     Display::return_icon('works.png', get_lang('WorksReport')),
1017
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/works_in_session_report.php?session=' . $session['id']
1017
+                    api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php?session='.$session['id']
1018 1018
                 );
1019 1019
                 $detailButtons[] = Display::url(
1020 1020
                     Display::return_icon('2rightarrow.png'),
1021
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id']
1021
+                    api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id']
1022 1022
                 );
1023 1023
 
1024 1024
                 $result[] = array(
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
         $result = $new_result;
1335 1335
         break;
1336 1336
     case 'get_gradebooks':
1337
-        $columns = array('name', 'certificates','skills', 'actions', 'has_certificates');
1337
+        $columns = array('name', 'certificates', 'skills', 'actions', 'has_certificates');
1338 1338
         if (!in_array($sidx, $columns)) {
1339 1339
             $sidx = 'name';
1340 1340
         }
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
                     if (!empty($exercises[$cnt - 4]['title'])) {
1505 1505
                         $title = ucwords(strtolower(trim($exercises[$cnt - 4]['title'])));
1506 1506
                     }
1507
-                    $columns[] = 'exer' . $i;
1507
+                    $columns[] = 'exer'.$i;
1508 1508
                     $column_names[] = $title;
1509 1509
                     $i++;
1510 1510
                     break;
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
             $sessionInfo = SessionManager::fetch($listUserSess[$user['user_id']]['id_session']);
1538 1538
             $result[$i]['session'] = $sessionInfo['name'];
1539 1539
             $result[$i]['username'] = $user['username'];
1540
-            $result[$i]['name'] = $user['lastname'] . " " . $user['firstname'];
1540
+            $result[$i]['name'] = $user['lastname']." ".$user['firstname'];
1541 1541
             $j = 1;
1542 1542
             $finalScore = 0;
1543 1543
             foreach ($quizIds as $quizID) {
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
                 if (!empty($arrGrade [$user['user_id']][$quizID]) || $arrGrade [$user['user_id']][$quizID] == 0) {
1546 1546
                     $finalScore += $grade = $arrGrade [$user['user_id']][$quizID];
1547 1547
                 }
1548
-                $result[$i]['exer' . $j] = $grade;
1548
+                $result[$i]['exer'.$j] = $grade;
1549 1549
                 $j++;
1550 1550
             }
1551 1551
 
@@ -1718,9 +1718,9 @@  discard block
 block discarded – undo
1718 1718
         foreach ($result as $row) {
1719 1719
             // if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235
1720 1720
             if (!isset($row['id']) || isset($row['id']) && $row['id'] == '') {
1721
-                $response->rows[$i]['id']= $i;
1721
+                $response->rows[$i]['id'] = $i;
1722 1722
             } else {
1723
-                $response->rows[$i]['id']= $row['id'];
1723
+                $response->rows[$i]['id'] = $row['id'];
1724 1724
             }
1725 1725
             $array = array();
1726 1726
             foreach ($columns as $col) {
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
                     $array[] = isset($row[$col]) ? Security::remove_XSS($row[$col]) : '';
1732 1732
                 }
1733 1733
             }
1734
-            $response->rows[$i]['cell']=$array;
1734
+            $response->rows[$i]['cell'] = $array;
1735 1735
             $i++;
1736 1736
         }
1737 1737
     }
Please login to merge, or discard this patch.