Completed
Push — 1.11.x ( 04eda1...44c218 )
by José
105:08 queued 67:27
created
main/gradebook/gradebook.php 2 patches
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     GradebookUtils::block_students();
228 228
     if (isset ($_GET['set_visible'])) {
229 229
         $visibility_command= 1;
230
-    }else {
230
+    } else {
231 231
         $visibility_command= 0;
232 232
     }
233 233
     $link= LinkFactory :: load($_GET['visiblelink']);
@@ -281,8 +281,7 @@  discard block
 block discarded – undo
281 281
     if ($number_of_selected_items == '0') {
282 282
         $warning_message = get_lang('NoItemsSelected');
283 283
         $filter_warning_msg = false;
284
-    }
285
-    else {
284
+    } else {
286 285
         switch ($_POST['action']) {
287 286
             case 'deleted' :
288 287
                 $number_of_deleted_categories= 0;
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 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 '../inc/global.inc.php';
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  </script>';
33 33
 api_block_anonymous_users();
34 34
 
35
-$htmlHeadXtra[]= '<script>
35
+$htmlHeadXtra[] = '<script>
36 36
 function confirmation () {
37 37
 	if (confirm("'.get_lang('DeleteAll').'?")) {
38 38
 	    return true;
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 //this is called when there is no data for the course admin
49 49
 if (isset ($_GET['createallcategories'])) {
50 50
     GradebookUtils::block_students();
51
-    $coursecat= Category :: get_not_created_course_categories(api_get_user_id());
51
+    $coursecat = Category :: get_not_created_course_categories(api_get_user_id());
52 52
     if (!count($coursecat) == 0) {
53 53
         foreach ($coursecat as $row) {
54
-            $cat= new Category();
54
+            $cat = new Category();
55 55
             $cat->set_name($row[1]);
56 56
             $cat->set_course_code($row[0]);
57 57
             $cat->set_description(null);
@@ -67,33 +67,33 @@  discard block
 block discarded – undo
67 67
     exit;
68 68
 }
69 69
 //move a category
70
-$selectcat = isset($_GET['selectcat']) ?  (int) $_GET['selectcat'] : '';
70
+$selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : '';
71 71
 
72 72
 if (isset($_GET['movecat'])) {
73 73
     $move_cat = Security::remove_XSS($_GET['movecat']);
74 74
     GradebookUtils::block_students();
75
-    $cats= Category :: load($move_cat);
75
+    $cats = Category :: load($move_cat);
76 76
     if (!isset ($_GET['targetcat'])) {
77
-        $move_form= new CatForm(CatForm :: TYPE_MOVE,
77
+        $move_form = new CatForm(CatForm :: TYPE_MOVE,
78 78
             $cats[0],
79 79
             'move_cat_form',
80 80
             null,
81
-            api_get_self() . '?movecat=' . $move_cat. '&selectcat=' . $selectcat
81
+            api_get_self().'?movecat='.$move_cat.'&selectcat='.$selectcat
82 82
         );
83 83
         if ($move_form->validate()) {
84
-            header('Location: ' . api_get_self() . '?selectcat=' . $selectcat
85
-                . '&movecat=' . $move_cat
86
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
84
+            header('Location: '.api_get_self().'?selectcat='.$selectcat
85
+                . '&movecat='.$move_cat
86
+                . '&targetcat='.$move_form->exportValue('move_cat'));
87 87
             exit;
88 88
         }
89 89
     } else {
90
-        $get_target_cat=Security::remove_XSS($_GET['targetcat']);
91
-        $targetcat= Category :: load($get_target_cat);
90
+        $get_target_cat = Security::remove_XSS($_GET['targetcat']);
91
+        $targetcat = Category :: load($get_target_cat);
92 92
         $course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
93 93
 
94 94
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
95 95
             $cats[0]->move_to_cat($targetcat[0]);
96
-            header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . $selectcat);
96
+            header('Location: '.api_get_self().'?categorymoved=&selectcat='.$selectcat);
97 97
             exit;
98 98
         }
99 99
         unset($targetcat);
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 //move an evaluation
105 105
 if (isset ($_GET['moveeval'])) {
106 106
     GradebookUtils::block_students();
107
-    $get_move_eval=Security::remove_XSS($_GET['moveeval']);
108
-    $evals= Evaluation :: load($get_move_eval);
107
+    $get_move_eval = Security::remove_XSS($_GET['moveeval']);
108
+    $evals = Evaluation :: load($get_move_eval);
109 109
     if (!isset ($_GET['targetcat'])) {
110 110
 
111 111
         $move_form = new EvalForm(EvalForm :: TYPE_MOVE,
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
             null,
114 114
             'move_eval_form',
115 115
             null,
116
-            api_get_self() . '?moveeval=' . $get_move_eval. '&selectcat=' . $selectcat
116
+            api_get_self().'?moveeval='.$get_move_eval.'&selectcat='.$selectcat
117 117
         );
118 118
 
119 119
         if ($move_form->validate()) {
120
-            header('Location: ' .api_get_self() . '?selectcat=' . $selectcat
121
-                . '&moveeval=' . $get_move_eval
122
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
120
+            header('Location: '.api_get_self().'?selectcat='.$selectcat
121
+                . '&moveeval='.$get_move_eval
122
+                . '&targetcat='.$move_form->exportValue('move_cat'));
123 123
             exit;
124 124
         }
125 125
     } else {
126
-        $get_target_cat=Security::remove_XSS($_GET['targetcat']);
127
-        $targetcat= Category :: load($get_target_cat);
126
+        $get_target_cat = Security::remove_XSS($_GET['targetcat']);
127
+        $targetcat = Category :: load($get_target_cat);
128 128
         $course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
129 129
 
130 130
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
131 131
             $evals[0]->move_to_cat($targetcat[0]);
132
-            header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . $selectcat);
132
+            header('Location: '.api_get_self().'?evaluationmoved=&selectcat='.$selectcat);
133 133
             exit;
134 134
         }
135 135
         unset ($targetcat);
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 //move a link
141 141
 if (isset ($_GET['movelink'])) {
142 142
     GradebookUtils::block_students();
143
-    $get_move_link=Security::remove_XSS($_GET['movelink']);
144
-    $link= LinkFactory :: load($get_move_link);
143
+    $get_move_link = Security::remove_XSS($_GET['movelink']);
144
+    $link = LinkFactory :: load($get_move_link);
145 145
     $move_form = new LinkForm(
146 146
         LinkForm :: TYPE_MOVE,
147 147
         null,
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
         api_get_self().'?movelink='.$get_move_link.'&selectcat='.$selectcat
152 152
     );
153 153
     if ($move_form->validate()) {
154
-        $targetcat= Category :: load($move_form->exportValue('move_cat'));
154
+        $targetcat = Category :: load($move_form->exportValue('move_cat'));
155 155
         $link[0]->move_to_cat($targetcat[0]);
156 156
         unset ($link);
157
-        header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . $selectcat);
157
+        header('Location: '.api_get_self().'?linkmoved=&selectcat='.$selectcat);
158 158
         exit;
159 159
     }
160 160
 }
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 if (isset ($_GET['visiblecat'])) {
164 164
     GradebookUtils::block_students();
165 165
     if (isset ($_GET['set_visible'])) {
166
-        $visibility_command= 1;
166
+        $visibility_command = 1;
167 167
     } else {
168
-        $visibility_command= 0;
168
+        $visibility_command = 0;
169 169
     }
170
-    $cats= Category :: load($_GET['visiblecat']);
170
+    $cats = Category :: load($_GET['visiblecat']);
171 171
     $cats[0]->set_visible($visibility_command);
172 172
     $cats[0]->save();
173 173
     $cats[0]->apply_visibility_to_children();
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 }
183 183
 if (isset ($_GET['deletecat'])) {
184 184
     GradebookUtils::block_students();
185
-    $cats= Category :: load($_GET['deletecat']);
185
+    $cats = Category :: load($_GET['deletecat']);
186 186
     //delete all categories,subcategories and results
187 187
     if ($cats[0] != null) {
188 188
         if ($cats[0]->get_id() != 0) {
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 if (isset ($_GET['visibleeval'])) {
198 198
     GradebookUtils::block_students();
199 199
     if (isset ($_GET['set_visible'])) {
200
-        $visibility_command= 1;
200
+        $visibility_command = 1;
201 201
     } else {
202
-        $visibility_command= 0;
202
+        $visibility_command = 0;
203 203
     }
204 204
 
205
-    $eval= Evaluation :: load($_GET['visibleeval']);
205
+    $eval = Evaluation :: load($_GET['visibleeval']);
206 206
     $eval[0]->set_visible($visibility_command);
207 207
     $eval[0]->save();
208 208
     unset ($eval);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 }
217 217
 if (isset ($_GET['deleteeval'])) {
218 218
     GradebookUtils::block_students();
219
-    $eval= Evaluation :: load($_GET['deleteeval']);
219
+    $eval = Evaluation :: load($_GET['deleteeval']);
220 220
     if ($eval[0] != null) {
221 221
         $eval[0]->delete_with_results();
222 222
     }
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 if (isset ($_GET['visiblelink'])) {
228 228
     GradebookUtils::block_students();
229 229
     if (isset ($_GET['set_visible'])) {
230
-        $visibility_command= 1;
231
-    }else {
232
-        $visibility_command= 0;
230
+        $visibility_command = 1;
231
+    } else {
232
+        $visibility_command = 0;
233 233
     }
234
-    $link= LinkFactory :: load($_GET['visiblelink']);
234
+    $link = LinkFactory :: load($_GET['visiblelink']);
235 235
     $link[0]->set_visible($visibility_command);
236 236
     $link[0]->save();
237 237
     unset ($link);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     GradebookUtils::block_students();
248 248
     //fixing #5229
249 249
     if (!empty($_GET['deletelink'])) {
250
-        $link= LinkFactory :: load($_GET['deletelink']);
250
+        $link = LinkFactory :: load($_GET['deletelink']);
251 251
         if ($link[0] != null) {
252 252
             $link[0]->delete();
253 253
         }
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
     }
265 265
     $button = '<form name="confirm"
266 266
                  method="post"
267
-                 action="'.api_get_self() .'?confirm='
268
-        .(isset($_GET['movecat']) ? '&movecat=' . Security::remove_XSS($_GET['movecat'])
269
-            : '&moveeval=' . Security::remove_XSS($_GET['moveeval']) ).'&selectcat=' . $selectcat.'&targetcat=' . Security::remove_XSS($_GET['targetcat']).'">
267
+                 action="'.api_get_self().'?confirm='
268
+        .(isset($_GET['movecat']) ? '&movecat='.Security::remove_XSS($_GET['movecat'])
269
+            : '&moveeval='.Security::remove_XSS($_GET['moveeval'])).'&selectcat='.$selectcat.'&targetcat='.Security::remove_XSS($_GET['targetcat']).'">
270 270
 			   <input type="submit" value="'.'  '.get_lang('Ok').'  '.'">
271 271
 			   </form>';
272 272
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 //actions on the sortabletable
277 277
 if (isset ($_POST['action'])) {
278 278
     GradebookUtils::block_students();
279
-    $number_of_selected_items= count($_POST['id']);
279
+    $number_of_selected_items = count($_POST['id']);
280 280
     if ($number_of_selected_items == '0') {
281 281
         $warning_message = get_lang('NoItemsSelected');
282 282
         $filter_warning_msg = false;
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
     else {
285 285
         switch ($_POST['action']) {
286 286
             case 'deleted' :
287
-                $number_of_deleted_categories= 0;
288
-                $number_of_deleted_evaluations= 0;
289
-                $number_of_deleted_links= 0;
287
+                $number_of_deleted_categories = 0;
288
+                $number_of_deleted_evaluations = 0;
289
+                $number_of_deleted_links = 0;
290 290
                 foreach ($_POST['id'] as $indexstr) {
291 291
                     if (api_substr($indexstr, 0, 4) == 'CATE') {
292
-                        $cats= Category :: load(api_substr($indexstr, 4));
292
+                        $cats = Category :: load(api_substr($indexstr, 4));
293 293
                         if ($cats[0] != null) {
294 294
                             $cats[0]->delete_all();
295 295
                         }
296 296
                         $number_of_deleted_categories++;
297 297
                     }
298 298
                     if (api_substr($indexstr, 0, 4) == 'EVAL') {
299
-                        $eval= Evaluation :: load(api_substr($indexstr, 4));
299
+                        $eval = Evaluation :: load(api_substr($indexstr, 4));
300 300
                         if ($eval[0] != null) {
301 301
                             $eval[0]->delete_with_results();
302 302
                         }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                     if (api_substr($indexstr, 0, 4) == 'LINK') {
306 306
                         $id = api_substr($indexstr, 4);
307 307
                         if (!empty($id)) {
308
-                            $link= LinkFactory :: load();
308
+                            $link = LinkFactory :: load();
309 309
                             if ($link[0] != null) {
310 310
                                 $link[0]->delete();
311 311
                             }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                         }
314 314
                     }
315 315
                 }
316
-                $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>';
316
+                $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 317
                 $filter_confirm_msg = false;
318 318
                 break;
319 319
             case 'setvisible' :
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 }
366 366
 
367 367
 if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
368
-    header('Location: ' . api_get_self() . '?selectcat=' . $selectcat
368
+    header('Location: '.api_get_self().'?selectcat='.$selectcat
369 369
         . '&search='.Security::remove_XSS($_POST['keyword']));
370 370
     exit;
371 371
 }
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 // DISPLAY HEADERS AND MESSAGES                           -
374 374
 if (!isset($_GET['exportpdf']) && !isset($_GET['export_certificate'])) {
375 375
     if (isset ($_GET['studentoverview'])) {
376
-        $interbreadcrumb[]= array (
377
-            'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $selectcat.'&'.api_get_cidreq(),
376
+        $interbreadcrumb[] = array(
377
+            'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat.'&'.api_get_cidreq(),
378 378
             'name' => get_lang('ToolGradebook')
379 379
         );
380 380
         Display :: display_header(get_lang('FlatView'));
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
             $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']);
386 386
         }
387 387
 
388
-        $interbreadcrumb[]= array ('url' => $gradebook_dest,'name' => get_lang('Gradebook'));
388
+        $interbreadcrumb[] = array('url' => $gradebook_dest, 'name' => get_lang('Gradebook'));
389 389
 
390
-        if ((isset($_GET['selectcat']) && $_GET['selectcat']>0)) {
390
+        if ((isset($_GET['selectcat']) && $_GET['selectcat'] > 0)) {
391 391
             if (!empty($_GET['course'])) {
392
-                $interbreadcrumb[]= array ('url' => $gradebook_dest.'selectcat='.$selectcat,'name' => get_lang('Details'));
392
+                $interbreadcrumb[] = array('url' => $gradebook_dest.'selectcat='.$selectcat, 'name' => get_lang('Details'));
393 393
             } else {
394
-                $interbreadcrumb[]= array ('url' => $_SESSION['gradebook_dest'].'?selectcat=0','name' => get_lang('Details'));
394
+                $interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'].'?selectcat=0', 'name' => get_lang('Details'));
395 395
             }
396 396
         }
397 397
         Display :: display_header('');
@@ -401,50 +401,50 @@  discard block
 block discarded – undo
401 401
 }
402 402
 
403 403
 if (isset($_GET['categorymoved'])) {
404
-    Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
404
+    Display :: display_confirmation_message(get_lang('CategoryMoved'), false);
405 405
 }
406 406
 if (isset($_GET['evaluationmoved'])) {
407
-    Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
407
+    Display :: display_confirmation_message(get_lang('EvaluationMoved'), false);
408 408
 }
409 409
 if (isset($_GET['linkmoved'])) {
410
-    Display :: display_confirmation_message(get_lang('LinkMoved'),false);
410
+    Display :: display_confirmation_message(get_lang('LinkMoved'), false);
411 411
 }
412 412
 if (isset ($_GET['addcat'])) {
413
-    Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
413
+    Display :: display_confirmation_message(get_lang('CategoryAdded'), false);
414 414
 }
415 415
 if (isset ($_GET['linkadded'])) {
416
-    Display :: display_confirmation_message(get_lang('LinkAdded'),false);
416
+    Display :: display_confirmation_message(get_lang('LinkAdded'), false);
417 417
 }
418 418
 if (isset ($_GET['addresult'])) {
419
-    Display :: display_confirmation_message(get_lang('ResultAdded'),false);
419
+    Display :: display_confirmation_message(get_lang('ResultAdded'), false);
420 420
 }
421 421
 if (isset ($_GET['editcat'])) {
422
-    Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
422
+    Display :: display_confirmation_message(get_lang('CategoryEdited'), false);
423 423
 }
424 424
 if (isset ($_GET['editeval'])) {
425
-    Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
425
+    Display :: display_confirmation_message(get_lang('EvaluationEdited'), false);
426 426
 }
427 427
 if (isset ($_GET['linkedited'])) {
428
-    Display :: display_confirmation_message(get_lang('LinkEdited'),false);
428
+    Display :: display_confirmation_message(get_lang('LinkEdited'), false);
429 429
 }
430 430
 if (isset ($_GET['nolinkitems'])) {
431
-    Display :: display_warning_message(get_lang('NoLinkItems'),false);
431
+    Display :: display_warning_message(get_lang('NoLinkItems'), false);
432 432
 }
433 433
 if (isset ($_GET['addallcat'])) {
434
-    Display :: display_normal_message(get_lang('AddAllCat'),false);
434
+    Display :: display_normal_message(get_lang('AddAllCat'), false);
435 435
 }
436 436
 if (isset ($confirmation_message)) {
437
-    Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
437
+    Display :: display_confirmation_message($confirmation_message, $filter_confirm_msg);
438 438
 }
439 439
 if (isset ($warning_message)) {
440
-    Display :: display_warning_message($warning_message,$filter_warning_msg);
440
+    Display :: display_warning_message($warning_message, $filter_warning_msg);
441 441
 }
442 442
 if (isset ($move_form)) {
443
-    Display :: display_normal_message($move_form->toHtml(),false);
443
+    Display :: display_normal_message($move_form->toHtml(), false);
444 444
 }
445 445
 // LOAD DATA & DISPLAY TABLE                             -
446
-$is_platform_admin= api_is_platform_admin();
447
-$is_course_admin= api_is_allowed_to_edit();
446
+$is_platform_admin = api_is_platform_admin();
447
+$is_course_admin = api_is_allowed_to_edit();
448 448
 
449 449
 //load data for category, evaluation and links
450 450
 if (empty($selectcat)) {
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
     null,
462 462
     api_get_self().'?selectcat='.$selectcat
463 463
 );
464
-$values= $simple_search_form->exportValues();
464
+$values = $simple_search_form->exportValues();
465 465
 $keyword = '';
466 466
 if (isset($_GET['search']) && !empty($_GET['search'])) {
467 467
     $keyword = Security::remove_XSS($_GET['search']);
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
 }
472 472
 
473 473
 if (!empty($keyword)) {
474
-    $cats= Category :: load($category);
475
-    $allcat= array ();
476
-    if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
477
-        $allcat= $cats[0]->get_subcategories(null);
478
-        $allcat_info = Category::find_category($keyword,$allcat);
479
-        $alleval=array();
480
-        $alllink=array();
474
+    $cats = Category :: load($category);
475
+    $allcat = array();
476
+    if ((isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search'])) {
477
+        $allcat = $cats[0]->get_subcategories(null);
478
+        $allcat_info = Category::find_category($keyword, $allcat);
479
+        $alleval = array();
480
+        $alllink = array();
481 481
     } else {
482 482
         $alleval = Evaluation::find_evaluations($keyword, $cats[0]->get_id());
483 483
         $alllink = LinkFactory::find_links($keyword, $cats[0]->get_id());
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 
486 486
 } elseif (isset ($_GET['studentoverview'])) {
487 487
     //@todo this code seems to be deprecated because the gradebook tab is off
488
-    $cats= Category :: load($category);
489
-    $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
490
-    $allcat= array ();
491
-    $alleval= $cats[0]->get_evaluations($stud_id, true);
492
-    $alllink= $cats[0]->get_links($stud_id, true);
488
+    $cats = Category :: load($category);
489
+    $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
490
+    $allcat = array();
491
+    $alleval = $cats[0]->get_evaluations($stud_id, true);
492
+    $alllink = $cats[0]->get_links($stud_id, true);
493 493
     if (isset ($_GET['exportpdf'])) {
494
-        $datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
494
+        $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink);
495 495
         $header_names = array(
496 496
             get_lang('Name'),
497 497
             get_lang('Description'),
@@ -499,18 +499,18 @@  discard block
 block discarded – undo
499 499
             get_lang('Date'),
500 500
             get_lang('Results'),
501 501
         );
502
-        $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
502
+        $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME, 0, null, true);
503 503
         $newarray = array();
504 504
         foreach ($data_array as $data) {
505 505
             $newarray[] = array_slice($data, 1);
506 506
         }
507
-        $pdf= new Cezpdf();
507
+        $pdf = new Cezpdf();
508 508
         $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
509 509
         $pdf->ezSetMargins(30, 30, 50, 30);
510 510
         $pdf->ezSetY(810);
511
-        $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'));
512
-        $pdf->line(50,790,550,790);
513
-        $pdf->line(50,40,550,40);
511
+        $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'));
512
+        $pdf->line(50, 790, 550, 790);
513
+        $pdf->line(50, 40, 550, 40);
514 514
         $pdf->ezSetY(750);
515 515
         $pdf->ezTable(
516 516
             $newarray,
@@ -527,57 +527,57 @@  discard block
 block discarded – undo
527 527
         $pdf->ezStream();
528 528
         exit;
529 529
     }
530
-} elseif (!empty($_GET['export_certificate'])){
530
+} elseif (!empty($_GET['export_certificate'])) {
531 531
     //@todo this code seems not to be used
532 532
     $user_id = strval(intval($_GET['user']));
533
-    if (!api_is_allowed_to_edit(true,true)) {
533
+    if (!api_is_allowed_to_edit(true, true)) {
534 534
         $user_id = api_get_user_id();
535 535
     }
536
-    $category = Category :: load ($_GET['cat_id']);
536
+    $category = Category :: load($_GET['cat_id']);
537 537
     if ($category[0]->is_certificate_available($user_id)) {
538 538
         $user = api_get_user_info($user_id);
539 539
         $scoredisplay = ScoreDisplay :: instance();
540 540
         $scorecourse = $category[0]->calc_score($user_id);
541
-        $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
541
+        $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
542 542
 
543 543
         $cattotal = Category :: load(0);
544
-        $scoretotal= $cattotal[0]->calc_score($user_id);
545
-        $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
544
+        $scoretotal = $cattotal[0]->calc_score($user_id);
545
+        $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
546 546
 
547 547
         //prepare all necessary variables:
548 548
         $organization_name = api_get_setting('Institution');
549 549
         $portal_name = api_get_setting('siteName');
550 550
         $stud_fn = $user['firstname'];
551 551
         $stud_ln = $user['lastname'];
552
-        $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'),$organization_name,$stud_fn.' '.$stud_ln,$category[0]->get_name(),$scorecourse_display);
553
-        $certif_text = str_replace("\\n","\n",$certif_text);
552
+        $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'), $organization_name, $stud_fn.' '.$stud_ln, $category[0]->get_name(), $scorecourse_display);
553
+        $certif_text = str_replace("\\n", "\n", $certif_text);
554 554
         $date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
555 555
 
556
-        $pdf= new Cezpdf('a4','landscape');
556
+        $pdf = new Cezpdf('a4', 'landscape');
557 557
         $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
558 558
         $pdf->ezSetMargins(30, 30, 50, 50);
559 559
         //line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
560
-        $pdf->line(50,50,790,50);
561
-        $pdf->line(50,550,790,550);
560
+        $pdf->line(50, 50, 790, 50);
561
+        $pdf->line(50, 550, 790, 550);
562 562
         $pdf->ezSetY(450);
563 563
         $pdf->ezSetY(480);
564
-        $pdf->ezText($certif_text,28,array('justification'=>'center'));
564
+        $pdf->ezText($certif_text, 28, array('justification'=>'center'));
565 565
         //$pdf->ezSetY(750);
566 566
         $pdf->ezSetY(50);
567
-        $pdf->ezText($date,18,array('justification'=>'center'));
567
+        $pdf->ezText($date, 18, array('justification'=>'center'));
568 568
         $pdf->ezSetY(580);
569
-        $pdf->ezText($organization_name,22,array('justification'=>'left'));
569
+        $pdf->ezText($organization_name, 22, array('justification'=>'left'));
570 570
         $pdf->ezSetY(580);
571
-        $pdf->ezText($portal_name,22,array('justification'=>'right'));
571
+        $pdf->ezText($portal_name, 22, array('justification'=>'right'));
572 572
         $pdf->ezStream();
573 573
     }
574 574
     exit;
575 575
 } else {
576
-    $cats= Category :: load($category);
577
-    $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
578
-    $allcat= $cats[0]->get_subcategories($stud_id);
579
-    $alleval= $cats[0]->get_evaluations($stud_id);
580
-    $alllink= $cats[0]->get_links($stud_id);
576
+    $cats = Category :: load($category);
577
+    $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
578
+    $allcat = $cats[0]->get_subcategories($stud_id);
579
+    $alleval = $cats[0]->get_evaluations($stud_id);
580
+    $alllink = $cats[0]->get_links($stud_id);
581 581
 }
582 582
 $addparams = array('selectcat' => $cats[0]->get_id());
583 583
 if (isset($_GET['search'])) {
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
 if (isset ($_GET['studentoverview'])) {
587 587
     $addparams['studentoverview'] = '';
588 588
 }
589
-if (isset($allcat_info) && count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
590
-    $allcat=$allcat_info;
589
+if (isset($allcat_info) && count($allcat_info) >= 0 && (isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search']) && strlen(trim($_GET['search'])) > 0) {
590
+    $allcat = $allcat_info;
591 591
 } else {
592
-    $allcat=$allcat;
592
+    $allcat = $allcat;
593 593
 }
594 594
 $gradebooktable = new GradebookTable(
595 595
     $cats[0],
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
     api_is_course_tutor()
603 603
 ) {
604 604
     Display :: display_normal_message(
605
-        get_lang('GradebookWelcomeMessage') .
605
+        get_lang('GradebookWelcomeMessage').
606 606
         '<br /><br />
607
-        <form name="createcat" method="post" action="' . api_get_self() . '?createallcategories=1">
608
-        <input type="submit" value="' . get_lang('CreateAllCat') . '"></form>',
607
+        <form name="createcat" method="post" action="' . api_get_self().'?createallcategories=1">
608
+        <input type="submit" value="' . get_lang('CreateAllCat').'"></form>',
609 609
         false
610 610
     );
611 611
 }
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_result.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@
 block discarded – undo
39 39
         $res->set_evaluation_id($values['evaluation_id']);
40 40
         $res->set_user_id(key($scores));
41 41
         //if no scores are given, don't set the score
42
-        if ((!empty ($row)) || ($row == '0')) $res->set_score($row);
42
+        if ((!empty ($row)) || ($row == '0')) {
43
+            $res->set_score($row);
44
+        }
43 45
         $res->add();
44 46
         next($scores);
45 47
     }
Please login to merge, or discard this 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 '../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/gradebook/gradebook_add_eval.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     null,
31 31
     'add_eval_form',
32 32
     null,
33
-    api_get_self() . '?selectcat=' . $select_cat.'&'.api_get_cidreq()
33
+    api_get_self().'?selectcat='.$select_cat.'&'.api_get_cidreq()
34 34
 );
35 35
 
36 36
 if ($form->validate()) {
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
             //header('Location: gradebook_add_user.php?selecteval=' . $eval->get_id());
70 70
             exit;
71 71
         } else {
72
-            header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
72
+            header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
73 73
             exit;
74 74
         }
75 75
     } else {
76 76
         $val_addresult = isset($values['addresult']) ? $values['addresult'] : null;
77 77
         if ($val_addresult == 1) {
78
-            header('Location: gradebook_add_result.php?selecteval=' . $eval->get_id().'&'.api_get_cidreq());
78
+            header('Location: gradebook_add_result.php?selecteval='.$eval->get_id().'&'.api_get_cidreq());
79 79
             exit;
80 80
         } else {
81
-            header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
81
+            header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
82 82
             exit;
83 83
         }
84 84
     }
85 85
 }
86 86
 
87 87
 $interbreadcrumb[] = array(
88
-    'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $select_cat.'&'.api_get_cidreq(),
88
+    'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$select_cat.'&'.api_get_cidreq(),
89 89
     'name' => get_lang('Gradebook'))
90 90
 ;
91 91
 $this_section = SECTION_COURSES;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
        $("#hid_category_id option:selected").each(function () {
97 97
            var cat_id = $(this).val();
98 98
             $.ajax({
99
-                url: "' . api_get_path(WEB_AJAX_PATH) . 'gradebook.ajax.php?a=get_gradebook_weight",
99
+                url: "' . api_get_path(WEB_AJAX_PATH).'gradebook.ajax.php?a=get_gradebook_weight",
100 100
                 data: "cat_id="+cat_id,
101 101
                 success: function(return_value) {
102 102
                     if (return_value != 0 ) {
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_link_select_course.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 require_once '../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();
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 $catadd = new Category();
17 17
 $catadd->set_user_id(api_get_user_id());
18 18
 $catadd->set_parent_id($_GET['selectcat']);
19
-$catcourse = Category :: load ($_GET['selectcat']);
19
+$catcourse = Category :: load($_GET['selectcat']);
20 20
 $form = new CatForm(
21 21
     CatForm :: TYPE_SELECT_COURSE,
22 22
     $catadd,
23 23
     'add_cat_form',
24 24
     null,
25
-    api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq()
25
+    api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq()
26 26
 );
27 27
 
28 28
 if ($form->validate()) {
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
     $cat = new Category();
31 31
     $cat->set_course_code($values['select_course']);
32 32
     $cat->set_name($values['name']);
33
-    header('location: gradebook_add_link.php?selectcat=' .Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
33
+    header('location: gradebook_add_link.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
34 34
     exit;
35 35
 }
36 36
 
37
-$interbreadcrumb[] = array (
37
+$interbreadcrumb[] = array(
38 38
     'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq(),
39 39
     'name' => get_lang('Gradebook')
40 40
 );
Please login to merge, or discard this patch.
main/gradebook/lib/fe/userform.class.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
 		}
32 32
 		if ($this->form_type == self :: TYPE_USER_INFO) {
33 33
 			$this->build_user_info_form();
34
-		}
35
-		elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
34
+		} elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
36 35
 			$this->build_simple_search();
37 36
 		}
38 37
 		$this->setDefaults();
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -9,71 +9,71 @@
 block discarded – undo
9 9
  */
10 10
 class UserForm extends FormValidator
11 11
 {
12
-	const TYPE_USER_INFO= 1;
13
-	const TYPE_SIMPLE_SEARCH = 3;
14
-	/**
15
-	 * Builds a form containing form items based on a given parameter
16
-	 * @param int form_type 1 = user_info
17
-	 * @param user array
18
-	 * @param string form name
19
-	 * @param method
20
-	 * @param action
21
-	 */
22
-	public function __construct($form_type, $user, $form_name, $method= 'post', $action= null)
23
-	{
24
-		parent :: __construct($form_name, $method, $action);
25
-		$this->form_type= $form_type;
26
-		if (isset ($user)) {
27
-			$this->user_info= $user;
28
-		}
29
-		if (isset ($result_object)) {
30
-			$this->result_object= $result_object;
31
-		}
32
-		if ($this->form_type == self :: TYPE_USER_INFO) {
33
-			$this->build_user_info_form();
34
-		}
35
-		elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
36
-			$this->build_simple_search();
37
-		}
38
-		$this->setDefaults();
39
-	}
12
+    const TYPE_USER_INFO= 1;
13
+    const TYPE_SIMPLE_SEARCH = 3;
14
+    /**
15
+     * Builds a form containing form items based on a given parameter
16
+     * @param int form_type 1 = user_info
17
+     * @param user array
18
+     * @param string form name
19
+     * @param method
20
+     * @param action
21
+     */
22
+    public function __construct($form_type, $user, $form_name, $method= 'post', $action= null)
23
+    {
24
+        parent :: __construct($form_name, $method, $action);
25
+        $this->form_type= $form_type;
26
+        if (isset ($user)) {
27
+            $this->user_info= $user;
28
+        }
29
+        if (isset ($result_object)) {
30
+            $this->result_object= $result_object;
31
+        }
32
+        if ($this->form_type == self :: TYPE_USER_INFO) {
33
+            $this->build_user_info_form();
34
+        }
35
+        elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
36
+            $this->build_simple_search();
37
+        }
38
+        $this->setDefaults();
39
+    }
40 40
 
41
-	protected function build_simple_search()
42
-	{
43
-		if (isset($_GET['search']) && (!empty($_GET['search']))) {
44
-			$this->setDefaults(array(
45
-				'keyword' => Security::remove_XSS($_GET['search'])
46
-			));
47
-		}
48
-		$renderer =& $this->defaultRenderer();
49
-		$renderer->setCustomElementTemplate('<span>{element}</span> ');
50
-		$this->addElement('text','keyword','');
51
-		$this->addButtonSearch(get_lang('Search'), 'submit');
52
-	}
41
+    protected function build_simple_search()
42
+    {
43
+        if (isset($_GET['search']) && (!empty($_GET['search']))) {
44
+            $this->setDefaults(array(
45
+                'keyword' => Security::remove_XSS($_GET['search'])
46
+            ));
47
+        }
48
+        $renderer =& $this->defaultRenderer();
49
+        $renderer->setCustomElementTemplate('<span>{element}</span> ');
50
+        $this->addElement('text','keyword','');
51
+        $this->addButtonSearch(get_lang('Search'), 'submit');
52
+    }
53 53
 
54
-	protected function build_user_info_form()
55
-	{
56
-		if (api_is_western_name_order()) {
57
-			$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
58
-			$this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
59
-		} else {
60
-			$this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
61
-			$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
62
-		}
63
-		$this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
64
-		$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>');
65
-		$this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
66
-		$this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
67
-		$this->addButtonSave(get_lang('Back'), 'submit');
68
-	}
54
+    protected function build_user_info_form()
55
+    {
56
+        if (api_is_western_name_order()) {
57
+            $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
58
+            $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
59
+        } else {
60
+            $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
61
+            $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
62
+        }
63
+        $this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
64
+        $this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>');
65
+        $this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
66
+        $this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
67
+        $this->addButtonSave(get_lang('Back'), 'submit');
68
+    }
69 69
 
70
-	function display()
71
-	{
72
-		parent :: display();
73
-	}
70
+    function display()
71
+    {
72
+        parent :: display();
73
+    }
74 74
 
75
-	function setDefaults($defaults= array(), $filter = null)
76
-	{
77
-		parent :: setDefaults($defaults, $filter);
78
-	}
75
+    function setDefaults($defaults= array(), $filter = null)
76
+    {
77
+        parent :: setDefaults($defaults, $filter);
78
+    }
79 79
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class UserForm extends FormValidator
11 11
 {
12
-	const TYPE_USER_INFO= 1;
12
+	const TYPE_USER_INFO = 1;
13 13
 	const TYPE_SIMPLE_SEARCH = 3;
14 14
 	/**
15 15
 	 * Builds a form containing form items based on a given parameter
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 	 * @param method
20 20
 	 * @param action
21 21
 	 */
22
-	public function __construct($form_type, $user, $form_name, $method= 'post', $action= null)
22
+	public function __construct($form_type, $user, $form_name, $method = 'post', $action = null)
23 23
 	{
24 24
 		parent :: __construct($form_name, $method, $action);
25
-		$this->form_type= $form_type;
25
+		$this->form_type = $form_type;
26 26
 		if (isset ($user)) {
27
-			$this->user_info= $user;
27
+			$this->user_info = $user;
28 28
 		}
29 29
 		if (isset ($result_object)) {
30
-			$this->result_object= $result_object;
30
+			$this->result_object = $result_object;
31 31
 		}
32 32
 		if ($this->form_type == self :: TYPE_USER_INFO) {
33 33
 			$this->build_user_info_form();
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 				'keyword' => Security::remove_XSS($_GET['search'])
46 46
 			));
47 47
 		}
48
-		$renderer =& $this->defaultRenderer();
48
+		$renderer = & $this->defaultRenderer();
49 49
 		$renderer->setCustomElementTemplate('<span>{element}</span> ');
50
-		$this->addElement('text','keyword','');
50
+		$this->addElement('text', 'keyword', '');
51 51
 		$this->addButtonSearch(get_lang('Search'), 'submit');
52 52
 	}
53 53
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
62 62
 		}
63 63
 		$this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
64
-		$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>');
64
+		$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:'.$this->user_info['email'].'">'.$this->user_info['email'].'</a>');
65 65
 		$this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
66 66
 		$this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
67 67
 		$this->addButtonSave(get_lang('Back'), 'submit');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		parent :: display();
73 73
 	}
74 74
 
75
-	function setDefaults($defaults= array(), $filter = null)
75
+	function setDefaults($defaults = array(), $filter = null)
76 76
 	{
77 77
 		parent :: setDefaults($defaults, $filter);
78 78
 	}
Please login to merge, or discard this patch.
main/gradebook/lib/fe/displaygradebook.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -558,7 +558,7 @@
 block discarded – undo
558 558
                     $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
559 559
                 }
560 560
                 if ($show_add_link && !$message_resource) {
561
-                   $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' .
561
+                    $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' .
562 562
                         Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . '</a>';
563 563
                     $cats = Category :: load($selectcat);
564 564
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -674,8 +674,9 @@
 block discarded – undo
674 674
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
675 675
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
676 676
             $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . $user['complete_name']. '</b><br />';
677
-            if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search'])))
678
-                $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
677
+            if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
678
+                            $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
679
+            }
679 680
             $scoreinfo.= '<br />' . get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
680 681
             Display :: display_normal_message($scoreinfo, false);
681 682
         }
Please login to merge, or discard this patch.
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -20,37 +20,37 @@  discard block
 block discarded – undo
20 20
         if (api_is_allowed_to_edit(null, true)) {
21 21
             $header = '<div class="actions">';
22 22
             if ($page != 'statistics') {
23
-                $header .= '<a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '&'.api_get_cidreq().'">' .
24
-                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
23
+                $header .= '<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat.'&'.api_get_cidreq().'">'.
24
+                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
25 25
                 if ($evalobj->get_course_code() == null) {
26 26
 
27 27
                 } elseif (!$evalobj->has_results()) {
28
-                    $header .= '<a href="gradebook_add_result.php?'.api_get_cidreq().'&selectcat=' . $selectcat . '&selecteval=' . $evalobj->get_id() . '">
29
-    				' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM) . '</a>';
28
+                    $header .= '<a href="gradebook_add_result.php?'.api_get_cidreq().'&selectcat='.$selectcat.'&selecteval='.$evalobj->get_id().'">
29
+    				' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM).'</a>';
30 30
                 }
31 31
 
32 32
                 if (api_is_platform_admin() || $evalobj->is_locked() == false) {
33
-                    $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&import=">' .
34
-                        Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM) . '</a>';
33
+                    $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&import=">'.
34
+                        Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM).'</a>';
35 35
                 }
36 36
 
37 37
                 if ($evalobj->has_results()) {
38
-                    $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&export=">' .
39
-                        Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM) . '</a>';
38
+                    $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&export=">'.
39
+                        Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM).'</a>';
40 40
 
41 41
                     if (api_is_platform_admin() || $evalobj->is_locked() == false) {
42
-                        $header .= '<a href="gradebook_edit_result.php?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '">' .
43
-                            Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM) . '</a>';
44
-                        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&deleteall=" onclick="return confirmationall();">' .
45
-                            Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM) . '</a>';
42
+                        $header .= '<a href="gradebook_edit_result.php?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'">'.
43
+                            Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM).'</a>';
44
+                        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&deleteall=" onclick="return confirmationall();">'.
45
+                            Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM).'</a>';
46 46
                     }
47 47
                 }
48 48
 
49
-                $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&print=&selecteval=' . $evalobj->get_id() . '" target="_blank">' .
50
-                    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>';
49
+                $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&print=&selecteval='.$evalobj->get_id().'" target="_blank">'.
50
+                    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
51 51
             } else {
52
-                $header .= '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' .
53
-                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
52
+                $header .= '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.
53
+                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
54 54
             }
55 55
             $header .= '</div>';
56 56
         }
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
             $score = $evalobj->calc_score();
70 70
 
71 71
             if ($score != null) {
72
-                $average = get_lang('Average') . ' :<b> ' . $scoredisplay->display_score($score, SCORE_AVERAGE) . '</b>';
72
+                $average = get_lang('Average').' :<b> '.$scoredisplay->display_score($score, SCORE_AVERAGE).'</b>';
73 73
                 $student_score = $evalobj->calc_score(api_get_user_id());
74 74
                 $student_score = Display::tag(
75 75
                     'h3',
76
-                    get_lang('Score') . ': ' . $scoredisplay->display_score($student_score, SCORE_DIV_PERCENT)
76
+                    get_lang('Score').': '.$scoredisplay->display_score($student_score, SCORE_DIV_PERCENT)
77 77
                 );
78 78
             }
79 79
         }
80 80
         $description = "";
81 81
         if (!$evalobj->get_description() == '') {
82
-            $description = get_lang('Description') . ' :<b> ' . $evalobj->get_description() . '</b><br>';
82
+            $description = get_lang('Description').' :<b> '.$evalobj->get_description().'</b><br>';
83 83
         }
84 84
 
85 85
         if ($evalobj->get_course_code() == null) {
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         $evalinfo = '<table width="100%" border="0"><tr><td>';
92
-        $evalinfo .= '<h2>' . $evalobj->get_name() . '</h2><hr>';
92
+        $evalinfo .= '<h2>'.$evalobj->get_name().'</h2><hr>';
93 93
         $evalinfo .= $description;
94
-        $evalinfo .= get_lang('Course') . ' :<b> ' . $course . '</b><br />';
95
-        $evalinfo .= get_lang('QualificationNumeric') . ' :<b> ' . $evalobj->get_max() . '</b><br>' . $average;
94
+        $evalinfo .= get_lang('Course').' :<b> '.$course.'</b><br />';
95
+        $evalinfo .= get_lang('QualificationNumeric').' :<b> '.$evalobj->get_max().'</b><br>'.$average;
96 96
 
97 97
         if (!api_is_allowed_to_edit()) {
98 98
             $evalinfo .= $student_score;
99 99
         }
100 100
 
101 101
         if (!$evalobj->has_results()) {
102
-            $evalinfo .= '<br /><i>' . get_lang('NoResultsInEvaluation') . '</i>';
102
+            $evalinfo .= '<br /><i>'.get_lang('NoResultsInEvaluation').'</i>';
103 103
         } elseif ($scoredisplay->is_custom() && api_get_self() != '/main/gradebook/gradebook_statistics.php') {
104 104
             if (api_is_allowed_to_edit(null, true)) {
105 105
                 if ($page != 'statistics') {
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
         }
110 110
         if ($page != 'statistics') {
111 111
             if (api_is_allowed_to_edit(null, true)) {
112
-                $evalinfo .= '<br /><a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' .
113
-                    Display::return_icon('statistics.png', get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM) . '</a>';
112
+                $evalinfo .= '<br /><a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.
113
+                    Display::return_icon('statistics.png', get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM).'</a>';
114 114
             }
115 115
         }
116 116
         $evalinfo .= '</td><td>'.Display::return_icon('tutorial.gif', '', ['style' => 'float:right; position:relative;']).'</td></table>';
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
     public function display_header_flatview($catobj, $showeval, $showlink, $simple_search_form)
128 128
     {
129 129
         $header = '<table border="0" cellpadding="5">';
130
-        $header .= '<td style="vertical-align: top;"><a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '">' . Display::return_icon('gradebook.gif') . get_lang('Gradebook') . '</a></td>';
131
-        $header .= '<td style="vertical-align: top;">' . get_lang('FilterCategory') . '</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
130
+        $header .= '<td style="vertical-align: top;"><a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('gradebook.gif').get_lang('Gradebook').'</a></td>';
131
+        $header .= '<td style="vertical-align: top;">'.get_lang('FilterCategory').'</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
132 132
         $cats = Category :: load();
133 133
         $tree = $cats[0]->get_tree();
134 134
         unset($cats);
@@ -137,35 +137,35 @@  discard block
 block discarded – undo
137 137
                 $line .= '&mdash;';
138 138
             }
139 139
             if ($_GET['selectcat'] == $cat[0]) {
140
-                $header .= '<option selected="selected" value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
140
+                $header .= '<option selected="selected" value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
141 141
             } else {
142
-                $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
142
+                $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
143 143
             }
144 144
             $line = '';
145 145
         }
146 146
         $header .= '</td></select></form>';
147 147
         if (!$catobj->get_id() == '0') {
148
-            $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">';
148
+            $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">';
149 149
             $header .= Display::return_icon('gradebook.gif', get_lang('Up'));
150 150
             $header .= '</a></td>';
151 151
         }
152
-        $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
152
+        $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
153 153
         $header .= '<td style="vertical-align: top;">
154
-                    <a href="' . api_get_self() . '?exportpdf=&offset=' . Security::remove_XSS($_GET['offset']) . '&search=' . Security::remove_XSS($_GET['search']) . '&selectcat=' . $catobj->get_id() . '">
154
+                    <a href="' . api_get_self().'?exportpdf=&offset='.Security::remove_XSS($_GET['offset']).'&search='.Security::remove_XSS($_GET['search']).'&selectcat='.$catobj->get_id().'">
155 155
                      '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).'
156
-                    ' . get_lang('ExportPDF') . '</a>';
156
+                    ' . get_lang('ExportPDF').'</a>';
157 157
         $header .= '<td style="vertical-align: top;">
158
-                    <a href="' . api_get_self() . '?print=&selectcat=' . $catobj->get_id() . '" target="_blank">
158
+                    <a href="' . api_get_self().'?print=&selectcat='.$catobj->get_id().'" target="_blank">
159 159
                      '.Display::return_icon('printer.png', get_lang('Print'), [], ICON_SIZE_MEDIUM).'
160
-                    ' . get_lang('Print') . '</a>';
160
+                    ' . get_lang('Print').'</a>';
161 161
         $header .= '</td></tr></table>';
162 162
         if (!$catobj->get_id() == '0') {
163
-            $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="' . api_get_self() . '?selectcat=' . $catobj->get_id() . '">
164
-            <input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" ' . (($showeval == '1') ? 'checked' : '') . '>Show Evaluations &nbsp;';
165
-            $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" ' . (($showlink == '1') ? 'checked' : '') . '>' . get_lang('ShowLinks') . '</form></td></tr></table>';
163
+            $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="'.api_get_self().'?selectcat='.$catobj->get_id().'">
164
+            <input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" ' . (($showeval == '1') ? 'checked' : '').'>Show Evaluations &nbsp;';
165
+            $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" '.(($showlink == '1') ? 'checked' : '').'>'.get_lang('ShowLinks').'</form></td></tr></table>';
166 166
         }
167 167
         if (isset($_GET['search'])) {
168
-            $header .= '<b>' . get_lang('SearchResults') . ' :</b>';
168
+            $header .= '<b>'.get_lang('SearchResults').' :</b>';
169 169
         }
170 170
         echo $header;
171 171
     }
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
             $select_cat = $catobj->get_parent_id();
187 187
             $url = 'gradebook_flatview.php';
188 188
         }
189
-        $header .= '<a href="' . $url . '?' . api_get_cidreq() . '&selectcat=' . $select_cat . '">' .
190
-            Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
189
+        $header .= '<a href="'.$url.'?'.api_get_cidreq().'&selectcat='.$select_cat.'">'.
190
+            Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
191 191
 
192 192
         $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : null;
193 193
         $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : null;
194 194
         $offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
195 195
 
196
-        $exportCsvUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
196
+        $exportCsvUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
197 197
             'export_format' => 'csv',
198 198
             'export_report' => 'export_report',
199 199
             'selectcat' => $catobj->get_id()
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             $exportCsvUrl
205 205
         );
206 206
 
207
-        $exportXlsUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
207
+        $exportXlsUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
208 208
             'export_format' => 'xls',
209 209
             'export_report' => 'export_report',
210 210
             'selectcat' => $catobj->get_id()
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $exportXlsUrl
216 216
         );
217 217
 
218
-        $exportDocUrl = api_get_self() . '?' .  api_get_cidreq() . '&' . http_build_query([
218
+        $exportDocUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
219 219
             'export_format' => 'doc',
220 220
             'export_report' => 'export_report',
221 221
             'selectcat' => $catobj->get_id()
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             $exportDocUrl
227 227
         );
228 228
 
229
-        $exportPrintUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
229
+        $exportPrintUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
230 230
                 'print' => '',
231 231
                 'selectcat' => $catobj->get_id(),
232 232
             ]);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
             ['target' => '_blank']
238 238
         );
239 239
 
240
-        $exportPdfUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
240
+        $exportPdfUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
241 241
             'exportpdf' => '',
242 242
             'selectcat' => $catobj->get_id(),
243 243
             'offset' => $offset,
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
                 $item = $evals_links[$count];
291 291
                 $score = $item->calc_score($user_id);
292 292
                 $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
293
-                $item_value+=$score[0] / $my_score_denom * $item->get_weight();
294
-                $item_total+=$item->get_weight();
293
+                $item_value += $score[0] / $my_score_denom * $item->get_weight();
294
+                $item_total += $item->get_weight();
295 295
             }
296 296
             $item_value = number_format($item_value, 2, '.', ' ');
297 297
             $total_score = array($item_value, $item_total);
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
             $cattotal = Category :: load(0);
301 301
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
302 302
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
303
-            $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . api_get_person_name($user['firstname'], $user['lastname']) . '</b><br />';
303
+            $scoreinfo = get_lang('StatsStudent').' :<b> '.api_get_person_name($user['firstname'], $user['lastname']).'</b><br />';
304 304
             if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
305
-                $scoreinfo.= '<h2>' . get_lang('Total') . ' : ' . $scorecourse_display . '</h2>';
305
+                $scoreinfo .= '<h2>'.get_lang('Total').' : '.$scorecourse_display.'</h2>';
306 306
             }
307 307
             Display :: display_normal_message($scoreinfo, false);
308 308
         }
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
         if (($showtree == '1') || (isset($_GET['studentoverview']))) {
313 313
             $header .= '<tr>';
314 314
             if (!$selectcat == '0') {
315
-                $header .= '<td style=" "><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
315
+                $header .= '<td style=" "><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>';
316 316
             }
317
-            $header .= '<td style=" ">' . get_lang('CurrentCategory') . '</td>' .
317
+            $header .= '<td style=" ">'.get_lang('CurrentCategory').'</td>'.
318 318
                     '<td style=" "><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
319 319
             $cats = Category :: load();
320 320
 
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
                 }
328 328
                 $line = isset($line) ? $line : '';
329 329
                 if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
330
-                    $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
330
+                    $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
331 331
                 } else {
332
-                    $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
332
+                    $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
333 333
                 }
334 334
                 $line = '';
335 335
             }
336 336
             $header .= '</select></form></td>';
337 337
             if (!empty($simple_search_form) && $message_resource === false) {
338
-                $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
338
+                $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
339 339
             } else {
340 340
                 $header .= '<td></td>';
341 341
             }
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
             } elseif (!(isset($_GET['studentoverview']))) {
346 346
 
347 347
             } else {
348
-                $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">
348
+                $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">
349 349
                 '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).'
350
-                ' . get_lang('ExportPDF') . '</a>';
350
+                ' . get_lang('ExportPDF').'</a>';
351 351
             }
352 352
             $header .= '</td></tr>';
353 353
         }
