Completed
Pull Request — 1.11.x (#1688)
by José
28:44
created
main/gradebook/lib/scoredisplay.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Compare the custom display of 2 scores, can be useful in sorting
36 36
      */
37
-    public static function compare_scores_by_custom_display ($score1, $score2)
37
+    public static function compare_scores_by_custom_display($score1, $score2)
38 38
     {
39 39
         if (!isset($score1)) {
40 40
             return (isset($score2) ? 1 : 0);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             if ($custom1 == $custom2) {
48 48
                 return 0;
49 49
             } else {
50
-                return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1);
50
+                return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1);
51 51
             }
52 52
         }
53 53
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         //Setting custom enabled
79 79
         $value = api_get_setting('gradebook_score_display_custom');
80 80
         $value = $value['my_display_custom'];
81
-        $this->custom_enabled  = $value == 'true' ? true : false;
81
+        $this->custom_enabled = $value == 'true' ? true : false;
82 82
 
83 83
         if ($this->custom_enabled) {
84 84
             $params = array('category = ?' =>  array('Gradebook'));
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
                 sort($portal_displays);
96 96
             }
97 97
             $this->custom_display = $portal_displays;
98
-            if (count($this->custom_display)>0) {
98
+            if (count($this->custom_display) > 0) {
99 99
                 $value = api_get_setting('gradebook_score_display_upperlimit');
100 100
                 $value = $value['my_display_upperlimit'];
101
-                $this->upperlimit_included  = $value == 'true' ? true : false;
101
+                $this->upperlimit_included = $value == 'true' ? true : false;
102 102
                 $this->custom_display_conv = $this->convert_displays($this->custom_display);
103 103
             }
104 104
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             //Load course settings
110 110
             if ($this->custom_enabled) {
111 111
                 $this->custom_display = $this->get_custom_displays();
112
-                if (count($this->custom_display)> 0) {
112
+                if (count($this->custom_display) > 0) {
113 113
                     $this->custom_display_conv = $this->convert_displays($this->custom_display);
114 114
                 }
115 115
             }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         }
181 181
 
182 182
         $sql = 'SELECT id FROM '.$tbl_gradebook_category.'
183
-                WHERE course_code = "'.$curr_course_code.'" '. $session_condition;
183
+                WHERE course_code = "'.$curr_course_code.'" '.$session_condition;
184 184
         $rs  = Database::query($sql);
185 185
         $category_id = 0;
186 186
         if (Database::num_rows($rs) > 0) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         );
250 250
 
251 251
         $tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