354
-        $header.='</table></div>';
354
+        $header .= '</table></div>';
355 355
 
356 356
         // for course admin & platform admin add item buttons are added to the header
357 357
         $header .= '<div class="actions">';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                 $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
372 372
                 $my_api_cidreq = api_get_cidreq();
373 373
                 if ($my_api_cidreq == '') {
374
-                    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
374
+                    $my_api_cidreq = 'cidReq='.$my_category['course_code'];
375 375
                 }
376 376
 
377 377
                 if (!$message_resource) {
@@ -380,24 +380,24 @@  discard block
 block discarded – undo
380 380
                     $my_course_id = api_get_course_id();
381 381
                     $my_file = substr($_SESSION['gradebook_dest'], 0, 5);
382 382
 
383
-                    $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
384
-                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
385
-                    $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?' . $my_api_cidreq . '&amp;cat_id=' . (int) $_GET['selectcat'] . '">' .
386
-                        Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '</a>';
383
+                    $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
384
+                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
385
+                    $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?'.$my_api_cidreq.'&amp;cat_id='.(int) $_GET['selectcat'].'">'.
386
+                        Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM).'</a>';
387 387
 
388 388
                     $visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible';
389 389
                     $visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
390 390
 
391 391
                     //Right icons
392
-                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
392
+                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
393 393
                     if ($catobj->get_name() != api_get_course_id()) {
394
-                        $modify_icons .= '&nbsp;<a  href="' . api_get_self() . '?deletecat=' . $catobj->get_id() . '&amp;selectcat=0&amp;cidReq=' . $catobj->get_course_code() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM) . '</a>';
394
+                        $modify_icons .= '&nbsp;<a  href="'.api_get_self().'?deletecat='.$catobj->get_id().'&amp;selectcat=0&amp;cidReq='.$catobj->get_course_code().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM).'</a>';
395 395
                     }
396 396
                     $header .= Display::div($modify_icons, array('class' => 'right'));
397 397
                 }
398 398
             }
399 399
         } elseif (isset($_GET['search'])) {
400
-            $header .= '<b>' . get_lang('SearchResults') . ' :</b>';
400
+            $header .= '<b>'.get_lang('SearchResults').' :</b>';
401 401
         }
402 402
         $header .= '</div>';
403 403
         echo $header;
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                     $aditionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : '';
510 510
                     $aditionalButtons .= '</div>';
511 511
                 }
512
-                $scoreinfo .= '<strong>' . sprintf(get_lang('TotalX'), $scorecourse_display . $aditionalButtons). '</strong>';
512
+                $scoreinfo .= '<strong>'.sprintf(get_lang('TotalX'), $scorecourse_display.$aditionalButtons).'</strong>';
513 513
 
514 514
             }
515 515
             Display :: display_normal_message($scoreinfo, false);
@@ -520,10 +520,10 @@  discard block
 block discarded – undo
520 520
             $header = '<div class="actions"><table>';
521 521
             $header .= '<tr>';
522 522
             if (!$selectcat == '0') {
523
-                $header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' .
524
-                    Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
523
+                $header .= '<td><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'.
524
+                    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>';
525 525
             }
526
-            $header .= '<td>' . get_lang('CurrentCategory') . '</td>' .
526
+            $header .= '<td>'.get_lang('CurrentCategory').'</td>'.
527 527
                     '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