252
-        foreach($display as $value => $text) {
252
+        foreach ($display as $value => $text) {
253 253
             $params = array(
254 254
                 'score' => $value,
255 255
                 'display' => $text,
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         $my_score = $score == 0 ? 1 : $score;
306 306
 
307 307
         if ($type == SCORE_BAR) {
308
-            $percentage = $my_score[0]/$my_score[1]*100;
308
+            $percentage = $my_score[0] / $my_score[1] * 100;
309 309
 
310 310
             return Display::bar_progress($percentage);
311 311
         }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             case SCORE_PERCENT:                        // XX %
347 347
                 return $this->display_as_percent($score);
348 348
             case SCORE_DIV_PERCENT:                    // X / Y (XX %)
349
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')';
349
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')';
350 350
             case SCORE_AVERAGE:                        // XX %
351 351
                 return $this->display_as_percent($score);
352 352
             case SCORE_DECIMAL:                        // 0.50  (X/Y)
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                 if (!empty($custom)) {
357 357
                     $custom = ' - '.$custom;
358 358
                 }
359
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom;
359
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')'.$custom;
360 360
             case SCORE_DIV_SIMPLE_WITH_CUSTOM:         // X - Good!
361 361
                 $custom = $this->display_custom($score);
362 362
 
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
      */
409 409
     private function display_as_decimal($score)
410 410
     {
411
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
411
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
412 412
 
413
-        return $this->format_score($score[0]/$score_denom);
413
+        return $this->format_score($score[0] / $score_denom);
414 414
     }
415 415
 
416 416
     /**
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
      */
419 419
     private function display_as_percent($score)
420 420
     {
421
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
421
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
422 422
 
423
-        return $this->format_score($score[0]/$score_denom*100) . ' %';
423
+        return $this->format_score($score[0] / $score_denom * 100).' %';
424 424
     }
425 425
 
426 426
     /**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         } else {
437 437
             $score[0] = isset($score[0]) ? $this->format_score($score[0]) : 0;
438 438
             $score[1] = isset($score[1]) ? $this->format_score($score[1]) : 0;
439
-            return  $score[0] . ' / ' . $score[1];
439
+            return  $score[0].' / '.$score[1];
440 440
         }
441 441
     }
442 442
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      */
447 447
     private function display_custom($score)
448 448
     {
449
-        $my_score_denom= ($score[1]==0) ? 1 : $score[1];
449
+        $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
450 450
         $scaledscore = $score[0] / $my_score_denom;
451 451
         if ($this->upperlimit_included) {
452 452
             foreach ($this->custom_display_conv as $displayitem) {
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
                 ORDER BY score';
511 511
         $result = Database::query($sql);
512 512
 
513
-        return Database::store_result($result,'ASSOC');
513
+        return Database::store_result($result, 'ASSOC');
514 514
     }
515 515
 
516 516
     /**
Please login to merge, or discard this patch.
main/gradebook/lib/results_data_generator.class.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     /**
39 39
      * Get total number of results (rows)
40 40
      */
41
-    public function get_total_results_count ()
41
+    public function get_total_results_count()
42 42
     {
43 43
         return count($this->results);
44 44
     }
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
      * 4 ['score']     : student's score
55 55
      * 5 ['display']   : custom score display (only if custom scoring enabled)
56 56
      */
57
-    public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf=false)
57
+    public function get_data($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf = false)
58 58
     {
59 59
         // do some checks on count, redefine if invalid value
60 60
         $number_decimals = api_get_setting('gradebook_number_decimals');
61 61
         if (!isset($count)) {
62
-            $count = count ($this->results) - $start;
62
+            $count = count($this->results) - $start;
63 63
         }
64 64
         if ($count < 0) {
65 65
             $count = 0;
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
         $scoredisplay = ScoreDisplay :: instance();
68 68
         // generate actual data array
69 69
         $table = array();
70
-        foreach($this->results as $result) {
70
+        foreach ($this->results as $result) {
71 71
             $user = array();
72 72
             $info = api_get_user_info($result->get_user_id());
73 73
             $user['id'] = $result->get_user_id();
74
-            if ($pdf){
74
+            if ($pdf) {
75 75
                 $user['username'] = $info['username'];
76 76
             }
77 77
             $user['result_id'] = $result->get_id();
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 true
94 94
             )
95 95
             );
96
-            if ($pdf && $number_decimals == null){
96
+            if ($pdf && $number_decimals == null) {
97 97
                 $user['scoreletter'] = $result->get_score();
98 98
             }
99 99
             if ($scoredisplay->is_custom()) {
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
      * @param boolean $realscore
135 135
      * @result string The score as we want to show it
136 136
      */
137
-    private function get_score_display ($score, $realscore, $ignore_score_color = false)
137
+    private function get_score_display($score, $realscore, $ignore_score_color = false)
138 138
     {
139 139
         if ($score != null) {
140 140
             $scoredisplay = ScoreDisplay :: instance();
141 141
             $type = SCORE_CUSTOM;
142 142
             if ($realscore === true) {
143
-                $type = SCORE_DIV_PERCENT ;
143
+                $type = SCORE_DIV_PERCENT;
144 144
             }
145 145
 
146 146
             return $scoredisplay->display_score(
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
         }
175 175
     }
176 176
 
177
-    function sort_by_mask ($item1, $item2)
177
+    function sort_by_mask($item1, $item2)
178 178
     {
179
-        $score1 = (isset($item1['score']) ? array($item1['score'],$this->evaluation->get_max()) : null);
180
-        $score2 = (isset($item2['score']) ? array($item2['score'],$this->evaluation->get_max()) : null);
179
+        $score1 = (isset($item1['score']) ? array($item1['score'], $this->evaluation->get_max()) : null);
180
+        $score2 = (isset($item2['score']) ? array($item2['score'], $this->evaluation->get_max()) : null);
181 181
         return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2);
182 182
     }
183 183
 }
Please login to merge, or discard this patch.
main/gradebook/index.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 //$cidReset = false;
12 12
 $_in_course = true;
13 13
 require_once __DIR__.'/../inc/global.inc.php';
14
-$current_course_tool  = TOOL_GRADEBOOK;
14
+$current_course_tool = TOOL_GRADEBOOK;
15 15
 
16 16
 api_protect_course_script(true);
17 17
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 });
76 76
 </script>';
77 77
 api_block_anonymous_users();
78
-$htmlHeadXtra[]= '<script type="text/javascript">
78
+$htmlHeadXtra[] = '<script type="text/javascript">
79 79
 function confirmation() {
80
-	if (confirm("' . get_lang('DeleteAll') . '?")) {
80
+	if (confirm("' . get_lang('DeleteAll').'?")) {
81 81
 		return true;
82 82
 	} else {
83 83
 		return false;
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
     }
114 114
 }
115 115
 
116
-if ($selectCat > 0 && (isset($_SESSION['studentview']) && $_SESSION['studentview']=='true')) {
116
+if ($selectCat > 0 && (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'true')) {
117 117
 
118 118
 } else {
119 119
     if (empty($selectCat) && (
120
-        $_SESSION['studentview']=='studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true')
120
+        $_SESSION['studentview'] == 'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true')
121 121
     ) {
122 122
         Display :: display_header(get_lang('Gradebook'));
123 123
 
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
 //this is called when there is no data for the course admin
153 153
 if (isset($_GET['createallcategories'])) {
154 154
     GradebookUtils::block_students();
155
-    $coursecat= Category :: get_not_created_course_categories($stud_id);
155
+    $coursecat = Category :: get_not_created_course_categories($stud_id);
156 156
     if (!count($coursecat) == 0) {
157 157
         foreach ($coursecat as $row) {
158
-            $cat= new Category();
158
+            $cat = new Category();
159 159
             $cat->set_name($row[1]);
160 160
             $cat->set_course_code($row[0]);
161 161
             $cat->set_description(null);
@@ -173,26 +173,26 @@  discard block
 block discarded – undo
173 173
 
174 174
 //show logs evaluations
175 175
 if (isset($_GET['visiblelog'])) {
176
-    header('Location: ' . api_get_self().'/gradebook_showlog_eval.php');
176
+    header('Location: '.api_get_self().'/gradebook_showlog_eval.php');
177 177
     exit;
178 178
 }
179 179
 
180 180
 //move a category
181 181
 if (isset($_GET['movecat'])) {
182 182
     GradebookUtils::block_students();
183
-    $cats= Category :: load($_GET['movecat']);
183
+    $cats = Category :: load($_GET['movecat']);
184 184
     if (!isset($_GET['targetcat'])) {
185
-        $move_form= new CatForm(
185
+        $move_form = new CatForm(
186 186
             CatForm :: TYPE_MOVE,
187 187
             $cats[0],
188 188
             'move_cat_form',
189 189
             null,
190
-            api_get_self() . '?movecat=' . intval($_GET['movecat']). '&selectcat=' . $selectCat
190
+            api_get_self().'?movecat='.intval($_GET['movecat']).'&selectcat='.$selectCat
191 191
         );
192 192
         if ($move_form->validate()) {
193
-            header('Location: ' . api_get_self() . '?selectcat=' . $selectCat
194
-                . '&movecat=' . intval($_GET['movecat'])
195
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
193
+            header('Location: '.api_get_self().'?selectcat='.$selectCat
194
+                . '&movecat='.intval($_GET['movecat'])
195
+                . '&targetcat='.$move_form->exportValue('move_cat'));
196 196
             exit;
197 197
         }
198 198
     } else {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
203 203
             $cats[0]->move_to_cat($targetcat[0]);
204
-            header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . $selectCat);
204
+            header('Location: '.api_get_self().'?categorymoved=&selectcat='.$selectCat);
205 205
             exit;
206 206
         }
207 207
         unset ($targetcat);
@@ -212,31 +212,31 @@  discard block
 block discarded – undo
212 212
 //move an evaluation
213 213
 if (isset($_GET['moveeval'])) {
214 214
     GradebookUtils::block_students();
215
-    $evals= Evaluation :: load($_GET['moveeval']);
215
+    $evals = Evaluation :: load($_GET['moveeval']);
216 216
     if (!isset ($_GET['targetcat'])) {
217 217
 
218
-        $move_form= new EvalForm(
218
+        $move_form = new EvalForm(
219 219
             EvalForm :: TYPE_MOVE,
220 220
             $evals[0],
221 221
             null,
222 222
             'move_eval_form',
223 223
             null,
224
-            api_get_self() . '?moveeval=' . Security::remove_XSS($_GET['moveeval']). '&selectcat=' . $selectCat
224
+            api_get_self().'?moveeval='.Security::remove_XSS($_GET['moveeval']).'&selectcat='.$selectCat
225 225
         );
226 226
 
227 227
         if ($move_form->validate()) {
228
-            header('Location: ' .api_get_self() . '?selectcat='.$selectCat
229
-                . '&moveeval=' . Security::remove_XSS($_GET['moveeval'])
230
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
228
+            header('Location: '.api_get_self().'?selectcat='.$selectCat
229
+                . '&moveeval='.Security::remove_XSS($_GET['moveeval'])
230
+                . '&targetcat='.$move_form->exportValue('move_cat'));
231 231
             exit;
232 232
         }
233 233
     } else {
234
-        $targetcat= Category :: load($_GET['targetcat']);
234
+        $targetcat = Category :: load($_GET['targetcat']);
235 235
         $course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
236 236
 
237 237
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
238 238
             $evals[0]->move_to_cat($targetcat[0]);
239
-            header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . $selectCat);
239
+            header('Location: '.api_get_self().'?evaluationmoved=&selectcat='.$selectCat);
240 240
             exit;
241 241
         }
242 242
         unset($targetcat);
@@ -247,21 +247,21 @@  discard block
 block discarded – undo
247 247
 //move a link
248 248
 if (isset($_GET['movelink'])) {
249 249
     GradebookUtils::block_students();
250
-    $link= LinkFactory :: load($_GET['movelink']);
250
+    $link = LinkFactory :: load($_GET['movelink']);
251 251
     $move_form = new LinkForm(
252 252
         LinkForm :: TYPE_MOVE,
253 253
         null,
254 254
         $link[0],
255 255
         'move_link_form',
256 256
         null,
257
-        api_get_self() . '?movelink=' . $_GET['movelink'] . '&selectcat=' . $selectCat
257
+        api_get_self().'?movelink='.$_GET['movelink'].'&selectcat='.$selectCat
258 258
     );
259 259
 
260 260
     if ($move_form->validate()) {
261
-        $targetcat= Category :: load($move_form->exportValue('move_cat'));
261
+        $targetcat = Category :: load($move_form->exportValue('move_cat'));
262 262
         $link[0]->move_to_cat($targetcat[0]);
263 263
         unset($link);
264
-        header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . $selectCat);
264
+        header('Location: '.api_get_self().'?linkmoved=&selectcat='.$selectCat);
265 265
         exit;
266 266
     }
267 267
 }
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
     GradebookUtils::block_students();
272 272
 
273 273
     if (isset($_GET['set_visible'])) {
274
-        $visibility_command= 1;
274
+        $visibility_command = 1;
275 275
     } else {
276
-        $visibility_command= 0;
276
+        $visibility_command = 0;
277 277
     }
278 278
     $cats = Category :: load($_GET['visiblecat']);
279 279
     $cats[0]->set_visible($visibility_command);
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 if (isset($_GET['visibleeval'])) {
309 309
     GradebookUtils::block_students();
310 310
     if (isset ($_GET['set_visible'])) {
311
-        $visibility_command= 1;
311
+        $visibility_command = 1;
312 312
     } else {
313
-        $visibility_command= 0;
313
+        $visibility_command = 0;
314 314
     }
315
-    $eval= Evaluation :: load($_GET['visibleeval']);
315
+    $eval = Evaluation :: load($_GET['visibleeval']);
316 316
     $eval[0]->set_visible($visibility_command);
317 317
     $eval[0]->save();
318 318
     unset ($eval);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 if (isset($_GET['lockedeval'])) {
330 330
     GradebookUtils::block_students();
331 331
     $locked = Security::remove_XSS($_GET['lockedeval']);
332
-    if (isset($_GET['typelocked']) && api_is_platform_admin()){
332
+    if (isset($_GET['typelocked']) && api_is_platform_admin()) {
333 333
         $type_locked = 0;
334 334
         $confirmation_message = get_lang('EvaluationHasBeenUnLocked');
335 335
     } else {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 if (isset($_GET['deleteeval'])) {
348 348
     GradebookUtils::block_students();
349
-    $eval= Evaluation :: load($_GET['deleteeval']);
349
+    $eval = Evaluation :: load($_GET['deleteeval']);
350 350
     if ($eval[0] != null) {
351 351
         $eval[0]->delete_with_results();
352 352
     }
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
 if (isset($_GET['visiblelink'])) {
359 359
     GradebookUtils::block_students();
360 360
     if (isset ($_GET['set_visible'])) {
361
-        $visibility_command= 1;
361
+        $visibility_command = 1;
362 362
     } else {
363
-        $visibility_command= 0;
363
+        $visibility_command = 0;
364 364
     }
365
-    $link= LinkFactory :: load($_GET['visiblelink']);
365
+    $link = LinkFactory :: load($_GET['visiblelink']);
366 366
     if (isset($link) && isset($link[0])) {
367 367
         $link[0]->set_visible($visibility_command);
368 368
         $link[0]->save();
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
     $get_delete_link = intval($_GET['deletelink']);
385 385
     //fixing #5229
386 386
     if (!empty($get_delete_link)) {
387
-        $link= LinkFactory :: load($get_delete_link);
387
+        $link = LinkFactory :: load($get_delete_link);
388 388
         if ($link[0] != null) {
389 389
             // Clean forum qualify
390 390
             $sql = 'UPDATE '.$tbl_forum_thread.' SET
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
     if (!isset($_GET['movecat']) && !isset($_GET['moveeval'])) {
420 420
         die ('Error: movecat or moveeval not defined');
421 421
     }
422
-    $button = '<form name="confirm" method="post" action="'.api_get_self() .'?confirm='
423
-        .(isset($_GET['movecat']) ? '&movecat=' . intval($_GET['movecat'])
424
-            : '&moveeval=' . Security::remove_XSS($_GET['moveeval'])).'&selectcat=' . $selectCat.'&targetcat=' . Security::remove_XSS($_GET['targetcat']).'">
422
+    $button = '<form name="confirm" method="post" action="'.api_get_self().'?confirm='
423
+        .(isset($_GET['movecat']) ? '&movecat='.intval($_GET['movecat'])
424
+            : '&moveeval='.Security::remove_XSS($_GET['moveeval'])).'&selectcat='.$selectCat.'&targetcat='.Security::remove_XSS($_GET['targetcat']).'">
425 425
 			   <input type="submit" value="'.get_lang('Ok').'">
426 426
 			   </form>';
427 427
     $warning_message = get_lang('MoveWarning').'<br><br>'.$button;
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 //actions on the sortabletable
453 453
 if (isset($_POST['action'])) {
454 454
     GradebookUtils::block_students();
455
-    $number_of_selected_items= count($_POST['id']);
455
+    $number_of_selected_items = count($_POST['id']);
456 456
 
457 457
     if ($number_of_selected_items == '0') {
458 458
         $warning_message = get_lang('NoItemsSelected');
@@ -460,19 +460,19 @@  discard block
 block discarded – undo
460 460
     } else {
461 461
         switch ($_POST['action']) {
462 462
             case 'deleted':
463
-                $number_of_deleted_categories= 0;
464
-                $number_of_deleted_evaluations= 0;
465
-                $number_of_deleted_links= 0;
463
+                $number_of_deleted_categories = 0;
464
+                $number_of_deleted_evaluations = 0;
465
+                $number_of_deleted_links = 0;
466 466
                 foreach ($_POST['id'] as $indexstr) {
467 467
                     if (substr($indexstr, 0, 4) == 'CATE') {
468
-                        $cats= Category :: load(substr($indexstr, 4));
468
+                        $cats = Category :: load(substr($indexstr, 4));
469 469
                         if ($cats[0] != null) {
470 470
                             $cats[0]->delete_all();
471 471
                         }
472 472
                         $number_of_deleted_categories++;
473 473
                     }
474 474
                     if (substr($indexstr, 0, 4) == 'EVAL') {
475
-                        $eval= Evaluation :: load(substr($indexstr, 4));
475
+                        $eval = Evaluation :: load(substr($indexstr, 4));
476 476
                         if ($eval[0] != null) {
477 477
                             $eval[0]->delete_with_results();
478 478
                         }
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                         //fixing #5229
484 484
                         $id = substr($indexstr, 4);
485 485
                         if (!empty($id)) {
486
-                            $link= LinkFactory :: load($id);
486
+                            $link = LinkFactory :: load($id);
487 487
                             if ($link[0] != null) {
488 488
                                 $link[0]->delete();
489 489
                             }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                         }
492 492
                     }
493 493
                 }
494
-                $confirmation_message = get_lang('DeletedCategories') . ' : <b>' . $number_of_deleted_categories . '</b><br />' . get_lang('DeletedEvaluations') . ' : <b>' . $number_of_deleted_evaluations . '</b><br />' . get_lang('DeletedLinks') . ' : <b>' . $number_of_deleted_links . '</b><br /><br />' . get_lang('TotalItems') . ' : <b>' . $number_of_selected_items . '</b>';
494
+                $confirmation_message = get_lang('DeletedCategories').' : <b>'.$number_of_deleted_categories.'</b><br />'.get_lang('DeletedEvaluations').' : <b>'.$number_of_deleted_evaluations.'</b><br />'.get_lang('DeletedLinks').' : <b>'.$number_of_deleted_links.'</b><br /><br />'.get_lang('TotalItems').' : <b>'.$number_of_selected_items.'</b>';
495 495
                 $filter_confirm_msg = false;
496 496
                 break;
497 497
             case 'setvisible':
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
                         $cats[0]->apply_visibility_to_children();
504 504
                     }
505 505
                     if (substr($indexstr, 0, 4) == 'EVAL') {
506
-                        $eval= Evaluation :: load(substr($indexstr, 4));
506
+                        $eval = Evaluation :: load(substr($indexstr, 4));
507 507
                         $eval[0]->set_visible(1);
508 508
                         $eval[0]->save();
509 509
                     }
510 510
                     if (substr($indexstr, 0, 4) == 'LINK') {
511
-                        $link= LinkFactory :: load(substr($indexstr, 4));
511
+                        $link = LinkFactory :: load(substr($indexstr, 4));
512 512
                         $link[0]->set_visible(1);
513 513
                         $link[0]->save();
514 514
                     }
@@ -525,12 +525,12 @@  discard block
 block discarded – undo
525 525
                         $cats[0]->apply_visibility_to_children();
526 526
                     }
527 527
                     if (substr($indexstr, 0, 4) == 'EVAL') {
528
-                        $eval= Evaluation :: load(substr($indexstr, 4));
528
+                        $eval = Evaluation :: load(substr($indexstr, 4));
529 529
                         $eval[0]->set_visible(0);
530 530
                         $eval[0]->save();
531 531
                     }
532 532
                     if (substr($indexstr, 0, 4) == 'LINK') {
533
-                        $link= LinkFactory :: load(substr($indexstr, 4));
533
+                        $link = LinkFactory :: load(substr($indexstr, 4));
534 534
                         $link[0]->set_visible(0);
535 535
                         $link[0]->save();
536 536
                     }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 }
544 544
 
545 545
 if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
546
-    header('Location: ' . api_get_self() . '?selectcat=' . $selectCat. '&search='.Security::remove_XSS($_POST['keyword']));
546
+    header('Location: '.api_get_self().'?selectcat='.$selectCat.'&search='.Security::remove_XSS($_POST['keyword']));
547 547
     exit;
548 548
 }
549 549
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
             'name' => get_lang('ToolGradebook')
562 562
         );
563 563
         Display :: display_header(get_lang('SearchResults'));
564
-    } elseif(!empty($selectCat)) {
564
+    } elseif (!empty($selectCat)) {
565 565
         $interbreadcrumb[] = array(
566 566
             'url' => '#',
567 567
             'name' => get_lang('ToolGradebook')
@@ -574,46 +574,46 @@  discard block
 block discarded – undo
574 574
 }
575 575
 
576 576
 if (isset ($_GET['categorymoved'])) {
577
-    Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
577
+    Display :: display_confirmation_message(get_lang('CategoryMoved'), false);
578 578
 }
579 579
 if (isset ($_GET['evaluationmoved'])) {
580
-    Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
580
+    Display :: display_confirmation_message(get_lang('EvaluationMoved'), false);
581 581
 }
582 582
 if (isset ($_GET['linkmoved'])) {
583
-    Display :: display_confirmation_message(get_lang('LinkMoved'),false);
583
+    Display :: display_confirmation_message(get_lang('LinkMoved'), false);
584 584
 }
585 585
 if (isset ($_GET['addcat'])) {
586
-    Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
586
+    Display :: display_confirmation_message(get_lang('CategoryAdded'), false);
587 587
 }
588 588
 if (isset ($_GET['linkadded'])) {
589
-    Display :: display_confirmation_message(get_lang('LinkAdded'),false);
589
+    Display :: display_confirmation_message(get_lang('LinkAdded'), false);
590 590
 }
591 591
 if (isset ($_GET['addresult'])) {
592
-    Display :: display_confirmation_message(get_lang('ResultAdded'),false);
592
+    Display :: display_confirmation_message(get_lang('ResultAdded'), false);
593 593
 }
594 594
 if (isset ($_GET['editcat'])) {
595
-    Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
595
+    Display :: display_confirmation_message(get_lang('CategoryEdited'), false);
596 596
 }
597 597
 if (isset ($_GET['editeval'])) {
598
-    Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
598
+    Display :: display_confirmation_message(get_lang('EvaluationEdited'), false);
599 599
 }
600 600
 if (isset ($_GET['linkedited'])) {
601
-    Display :: display_confirmation_message(get_lang('LinkEdited'),false);
601
+    Display :: display_confirmation_message(get_lang('LinkEdited'), false);
602 602
 }
603
-if (isset ($_GET['nolinkitems'])){
604
-    Display :: display_warning_message(get_lang('NoLinkItems'),false);
603
+if (isset ($_GET['nolinkitems'])) {
604
+    Display :: display_warning_message(get_lang('NoLinkItems'), false);
605 605
 }
606
-if (isset ($_GET['addallcat'])){
607
-    Display :: display_normal_message(get_lang('AddAllCat'),false);
606
+if (isset ($_GET['addallcat'])) {
607
+    Display :: display_normal_message(get_lang('AddAllCat'), false);
608 608
 }
609
-if (isset ($confirmation_message)){
610
-    Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
609
+if (isset ($confirmation_message)) {
610
+    Display :: display_confirmation_message($confirmation_message, $filter_confirm_msg);
611 611
 }
612
-if (isset ($warning_message)){
613
-    Display :: display_warning_message($warning_message,$filter_warning_msg);
612
+if (isset ($warning_message)) {
613
+    Display :: display_warning_message($warning_message, $filter_warning_msg);
614 614
 }
615
-if (isset ($move_form)){
616
-    Display :: display_normal_message($move_form->toHtml(),false);
615
+if (isset ($move_form)) {
616
+    Display :: display_normal_message($move_form->toHtml(), false);
617 617
 }
618 618
 
619 619
 // LOAD DATA & DISPLAY TABLE
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
     $alleval = $cats[0]->get_evaluations($stud_id, true);
631 631
     $alllink = $cats[0]->get_links($stud_id, true);
632 632
     if (isset ($_GET['exportpdf'])) {
633
-        $datagen = new GradebookDataGenerator($allcat,$alleval, $alllink);
633
+        $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink);
634 634
         $header_names = array(
635 635
             get_lang('Name'),
636 636
             get_lang('Description'),
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
         foreach ($data_array as $data) {
649 649
             $newarray[] = array_slice($data, 1);
650 650
         }
651
-        $pdf= new Cezpdf();
651
+        $pdf = new Cezpdf();
652 652
         $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
653 653
         $pdf->ezSetMargins(30, 30, 50, 30);
654 654
         $pdf->ezSetY(810);
655
-        $pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
656
-        $pdf->line(50,790,550,790);
657
-        $pdf->line(50,40,550,40);
655
+        $pdf->ezText(get_lang('FlatView').' ('.api_convert_and_format_date(null, DATE_FORMAT_SHORT).' '.api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).')', 12, array('justification'=>'center'));
656
+        $pdf->line(50, 790, 550, 790);
657
+        $pdf->line(50, 40, 550, 40);
658 658
         $pdf->ezSetY(750);
659 659
         $pdf->ezTable(
660 660
             $newarray,
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
     $addparams['studentoverview'] = '';
746 746
 }
747 747
 //$addparams['cidReq']='';
748
-if (isset($_GET['cidReq']) && $_GET['cidReq']!='') {
748
+if (isset($_GET['cidReq']) && $_GET['cidReq'] != '') {
749 749
     $addparams['cidReq'] = Security::remove_XSS($_GET['cidReq']);
750 750
 } else {
751
-    $addparams['cidReq']='';
751
+    $addparams['cidReq'] = '';
752 752
 }
753 753
 
754 754
 $no_qualification = false;
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             );
773 773
 
774 774
             if (isset($certificate['pdf_url']) && $hideCertificateExport !== 'true') {
775
-                $actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') .
775
+                $actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o').
776 776
                     get_lang('DownloadCertificatePdf'),
777 777
                     $certificate['pdf_url'],
778 778
                     ['class' => 'btn btn-default']
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
     }
823 823
 }
824 824
 
825
-if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null,true)) {
825
+if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)) {
826 826
     echo '<meta http-equiv="refresh" content="0;url='.api_get_self().'?'.api_get_cidreq().'" />';
827 827
 } else {
828 828
     $cats = Category::load(null, null, $course_code, null, null, $session_id, false);
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
                         $components = $obj->get_components($value);
860 860
 
861 861
                         foreach ($components as $component) {
862
-                            $gradebook =  new Gradebook();
862
+                            $gradebook = new Gradebook();
863 863
                             $params = array();
864 864
 
865 865
                             $params['name'] = $component['acronym'];
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                     $certificate
908 908
                 );
909 909
 
910
-                if (api_is_allowed_to_edit(null,true) &&
910
+                if (api_is_allowed_to_edit(null, true) &&
911 911
                     api_get_setting('gradebook_enable_grade_model') === 'true'
912 912
                 ) {
913 913
                     //Showing the grading system
Please login to merge, or discard this patch.
main/gradebook/gradebook.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 // $cidReset : This is the main difference with gradebook.php, here we say,
10 10
 // basically, that we are inside a course, and many things depend from that
11
-$cidReset= true;
11
+$cidReset = true;
12 12
 $_in_course = false;
13 13
 //make sure the destination for scripts is index.php instead of gradebook.php
14 14
 require_once __DIR__.'/../inc/global.inc.php';
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     unset($_GET['course']);
22 22
 }
23 23
 
24
-$selectcat = isset($_GET['selectcat']) ?  (int) $_GET['selectcat'] : 0;
24
+$selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
25 25
 
26 26
 $htmlHeadXtra[] = '<script>
27 27
 $(document).ready( function() {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  </script>';
35 35
 api_block_anonymous_users();
36 36
 
37
-$htmlHeadXtra[]= '<script>
37
+$htmlHeadXtra[] = '<script>
38 38
 function confirmation () {
39 39
 	if (confirm("'.get_lang('DeleteAll').'?")) {
40 40
 	    return true;
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 //this is called when there is no data for the course admin
51 51
 if (isset ($_GET['createallcategories'])) {
52 52
     GradebookUtils::block_students();
53
-    $coursecat= Category :: get_not_created_course_categories(api_get_user_id());
53
+    $coursecat = Category :: get_not_created_course_categories(api_get_user_id());
54 54
     if (!count($coursecat) == 0) {
55 55
         foreach ($coursecat as $row) {
56
-            $cat= new Category();
56
+            $cat = new Category();
57 57
             $cat->set_name($row[1]);
58 58
             $cat->set_course_code($row[0]);
59 59
             $cat->set_description(null);
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
     GradebookUtils::block_students();
76 76
     $cats = Category :: load($move_cat);
77 77
     if (!isset ($_GET['targetcat'])) {
78
-        $move_form= new CatForm(CatForm :: TYPE_MOVE,
78
+        $move_form = new CatForm(CatForm :: TYPE_MOVE,
79 79
             $cats[0],
80 80
             'move_cat_form',
81 81
             null,
82
-            api_get_self() . '?movecat=' . $move_cat. '&selectcat=' . $selectcat
82
+            api_get_self().'?movecat='.$move_cat.'&selectcat='.$selectcat
83 83
         );
84 84
         if ($move_form->validate()) {
85
-            header('Location: ' . api_get_self() . '?selectcat=' . $selectcat
86
-                . '&movecat=' . $move_cat
87
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
85
+            header('Location: '.api_get_self().'?selectcat='.$selectcat
86
+                . '&movecat='.$move_cat
87
+                . '&targetcat='.$move_form->exportValue('move_cat'));
88 88
             exit;
89 89
         }
90 90
     } else {
91
-        $get_target_cat=Security::remove_XSS($_GET['targetcat']);
92
-        $targetcat= Category :: load($get_target_cat);
91
+        $get_target_cat = Security::remove_XSS($_GET['targetcat']);
92
+        $targetcat = Category :: load($get_target_cat);
93 93
         $course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
94 94
 
95 95
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
96 96
             $cats[0]->move_to_cat($targetcat[0]);
97
-            header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . $selectcat);
97
+            header('Location: '.api_get_self().'?categorymoved=&selectcat='.$selectcat);
98 98
             exit;
99 99
         }
100 100
         unset($targetcat);
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 //move an evaluation
106 106
 if (isset ($_GET['moveeval'])) {
107 107
     GradebookUtils::block_students();
108
-    $get_move_eval=Security::remove_XSS($_GET['moveeval']);
109
-    $evals= Evaluation :: load($get_move_eval);
108
+    $get_move_eval = Security::remove_XSS($_GET['moveeval']);
109
+    $evals = Evaluation :: load($get_move_eval);
110 110
     if (!isset ($_GET['targetcat'])) {
111 111
 
112 112
         $move_form = new EvalForm(EvalForm :: TYPE_MOVE,
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
             null,
115 115
             'move_eval_form',
116 116
             null,
117
-            api_get_self() . '?moveeval=' . $get_move_eval. '&selectcat=' . $selectcat
117
+            api_get_self().'?moveeval='.$get_move_eval.'&selectcat='.$selectcat
118 118
         );
119 119
 
120 120
         if ($move_form->validate()) {
121
-            header('Location: ' .api_get_self() . '?selectcat=' . $selectcat
122
-                . '&moveeval=' . $get_move_eval
123
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
121
+            header('Location: '.api_get_self().'?selectcat='.$selectcat
122
+                . '&moveeval='.$get_move_eval
123
+                . '&targetcat='.$move_form->exportValue('move_cat'));
124 124
             exit;
125 125
         }
126 126
     } else {
127
-        $get_target_cat=Security::remove_XSS($_GET['targetcat']);
128
-        $targetcat= Category :: load($get_target_cat);
127
+        $get_target_cat = Security::remove_XSS($_GET['targetcat']);
128
+        $targetcat = Category :: load($get_target_cat);
129 129
         $course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
130 130
 
131 131
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
132 132
             $evals[0]->move_to_cat($targetcat[0]);
133
-            header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . $selectcat);
133
+            header('Location: '.api_get_self().'?evaluationmoved=&selectcat='.$selectcat);
134 134
             exit;
135 135
         }
136 136
         unset ($targetcat);
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 //move a link
142 142
 if (isset ($_GET['movelink'])) {
143 143
     GradebookUtils::block_students();
144
-    $get_move_link=Security::remove_XSS($_GET['movelink']);
145
-    $link= LinkFactory :: load($get_move_link);
144
+    $get_move_link = Security::remove_XSS($_GET['movelink']);
145
+    $link = LinkFactory :: load($get_move_link);
146 146
     $move_form = new LinkForm(
147 147
         LinkForm :: TYPE_MOVE,
148 148
         null,
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
         api_get_self().'?movelink='.$get_move_link.'&selectcat='.$selectcat
153 153
     );
154 154
     if ($move_form->validate()) {
155
-        $targetcat= Category :: load($move_form->exportValue('move_cat'));
155
+        $targetcat = Category :: load($move_form->exportValue('move_cat'));
156 156
         $link[0]->move_to_cat($targetcat[0]);
157 157
         unset ($link);
158
-        header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . $selectcat);
158
+        header('Location: '.api_get_self().'?linkmoved=&selectcat='.$selectcat);
159 159
         exit;
160 160
     }
161 161
 }
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 if (isset ($_GET['visiblecat'])) {
165 165
     GradebookUtils::block_students();
166 166
     if (isset ($_GET['set_visible'])) {
167
-        $visibility_command= 1;
167
+        $visibility_command = 1;
168 168
     } else {
169
-        $visibility_command= 0;
169
+        $visibility_command = 0;
170 170
     }
171
-    $cats= Category :: load($_GET['visiblecat']);
171
+    $cats = Category :: load($_GET['visiblecat']);
172 172
     $cats[0]->set_visible($visibility_command);
173 173
     $cats[0]->save();
174 174
     $cats[0]->apply_visibility_to_children();
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 }
184 184
 if (isset ($_GET['deletecat'])) {
185 185
     GradebookUtils::block_students();
186
-    $cats= Category :: load($_GET['deletecat']);
186
+    $cats = Category :: load($_GET['deletecat']);
187 187
     //delete all categories,subcategories and results
188 188
     if ($cats[0] != null) {
189 189
         if ($cats[0]->get_id() != 0) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 if (isset ($_GET['visibleeval'])) {
199 199
     GradebookUtils::block_students();
200 200
     if (isset ($_GET['set_visible'])) {
201
-        $visibility_command= 1;
201
+        $visibility_command = 1;
202 202
     } else {
203
-        $visibility_command= 0;
203
+        $visibility_command = 0;
204 204
     }
205 205
 
206
-    $eval= Evaluation :: load($_GET['visibleeval']);
206
+    $eval = Evaluation :: load($_GET['visibleeval']);
207 207
     $eval[0]->set_visible($visibility_command);
208 208
     $eval[0]->save();
209 209
     unset ($eval);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 }
218 218
 if (isset ($_GET['deleteeval'])) {
219 219
     GradebookUtils::block_students();
220
-    $eval= Evaluation :: load($_GET['deleteeval']);
220
+    $eval = Evaluation :: load($_GET['deleteeval']);
221 221
     if ($eval[0] != null) {
222 222
         $eval[0]->delete_with_results();
223 223
     }
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 if (isset ($_GET['visiblelink'])) {
229 229
     GradebookUtils::block_students();
230 230
     if (isset ($_GET['set_visible'])) {
231
-        $visibility_command= 1;
232
-    }else {
233
-        $visibility_command= 0;
231
+        $visibility_command = 1;
232
+    } else {
233
+        $visibility_command = 0;
234 234
     }
235
-    $link= LinkFactory :: load($_GET['visiblelink']);
235
+    $link = LinkFactory :: load($_GET['visiblelink']);
236 236
     $link[0]->set_visible($visibility_command);
237 237
     $link[0]->save();
238 238
     unset ($link);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     GradebookUtils::block_students();
249 249
     //fixing #5229
250 250
     if (!empty($_GET['deletelink'])) {
251
-        $link= LinkFactory :: load($_GET['deletelink']);
251
+        $link = LinkFactory :: load($_GET['deletelink']);
252 252
         if ($link[0] != null) {
253 253
             $link[0]->delete();
254 254
         }
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
     }
266 266
     $button = '<form name="confirm"
267 267
                  method="post"
268
-                 action="'.api_get_self() .'?confirm='
269
-        .(isset($_GET['movecat']) ? '&movecat=' . Security::remove_XSS($_GET['movecat'])
270
-            : '&moveeval=' . intval($_GET['moveeval']) ).'&selectcat=' . $selectcat.'&targetcat=' . Security::remove_XSS($_GET['targetcat']).'">
268
+                 action="'.api_get_self().'?confirm='
269
+        .(isset($_GET['movecat']) ? '&movecat='.Security::remove_XSS($_GET['movecat'])
270
+            : '&moveeval='.intval($_GET['moveeval'])).'&selectcat='.$selectcat.'&targetcat='.Security::remove_XSS($_GET['targetcat']).'">
271 271
 			   <input type="submit" value="'.'  '.get_lang('Ok').'  '.'">
272 272
 			   </form>';
273 273
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 //actions on the sortabletable
278 278
 if (isset ($_POST['action'])) {
279 279
     GradebookUtils::block_students();
280
-    $number_of_selected_items= count($_POST['id']);
280
+    $number_of_selected_items = count($_POST['id']);
281 281
     if ($number_of_selected_items == '0') {
282 282
         $warning_message = get_lang('NoItemsSelected');
283 283
         $filter_warning_msg = false;
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
     else {
286 286
         switch ($_POST['action']) {
287 287
             case 'deleted' :
288
-                $number_of_deleted_categories= 0;
289
-                $number_of_deleted_evaluations= 0;
290
-                $number_of_deleted_links= 0;
288
+                $number_of_deleted_categories = 0;
289
+                $number_of_deleted_evaluations = 0;
290
+                $number_of_deleted_links = 0;
291 291
                 foreach ($_POST['id'] as $indexstr) {
292 292
                     if (api_substr($indexstr, 0, 4) == 'CATE') {
293
-                        $cats= Category :: load(api_substr($indexstr, 4));
293
+                        $cats = Category :: load(api_substr($indexstr, 4));
294 294
                         if ($cats[0] != null) {
295 295
                             $cats[0]->delete_all();
296 296
                         }
297 297
                         $number_of_deleted_categories++;
298 298
                     }
299 299
                     if (api_substr($indexstr, 0, 4) == 'EVAL') {
300
-                        $eval= Evaluation :: load(api_substr($indexstr, 4));
300
+                        $eval = Evaluation :: load(api_substr($indexstr, 4));
301 301
                         if ($eval[0] != null) {
302 302
                             $eval[0]->delete_with_results();
303 303
                         }
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                     if (api_substr($indexstr, 0, 4) == 'LINK') {
307 307
                         $id = api_substr($indexstr, 4);
308 308
                         if (!empty($id)) {
309
-                            $link= LinkFactory :: load();
309
+                            $link = LinkFactory :: load();
310 310
                             if ($link[0] != null) {
311 311
                                 $link[0]->delete();
312 312
                             }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
                         }
315 315
                     }
316 316
                 }
317
-                $confirmation_message = get_lang('DeletedCategories') . ' : <b>' . $number_of_deleted_categories . '</b><br />' . get_lang('DeletedEvaluations') . ' : <b>' . $number_of_deleted_evaluations . '</b><br />' . get_lang('DeletedLinks') . ' : <b>' . $number_of_deleted_links . '</b><br /><br />' . get_lang('TotalItems') . ' : <b>' . $number_of_selected_items . '</b>';
317
+                $confirmation_message = get_lang('DeletedCategories').' : <b>'.$number_of_deleted_categories.'</b><br />'.get_lang('DeletedEvaluations').' : <b>'.$number_of_deleted_evaluations.'</b><br />'.get_lang('DeletedLinks').' : <b>'.$number_of_deleted_links.'</b><br /><br />'.get_lang('TotalItems').' : <b>'.$number_of_selected_items.'</b>';
318 318
                 $filter_confirm_msg = false;
319 319
                 break;
320 320
             case 'setvisible' :
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 }
367 367
 
368 368
 if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
369
-    header('Location: ' . api_get_self() . '?selectcat=' . $selectcat
369
+    header('Location: '.api_get_self().'?selectcat='.$selectcat
370 370
         . '&search='.Security::remove_XSS($_POST['keyword']));
371 371
     exit;
372 372
 }
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
 // DISPLAY HEADERS AND MESSAGES                           -
375 375
 if (!isset($_GET['exportpdf']) && !isset($_GET['export_certificate'])) {
376 376
     if (isset ($_GET['studentoverview'])) {
377
-        $interbreadcrumb[]= array (
378
-            'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $selectcat.'&'.api_get_cidreq(),
377
+        $interbreadcrumb[] = array(
378
+            'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat.'&'.api_get_cidreq(),
379 379
             'name' => get_lang('ToolGradebook')
380 380
         );
381 381
         Display :: display_header(get_lang('FlatView'));
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
             $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']);
387 387
         }
388 388
 
389
-        $interbreadcrumb[]= array ('url' => $gradebook_dest,'name' => get_lang('Gradebook'));
389
+        $interbreadcrumb[] = array('url' => $gradebook_dest, 'name' => get_lang('Gradebook'));
390 390
 
391
-        if ((isset($_GET['selectcat']) && $_GET['selectcat']>0)) {
391
+        if ((isset($_GET['selectcat']) && $_GET['selectcat'] > 0)) {
392 392
             if (!empty($_GET['course'])) {
393
-                $interbreadcrumb[]= array ('url' => $gradebook_dest.'selectcat='.$selectcat,'name' => get_lang('Details'));
393
+                $interbreadcrumb[] = array('url' => $gradebook_dest.'selectcat='.$selectcat, 'name' => get_lang('Details'));
394 394
             } else {
395
-                $interbreadcrumb[]= array ('url' => $_SESSION['gradebook_dest'].'?selectcat=0','name' => get_lang('Details'));
395
+                $interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'].'?selectcat=0', 'name' => get_lang('Details'));
396 396
             }
397 397
         }
398 398
         Display :: display_header('');
@@ -402,50 +402,50 @@  discard block
 block discarded – undo
402 402
 }
403 403
 
404 404
 if (isset($_GET['categorymoved'])) {
405
-    Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
405
+    Display :: display_confirmation_message(get_lang('CategoryMoved'), false);
406 406
 }
407 407
 if (isset($_GET['evaluationmoved'])) {
408
-    Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
408
+    Display :: display_confirmation_message(get_lang('EvaluationMoved'), false);
409 409
 }
410 410
 if (isset($_GET['linkmoved'])) {
411
-    Display :: display_confirmation_message(get_lang('LinkMoved'),false);
411
+    Display :: display_confirmation_message(get_lang('LinkMoved'), false);
412 412
 }
413 413
 if (isset ($_GET['addcat'])) {
414
-    Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
414
+    Display :: display_confirmation_message(get_lang('CategoryAdded'), false);
415 415
 }
416 416
 if (isset ($_GET['linkadded'])) {
417
-    Display :: display_confirmation_message(get_lang('LinkAdded'),false);
417
+    Display :: display_confirmation_message(get_lang('LinkAdded'), false);
418 418
 }
419 419
 if (isset ($_GET['addresult'])) {
420
-    Display :: display_confirmation_message(get_lang('ResultAdded'),false);
420
+    Display :: display_confirmation_message(get_lang('ResultAdded'), false);
421 421
 }
422 422
 if (isset ($_GET['editcat'])) {
423
-    Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
423
+    Display :: display_confirmation_message(get_lang('CategoryEdited'), false);
424 424
 }
425 425
 if (isset ($_GET['editeval'])) {
426
-    Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
426
+    Display :: display_confirmation_message(get_lang('EvaluationEdited'), false);
427 427
 }
428 428
 if (isset ($_GET['linkedited'])) {
429
-    Display :: display_confirmation_message(get_lang('LinkEdited'),false);
429
+    Display :: display_confirmation_message(get_lang('LinkEdited'), false);
430 430
 }
431 431
 if (isset ($_GET['nolinkitems'])) {
432
-    Display :: display_warning_message(get_lang('NoLinkItems'),false);
432
+    Display :: display_warning_message(get_lang('NoLinkItems'), false);
433 433
 }
434 434
 if (isset ($_GET['addallcat'])) {
435
-    Display :: display_normal_message(get_lang('AddAllCat'),false);
435
+    Display :: display_normal_message(get_lang('AddAllCat'), false);
436 436
 }
437 437
 if (isset ($confirmation_message)) {
438
-    Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
438
+    Display :: display_confirmation_message($confirmation_message, $filter_confirm_msg);
439 439
 }
440 440
 if (isset ($warning_message)) {
441
-    Display :: display_warning_message($warning_message,$filter_warning_msg);
441
+    Display :: display_warning_message($warning_message, $filter_warning_msg);
442 442
 }
443 443
 if (isset ($move_form)) {
444
-    Display :: display_normal_message($move_form->toHtml(),false);
444
+    Display :: display_normal_message($move_form->toHtml(), false);
445 445
 }
446 446
 // LOAD DATA & DISPLAY TABLE                             -
447
-$is_platform_admin= api_is_platform_admin();
448
-$is_course_admin= api_is_allowed_to_edit();
447
+$is_platform_admin = api_is_platform_admin();
448
+$is_course_admin = api_is_allowed_to_edit();
449 449
 
450 450
 //load data for category, evaluation and links
451 451
 if (empty($selectcat)) {
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
     null,
463 463
     api_get_self().'?selectcat='.$selectcat
464 464
 );
465
-$values= $simple_search_form->exportValues();
465
+$values = $simple_search_form->exportValues();
466 466
 $keyword = '';
467 467
 if (isset($_GET['search']) && !empty($_GET['search'])) {
468 468
     $keyword = Security::remove_XSS($_GET['search']);
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
 }
473 473
 
474 474
 if (!empty($keyword)) {
475
-    $cats= Category :: load($category);
476
-    $allcat= array ();
477
-    if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
478
-        $allcat= $cats[0]->get_subcategories(null);
479
-        $allcat_info = Category::find_category($keyword,$allcat);
480
-        $alleval=array();
481
-        $alllink=array();
475
+    $cats = Category :: load($category);
476
+    $allcat = array();
477
+    if ((isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search'])) {
478
+        $allcat = $cats[0]->get_subcategories(null);
479
+        $allcat_info = Category::find_category($keyword, $allcat);
480
+        $alleval = array();
481
+        $alllink = array();
482 482
     } else {
483 483
         $alleval = Evaluation::find_evaluations($keyword, $cats[0]->get_id());
484 484
         $alllink = LinkFactory::find_links($keyword, $cats[0]->get_id());
@@ -486,13 +486,13 @@  discard block
 block discarded – undo
486 486
 
487 487
 } elseif (isset ($_GET['studentoverview'])) {
488 488
     //@todo this code seems to be deprecated because the gradebook tab is off
489
-    $cats= Category :: load($category);
490
-    $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
491
-    $allcat= array ();
492
-    $alleval= $cats[0]->get_evaluations($stud_id, true);
493
-    $alllink= $cats[0]->get_links($stud_id, true);
489
+    $cats = Category :: load($category);
490
+    $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
491
+    $allcat = array();
492
+    $alleval = $cats[0]->get_evaluations($stud_id, true);
493
+    $alllink = $cats[0]->get_links($stud_id, true);
494 494
     if (isset ($_GET['exportpdf'])) {
495
-        $datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
495
+        $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink);
496 496
         $header_names = array(
497 497
             get_lang('Name'),
498 498
             get_lang('Description'),
@@ -500,18 +500,18 @@  discard block
 block discarded – undo
500 500
             get_lang('Date'),
501 501
             get_lang('Results'),
502 502
         );
503
-        $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
503
+        $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME, 0, null, true);
504 504
         $newarray = array();
505 505
         foreach ($data_array as $data) {
506 506
             $newarray[] = array_slice($data, 1);
507 507
         }
508
-        $pdf= new Cezpdf();
508
+        $pdf = new Cezpdf();
509 509
         $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
510 510
         $pdf->ezSetMargins(30, 30, 50, 30);
511 511
         $pdf->ezSetY(810);
512
-        $pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
513
-        $pdf->line(50,790,550,790);
514
-        $pdf->line(50,40,550,40);
512
+        $pdf->ezText(get_lang('FlatView').' ('.api_convert_and_format_date(null, DATE_FORMAT_SHORT).' '.api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).')', 12, array('justification'=>'center'));
513
+        $pdf->line(50, 790, 550, 790);
514
+        $pdf->line(50, 40, 550, 40);
515 515
         $pdf->ezSetY(750);
516 516
         $pdf->ezTable(
517 517
             $newarray,
@@ -528,57 +528,57 @@  discard block
 block discarded – undo
528 528
         $pdf->ezStream();
529 529
         exit;
530 530
     }
531
-} elseif (!empty($_GET['export_certificate'])){
531
+} elseif (!empty($_GET['export_certificate'])) {
532 532
     //@todo this code seems not to be used
533 533
     $user_id = strval(intval($_GET['user']));
534
-    if (!api_is_allowed_to_edit(true,true)) {
534
+    if (!api_is_allowed_to_edit(true, true)) {
535 535
         $user_id = api_get_user_id();
536 536
     }
537
-    $category = Category :: load ($_GET['cat_id']);
537
+    $category = Category :: load($_GET['cat_id']);
538 538
     if ($category[0]->is_certificate_available($user_id)) {
539 539
         $user = api_get_user_info($user_id);
540 540
         $scoredisplay = ScoreDisplay :: instance();
541 541
         $scorecourse = $category[0]->calc_score($user_id);
542
-        $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
542
+        $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
543 543
 
544 544
         $cattotal = Category :: load(0);
545
-        $scoretotal= $cattotal[0]->calc_score($user_id);
546
-        $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
545
+        $scoretotal = $cattotal[0]->calc_score($user_id);
546
+        $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
547 547
 
548 548
         //prepare all necessary variables:
549 549
         $organization_name = api_get_setting('Institution');
550 550
         $portal_name = api_get_setting('siteName');
551 551
         $stud_fn = $user['firstname'];
552 552
         $stud_ln = $user['lastname'];
553
-        $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'),$organization_name,$stud_fn.' '.$stud_ln,$category[0]->get_name(),$scorecourse_display);
554
-        $certif_text = str_replace("\\n","\n",$certif_text);
553
+        $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'), $organization_name, $stud_fn.' '.$stud_ln, $category[0]->get_name(), $scorecourse_display);
554
+        $certif_text = str_replace("\\n", "\n", $certif_text);
555 555
         $date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
556 556
 
557
-        $pdf= new Cezpdf('a4','landscape');
557
+        $pdf = new Cezpdf('a4', 'landscape');
558 558
         $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
559 559
         $pdf->ezSetMargins(30, 30, 50, 50);
560 560
         //line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
561
-        $pdf->line(50,50,790,50);
562
-        $pdf->line(50,550,790,550);
561
+        $pdf->line(50, 50, 790, 50);
562
+        $pdf->line(50, 550, 790, 550);
563 563
         $pdf->ezSetY(450);
564 564
         $pdf->ezSetY(480);
565
-        $pdf->ezText($certif_text,28,array('justification'=>'center'));
565
+        $pdf->ezText($certif_text, 28, array('justification'=>'center'));
566 566
         //$pdf->ezSetY(750);
567 567
         $pdf->ezSetY(50);
568
-        $pdf->ezText($date,18,array('justification'=>'center'));
568
+        $pdf->ezText($date, 18, array('justification'=>'center'));
569 569
         $pdf->ezSetY(580);
570
-        $pdf->ezText($organization_name,22,array('justification'=>'left'));
570
+        $pdf->ezText($organization_name, 22, array('justification'=>'left'));
571 571
         $pdf->ezSetY(580);
572
-        $pdf->ezText($portal_name,22,array('justification'=>'right'));
572
+        $pdf->ezText($portal_name, 22, array('justification'=>'right'));
573 573
         $pdf->ezStream();
574 574
     }
575 575
     exit;
576 576
 } else {
577
-    $cats= Category :: load($category);
578
-    $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
579
-    $allcat= $cats[0]->get_subcategories($stud_id);
580
-    $alleval= $cats[0]->get_evaluations($stud_id);
581
-    $alllink= $cats[0]->get_links($stud_id);
577
+    $cats = Category :: load($category);
578
+    $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
579
+    $allcat = $cats[0]->get_subcategories($stud_id);
580
+    $alleval = $cats[0]->get_evaluations($stud_id);
581
+    $alllink = $cats[0]->get_links($stud_id);
582 582
 }
583 583
 $addparams = array('selectcat' => $cats[0]->get_id());
584 584
 if (isset($_GET['search'])) {
@@ -587,10 +587,10 @@  discard block
 block discarded – undo
587 587
 if (isset ($_GET['studentoverview'])) {
588 588
     $addparams['studentoverview'] = '';
589 589
 }
590
-if (isset($allcat_info) && count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
591
-    $allcat=$allcat_info;
590
+if (isset($allcat_info) && count($allcat_info) >= 0 && (isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search']) && strlen(trim($_GET['search'])) > 0) {
591
+    $allcat = $allcat_info;
592 592
 } else {
593
-    $allcat=$allcat;
593
+    $allcat = $allcat;
594 594
 }
595 595
 $gradebooktable = new GradebookTable(
596 596
     $cats[0],
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
     api_is_course_tutor()
604 604
 ) {
605 605
     Display :: display_normal_message(
606
-        get_lang('GradebookWelcomeMessage') .
606
+        get_lang('GradebookWelcomeMessage').
607 607
         '<br /><br />
608
-        <form name="createcat" method="post" action="' . api_get_self() . '?createallcategories=1">
609
-        <input type="submit" value="' . get_lang('CreateAllCat') . '"></form>',
608
+        <form name="createcat" method="post" action="' . api_get_self().'?createallcategories=1">
609
+        <input type="submit" value="' . get_lang('CreateAllCat').'"></form>',
610 610
         false
611 611
     );
612 612
 }
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_result.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 //$cidReset = true;
9 9
 require_once __DIR__.'/../inc/global.inc.php';
10
-$current_course_tool  = TOOL_GRADEBOOK;
10
+$current_course_tool = TOOL_GRADEBOOK;
11 11
 
12 12
 api_protect_course_script(true);
13 13
 api_block_anonymous_users();
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
     $resultadd,
26 26
     'add_result_form',
27 27
     null,
28
-    api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . $selectEval.'&'.api_get_cidreq()
28
+    api_get_self().'?selectcat='.Security::remove_XSS($category).'&selecteval='.$selectEval.'&'.api_get_cidreq()
29 29
 );
30 30
 $table = $add_result_form->toHtml();
31 31
 if ($add_result_form->validate()) {
32 32
     $values = $add_result_form->exportValues();
33 33
     $nr_users = $values['nr_users'];
34 34
     if ($nr_users == '0') {
35
-        header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . $selectEval.'&'.api_get_cidreq());
35
+        header('Location: gradebook_view_result.php?addresultnostudents=&selecteval='.$selectEval.'&'.api_get_cidreq());
36 36
         exit;
37 37
     }
38 38
     $scores = ($values['score']);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $res->add();
46 46
         next($scores);
47 47
     }
48
-    header('Location: gradebook_view_result.php?addresult=&selecteval=' . $selectEval.'&'.api_get_cidreq());
48
+    header('Location: gradebook_view_result.php?addresult=&selecteval='.$selectEval.'&'.api_get_cidreq());
49 49
     exit;
50 50
 }
51 51
 $interbreadcrumb[] = array(
Please login to merge, or discard this patch.
main/help/faq.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300')
30 30
     );
31 31
     $form->addButtonSave(get_lang('Ok'), 'faq_submit');
32
-    $faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/faq.html');
32
+    $faq_content = @(string) file_get_contents(api_get_path(SYS_APP_PATH).'home/faq.html');
33 33
     $faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
34 34
     $form->setDefaults(array('faq_content' => $faq_content));
35 35
     if ($form->validate()) {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $form->display();
48 48
     }
49 49
 } else {
50
-	$faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file);
50
+	$faq_content = @(string) file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file);
51 51
 	$faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
52 52
 	echo $faq_content;
53 53
 }
Please login to merge, or discard this patch.
main/badge/issued.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $issue = isset($_REQUEST['issue']) ? intval($_REQUEST['issue']) : 0;
13 13
 
14 14
 if (!$issue) {
15
-    header('Location: ' . api_get_path(WEB_PATH));
15
+    header('Location: '.api_get_path(WEB_PATH));
16 16
     exit;
17 17
 }
18 18
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         Display::return_message(get_lang('TheUserXNotYetAchievedTheSkillX'), 'error')
27 27
     );
28 28
 
29
-    header('Location: ' . api_get_path(WEB_PATH));
29
+    header('Location: '.api_get_path(WEB_PATH));
30 30
     exit;
31 31
 }
32 32
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         Display::return_message(get_lang('NoResults'), 'error')
39 39
     );
40 40
 
41
-    header('Location: ' . api_get_path(WEB_PATH));
41
+    header('Location: '.api_get_path(WEB_PATH));
42 42
     exit;
43 43
 }
44 44
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     $entityManager->persist($skillIssue);
178 178
     $entityManager->flush();
179 179
 
180
-    header("Location: " . $skillIssue->getIssueUrl());
180
+    header("Location: ".$skillIssue->getIssueUrl());
181 181
     exit;
182 182
 }
183 183
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     $entityManager->persist($skillUserComment);
209 209
     $entityManager->flush();
210 210
 
211
-    header("Location: " . $skillIssue->getIssueUrl());
211
+    header("Location: ".$skillIssue->getIssueUrl());
212 212
     exit;
213 213
 }
214 214
 
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
         $backpack = $configBackpack;
225 225
     }
226 226
 
227
-    $htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>';
227
+    $htmlHeadXtra[] = '<script src="'.$backpack.'issuer.js"></script>';
228 228
     $objSkill = new Skill();
229 229
     $assertionUrl = $skillIssueInfo['badge_assertion'];
230 230
     $skills = $objSkill->get($skillId);
231
-    $unbakedBadge = api_get_path(SYS_UPLOAD_PATH) . "badges/".$skills['icon'];
231
+    $unbakedBadge = api_get_path(SYS_UPLOAD_PATH)."badges/".$skills['icon'];
232 232
     if (!is_file($unbakedBadge)) {
233 233
         $unbakedBadge = api_get_path(WEB_CODE_PATH).'img/icons/128/badges-default.png';
234 234
     }
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
             mkdir($bakedBadge, api_get_permissions_for_new_directories(), true);
247 247
         }
248 248
         $skillRelUserId = $skillIssueInfo['id'];
249
-        if (!file_exists($bakedBadge . "/badge_" . $skillRelUserId)) {
250
-            file_put_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png", $bakedInfo);
249
+        if (!file_exists($bakedBadge."/badge_".$skillRelUserId)) {
250
+            file_put_contents($bakedBadge."/badge_".$skillRelUserId.".png", $bakedInfo);
251 251
         }
252 252
 
253 253
         //Process to validate a baked badge
254
-        $badgeContent = file_get_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png");
254
+        $badgeContent = file_get_contents($bakedBadge."/badge_".$skillRelUserId.".png");
255 255
         $verifyBakedBadge = $png->extractBadgeInfo($badgeContent);
256 256
         if (!is_array($verifyBakedBadge)) {
257 257
             $badgeInfoError = true;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
         if (!$badgeInfoError) {
261 261
             $personalBadge = UserManager::getUserPathById($userId, "web");
262
-            $personalBadge = $personalBadge."badges/badge_" . $skillRelUserId . ".png";
262
+            $personalBadge = $personalBadge."badges/badge_".$skillRelUserId.".png";
263 263
         }
264 264
     }
265 265
 }
Please login to merge, or discard this patch.
main/admin/sub_language.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 $this_section = SECTION_PLATFORM_ADMIN;
12 12
 
13 13
 api_protect_admin_script();
14
-$htmlHeadXtra[] ='<script>
14
+$htmlHeadXtra[] = '<script>
15 15
  $(document).ready(function() {
16 16
 	$(".save").click(function() {
17 17
 		var button_name=$(this).attr("name");
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 				    \'new_language\': is_new_language,
37 37
 				    \'variable_language\': is_variable_language,
38 38
 				    \'file_id\': file_id,
39
-				    \'id\': ' . intval($_REQUEST['id']) . ',
40
-                    \'sub\': ' . intval($_REQUEST['sub_language_id']) . ',
41
-                    \'sub_language_id\': ' . intval($_REQUEST['sub_language_id']) . '
39
+				    \'id\': ' . intval($_REQUEST['id']).',
40
+                    \'sub\': ' . intval($_REQUEST['sub_language_id']).',
41
+                    \'sub_language_id\': ' . intval($_REQUEST['sub_language_id']).'
42 42
 				},
43 43
 				success: function(datos) {
44 44
 					if (datos == "1") {
45
-						$("#div_message_information_id").html(\'' . Display::return_message(get_lang('TheNewWordHasBeenAdded'), 'success') . '\');
45
+						$("#div_message_information_id").html(\'' . Display::return_message(get_lang('TheNewWordHasBeenAdded'), 'success').'\');
46 46
 					} else {
47 47
 						$("#div_message_information_id").html("<div class=\"alert alert-warning\">" + datos +"</div>");
48 48
 					}
49 49
 				}
50 50
 			});
51 51
 		} else {
52
-			$("#div_message_information_id").html(\'' . Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'error') . '\');
52
+			$("#div_message_information_id").html(\'' . Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'error').'\');
53 53
 		}
54 54
 	});
55 55
 });
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 // setting the name of the tool
61 61
 $tool_name = get_lang('CreateSubLanguage');
62 62
 // setting breadcrumbs
63
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
64
-$interbreadcrumb[] = array ('url' => 'languages.php', 'name' => get_lang('PlatformLanguages'));
63
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
64
+$interbreadcrumb[] = array('url' => 'languages.php', 'name' => get_lang('PlatformLanguages'));
65 65
 
66 66
 $sublanguage_folder_error = false;
67 67
 
68
-if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) {
69
-	$language_name              = SubLanguageManager::get_name_of_language_by_id ($_GET['id']);
70
-	$sub_language_name          = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']);
68
+if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) {
69
+	$language_name              = SubLanguageManager::get_name_of_language_by_id($_GET['id']);
70
+	$sub_language_name          = SubLanguageManager::get_name_of_language_by_id($_GET['sub_language_id']);
71 71
 	$all_data_of_language       = SubLanguageManager::get_all_information_of_language($_GET['id']);
72 72
 	$all_data_of_sublanguage    = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']);
73 73
 	$sub_language_file          = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder'];
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 	if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) {
76 76
 		$sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable');
77 77
 	}
78
-	if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) {
78
+	if (SubLanguageManager::check_if_exist_language_by_id($_GET['id']) === true) {
79 79
 		$language_id_exist = true;
80 80
 	} else {
81 81
 		$language_id_exist = false;
82 82
 	}
83 83
 } else {
84
-	$language_name='';
85
-	$language_id_exist=false;
84
+	$language_name = '';
85
+	$language_id_exist = false;
86 86
 }
87 87
 
88 88
 $intro = sprintf(get_lang('RegisterTermsOfSubLanguageForX'), strtolower($sub_language_name));
89 89
 $path_folder = api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder'];
90 90
 
91
-if (!is_dir($path_folder) || strlen($all_data_of_language['dokeos_folder'])==0) {
91
+if (!is_dir($path_folder) || strlen($all_data_of_language['dokeos_folder']) == 0) {
92 92
 	api_not_allowed(true);
93 93
 }
94 94
 
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 echo '</div>';
102 102
 echo '<br />';
103 103
 $txt_search_word = (!empty($_REQUEST['txt_search_word']) ? Security::remove_XSS($_REQUEST['txt_search_word']) : '');
104
-$html ='<div style="float:left" class="actions">';
105
-$html.='<form style="float:left"  id="Searchlanguage" name="Searchlanguage" method="GET" action="sub_language.php">';
106
-$html.='&nbsp;'.get_lang('OriginalName').'&nbsp; :&nbsp;';
104
+$html = '<div style="float:left" class="actions">';
105
+$html .= '<form style="float:left"  id="Searchlanguage" name="Searchlanguage" method="GET" action="sub_language.php">';
106
+$html .= '&nbsp;'.get_lang('OriginalName').'&nbsp; :&nbsp;';
107 107
 
108
-$html.='<input name="id" type="hidden"  id="id" value="'.Security::remove_XSS($_REQUEST['id']).'" />';
109
-$html.='<input name="sub_language_id" type="hidden"  id="id" value="'.Security::remove_XSS($_REQUEST['sub_language_id']).'" />';
110
-$html.='<input name="txt_search_word" type="text" size="50"  id="txt_search_word" value="'.$txt_search_word.'" />';
111
-$html.="&nbsp;".'<button name="SubmitSearchLanguage" class="search" type="submit">'.get_lang('Search').'</button>';
112
-$html.='</form>';
113
-$html.='</div>';
108
+$html .= '<input name="id" type="hidden"  id="id" value="'.Security::remove_XSS($_REQUEST['id']).'" />';
109
+$html .= '<input name="sub_language_id" type="hidden"  id="id" value="'.Security::remove_XSS($_REQUEST['sub_language_id']).'" />';
110
+$html .= '<input name="txt_search_word" type="text" size="50"  id="txt_search_word" value="'.$txt_search_word.'" />';
111
+$html .= "&nbsp;".'<button name="SubmitSearchLanguage" class="search" type="submit">'.get_lang('Search').'</button>';
112
+$html .= '</form>';
113
+$html .= '</div>';
114 114
 echo $html;
115 115
 echo '<br /><br /><br />';
116 116
 if (!empty($sublanguage_folder_error)) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	$language_files_to_load_keys = array_flip($language_files_to_load);
147 147
 	$array_to_search = $parent_language_array;
148 148
 	$list_info = array();
149
-	$term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i';
149
+	$term = '/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i';
150 150
 	//@todo optimize this foreach
151 151
 	foreach ($language_files_to_load as $lang_file) {
152 152
 		//searching in parent language of the sub language
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				}
160 160
 				$founded = false;
161 161
 				// searching the item in the parent tool
162
-				if (preg_match($term,$parent_variable_value)!==0) {
162
+				if (preg_match($term, $parent_variable_value) !== 0) {
163 163
 					$founded = true;
164 164
 				}
165 165
 				if ($founded) {
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 						$size =4;
176 176
 					}*/
177 177
 
178
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>';
179
-					$obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'"  />'.get_lang('Save').'</button>';
178
+					$obj_text = '<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>';
179
+					$obj_button = '<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'"  />'.get_lang('Save').'</button>';
180 180
 
181 181
 					$list_info[] = array(
182
-						$lang_file . '.inc.php',
182
+						$lang_file.'.inc.php',
183 183
 						$parent_name_variable,
184 184
 						$english_name_variable,
185 185
 						$parent_variable_value,
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
 				$founded = false;
204 204
 				if ($search_in_english && $search_in_variable) {
205 205
 					// searching the item in the parent tool
206
-					if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) {
206
+					if (preg_match($term, $variable_value) !== 0 || preg_match($term, $name_variable) !== 0) {
207 207
 						$founded = true;
208 208
 					}
209 209
 				} else {
210 210
 					if ($search_in_english) {
211
-						if (preg_match($term,$variable_value)!==0) {
211
+						if (preg_match($term, $variable_value) !== 0) {
212 212
 							$founded = true;
213 213
 						}
214 214
 					} else {
215
-						if (preg_match($term,$name_variable)!==0) {
215
+						if (preg_match($term, $name_variable) !== 0) {
216 216
 							$founded = true;
217 217
 						}
218 218
 					}
@@ -229,16 +229,16 @@  discard block
 block discarded – undo
229 229
 						$parent_variable_value = $parent_language_array[$lang_file][$name_variable];
230 230
 					}
231 231
 					//config buttons
232
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.
232
+					$obj_text = '<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.
233 233
 						$sub_language_name_variable.'
234 234
 						</textarea>';
235
-					$obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
235
+					$obj_button = '<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
236 236
 
237 237
 					//loading variable from the english array
238 238
 					$english_name_variable = $english_language_array[$lang_file][$name_variable];
239 239
 
240 240
 					$list_info[] = array(
241
-						$lang_file . '.inc.php',
241
+						$lang_file.'.inc.php',
242 242
 						$name_variable,
243 243
 						$english_name_variable,
244 244
 						$parent_variable_value,
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 				$founded = false;
265 265
 				// searching the item in the parent tool
266
-				if (preg_match($term,$variable_value)!==0) {
266
+				if (preg_match($term, $variable_value) !== 0) {
267 267
 					$founded = true;
268 268
 				}
269 269
 				if ($founded) {
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 					$sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
272 272
 					$parent_variable_value = $parent_language_array[$lang_file][$name_variable];
273 273
 					//config buttons
274
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>';
275
-					$obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
274
+					$obj_text = '<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>';
275
+					$obj_button = '<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
276 276
 
277 277
 					//loading variable from the english array
278 278
 					$english_name_variable = $english_language_array[$lang_file][$name_variable];
279
-					$list_info[]=array($lang_file.'.inc.php',
279
+					$list_info[] = array($lang_file.'.inc.php',
280 280
 						$name_variable,
281 281
 						$english_name_variable,
282
-						$parent_variable_value,$obj_text,$obj_button);
282
+						$parent_variable_value, $obj_text, $obj_button);
283 283
 				}
284 284
 			}
285 285
 		}
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 $list_info = array();
294 294
 if (isset($_REQUEST['txt_search_word'])) {
295 295
 	//@todo fix to accept a char with 1 char
296
-	if (strlen(trim($_REQUEST['txt_search_word']))>2) {
296
+	if (strlen(trim($_REQUEST['txt_search_word'])) > 2) {
297 297
 		$list_info = search_language_term(
298 298
 			$_REQUEST['txt_search_word'],
299 299
 			true,
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
 	'sub_language_id' => intval($_GET['sub_language_id']),
310 310
 	'txt_search_word' => $txt_search_word
311 311
 );
312
-$table = new SortableTableFromArrayConfig($list_info, 1,20,'data_info');
312
+$table = new SortableTableFromArrayConfig($list_info, 1, 20, 'data_info');
313 313
 $table->set_additional_parameters($parameters);
314 314
 $table->set_header(0, get_lang('LanguageFile'));
315 315
 $table->set_header(1, get_lang('LanguageVariable'));
316 316
 $table->set_header(2, get_lang('EnglishName'));
317 317
 $table->set_header(3, get_lang('OriginalName'));
318
-$table->set_header(4, get_lang('Translation'),false);
319
-$table->set_header(5, get_lang('Action'),false);
318
+$table->set_header(4, get_lang('Translation'), false);
319
+$table->set_header(5, get_lang('Action'), false);
320 320
 $table->display();
321 321
 
322 322
 Display :: display_footer();
Please login to merge, or discard this patch.
main/admin/skill_edit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 if (!empty($jquery_ready_content)) {
80 80
     $htmlHeadXtra[] = '<script>
81 81
     $(document).ready(function(){
82
-        ' . $jquery_ready_content . '
82
+        ' . $jquery_ready_content.'
83 83
     });
84 84
     </script>';
85 85
 }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         );
110 110
     }
111 111
 
112
-    header('Location: '.api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
112
+    header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skill_list.php');
113 113
     exit;
114 114
 }
115 115
 
Please login to merge, or discard this patch.