528 528
             $cats = Category :: load();
529 529
 
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
                 }
537 537
                 $line = isset($line) ? $line : '';
538 538
                 if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
539
-                    $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
539
+                    $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
540 540
                 } else {
541
-                    $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
541
+                    $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
542 542
                 }
543 543
                 $line = '';
544 544
             }
545 545
             $header .= '</select></form></td>';
546 546
             if (!empty($simple_search_form) && $message_resource === false) {
547
-                $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
547
+                $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
548 548
             } else {
549 549
                 $header .= '<td></td>';
550 550
             }
@@ -555,9 +555,9 @@  discard block
 block discarded – undo
555 555
             } elseif (!(isset($_GET['studentoverview']))) {
556 556
 
557 557
             } else {
558
-                $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">
558
+                $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">
559 559
 							 '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).'
560
-							' . get_lang('ExportPDF') . '</a>';
560
+							' . get_lang('ExportPDF').'</a>';
561 561
             }
562 562
             $header .= '</td></tr>';
563 563
             $header .= '</table></div>';
@@ -572,33 +572,33 @@  discard block
 block discarded – undo
572 572
 
573 573
         if (api_is_allowed_to_edit(null, true)) {
574 574
             if (empty($grade_model_id) || $grade_model_id == -1) {
575
-                $actionsLeft .= '<a href="gradebook_add_cat.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' .
576
-                    Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM) . '</a></td>';
575
+                $actionsLeft .= '<a href="gradebook_add_cat.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.
576
+                    Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM).'</a></td>';
577 577
             }
578 578
             if ($selectcat == '0') {
579 579
 
580 580
             } else {
581 581
                 $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
582 582
                 if ($my_api_cidreq == '') {
583
-                    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
583
+                    $my_api_cidreq = 'cidReq='.$my_category['course_code'];
584 584
                 }
585 585
                 if ($show_add_link && !$message_resource) {
586
-                   $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' .
587
-                        Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . '</a>';
586
+                   $actionsLeft .= '<a href="gradebook_add_eval.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'" >'.
587
+                        Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM).'</a>';
588 588
                     $cats = Category :: load($selectcat);
589 589
 
590 590
                     if ($cats[0]->get_course_code() != null && !$message_resource) {
591
-                        $actionsLeft .= '<a href="gradebook_add_link.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
592
-                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
591
+                        $actionsLeft .= '<a href="gradebook_add_link.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
592
+                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>';
593 593
                     } else {
594
-                        $actionsLeft .= '<a href="gradebook_add_link_select_course.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
595
-                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
594
+                        $actionsLeft .= '<a href="gradebook_add_link_select_course.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
595
+                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>';
596 596
                     }
597 597
                 }
598 598
 
599 599
                 if (!$message_resource) {
600
-                    $actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
601
-                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
600
+                    $actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
601
+                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
602 602
 
603 603
                     if ($my_category['generate_certificates'] == 1) {
604 604
                         $actionsLeft .= Display::url(
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
                                         '',
609 609
                                         ICON_SIZE_MEDIUM
610 610
                                         ),
611
-                                "gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . intval($_GET['selectcat'])
611
+                                "gradebook_display_certificate.php?$my_api_cidreq&cat_id=".intval($_GET['selectcat'])
612 612
                             );
613 613
                     }
614 614
 
@@ -619,29 +619,29 @@  discard block
 block discarded – undo
619 619
                                 '',
620 620
                                 ICON_SIZE_MEDIUM
621 621
                                 ),
622
-                        "gradebook_display_summary.php?$my_api_cidreq&selectcat=" . intval($_GET['selectcat'])
622
+                        "gradebook_display_summary.php?$my_api_cidreq&selectcat=".intval($_GET['selectcat'])
623 623
                     );
624 624
 
625 625
                     // Right icons
626
-                    $actionsRight = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' .
627
-                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
628
-                    $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&' . $my_api_cidreq . '&origin=gradebook&selectcat=' . $catobj->get_id() . '">' .
629
-                            Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM) . '</a>';
626
+                    $actionsRight = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
627
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
628
+                    $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat='.$catobj->get_id().'">'.
629
+                            Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM).'</a>';
630 630
 
631 631
                     if (empty($categories)) {
632
-                        $actionsRight .= '<a href="gradebook_edit_all.php?id_session=' . api_get_session_id() . '&amp;' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
633
-                            Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM) . '</a>';
632
+                        $actionsRight .= '<a href="gradebook_edit_all.php?id_session='.api_get_session_id().'&amp;'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
633
+                            Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM).'</a>';
634 634
                     }
635 635
                     $score_display_custom = api_get_setting('gradebook_score_display_custom');
636 636
                     if (api_get_setting('teachers_can_change_score_settings') == 'true' && $score_display_custom['my_display_custom'] == 'true') {
637
-                        $actionsRight .= '<a href="gradebook_scoring_system.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
638
-                            Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
637
+                        $actionsRight .= '<a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
638
+                            Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>';
639 639
                     }
640 640
 
641 641
                 }
642 642
             }
643 643
         } elseif (isset($_GET['search'])) {
644
-            echo $header = '<b>' . get_lang('SearchResults') . ' :</b>';
644
+            echo $header = '<b>'.get_lang('SearchResults').' :</b>';
645 645
         }
646 646
 
647 647
         $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
@@ -650,26 +650,26 @@  discard block
 block discarded – undo
650 650
         );
651 651
 
652 652
         if ($isDrhOfCourse) {
653
-            $$actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
654
-                Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
653
+            $$actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
654
+                Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
655 655
         }
656 656
 
657
-        if (api_is_allowed_to_edit(null, true)){
657
+        if (api_is_allowed_to_edit(null, true)) {
658 658
             echo $toolbar = Display::toolbarAction('gradebook-actions', array($actionsLeft, $actionsRight));
659 659
         }
660 660
 
661 661
         if (api_is_allowed_to_edit(null, true)) {
662 662
             $weight = intval($catobj->get_weight()) > 0 ? $catobj->get_weight() : 0;
663
-            $weight = '<strong>' . get_lang('TotalWeight') . ' : </strong>' . $weight;
663
+            $weight = '<strong>'.get_lang('TotalWeight').' : </strong>'.$weight;
664 664
 
665 665
             $min_certification = (intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0);
666
-            $min_certification = get_lang('CertificateMinScore') . ' : ' . $min_certification;
667
-            $edit_icon = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' .
668
-                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
666
+            $min_certification = get_lang('CertificateMinScore').' : '.$min_certification;
667
+            $edit_icon = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
668
+                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
669 669
             //$msg = Display::tag('h3', $weight.' - '.$min_certification);
670
-            $msg = $weight . ' - ' . $min_certification . $edit_icon;
670
+            $msg = $weight.' - '.$min_certification.$edit_icon;
671 671
             //@todo show description
672
-            $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>' . get_lang('GradebookDescriptionLog') . '</strong>' . ': ' . $catobj->get_description());
672
+            $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>'.get_lang('GradebookDescriptionLog').'</strong>'.': '.$catobj->get_description());
673 673
             Display::display_normal_message($msg, false);
674 674
             if (!empty($description)) {
675 675
                 echo Display::div($description, array());
@@ -697,24 +697,24 @@  discard block
 block discarded – undo
697 697
             $cattotal = Category :: load(0);
698 698
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
699 699
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
700
-            $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . $user['complete_name']. '</b><br />';
700
+            $scoreinfo = get_lang('StatsStudent').' :<b> '.$user['complete_name'].'</b><br />';
701 701
             if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search'])))
702
-                $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
703
-            $scoreinfo.= '<br />' . get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
702
+                $scoreinfo .= '<br />'.get_lang('TotalForThisCategory').' : <b>'.$scorecourse_display.'</b>';
703
+            $scoreinfo .= '<br />'.get_lang('Total').' : <b>'.$scoretotal_display.'</b>';
704 704
             Display :: display_normal_message($scoreinfo, false);
705 705
         }
706 706
         // show navigation tree and buttons?
707 707
         $header = '<div class="actions">';
708 708
 
709 709
         if ($is_course_admin) {
710
-            $header .= '<a href="gradebook_flatview.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
711
-            $header .= '<a href="gradebook_scoring_system.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
710
+            $header .= '<a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
711
+            $header .= '<a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>';
712 712
         } elseif (!(isset($_GET['studentoverview']))) {
713
-            $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('view_list.gif', get_lang('FlatView')) . ' ' . get_lang('FlatView') . '</a>';
713
+            $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat='.$catobj->get_id().'">'.Display::return_icon('view_list.gif', get_lang('FlatView')).' '.get_lang('FlatView').'</a>';
714 714
         } else {
715
-            $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">' . Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
715
+            $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">'.Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM).'</a>';
716 716
         }
717
-        $header.='</div>';
717
+        $header .= '</div>';
718 718
         echo $header;
719 719
     }
720 720
 
@@ -741,8 +741,8 @@  discard block
 block discarded – undo
741 741
             $item = $evals_links[$count];
742 742
             $score = $item->calc_score($user_id);
743 743
             $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
744
-            $item_value+=$score[0] / $my_score_denom * $item->get_weight();
745
-            $item_total+=$item->get_weight();
744
+            $item_value += $score[0] / $my_score_denom * $item->get_weight();
745
+            $item_total += $item->get_weight();
746 746
             //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT);
747 747
         }
748 748
         $item_value = number_format($item_value, 2, '.', ' ');
@@ -757,17 +757,17 @@  discard block
 block discarded – undo
757 757
         $imageUrl = UserManager::getUserPicture($userid);
758 758
 
759 759
         $info = '<div class="row"><div class="col-md-3">';
760
-        $info .= '<div class="thumbnail"><img src="' . $imageUrl . '" /></div>';
760
+        $info .= '<div class="thumbnail"><img src="'.$imageUrl.'" /></div>';
761 761
         $info .= '</div>';
762 762
         $info .= '<div class="col-md-6">';
763
-        $info .= get_lang('Name') . ' :  <a target="_blank" href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $userid . '"> ' .
764
-            $user['complete_name'] . '</a><br />';
763
+        $info .= get_lang('Name').' :  <a target="_blank" href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userid.'"> '.
764
+            $user['complete_name'].'</a><br />';
765 765
 
766 766
         if (api_get_setting('show_email_addresses') == 'true') {
767
-            $info .= get_lang('Email') . ' : <a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a><br />';
767
+            $info .= get_lang('Email').' : <a href="mailto:'.$user['email'].'">'.$user['email'].'</a><br />';
768 768
         }
769 769
 
770
-        $info .= get_lang('TotalUser') . ' : <b>' . $scorecourse_display . '</b>';
770
+        $info .= get_lang('TotalUser').' : <b>'.$scorecourse_display.'</b>';
771 771
         $info .= '</div>';
772 772
         $info .= '</div>';
773 773
 
Please login to merge, or discard this patch.
main/gradebook/lib/fe/linkform.class.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 
57 57
 	protected function build_move()
58 58
 	{
59
-		$renderer =& $this->defaultRenderer();
59
+		$renderer = & $this->defaultRenderer();
60 60
 		$renderer->setCustomElementTemplate('<span>{element}</span> ');
61
-		$this->addElement('static',null,null,'"'.$this->link_object->get_name().'" ');
62
-		$this->addElement('static',null,null,get_lang('MoveTo').' : ');
63
-		$select = $this->addElement('select','move_cat',null,null);
61
+		$this->addElement('static', null, null, '"'.$this->link_object->get_name().'" ');
62
+		$this->addElement('static', null, null, get_lang('MoveTo').' : ');
63
+		$select = $this->addElement('select', 'move_cat', null, null);
64 64
 		$line = '';
65 65
 		foreach ($this->link_object->get_target_categories() as $cat) {
66
-			for ($i=0;$i<$cat[2];$i++) {
66
+			for ($i = 0; $i < $cat[2]; $i++) {
67 67
 				$line .= '&mdash;';
68 68
 			}
69
-			$select->addoption($line.' '.$cat[1],$cat[0]);
69
+			$select->addoption($line.' '.$cat[1], $cat[0]);
70 70
 			$line = '';
71 71
 		}
72 72
 		$this->addElement('submit', null, get_lang('Ok'));
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$link = LinkFactory::create($link);
134 134
 		if (!empty($courseCode)) {
135 135
 			$link->set_course_code($courseCode);
136
-		} elseif(!empty($_GET['course_code'])) {
136
+		} elseif (!empty($_GET['course_code'])) {
137 137
 			$link->set_course_code(Database::escape_string($_GET['course_code'], null, false));
138 138
 		}
139 139
 
Please login to merge, or discard this patch.
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -10,133 +10,133 @@
 block discarded – undo
10 10
  */
11 11
 class LinkForm extends FormValidator
12 12
 {
13
-	const TYPE_CREATE = 1;
14
-	const TYPE_MOVE = 2;
15
-	/** @var Category */
16
-	private $category_object;
17
-	private $link_object;
18
-	private $extra;
13
+    const TYPE_CREATE = 1;
14
+    const TYPE_MOVE = 2;
15
+    /** @var Category */
16
+    private $category_object;
17
+    private $link_object;
18
+    private $extra;
19 19
 
20
-	/**
21
-	 * Builds a form containing form items based on a given parameter
22
-	 * @param int form_type 1=choose link
23
-	 * @param obj cat_obj the category object
24
-	 * @param string form name
25
-	 * @param method
26
-	 * @param action
27
-	 */
28
-	public function __construct(
29
-		$form_type,
30
-		$category_object,
31
-		$link_object,
32
-		$form_name,
33
-		$method = 'post',
34
-		$action = null,
35
-		$extra = null
36
-	) {
37
-		parent :: __construct($form_name, $method, $action);
20
+    /**
21
+     * Builds a form containing form items based on a given parameter
22
+     * @param int form_type 1=choose link
23
+     * @param obj cat_obj the category object
24
+     * @param string form name
25
+     * @param method
26
+     * @param action
27
+     */
28
+    public function __construct(
29
+        $form_type,
30
+        $category_object,
31
+        $link_object,
32
+        $form_name,
33
+        $method = 'post',
34
+        $action = null,
35
+        $extra = null
36
+    ) {
37
+        parent :: __construct($form_name, $method, $action);
38 38
 
39
-		if (isset ($category_object)) {
40
-			$this->category_object = $category_object;
41
-		} else {
42
-			if (isset($link_object)) {
43
-				$this->link_object = $link_object;
44
-			}
45
-		}
39
+        if (isset ($category_object)) {
40
+            $this->category_object = $category_object;
41
+        } else {
42
+            if (isset($link_object)) {
43
+                $this->link_object = $link_object;
44
+            }
45
+        }
46 46
 
47
-		if (isset ($extra)) {
48
-			$this->extra = $extra;
49
-		}
50
-		if ($form_type == self :: TYPE_CREATE) {
51
-			$this->build_create();
52
-		} elseif ($form_type == self :: TYPE_MOVE) {
53
-			$this->build_move();
54
-		}
55
-	}
47
+        if (isset ($extra)) {
48
+            $this->extra = $extra;
49
+        }
50
+        if ($form_type == self :: TYPE_CREATE) {
51
+            $this->build_create();
52
+        } elseif ($form_type == self :: TYPE_MOVE) {
53
+            $this->build_move();
54
+        }
55
+    }
56 56
 
57
-	protected function build_move()
58
-	{
59
-		$renderer =& $this->defaultRenderer();
60
-		$renderer->setCustomElementTemplate('<span>{element}</span> ');
61
-		$this->addElement('static',null,null,'"'.$this->link_object->get_name().'" ');
62
-		$this->addElement('static',null,null,get_lang('MoveTo').' : ');
63
-		$select = $this->addElement('select','move_cat',null,null);
64
-		$line = '';
65
-		foreach ($this->link_object->get_target_categories() as $cat) {
66
-			for ($i=0;$i<$cat[2];$i++) {
67
-				$line .= '&mdash;';
68
-			}
69
-			$select->addoption($line.' '.$cat[1],$cat[0]);
70
-			$line = '';
71
-		}
72
-		$this->addElement('submit', null, get_lang('Ok'));
73
-	}
57
+    protected function build_move()
58
+    {
59
+        $renderer =& $this->defaultRenderer();
60
+        $renderer->setCustomElementTemplate('<span>{element}</span> ');
61
+        $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" ');
62
+        $this->addElement('static',null,null,get_lang('MoveTo').' : ');
63
+        $select = $this->addElement('select','move_cat',null,null);
64
+        $line = '';
65
+        foreach ($this->link_object->get_target_categories() as $cat) {
66
+            for ($i=0;$i<$cat[2];$i++) {
67
+                $line .= '&mdash;';
68
+            }
69
+            $select->addoption($line.' '.$cat[1],$cat[0]);
70
+            $line = '';
71
+        }
72
+        $this->addElement('submit', null, get_lang('Ok'));
73
+    }
74 74
 
75
-	/**
76
-	 * Builds the form
77
-	 */
78
-	protected function build_create()
79
-	{
80
-		$this->addElement('header', get_lang('MakeLink'));
81
-		$select = $this->addElement(
82
-			'select',
83
-			'select_link',
84
-			get_lang('ChooseLink'),
85
-			null,
86
-			array('onchange' => 'document.create_link.submit()')
87
-		);
75
+    /**
76
+     * Builds the form
77
+     */
78
+    protected function build_create()
79
+    {
80
+        $this->addElement('header', get_lang('MakeLink'));
81
+        $select = $this->addElement(
82
+            'select',
83
+            'select_link',
84
+            get_lang('ChooseLink'),
85
+            null,
86
+            array('onchange' => 'document.create_link.submit()')
87
+        );
88 88
 
89
-		$linkTypes = LinkFactory::get_all_types();
89
+        $linkTypes = LinkFactory::get_all_types();
90 90
 
91
-		$select->addoption('['.get_lang('ChooseLink').']', 0);
91
+        $select->addoption('['.get_lang('ChooseLink').']', 0);
92 92
 
93
-		$courseCode = $this->category_object->get_course_code();
93
+        $courseCode = $this->category_object->get_course_code();
94 94
 
95
-		foreach ($linkTypes as $linkType) {
96
-			// The hot potatoe link will be added "inside" the exercise option.
97
-			if ($linkType == LINK_HOTPOTATOES) {
98
-				continue;
99
-			}
100
-			$link = $this->createLink($linkType, $courseCode);
101
-			// disable this element if the link works with a dropdownlist
102
-			// and if there are no links left
103
-			if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') {
104
-				$select->addoption($link->get_type_name(), $linkType, 'disabled');
105
-			} else {
106
-				if ($link->get_type() == LINK_EXERCISE) {
107
-					// Adding exercise
108
-					$select->addoption($link->get_type_name(), $linkType);
109
-					// Adding hot potatoes
110
-					$linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode);
111
-					$select->addoption(
112
-						'&nbsp;&nbsp;&nbsp;'.$linkHot->get_type_name(),
113
-						LINK_HOTPOTATOES
114
-					);
115
-				} else {
116
-					$select->addoption($link->get_type_name(), $linkType);
117
-				}
118
-			}
119
-		}
95
+        foreach ($linkTypes as $linkType) {
96
+            // The hot potatoe link will be added "inside" the exercise option.
97
+            if ($linkType == LINK_HOTPOTATOES) {
98
+                continue;
99
+            }
100
+            $link = $this->createLink($linkType, $courseCode);
101
+            // disable this element if the link works with a dropdownlist
102
+            // and if there are no links left
103
+            if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') {
104
+                $select->addoption($link->get_type_name(), $linkType, 'disabled');
105
+            } else {
106
+                if ($link->get_type() == LINK_EXERCISE) {
107
+                    // Adding exercise
108
+                    $select->addoption($link->get_type_name(), $linkType);
109
+                    // Adding hot potatoes
110
+                    $linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode);
111
+                    $select->addoption(
112
+                        '&nbsp;&nbsp;&nbsp;'.$linkHot->get_type_name(),
113
+                        LINK_HOTPOTATOES
114
+                    );
115
+                } else {
116
+                    $select->addoption($link->get_type_name(), $linkType);
117
+                }
118
+            }
119
+        }
120 120
 
121
-		if (isset($this->extra)) {
122
-			$this->setDefaults(array('select_link' => $this->extra));
123
-		}
124
-	}
121
+        if (isset($this->extra)) {
122
+            $this->setDefaults(array('select_link' => $this->extra));
123
+        }
124
+    }
125 125
 
126
-	/**
127
-	 * @param integer $link
128
-	 * @param null|string $courseCode
129
-	 * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink
130
-	 */
131
-	private function createLink($link, $courseCode)
132
-	{
133
-		$link = LinkFactory::create($link);
134
-		if (!empty($courseCode)) {
135
-			$link->set_course_code($courseCode);
136
-		} elseif(!empty($_GET['course_code'])) {
137
-			$link->set_course_code(Database::escape_string($_GET['course_code'], null, false));
138
-		}
126
+    /**
127
+     * @param integer $link
128
+     * @param null|string $courseCode
129
+     * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink
130
+     */
131
+    private function createLink($link, $courseCode)
132
+    {
133
+        $link = LinkFactory::create($link);
134
+        if (!empty($courseCode)) {
135
+            $link->set_course_code($courseCode);
136
+        } elseif(!empty($_GET['course_code'])) {
137
+            $link->set_course_code(Database::escape_string($_GET['course_code'], null, false));
138
+        }
139 139
 
140
-		return $link;
141
-	}
140
+        return $link;
141
+    }
142 142
 }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/catform.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function build_move_form()
54 54
     {
55
-        $renderer =& $this->defaultRenderer();
55
+        $renderer = & $this->defaultRenderer();
56 56
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
57 57
         $this->addElement(
58 58
             'static',
59 59
             null,
60 60
             null,
61
-            '"' . $this->category_object->get_name() . '" '
61
+            '"'.$this->category_object->get_name().'" '
62 62
         );
63
-        $this->addElement('static', null, null, get_lang('MoveTo') . ' : ');
63
+        $this->addElement('static', null, null, get_lang('MoveTo').' : ');
64 64
         $select = $this->addElement('select', 'move_cat', null, null);
65 65
         $line = null;
66 66
         foreach ($this->category_object->get_target_categories() as $cat) {
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
                 $line .= '--';
69 69
             }
70 70
             if ($cat[0] != $this->category_object->get_parent_id()) {
71
-                $select->addoption($line . ' ' . $cat[1], $cat[0]);
71
+                $select->addoption($line.' '.$cat[1], $cat[0]);
72 72
             } else {
73
-                $select->addoption($line . ' ' . $cat[1], $cat[0], 'disabled');
73
+                $select->addoption($line.' '.$cat[1], $cat[0], 'disabled');
74 74
             }
75 75
             $line = '';
76 76
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $grade_model_id = $this->category_object->get_grade_model_id();
154 154
 
155 155
         if (empty($links)) {
156
-            $grade_model_id    = 0;
156
+            $grade_model_id = 0;
157 157
         }
158 158
 
159 159
         $category_name = $this->category_object->get_name();
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                     [
243 243
                         'id' => 'skills',
244 244
                         'multiple' => 'multiple',
245
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?a=search_skills'
245
+                        'url' => api_get_path(WEB_AJAX_PATH).'skill.ajax.php?a=search_skills'
246 246
                     ]
247 247
                 );
248 248
 
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
         //only return courses that are not yet created by the teacher
401 401
 
402 402
         foreach ($coursecat as $row) {
403
-            $select->addoption($row[1],$row[0]);
403
+            $select->addoption($row[1], $row[0]);
404 404
         }
405 405
         $this->setDefaults(array(
406 406
             'hid_user_id' => $this->category_object->get_user_id(),
407 407
             'hid_parent_id' => $this->category_object->get_parent_id()
408 408
         ));
409
-        $this->addElement('hidden','hid_user_id');
410
-        $this->addElement('hidden','hid_parent_id');
409
+        $this->addElement('hidden', 'hid_user_id');
410
+        $this->addElement('hidden', 'hid_parent_id');
411 411
         $this->addElement('submit', null, get_lang('Ok'));
412 412
     }
413 413
 
Please login to merge, or discard this patch.
main/gradebook/lib/fe/linkaddeditform.class.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		if (isset($link_object)) {
32 32
 			$link = $link_object;
33 33
 		} elseif (isset($link_type) && isset($category_object)) {
34
-			$link = LinkFactory :: create ($link_type);
34
+			$link = LinkFactory :: create($link_type);
35 35
 			$link->set_course_code(api_get_course_id());
36 36
 			$link->set_category_id($category_object[0]->get_id());
37 37
 		} else {
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 			} else {
53 53
 				$select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54 54
 				foreach ($link->get_all_links() as $newlink) {
55
-					$select->addoption($newlink[1],$newlink[0]);
55
+					$select->addoption($newlink[1], $newlink[0]);
56 56
 				}
57 57
 			}
58 58
 		} else {
59
-			$this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
-			$this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
59
+			$this->addElement('label', get_lang('Name'), '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
+			$this->addElement('hidden', 'name_link', $link->get_name(), array('id'=>'name_link'));
61 61
 		}
62 62
 
63 63
 		if (count($category_object) == 1) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 						$grade_model_id = $my_cat->get_grade_model_id();
81 81
 						if (empty($grade_model_id)) {
82 82
 
83
-							if ($my_cat->get_parent_id() == 0 ) {
83
+							if ($my_cat->get_parent_id() == 0) {
84 84
 								$default_weight = $my_cat->get_weight();
85 85
 								$select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86 86
 							} else {
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
             'class' => 'span1'
120 120
         ));*/
121 121
 
122
-		$this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
-		$this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
122
+		$this->addRule('weight_mask', get_lang('OnlyNumbers'), 'numeric');
123
+		$this->addRule(array('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124 124
 		if ($form_type == self :: TYPE_EDIT) {
125 125
 			$parent_cat = Category :: load($link->get_category_id());
126 126
 
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
 				//var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134 134
 				//$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135 135
 				//$values['weight'] = $weight;
136
-				$values['weight'] = $link->get_weight() ;
136
+				$values['weight'] = $link->get_weight();
137 137
 			}
138
-			$defaults['weight_mask'] = $values['weight'] ;
138
+			$defaults['weight_mask'] = $values['weight'];
139 139
 			$defaults['select_gradebook'] = $link->get_category_id();
140 140
 
141 141
 		}
142 142
 		// ELEMENT: max
143 143
 		if ($link->needs_max()) {
144 144
 			if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
-				$this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
145
+				$this->addText('max', get_lang('QualificationNumeric'), false, array('size' => '4', 'maxlength' => '5', 'disabled' => 'disabled'));
146 146
 			} else {
147
-				$this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
147
+				$this->addText('max', get_lang('QualificationNumeric'), true, array('size' => '4', 'maxlength' => '5'));
148 148
 				$this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
-				$this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
149
+				$this->addRule(array('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150 150
 			}
151 151
 			if ($form_type == self :: TYPE_EDIT) {
152 152
 				$defaults['max'] = $link->get_max();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		// ELEMENT: description
157 157
 		if ($link->needs_name_and_description()) {
158
-			$this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
158
+			$this->addElement('textarea', 'description', get_lang('Description'), array('rows' => '3', 'cols' => '34'));
159 159
 			if ($form_type == self :: TYPE_EDIT) {
160 160
 				$defaults['description'] = $link->get_description();
161 161
 			}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186 186
 				$visibility_default = 0;
187 187
 			}
188
-			$defaults['visible']  = $visibility_default;
188
+			$defaults['visible'] = $visibility_default;
189 189
 		}
190 190
 
191 191
 		// set default values
Please login to merge, or discard this patch.
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -9,108 +9,108 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class LinkAddEditForm extends FormValidator
11 11
 {
12
-	const TYPE_ADD  = 1;
13
-	const TYPE_EDIT = 2;
14
-
15
-	/**
16
-	 * Constructor
17
-	 * To add link, define category_object and link_type
18
-	 * To edit link, define link_object
19
-	 */
20
-	public function __construct(
21
-		$form_type,
22
-		$category_object,
23
-		$link_type,
24
-		$link_object,
25
-		$form_name,
26
-		$action = null
27
-	) {
28
-		parent :: __construct($form_name, 'post', $action);
29
-
30
-		// set or create link object
31
-		if (isset($link_object)) {
32
-			$link = $link_object;
33
-		} elseif (isset($link_type) && isset($category_object)) {
34
-			$link = LinkFactory :: create ($link_type);
35
-			$link->set_course_code(api_get_course_id());
36
-			$link->set_category_id($category_object[0]->get_id());
37
-		} else {
38
-			die ('LinkAddEditForm error: define link_type/category_object or link_object');
39
-		}
40
-
41
-		$defaults = array();
42
-		$this->addElement('hidden', 'zero', 0);
43
-
44
-		if (!empty($_GET['editlink'])) {
45
-			$this->addElement('header', '', get_lang('EditLink'));
46
-		}
47
-
48
-		// ELEMENT: name
49
-		if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
50
-			if ($link->needs_name_and_description()) {
51
-				$this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
52
-			} else {
53
-				$select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54
-				foreach ($link->get_all_links() as $newlink) {
55
-					$select->addoption($newlink[1],$newlink[0]);
56
-				}
57
-			}
58
-		} else {
59
-			$this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
-			$this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
61
-		}
62
-
63
-		if (count($category_object) == 1) {
64
-			$this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
65
-		} else {
66
-			$select_gradebook = $this->addElement(
67
-				'select',
68
-				'select_gradebook',
69
-				get_lang('SelectGradebook'),
70
-				array(),
71
-				array('id' => 'hide_category_id')
72
-			);
73
-			$this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
74
-
75
-			$default_weight = 0;
76
-			if (!empty($category_object)) {
77
-				foreach ($category_object as $my_cat) {
78
-
79
-					if ($my_cat->get_course_code() == api_get_course_id()) {
80
-						$grade_model_id = $my_cat->get_grade_model_id();
81
-						if (empty($grade_model_id)) {
82
-
83
-							if ($my_cat->get_parent_id() == 0 ) {
84
-								$default_weight = $my_cat->get_weight();
85
-								$select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86
-							} else {
87
-								$select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
88
-							}
89
-						} else {
90
-							$select_gradebook->addoption(get_lang('Select'), 0);
91
-						}
92
-						if ($link->get_category_id() == $my_cat->get_id()) {
93
-							$default_weight = $my_cat->get_weight();
94
-						}
95
-					}
96
-				}
97
-			}
98
-		}
99
-
100
-		$this->addText(
101
-			'weight_mask',
102
-			array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">'.$category_object[0]->get_weight().'</span>] '),
103
-			true,
104
-			array(
105
-				'size' => '4',
106
-				'maxlength' => '5',
107
-				'class' => 'span1'
108
-			)
109
-		);
110
-
111
-		$this->addElement('hidden', 'weight');
112
-
113
-		/*
12
+    const TYPE_ADD  = 1;
13
+    const TYPE_EDIT = 2;
14
+
15
+    /**
16
+     * Constructor
17
+     * To add link, define category_object and link_type
18
+     * To edit link, define link_object
19
+     */
20
+    public function __construct(
21
+        $form_type,
22
+        $category_object,
23
+        $link_type,
24
+        $link_object,
25
+        $form_name,
26
+        $action = null
27
+    ) {
28
+        parent :: __construct($form_name, 'post', $action);
29
+
30
+        // set or create link object
31
+        if (isset($link_object)) {
32
+            $link = $link_object;
33
+        } elseif (isset($link_type) && isset($category_object)) {
34
+            $link = LinkFactory :: create ($link_type);
35
+            $link->set_course_code(api_get_course_id());
36
+            $link->set_category_id($category_object[0]->get_id());
37
+        } else {
38
+            die ('LinkAddEditForm error: define link_type/category_object or link_object');
39
+        }
40
+
41
+        $defaults = array();
42
+        $this->addElement('hidden', 'zero', 0);
43
+
44
+        if (!empty($_GET['editlink'])) {
45
+            $this->addElement('header', '', get_lang('EditLink'));
46
+        }
47
+
48
+        // ELEMENT: name
49
+        if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
50
+            if ($link->needs_name_and_description()) {
51
+                $this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
52
+            } else {
53
+                $select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54
+                foreach ($link->get_all_links() as $newlink) {
55
+                    $select->addoption($newlink[1],$newlink[0]);
56
+                }
57
+            }
58
+        } else {
59
+            $this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
+            $this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
61
+        }
62
+
63
+        if (count($category_object) == 1) {
64
+            $this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
65
+        } else {
66
+            $select_gradebook = $this->addElement(
67
+                'select',
68
+                'select_gradebook',
69
+                get_lang('SelectGradebook'),
70
+                array(),
71
+                array('id' => 'hide_category_id')
72
+            );
73
+            $this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
74
+
75
+            $default_weight = 0;
76
+            if (!empty($category_object)) {
77
+                foreach ($category_object as $my_cat) {
78
+
79
+                    if ($my_cat->get_course_code() == api_get_course_id()) {
80
+                        $grade_model_id = $my_cat->get_grade_model_id();
81
+                        if (empty($grade_model_id)) {
82
+
83
+                            if ($my_cat->get_parent_id() == 0 ) {
84
+                                $default_weight = $my_cat->get_weight();
85
+                                $select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86
+                            } else {
87
+                                $select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
88
+                            }
89
+                        } else {
90
+                            $select_gradebook->addoption(get_lang('Select'), 0);
91
+                        }
92
+                        if ($link->get_category_id() == $my_cat->get_id()) {
93
+                            $default_weight = $my_cat->get_weight();
94
+                        }
95
+                    }
96
+                }
97
+            }
98
+        }
99
+
100
+        $this->addText(
101
+            'weight_mask',
102
+            array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">'.$category_object[0]->get_weight().'</span>] '),
103
+            true,
104
+            array(
105
+                'size' => '4',
106
+                'maxlength' => '5',
107
+                'class' => 'span1'
108
+            )
109
+        );
110
+
111
+        $this->addElement('hidden', 'weight');
112
+
113
+        /*
114 114
 
115 115
         // ELEMENT: weight
116 116
         $this->addText('weight', array(get_lang('Weight'), null, '/ <span id="max_weight">'.$default_weight.'</span>'), true, array (
@@ -119,76 +119,76 @@  discard block
 block discarded – undo
119 119
             'class' => 'span1'
120 120
         ));*/
121 121
 
122
-		$this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
-		$this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124
-		if ($form_type == self :: TYPE_EDIT) {
125
-			$parent_cat = Category :: load($link->get_category_id());
126
-
127
-			if ($parent_cat[0]->get_parent_id() == 0) {
128
-				$values['weight'] = $link->get_weight();
129
-			} else {
130
-				$cat = Category :: load($parent_cat[0]->get_parent_id());
131
-				//$global_weight = $cat[0]->get_weight();
132
-				//$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
133
-				//var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134
-				//$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135
-				//$values['weight'] = $weight;
136
-				$values['weight'] = $link->get_weight() ;
137
-			}
138
-			$defaults['weight_mask'] = $values['weight'] ;
139
-			$defaults['select_gradebook'] = $link->get_category_id();
140
-
141
-		}
142
-		// ELEMENT: max
143
-		if ($link->needs_max()) {
144
-			if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
-				$this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
146
-			} else {
147
-				$this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
148
-				$this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
-				$this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150
-			}
151
-			if ($form_type == self :: TYPE_EDIT) {
152
-				$defaults['max'] = $link->get_max();
153
-			}
154
-		}
155
-
156
-		// ELEMENT: description
157
-		if ($link->needs_name_and_description()) {
158
-			$this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
159
-			if ($form_type == self :: TYPE_EDIT) {
160
-				$defaults['description'] = $link->get_description();
161
-			}
162
-		}
163
-
164
-		// ELEMENT: visible
165
-		$visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
166
-		$this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
167
-		if ($form_type == self :: TYPE_EDIT) {
168
-			$defaults['visible'] = $link->is_visible();
169
-		}
170
-
171
-		// ELEMENT: add results
172
-		if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
173
-			$this->addElement('checkbox', 'addresult', get_lang('AddResult'));
174
-		}
175
-		// submit button
176
-		if ($form_type == self :: TYPE_ADD) {
177
-			$this->addButtonCreate(get_lang('CreateLink'));
178
-		} else {
179
-			$this->addButtonUpdate(get_lang('LinkMod'));
180
-		}
181
-
182
-		if ($form_type == self :: TYPE_ADD) {
183
-			$setting = api_get_setting('tool_visible_by_default_at_creation');
184
-			$visibility_default = 1;
185
-			if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186
-				$visibility_default = 0;
187
-			}
188
-			$defaults['visible']  = $visibility_default;
189
-		}
190
-
191
-		// set default values
192
-		$this->setDefaults($defaults);
193
-	}
122
+        $this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
+        $this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124
+        if ($form_type == self :: TYPE_EDIT) {
125
+            $parent_cat = Category :: load($link->get_category_id());
126
+
127
+            if ($parent_cat[0]->get_parent_id() == 0) {
128
+                $values['weight'] = $link->get_weight();
129
+            } else {
130
+                $cat = Category :: load($parent_cat[0]->get_parent_id());
131
+                //$global_weight = $cat[0]->get_weight();
132
+                //$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
133
+                //var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134
+                //$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135
+                //$values['weight'] = $weight;
136
+                $values['weight'] = $link->get_weight() ;
137
+            }
138
+            $defaults['weight_mask'] = $values['weight'] ;
139
+            $defaults['select_gradebook'] = $link->get_category_id();
140
+
141
+        }
142
+        // ELEMENT: max
143
+        if ($link->needs_max()) {
144
+            if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
+                $this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
146
+            } else {
147
+                $this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
148
+                $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
+                $this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150
+            }
151
+            if ($form_type == self :: TYPE_EDIT) {
152
+                $defaults['max'] = $link->get_max();
153
+            }
154
+        }
155
+
156
+        // ELEMENT: description
157
+        if ($link->needs_name_and_description()) {
158
+            $this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
159
+            if ($form_type == self :: TYPE_EDIT) {
160
+                $defaults['description'] = $link->get_description();
161
+            }
162
+        }
163
+
164
+        // ELEMENT: visible
165
+        $visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
166
+        $this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
167
+        if ($form_type == self :: TYPE_EDIT) {
168
+            $defaults['visible'] = $link->is_visible();
169
+        }
170
+
171
+        // ELEMENT: add results
172
+        if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
173
+            $this->addElement('checkbox', 'addresult', get_lang('AddResult'));
174
+        }
175
+        // submit button
176
+        if ($form_type == self :: TYPE_ADD) {
177
+            $this->addButtonCreate(get_lang('CreateLink'));
178
+        } else {
179
+            $this->addButtonUpdate(get_lang('LinkMod'));
180
+        }
181
+
182
+        if ($form_type == self :: TYPE_ADD) {
183
+            $setting = api_get_setting('tool_visible_by_default_at_creation');
184
+            $visibility_default = 1;
185
+            if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186
+                $visibility_default = 0;
187
+            }
188
+            $defaults['visible']  = $visibility_default;
189
+        }
190
+
191
+        // set default values
192
+        $this->setDefaults($defaults);
193
+    }
194 194
 }
Please login to merge, or discard this patch.