Completed
Push — 1.10.x ( 3658ba...81c9ff )
by
unknown
91:59 queued 46:43
created
main/gradebook/lib/GradebookUtils.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
         $course_code = Database::escape_string($course_code);
78 78
         if (!empty($link_id)) {
79 79
             $link_id = intval($link_id);
80
-            $sql = 'UPDATE ' . Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK) . '
81
-                    SET weight = ' . "'" . Database::escape_string((float) $weight) . "'" . '
82
-                    WHERE course_code = "' . $course_code . '" AND id = ' . $link_id;
80
+            $sql = 'UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).'
81
+                    SET weight = ' . "'".Database::escape_string((float) $weight)."'".'
82
+                    WHERE course_code = "' . $course_code.'" AND id = '.$link_id;
83 83
             Database::query($sql);
84 84
         }
85 85
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
         // TODO find the corresponding category (the first one for this course, ordered by ID)
101 101
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
102
-        $sql = "DELETE FROM $l WHERE id = ".(int)$link_id;
102
+        $sql = "DELETE FROM $l WHERE id = ".(int) $link_id;
103 103
         Database::query($sql);
104 104
 
105 105
         return true;
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
             $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible';
196 196
             $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible';
197 197
 
198
-            $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' .
199
-                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>';
198
+            $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'.
199
+                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>';
200 200
 
201 201
             if (!api_is_allowed_to_edit(null, true)) {
202 202
                 $modify_icons .= Display::url(
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
                         '',
207 207
                         ICON_SIZE_SMALL
208 208
                     ),
209
-                    'personal_stats.php?' . http_build_query([
209
+                    'personal_stats.php?'.http_build_query([
210 210
                         'selectcat' => $cat->get_id()
211
-                    ]) . '&' . api_get_cidreq(),
211
+                    ]).'&'.api_get_cidreq(),
212 212
                     [
213 213
                         'class' => 'ajax',
214 214
                         'data-title' => get_lang('FlatView')
@@ -222,16 +222,16 @@  discard block
 block discarded – undo
222 222
                 if (api_get_setting('gradebook_locking_enabled') == 'true') {
223 223
                     if ($cat->is_locked()) {
224 224
                         if (api_is_platform_admin()) {
225
-                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' .
226
-                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
225
+                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'.
226
+                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
227 227
                         } else {
228
-                            $modify_icons .= '&nbsp;<a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>';
228
+                            $modify_icons .= '&nbsp;<a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>';
229 229
                         }
230
-                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
230
+                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
231 231
                     } else {
232
-                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' .
233
-                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
234
-                        $modify_icons .= '&nbsp;<a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
232
+                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'.
233
+                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
234
+                        $modify_icons .= '&nbsp;<a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
235 235
                     }
236 236
                 }
237 237
 
@@ -239,44 +239,44 @@  discard block
 block discarded – undo
239 239
                     if ($cat->is_locked() && !api_is_platform_admin()) {
240 240
                         $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
241 241
                     } else {
242
-                        $modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' .
242
+                        $modify_icons .= '<a href="gradebook_edit_cat.php?'.'editcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'.
243 243
                             Display::return_icon(
244 244
                                 'edit.png',
245 245
                                 get_lang('Modify'),
246 246
                                 '',
247 247
                                 ICON_SIZE_SMALL
248
-                            ) . '</a>';
248
+                            ).'</a>';
249 249
                     }
250 250
                 }
251 251
 
252
-               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' .
252
+               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'.
253 253
                     Display::return_icon(
254 254
                         'percentage.png',
255 255
                         get_lang('EditAllWeights'),
256 256
                         '',
257 257
                         ICON_SIZE_SMALL
258
-                    ) . '</a>';
258
+                    ).'</a>';
259 259
 
260
-                $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' .
260
+                $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'.
261 261
                     Display::return_icon(
262 262
                         'stats.png',
263 263
                         get_lang('FlatView'),
264 264
                         '',
265 265
                         ICON_SIZE_SMALL
266
-                    ) . '</a>';
267
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' .
266
+                    ).'</a>';
267
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblecat='.$cat->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'.
268 268
                     Display::return_icon(
269
-                        $visibility_icon . '.png',
269
+                        $visibility_icon.'.png',
270 270
                         get_lang('Visible'),
271 271
                         '',
272 272
                         ICON_SIZE_SMALL
273
-                    ) . '</a>';
273
+                    ).'</a>';
274 274
 
275 275
                 if ($cat->is_locked() && !api_is_platform_admin()) {
276 276
                     $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL);
277 277
                 } else {
278
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '" onclick="return confirmation();">' .
279
-                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>';
278
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletecat='.$cat->get_id().'&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'" onclick="return confirmation();">'.
279
+                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>';
280 280
                 }
281 281
             }
282 282
 
@@ -303,21 +303,21 @@  discard block
 block discarded – undo
303 303
             if ($is_locked && !api_is_platform_admin()) {
304 304
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
305 305
             } else {
306
-                $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' .
307
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
306
+                $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'.
307
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
308 308
             }
309 309
 
310
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$eval->getSessionId(). ' ">' .
311
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
310
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$eval->getSessionId().' ">'.
311
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
312 312
             if (api_is_allowed_to_edit(null, true)) {
313
-                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' .
314
-                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
313
+                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'.
314
+                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
315 315
             }
316 316
 
317 317
             if ($is_locked && !api_is_platform_admin()) {
318
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
318
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
319 319
             } else {
320
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
320
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deleteeval='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
321 321
             }
322 322
             return $modify_icons;
323 323
         }
@@ -347,21 +347,21 @@  discard block
 block discarded – undo
347 347
             if ($is_locked && !api_is_platform_admin()) {
348 348
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
349 349
             } else {
350
-                $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id().'">' .
351
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
350
+                $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'.
351
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
352 352
             }
353
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$link->get_session_id(). ' ">' .
354
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
355
-            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '">' .
356
-                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
353
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$link->get_session_id().' ">'.
354
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
355
+            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink='.$link->get_id().'&selectcat='.$selectcat.'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'.
356
+                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
357 357
 
358 358
             //If a work is added in a gradebook you can only delete the link in the work tool
359 359
 
360 360
             if ($is_locked && !api_is_platform_admin()) {
361
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
361
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
362 362
             } else {
363
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '" onclick="return confirmation();">' .
364
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
363
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletelink='.$link->get_id().'&selectcat='.$selectcat.' &cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'" onclick="return confirmation();">'.
364
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
365 365
             }
366 366
             return $modify_icons;
367 367
         }
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
         $sql = "SELECT * FROM $table l
383 383
                 WHERE
384 384
                     course_code = '$course_code' AND
385
-                    type = ".(int)$resource_type . " AND
386
-                    ref_id = " . (int)$resource_id;
385
+                    type = ".(int) $resource_type." AND
386
+                    ref_id = " . (int) $resource_id;
387 387
         $res = Database::query($sql);
388 388
 
389 389
         if (Database::num_rows($res) < 1) {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         }
406 406
         // TODO find the corresponding category (the first one for this course, ordered by ID)
407 407
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
408
-        $sql = "SELECT * FROM $l WHERE id = " . (int) $link_id;
408
+        $sql = "SELECT * FROM $l WHERE id = ".(int) $link_id;
409 409
         $res = Database::query($sql);
410 410
         $row = array();
411 411
         if (Database::num_rows($res) > 0) {
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
     {
424 424
         $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
425 425
         $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
426
-        $sql = 'SELECT c.id FROM ' . $course_table . ' c
427
-                INNER JOIN ' . $tbl_grade_links . ' l
426
+        $sql = 'SELECT c.id FROM '.$course_table.' c
427
+                INNER JOIN ' . $tbl_grade_links.' l
428 428
                 ON c.code = l.course_code
429
-                WHERE l.id=' . intval($id_link) . ' OR l.category_id=' . intval($id_link);
429
+                WHERE l.id=' . intval($id_link).' OR l.category_id='.intval($id_link);
430 430
         $res = Database::query($sql);
431 431
         $array = Database::fetch_array($res, 'ASSOC');
432 432
         return $array['id'];
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     {
536 536
         $result = Result :: load($resid);
537 537
         if ($importscore > $eval_max) {
538
-            header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax=');
538
+            header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax=');
539 539
             exit;
540 540
         }
541 541
         $result[0]->set_score($importscore);
@@ -576,8 +576,8 @@  discard block
 block discarded – undo
576 576
     {
577 577
         $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
578 578
         $sql = 'SELECT COUNT(*) as count
579
-                FROM ' . $table . ' gc
580
-                WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" ';
579
+                FROM ' . $table.' gc
580
+                WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" ';
581 581
         $rs_exist = Database::query($sql);
582 582
         $row = Database::fetch_array($rs_exist);
583 583
         if ($row['count'] == 0) {
@@ -600,8 +600,8 @@  discard block
 block discarded – undo
600 600
     public static function get_certificate_by_user_id($cat_id, $user_id)
601 601
     {
602 602
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
603
-        $sql = 'SELECT * FROM ' . $table_certificate . '
604
-                WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
603
+        $sql = 'SELECT * FROM '.$table_certificate.'
604
+                WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"';
605 605
 
606 606
         $result = Database::query($sql);
607 607
         $row = Database::fetch_array($result, 'ASSOC');
@@ -620,18 +620,18 @@  discard block
 block discarded – undo
620 620
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
621 621
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
622 622
         $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username
623
-                FROM ' . $table_user . ' u
624
-                INNER JOIN ' . $table_certificate . ' gc
623
+                FROM ' . $table_user.' u
624
+                INNER JOIN ' . $table_certificate.' gc
625 625
                 ON u.user_id=gc.user_id ';
626 626
         if (!is_null($cat_id) && $cat_id > 0) {
627
-            $sql.=' WHERE cat_id=' . intval($cat_id);
627
+            $sql .= ' WHERE cat_id='.intval($cat_id);
628 628
         }
629 629
         if (!empty($userList)) {
630 630
             $userList = array_map('intval', $userList);
631 631
             $userListCondition = implode("','", $userList);
632 632
             $sql .= " AND u.user_id IN ('$userListCondition')";
633 633
         }
634
-        $sql.=' ORDER BY u.firstname';
634
+        $sql .= ' ORDER BY u.firstname';
635 635
         $rs = Database::query($sql);
636 636
 
637 637
         $list_users = array();
@@ -652,10 +652,10 @@  discard block
 block discarded – undo
652 652
     {
653 653
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
654 654
         $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id
655
-                FROM  ' . $table_certificate . ' gc
656
-                WHERE gc.user_id="' . intval($user_id) . '" ';
655
+                FROM  ' . $table_certificate.' gc
656
+                WHERE gc.user_id="' . intval($user_id).'" ';
657 657
         if (!is_null($cat_id) && $cat_id > 0) {
658
-            $sql.=' AND cat_id=' . intval($cat_id);
658
+            $sql .= ' AND cat_id='.intval($cat_id);
659 659
         }
660 660
 
661 661
         $rs = Database::query($sql);
@@ -693,12 +693,12 @@  discard block
 block discarded – undo
693 693
             $variables = $content_html['variables'];
694 694
         }
695 695
 
696
-        $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery';
696
+        $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery';
697 697
         $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html);
698 698
 
699
-        $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document';
699
+        $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document';
700 700
         $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html);
701
-        $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
701
+        $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
702 702
 
703 703
         //add print header
704 704
         if ($hide_print_button == false) {
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
         }
710 710
 
711 711
         // Add header
712
-        $new_content_html =  $contentHead. $print . '</head>' . $new_content_html;
712
+        $new_content_html = $contentHead.$print.'</head>'.$new_content_html;
713 713
 
714 714
         return array(
715 715
             'content' => $new_content_html,
@@ -731,9 +731,9 @@  discard block
 block discarded – undo
731 731
             $session_id = api_get_session_id();
732 732
 
733 733
             $t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
734
-            $sql = "SELECT * FROM $t WHERE course_code = '" . Database::escape_string($course_code) . "' ";
734
+            $sql = "SELECT * FROM $t WHERE course_code = '".Database::escape_string($course_code)."' ";
735 735
             if (!empty($session_id)) {
736
-                $sql .= " AND session_id = " . (int) $session_id;
736
+                $sql .= " AND session_id = ".(int) $session_id;
737 737
             } else {
738 738
                 $sql .= " AND (session_id IS NULL OR session_id = 0) ";
739 739
             }
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
                 if (!empty($session_id)) {
746 746
                     $my_session_id = api_get_session_id();
747 747
                     $s_name = api_get_session_name($my_session_id);
748
-                    $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name);
748
+                    $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name);
749 749
                     $cat->set_session_id($session_id);
750 750
                 } else {
751 751
                     $cat->set_name($course_code);
@@ -867,13 +867,13 @@  discard block
 block discarded – undo
867 867
 
868 868
         if ($use_grade_model) {
869 869
             if ($parent_id == 0) {
870
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
870
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
871 871
             } else {
872
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')';
872
+                $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')';
873 873
             }
874 874
         } else {
875 875
             if ($parent_id == 0) {
876
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
876
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
877 877
             } else {
878 878
                 $title = api_strtoupper(get_lang('Average'));
879 879
             }
@@ -927,11 +927,11 @@  discard block
 block discarded – undo
927 927
         } else {
928 928
             $column = 0;
929 929
             $table->setCellContents($row, $column, get_lang('NoResults'));
930
-            $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"');
930
+            $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"');
931 931
         }
932 932
 
933 933
         $pdfParams = array(
934
-            'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(),
934
+            'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(),
935 935
             'pdf_title' => $title,
936 936
             'course_code' => $course_code,
937 937
             'add_signatures' => true
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
         $a_students = array();
1017 1017
         while ($user = Database::fetch_array($result)) {
1018 1018
             if (!array_key_exists($user['user_id'], $a_students)) {
1019
-                $a_current_student = array ();
1019
+                $a_current_student = array();
1020 1020
                 $a_current_student[] = $user['user_id'];
1021 1021
                 $a_current_student[] = $user['username'];
1022 1022
                 $a_current_student[] = $user['lastname'];
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
         foreach ($links as $link) {
1075 1075
             // links are always in a course
1076 1076
             $coursecode = $link->get_course_code();
1077
-            if (!array_key_exists($coursecode,$coursecodes)) {
1077
+            if (!array_key_exists($coursecode, $coursecodes)) {
1078 1078
                 $coursecodes[$coursecode] = '1';
1079 1079
                 $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode));
1080 1080
             }
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
      * Search students matching a given last name and/or first name
1088 1088
      * @author Bert Steppé
1089 1089
      */
1090
-    public static function find_students($mask= '')
1090
+    public static function find_students($mask = '')
1091 1091
     {
1092 1092
         // students shouldn't be here // don't search if mask empty
1093 1093
         if (!api_is_allowed_to_edit() || empty ($mask)) {
@@ -1098,23 +1098,23 @@  discard block
 block discarded – undo
1098 1098
         $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
1099 1099
         $tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
1100 1100
         $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code
1101
-                FROM ' . $tbl_user . ' user';
1101
+                FROM ' . $tbl_user.' user';
1102 1102
         if (!api_is_platform_admin()) {
1103
-            $sql .= ', ' . $tbl_cru . ' cru';
1103
+            $sql .= ', '.$tbl_cru.' cru';
1104 1104
         }
1105 1105
 
1106
-        $sql .= ' WHERE user.status = ' . STUDENT;
1107
-        $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'";
1108
-        $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')";
1106
+        $sql .= ' WHERE user.status = '.STUDENT;
1107
+        $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'";
1108
+        $sql .= ' OR user.firstname LIKE '."'%".$mask."%')";
1109 1109
 
1110 1110
         if (!api_is_platform_admin()) {
1111 1111
             $sql .= ' AND user.user_id = cru.user_id AND
1112 1112
                       cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND
1113 1113
                       cru.c_id in (
1114
-                            SELECT c_id FROM '.$tbl_cru . '
1114
+                            SELECT c_id FROM '.$tbl_cru.'
1115 1115
                             WHERE
1116
-                                user_id = ' . api_get_user_id() . ' AND
1117
-                                status = ' . COURSEMANAGER . '
1116
+                                user_id = ' . api_get_user_id().' AND
1117
+                                status = ' . COURSEMANAGER.'
1118 1118
                         )
1119 1119
                     ';
1120 1120
         }
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
         $sql = 'SELECT ref_id FROM '.$table_link.'
1158 1158
                 WHERE id = '.$linkId.' AND type='.LINK_ATTENDANCE;
1159 1159
 
1160
-        $rs_attendance  = Database::query($sql);
1160
+        $rs_attendance = Database::query($sql);
1161 1161
         if (Database::num_rows($rs_attendance) > 0) {
1162 1162
             $row_attendance = Database::fetch_array($rs_attendance);
1163 1163
             $sql = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.$weight.'
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
                 'course' => $courseInfo['title'],
1244 1244
                 'score' => $certificateInfo['score_certificate'],
1245 1245
                 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
1246
-                'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
1246
+                'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
1247 1247
             ];
1248 1248
         }
1249 1249
 
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                     'course' => $course['title'],
1308 1308
                     'score' => $certificateInfo['score_certificate'],
1309 1309
                     'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
1310
-                    'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
1310
+                    'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
1311 1311
                 ];
1312 1312
             }
1313 1313
         }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/resulttable.class.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	/**
19 19
 	 * Constructor
20 20
 	 */
21
-    public function ResultTable ($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false)
21
+    public function ResultTable($evaluation, $results = array(), $iscourse, $addparams = null, $forprint = false)
22 22
 	{
23
-    	parent :: __construct ('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
23
+    	parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
24 24
 
25 25
 		$this->datagen = new ResultsDataGenerator($evaluation, $results, true);
26 26
 
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 		$this->iscourse = $iscourse;
29 29
 		$this->forprint = $forprint;
30 30
 
31
-		if (isset ($addparams))  {
31
+		if (isset ($addparams)) {
32 32
 			$this->set_additional_parameters($addparams);
33 33
 		}
34 34
 		$scoredisplay = ScoreDisplay :: instance();
35
-		$column= 0;
35
+		$column = 0;
36 36
 		if ($this->iscourse == '1') {
37 37
 			$this->set_header($column++, '', false);
38
-			$this->set_form_actions(array (
38
+			$this->set_form_actions(array(
39 39
 					'delete' => get_lang('Delete')
40 40
 			));
41 41
 		}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			$this->set_header($column++, get_lang('Display'));
52 52
 		}
53 53
 		if (!$this->forprint) {
54
-			$this->set_header($column++, get_lang('Modify'),false);
54
+			$this->set_header($column++, get_lang('Modify'), false);
55 55
 		}
56 56
     }
57 57
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	/**
60 60
 	 * Function used by SortableTable to get total number of items in the table
61 61
 	 */
62
-	public function get_total_number_of_items ()
62
+	public function get_total_number_of_items()
63 63
     {
64 64
 		return $this->datagen->get_total_results_count();
65 65
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		// generate the data to display
113 113
 		$sortable_data = array();
114 114
 		foreach ($data_array as $item) {
115
-			$row = array ();
115
+			$row = array();
116 116
 			if ($this->iscourse == '1') {
117 117
 				 $row[] = $item['result_id'];
118 118
 			}
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 				$row[] = $item['firstname'];
125 125
 			}
126 126
 
127
-			$row[] =  Display::bar_progress($item['percentage_score'], false, $item['score']);
127
+			$row[] = Display::bar_progress($item['percentage_score'], false, $item['score']);
128 128
             //$row[] =  Display::bar_progress($item['percentage_score'], true);
129 129
 			if ($scoredisplay->is_custom()) {
130 130
 				$row[] = $item['display'];
131 131
 			}
132 132
 			if (!$this->forprint) {
133
-				$row[] = $this->build_edit_column ($item);
133
+				$row[] = $this->build_edit_column($item);
134 134
 			}
135 135
 			$sortable_data[] = $row;
136 136
 		}
@@ -138,23 +138,23 @@  discard block
 block discarded – undo
138 138
 		return $sortable_data;
139 139
 	}
140 140
 
141
-	private function build_edit_column ($item)
141
+	private function build_edit_column($item)
142 142
 	{
143
-		$status=CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
143
+		$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
144 144
 		$locked_status = $this->evaluation->get_locked();
145 145
 		if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
146 146
 			//api_is_course_admin()
147
-			$edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
148
-				Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>';
149
-			$edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
150
-				Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>';
147
+			$edit_column = '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
148
+				Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>';
149
+			$edit_column .= ' <a href="'.api_get_self().'?delete_mark='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
150
+				Display::return_icon('delete.png', get_lang('Delete'), '', '22').'</a>';
151 151
 		}
152 152
 
153 153
 		if ($this->evaluation->get_course_code() == null) {
154
-			$edit_column .= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">';
154
+			$edit_column .= '&nbsp;<a href="'.api_get_self().'?resultdelete='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'" onclick="return confirmationuser();">';
155 155
 			$edit_column .= Display::return_icon('delete.png', get_lang('Delete'));
156 156
 			$edit_column .= '</a>';
157
-		    $edit_column .= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">';
157
+		    $edit_column .= '&nbsp;<a href="user_stats.php?userid='.$item['id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">';
158 158
 			$edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics'));
159 159
 		    $edit_column .= '</a>';
160 160
 		}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			$doc_url = $link->get_view_url($item['id']);
166 166
 
167 167
 			if ($doc_url != null) {
168
-				$edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">';
168
+				$edit_column .= '&nbsp;<a href="'.$doc_url.'" target="_blank">';
169 169
 				$edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument').'</a>';
170 170
 			}
171 171
 		}
Please login to merge, or discard this patch.
main/inc/lib/statsUtils.lib.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $last_day = -1;
156 156
             while ($row = Database::fetch_row($res)) {
157 157
                 $date_array = getdate($row[0]);
158
-                $display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year'];
158
+                $display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
159 159
                 if ($date_array['mday'] == $last_day) {
160 160
                     $days_array[$display_date]++;
161 161
                 } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     &nbsp;
222 222
                 </td>
223 223
                 <td width='10%'>
224
-                    <b>" . get_lang('Hits') . "</b>
224
+                    <b>".get_lang('Hits')."</b>
225 225
                 </td>
226 226
                 <td width='15%'>
227 227
                     <b>%</b>
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     echo "<img src='".Display::returnIconPath('bar_1m.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
250 250
                 }
251 251
                 if ($pourcent != 100) {
252
-                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
252
+                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='".($maxSize - $barwidth)."' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
253 253
                 }
254 254
                 echo "<img src='".Display::returnIconPath('bar_1.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
255 255
                     </td>
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         }
266 266
         echo "<tr bgcolor='#E6E6E6'>
267 267
                 <td width='15%' align='center'>
268
-                    " . get_lang('Total') . "
268
+                    " . get_lang('Total')."
269 269
                 </td>
270 270
                 <td align='right' width='60%'>
271 271
                     &nbsp;
272 272
                 </td>
273 273
                 <td align='center' width='10%'>
274
-                    " . $period_array['total'] . "
274
+                    " . $period_array['total']."
275 275
                 </td>
276 276
                 <td width='15%'>
277 277
                     &nbsp;
Please login to merge, or discard this patch.
main/inc/lib/upload.xajax.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
 include(dirname(__FILE__).'/../global.inc.php');
9 9
 $xajax_upload = new Xajax();
10
-$xajax_upload -> registerFunction ('updateProgress');
10
+$xajax_upload -> registerFunction('updateProgress');
11 11
 $xajax_upload -> processRequests();
12 12
 
13 13
 /**
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 
20 20
 	$objResponse = new xajaxResponse();
21 21
 	$ul_info = uploadprogress_get_info($upload_id);
22
-	$percent = intval($ul_info['bytes_uploaded']*100/$ul_info['bytes_total']);
23
-	if($waitAfterupload && $ul_info['est_sec']<2) {
22
+	$percent = intval($ul_info['bytes_uploaded'] * 100 / $ul_info['bytes_total']);
23
+	if ($waitAfterupload && $ul_info['est_sec'] < 2) {
24 24
 		$percent = 100;
25
-		$objResponse->addAssign($div_id.'_label' , 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
-		$objResponse->addAssign($div_id.'_waiter_frame','innerHTML', Display::return_icon('progress_bar.gif'));
25
+		$objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
+		$objResponse->addAssign($div_id.'_waiter_frame', 'innerHTML', Display::return_icon('progress_bar.gif'));
27 27
 		$objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
28 28
 	}
29 29
 	$objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
Please login to merge, or discard this patch.
main/tracking/lp_results_by_user.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$export_to_csv = true;
27 27
 }
28 28
 
29
-if (api_is_platform_admin() ) {
29
+if (api_is_platform_admin()) {
30 30
 	$global = true;
31 31
 } else {
32 32
 	$global = false;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 if ($global) {
36 36
 	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
37
+	foreach ($temp_course_list  as $temp_course_item) {
38 38
 		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 $new_course_select = array();
50
-foreach($course_list as $data) {
50
+foreach ($course_list as $data) {
51 51
     $new_course_select[$data['code']] = $data['title'];
52 52
 }
53 53
 
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55
-$form->addElement('select','course_code',get_lang('Course'), $new_course_select);
55
+$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+	$form->addElement('hidden', 'view', 'admin');
58 58
 } else {
59 59
 	//Get exam lists
60 60
     $course_id = api_get_course_int_id();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	                 ORDER BY quiz.title ASC";
65 65
 	$resultExercices = Database::query($sqlExercices);
66 66
 	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
67
+	while ($a_exercices = Database::fetch_array($resultExercices)) {
68 68
 		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69 69
 	}
70 70
 	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
90
-                &nbsp;'.get_lang('ExportAsCSV').'</a>' .
90
+                &nbsp;'.get_lang('ExportAsCSV').'</a>'.
91 91
                 '<a href="javascript: void(0);" onclick="javascript: window.print()">
92 92
                 '.Display::return_icon('printmgr.gif').'
93 93
                 &nbsp;'.get_lang('Print').'</a>
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         }
102 102
 		$menu_items[] = get_lang('ExamTracking');
103 103
 		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
104
+		if ($nb_menu_items > 1) {
105
+			foreach ($menu_items as $key=> $item) {
106 106
 				echo $item;
107
-				if($key!=$nb_menu_items-1) {
107
+				if ($key != $nb_menu_items - 1) {
108 108
 					echo ' | ';
109 109
 				}
110 110
 			}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131
-foreach ($course_list  as $current_course ) {
131
+foreach ($course_list  as $current_course) {
132 132
 	$course_info = api_get_course_info($current_course['code']);
133 133
 	$_course = $course_info;
134 134
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165
-    foreach($user_list as $user_id) {
165
+    foreach ($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167 167
 		$user_list_name[$user_id] = api_get_person_name(
168 168
 			$user_data['firstname'],
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		);
171 171
     }
172 172
 }
173
-$export_array =  array();
173
+$export_array = array();
174 174
 if (!empty($main_result)) {
175 175
 
176 176
     $html_result .= '<table  class="data_table">';
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
             foreach ($exercises as $exercise_id => $exercise_data) {
195 195
                 $users = $exercise_data['users'];
196
-                foreach($users as $user_id => $attempts) {
196
+                foreach ($users as $user_id => $attempts) {
197 197
                     $attempt = 1;
198
-                    foreach($attempts as $exe_id => $attempt_data) {
198
+                    foreach ($attempts as $exe_id => $attempt_data) {
199 199
                         $html_result .= '<tr colspan="">';
200 200
                         $html_result .= Display::tag('td', $course_code);
201 201
                         $html_result .= Display::tag('td', $lp_list_name[$lp_id]);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             }
223 223
         }
224 224
     }
225
-    $html_result .='</table>';
225
+    $html_result .= '</table>';
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
Please login to merge, or discard this patch.
main/exercice/hotspot_admin.inc.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 if ($modifyIn) {
27 27
     if ($debug > 0) {
28
-        echo '$modifyIn was set' . "<br />\n";
28
+        echo '$modifyIn was set'."<br />\n";
29 29
     }
30 30
     // if the user has chosen to modify the question only in the current exercise
31 31
     if ($modifyIn == 'thisExercise') {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     unset($buttonBack);
65 65
 }
66 66
 
67
-$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId;
67
+$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$exerciseId;
68 68
 
69 69
 // the answer form has been submitted
70 70
 $submitAnswers = isset($_POST['submitAnswers']) ? true : false;
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 if ($submitAnswers || $buttonBack) {
75 75
     if ($answerType == HOT_SPOT) {
76 76
         if ($debug > 0) {
77
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
77
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
78 78
         }
79 79
 
80 80
         $questionWeighting = $nbrGoodAnswers = 0;
81 81
         for ($i = 1; $i <= $nbrAnswers; $i++) {
82 82
             if ($debug > 0) {
83
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
83
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
84 84
             }
85 85
 
86 86
             $reponse[$i] = trim($reponse[$i]);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if (empty($msgErr)) {
115 115
             for ($i = 1; $i <= $nbrAnswers; $i++) {
116 116
                 if ($debug > 0) {
117
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
117
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
118 118
                 }
119 119
 
120 120
                 $reponse[$i] = trim($reponse[$i]);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 $weighting[$i] = ($weighting[$i]); //it can be float
123 123
 
124 124
                 if ($weighting[$i]) {
125
-                    $questionWeighting+=$weighting[$i];
125
+                    $questionWeighting += $weighting[$i];
126 126
                 }
127 127
 
128 128
                 // creates answer
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 
146 146
             $editQuestion = $questionId;
147 147
             unset($modifyAnswers);
148
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
148
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
149 149
         }
150 150
 
151 151
         if ($debug > 0) {
152
-            echo '$modifyIn was set - end' . "<br />\n";
152
+            echo '$modifyIn was set - end'."<br />\n";
153 153
         }
154 154
     } else {
155 155
         if ($debug > 0) {
156
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
156
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
157 157
         }
158 158
 
159 159
         $questionWeighting = $nbrGoodAnswers = 0;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         for ($i = 1; $i <= $nbrAnswers; $i++) {
170 170
             if ($debug > 0) {
171
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
171
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
172 172
             }
173 173
 
174 174
             $reponse[$i] = trim($reponse[$i]);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                 $threadhold3_str = intval($threadhold3[$i]);
194 194
             }
195 195
 
196
-            $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str;
196
+            $threadhold_total = $threadhold1_str.';'.$threadhold2_str.';'.$threadhold3_str;
197 197
 
198 198
             if (isset($try[$i]) && $try[$i] == 'on') {
199 199
                 $try_str = 1;
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                 $question_str = $select_question[$i];
220 220
             }
221 221
 
222
-            $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
222
+            $destination[$i] = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
223 223
 
224 224
             // checks if field is empty
225 225
             if (empty($reponse[$i]) && $reponse[$i] != '0') {
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
             $question_str = $selectQuestionNoError;
278 278
         }
279 279
 
280
-        $destination_noerror = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
280
+        $destination_noerror = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
281 281
 
282 282
         if (empty($msgErr)) {
283 283
             for ($i = 1; $i <= $nbrAnswers; $i++) {
284 284
                 if ($debug > 0) {
285
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
285
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
286 286
                 }
287 287
 
288 288
                 $reponse[$i] = trim($reponse[$i]);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $weighting[$i] = ($weighting[$i]); //it can be float
291 291
 
292 292
                 if ($weighting[$i]) {
293
-                    $questionWeighting+=$weighting[$i];
293
+                    $questionWeighting += $weighting[$i];
294 294
                 }
295 295
                 // creates answer
296 296
                 $objAnswer->createAnswer(
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
             $editQuestion = $questionId;
326 326
             unset($modifyAnswers);
327 327
 
328
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
328
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
329 329
         }
330 330
     }
331 331
 }
332 332
 
333 333
 if ($modifyAnswers) {
334 334
     if ($debug > 0) {
335
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers is set' . "<br />\n";
335
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers is set'."<br />\n";
336 336
     }
337 337
 
338 338
     // construction of the Answer object
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     Session::write('objAnswer', $objAnswer);
341 341
 
342 342
     if ($debug > 0) {
343
-        echo str_repeat('&nbsp;', 2) . '$answerType is HOT_SPOT' . "<br />\n";
343
+        echo str_repeat('&nbsp;', 2).'$answerType is HOT_SPOT'."<br />\n";
344 344
     }
345 345
 
346 346
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -521,11 +521,11 @@  discard block
 block discarded – undo
521 521
     }
522 522
 
523 523
     if ($debug > 0) {
524
-        echo str_repeat('&nbsp;', 2) . '$usedInSeveralExercises is untrue' . "<br />\n";
524
+        echo str_repeat('&nbsp;', 2).'$usedInSeveralExercises is untrue'."<br />\n";
525 525
     }
526 526
 
527 527
     if ($debug > 0) {
528
-        echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
528
+        echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
529 529
     }
530 530
 
531 531
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 
566 566
     Display::tag(
567 567
         'h3',
568
-        get_lang('Question') . ": " . $questionName . Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose')))
568
+        get_lang('Question').": ".$questionName.Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose')))
569 569
     );
570 570
 
571 571
     if (!empty($msgErr)) {
572 572
         Display::display_normal_message($msgErr); //main API
573 573
     }
574 574
 
575
-    $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq();
575
+    $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq();
576 576
     ?>
577 577
     <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise">
578 578
         <div class="form-group">
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
                                 <th><?php echo get_lang('Comment'); ?></th>
612 612
                                 <?php
613 613
                                 if ($answerType == HOT_SPOT_DELINEATION) {
614
-                                    echo '<th >' . get_lang('Scenario') . '</th>';
614
+                                    echo '<th >'.get_lang('Scenario').'</th>';
615 615
                                 }
616 616
                                 ?>
617 617
                                 <?php
@@ -643,36 +643,36 @@  discard block
 block discarded – undo
643 643
                                         $isSelected = true;
644 644
                                         $selected = 'selected="selected"';
645 645
                                     }
646
-                                    $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
646
+                                    $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
647 647
                                 }
648 648
 
649 649
                                 if ($isSelected) {
650
-                                    $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
650
+                                    $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
651 651
                                 } else {
652
-                                    $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
652
+                                    $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
653 653
                                 }
654 654
 
655 655
                                 // Feedback SELECT
656 656
                                 $question_list = $objExercise->selectQuestionList();
657 657
                                 $option_feed = '';
658
-                                $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
658
+                                $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
659 659
 
660 660
                                 foreach ($question_list as $key => $questionid) {
661 661
                                     $selected = '';
662 662
                                     $question = Question::read($questionid);
663
-                                    $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
663
+                                    $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
664 664
 
665 665
                                     if (isset($select_question[$i]) && $questionid == $select_question[$i]) {
666 666
                                         $selected = 'selected="selected"';
667 667
                                     }
668 668
 
669
-                                    $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
669
+                                    $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
670 670
                                 }
671 671
 
672 672
                                 if (isset($select_question[$i]) && $select_question[$i] == -1) {
673
-                                    $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
673
+                                    $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
674 674
                                 } else {
675
-                                    $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>';
675
+                                    $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
676 676
                                 }
677 677
 
678 678
                                 //-------- IF it is a delineation
@@ -688,9 +688,9 @@  discard block
 block discarded – undo
688 688
                                             $selected2 = 'selected="selected"';
689 689
                                         if ($k == $threadhold3[$i])
690 690
                                             $selected3 = 'selected="selected"';
691
-                                        $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
692
-                                        $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
693
-                                        $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
691
+                                        $option1 .= '<option '.$selected1.' >'.$k.' % </option>';
692
+                                        $option2 .= '<option '.$selected2.' >'.$k.' % </option>';
693
+                                        $option3 .= '<option '.$selected3.'>'.$k.' %</option>';
694 694
                                     }
695 695
                                     ?>
696 696
                                     <tr>
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
                                                 <div class="checkbox">
735 735
                                                     <p>
736 736
                                                         <label>
737
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
737
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
738 738
                                                             <?php echo get_lang('TryAgain'); ?>
739 739
                                                         </label>
740 740
                                                     </p>
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                                                             <div class="checkbox">
788 788
                                                                 <p>
789 789
                                                                     <label>
790
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
790
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
791 791
                                                                         <?php echo get_lang('TryAgain'); ?>
792 792
                                                                     </label>
793 793
                                                                 </p>
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
                                                 <div class="checkbox">
853 853
                                                     <p>
854 854
                                                         <label>
855
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
855
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
856 856
                                                             <?php echo get_lang('TryAgain'); ?>
857 857
                                                         </label>
858 858
                                                     </p>
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
                                         <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" />
893 893
                                     </td>
894 894
                                     <?php
895
-                                    $form = new FormValidator('form_' . $i);
895
+                                    $form = new FormValidator('form_'.$i);
896 896
                                     $config = array(
897 897
                                         'ToolbarSet' => 'TestProposedAnswer',
898 898
                                         'cols-size' => [0, 12, 0]
899 899
                                     );
900
-                                    $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config);
900
+                                    $form->addHtmlEditor('comment['.$i.']', null, false, false, $config);
901 901
                                     $renderer = $form->defaultRenderer();
902 902
                                     $form_template = '{content}';
903 903
                                     $renderer->setFormTemplate($form_template);
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                                         {element}';
907 907
                                     $renderer->setElementTemplate($element_template);
908 908
 
909
-                                    $form->setDefaults(array('comment[' . $i . ']' => $commentValue));
909
+                                    $form->setDefaults(array('comment['.$i.']' => $commentValue));
910 910
                                     $return = $form->return_form();
911 911
                                     ?>
912 912
                                     <td colspan="2" align="left" ><?php echo $return; ?></td>
@@ -945,36 +945,36 @@  discard block
 block discarded – undo
945 945
                                 $selected = 'selected="selected"';
946 946
                                 $isSelected = true;
947 947
                             }
948
-                            $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
948
+                            $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
949 949
                         }
950 950
 
951 951
                         if ($isSelected) {
952
-                            $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
952
+                            $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
953 953
                         } else {
954
-                            $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
954
+                            $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
955 955
                         }
956 956
 
957 957
                         // Feedback SELECT
958 958
                         $question_list = $objExercise->selectQuestionList();
959 959
                         $option_feed = '';
960
-                        $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
960
+                        $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
961 961
                         $details = isset($details) ? $details : null;
962 962
                         $id = isset($id) ? $id : 0;
963 963
                         $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null;
964 964
                         foreach ($question_list as $key => $questionid) {
965 965
                             $selected = '';
966 966
                             $question = Question::read($questionid);
967
-                            $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
967
+                            $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
968 968
                             $select_lp_id[$id] = $details['lp_name'];
969 969
                             if ($questionid == $selectQuestionNoError) {
970 970
                                 $selected = 'selected="selected"';
971 971
                             }
972
-                            $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
972
+                            $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
973 973
                         }
974 974
                         if ($selectQuestionNoError == -1) {
975
-                            $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
975
+                            $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
976 976
                         } else {
977
-                            $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
977
+                            $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
978 978
                         }
979 979
 
980 980
                         if ($answerType == HOT_SPOT_DELINEATION) {
@@ -1065,6 +1065,6 @@  discard block
 block discarded – undo
1065 1065
     </script>
1066 1066
     <?php
1067 1067
     if ($debug > 0) {
1068
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers was set - end' . "<br />\n";
1068
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers was set - end'."<br />\n";
1069 1069
     }
1070 1070
 }
Please login to merge, or discard this patch.
main/upload/upload.document.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  * @author Yannick Warnier <[email protected]>
10 10
  */
11 11
 
12
-$courseDir = $_course['path'] . "/document";
12
+$courseDir = $_course['path']."/document";
13 13
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
14
-$base_work_dir = $sys_course_path . $courseDir;
14
+$base_work_dir = $sys_course_path.$courseDir;
15 15
 $noPHP_SELF = true;
16 16
 $max_filled_space = DocumentManager::get_course_quota();
17 17
 
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 
35 35
 $nameTools = get_lang('UplUploadDocument');
36 36
 $interbreadcrumb[] = array(
37
-    "url" => "./document.php?curdirpath=" . urlencode(
37
+    "url" => "./document.php?curdirpath=".urlencode(
38 38
             $path
39
-        ) . $req_gid,
39
+        ).$req_gid,
40 40
     "name" => $langDocuments
41 41
 );
42 42
 Display::display_header($nameTools, "Doc");
43 43
 //show the title
44
-api_display_tool_title($nameTools . $add_group_to_title);
44
+api_display_tool_title($nameTools.$add_group_to_title);
45 45
 
46 46
 /**
47 47
  * Process
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
         	$ct = '';
72 72
         	if ($new_comment) $ct .= ", comment='$new_comment'";
73 73
         	if ($new_title)   $ct .= ", title='$new_title'";
74
-        	Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
74
+        	Database::query("UPDATE $table_document SET".substr($ct, 1)." WHERE id = '$docid'");
75 75
     	}
76 76
         //check for missing images in html files
77 77
         $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
78
-        if ($missing_files)  {
78
+        if ($missing_files) {
79 79
             //show a form to upload the missing files
80 80
             Display::display_normal_message(
81 81
                 build_missing_files_form(
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     if ($number_of_uploaded_images > 0) {
95 95
         //we could also create a function for this, I'm not sure...
96 96
         //create a directory for the missing files
97
-        $img_directory = str_replace('.','_',$_POST['related_file']."_files");
97
+        $img_directory = str_replace('.', '_', $_POST['related_file']."_files");
98 98
         $folderData = create_unexisting_directory(
99 99
             $_course,
100 100
             $_user['user_id'],
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
         replace_img_path_in_html_file(
121 121
             $_POST['img_file_path'],
122 122
             $paths_to_replace_in_file,
123
-            $base_work_dir . $_POST['related_file']
123
+            $base_work_dir.$_POST['related_file']
124 124
         );
125 125
         //update parent folders
126
-        item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
126
+        item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']);
127 127
     }
128 128
 }
129 129
 //they want to create a directory
130
-if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
131
-	$added_slash = ($path=='/')?'':'/';
130
+if (isset($_POST['create_dir']) && $_POST['dirname'] != '') {
131
+	$added_slash = ($path == '/') ? '' : '/';
132 132
 	$dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']);
133 133
     $created_dir = create_unexisting_directory(
134 134
         $_course,
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	//create the form that asks for the directory name
153 153
 	$new_folder_text = '<form action="'.api_get_self().'" method="POST">';
154 154
 	$new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>';
155
-	$new_folder_text .= get_lang('NewDir') .' ';
155
+	$new_folder_text .= get_lang('NewDir').' ';
156 156
 	$new_folder_text .= '<input type="text" name="dirname"/>';
157 157
 	$new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
158 158
 	$new_folder_text .= '</form>';
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	<p>
164 164
         <a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&amp;createdir=1">
165 165
             <?php echo Display::return_icon('new_folder.gif'); ?>
166
-            <?php echo(get_lang('CreateDir'));?>
166
+            <?php echo(get_lang('CreateDir')); ?>
167 167
         </a>
168 168
     </p>
169 169
 <?php
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 </td>
187 187
 </tr>
188 188
 <tr>
189
-<td><?php echo get_lang('Title');?></td>
189
+<td><?php echo get_lang('Title'); ?></td>
190 190
 <td><input type="text" size="20" name="title" style="width:300px;"></td>
191 191
 </tr>
192 192
 <tr>
193
-<td valign="top"><?php echo get_lang('Comment');?></td>
193
+<td valign="top"><?php echo get_lang('Comment'); ?></td>
194 194
 <td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td>
195 195
 </tr>
196 196
 <tr>
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 <?php echo get_lang('Options'); ?>
199 199
 </td>
200 200
 <td>
201
-- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/>
202
-- <?php echo (get_lang('UplWhatIfFileExists'));?><br/>
203
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/>  <?php echo (get_lang('UplDoNothing'));?><br/>
204
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/>
205
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?>
201
+- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress')); ?><br/>
202
+- <?php echo (get_lang('UplWhatIfFileExists')); ?><br/>
203
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong')); ?>" checked="checked"/>  <?php echo (get_lang('UplDoNothing')); ?><br/>
204
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong')); ?>"/> <?php echo (get_lang('UplOverwrite')); ?><br/>
205
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong')); ?>"/> <?php echo (get_lang('UplRename')); ?>
206 206
 
207 207
 </td>
208 208
 </tr>
209 209
 </table>
210 210
 
211
-<input type="submit" value="<?php echo(get_lang('Ok'));?>">
211
+<input type="submit" value="<?php echo(get_lang('Ok')); ?>">
212 212
 </form>
213 213
 <!-- end upload form -->
214 214
 
215 215
  <!-- so they can get back to the documents   -->
216
- <p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
216
+ <p><?php echo (get_lang('Back')); ?> <?php echo (get_lang('To')); ?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview')); ?></a></p>
217 217
 <?php
218 218
 
219 219
 Display::display_footer();
Please login to merge, or discard this patch.
main/upload/upload_word.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 include '../inc/global.inc.php';
12 12
 
13
-$form_style= '<style>
13
+$form_style = '<style>
14 14
 .row {
15 15
     width: 200px;
16 16
 }
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 </script>';
29 29
 $htmlHeadXtra[] = $form_style;
30 30
 
31
-if (api_get_setting('search_enabled')=='true') {
31
+if (api_get_setting('search_enabled') == 'true') {
32 32
     $specific_fields = get_specific_field_list();
33 33
 }
34 34
 
35 35
 if (isset($_POST['convert'])) {
36 36
     $cwdir = getcwd();
37 37
     if (isset($_FILES['user_file'])) {
38
-        $allowed_extensions = array('doc','docx','odt','txt','sxw','rtf');
39
-        if (in_array(strtolower(pathinfo($_FILES['user_file']['name'],PATHINFO_EXTENSION)),$allowed_extensions)) {
38
+        $allowed_extensions = array('doc', 'docx', 'odt', 'txt', 'sxw', 'rtf');
39
+        if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) {
40 40
             require('../newscorm/lp_upload.php');
41 41
             if (isset($o_doc) && $first_item_id != 0) {
42 42
                 // Search-related section
43
-                if (api_get_setting('search_enabled')=='true') {
44
-                    require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
43
+                if (api_get_setting('search_enabled') == 'true') {
44
+                    require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');
45 45
                     $specific_fields = get_specific_field_list();
46 46
 
47 47
                     foreach ($specific_fields as $specific_field) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     api_not_allowed(true);
78 78
 }
79 79
 
80
-$interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc"));
80
+$interbreadcrumb[] = array("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Doc"));
81 81
 $nameTools = get_lang("WoogieConversionPowerPoint");
82 82
 Display :: display_header($nameTools);
83 83
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
          border-color: #4171B5;
98 98
          color: #000;";
99 99
 
100
-$s_style_error="border-width: 1px;
100
+$s_style_error = "border-width: 1px;
101 101
          border-style: solid;
102 102
          margin-left: 0;
103 103
          margin-top: 10px;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 // build the form
125 125
 
126
-$form -> addElement ('html','<br>');
126
+$form -> addElement('html', '<br>');
127 127
 
128 128
 $div_upload_limit = '&nbsp;&nbsp;'.get_lang('UploadMaxSize').' : '.ini_get('post_max_size');
129 129
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         <!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->
137 137
 </div>
138 138
 EOT;
139
-$renderer->setElementTemplate($user_file_template,'user_file');
139
+$renderer->setElementTemplate($user_file_template, 'user_file');
140 140
 
141 141
 // set template for other elements
142 142
 $user_file_template =
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 EOT;
149 149
 $renderer->setCustomElementTemplate($user_file_template);
150 150
 
151
-$form -> addElement ('file', 'user_file', Display::return_icon('word_big.gif'));
151
+$form -> addElement('file', 'user_file', Display::return_icon('word_big.gif'));
152 152
 if (api_get_setting('search_enabled') == 'true') {
153 153
     $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
154 154
     $form->addElement('html', '<br />');
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     foreach ($specific_fields as $specific_field) {
163 163
         $form->addElement('text', $specific_field['code'], $specific_field['name'].' : ');
164 164
     }
165
-    $form -> addElement ('html','</div>');
165
+    $form -> addElement('html', '</div>');
166 166
 }
167 167
 
168 168
 /*
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
  * $form -> addElement ('radio', 'split_steps',null, get_lang('SplitStepsPerPage'),'per_page');
171 171
  * $form -> addElement ('radio', 'split_steps',null, get_lang('SplitStepsPerChapter'),'per_chapter');
172 172
  */
173
-$form -> addElement ('hidden', 'split_steps','per_page');
174
-$form -> addElement ('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"');
175
-$form -> addElement ('hidden', 'woogie', 'true');
176
-$form -> add_real_progress_bar(md5(rand(0,10000)), 'user_file', 1, true);
177
-$defaults = array('split_steps'=>'per_page','index_document'=>'checked="checked"');
173
+$form -> addElement('hidden', 'split_steps', 'per_page');
174
+$form -> addElement('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"');
175
+$form -> addElement('hidden', 'woogie', 'true');
176
+$form -> add_real_progress_bar(md5(rand(0, 10000)), 'user_file', 1, true);
177
+$defaults = array('split_steps'=>'per_page', 'index_document'=>'checked="checked"');
178 178
 $form -> setDefaults($defaults);
179 179
 
180 180
 // display the form
Please login to merge, or discard this patch.
main/social/search.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 $tool_name = get_lang('Search');
21 21
 $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork'));
22 22
 
23
-$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null;
24
-$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null;
23
+$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : null;
24
+$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0', '1', '2')) ? $_GET['search_type'] : null;
25 25
 $extra_fields = UserManager::get_extra_filtrable_fields();
26 26
 $query_vars = array('q' => $query, 'search_type' => $query_search_type);
27 27
 if (!empty($extra_fields)) {
28 28
     foreach ($extra_fields as $extra_field) {
29
-        $field_name = 'field_' . $extra_field['variable'];
29
+        $field_name = 'field_'.$extra_field['variable'];
30 30
         if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') {
31 31
             $query_vars[$field_name] = $_GET[$field_name];
32 32
         }
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 $usergroup = new UserGroup();
47 47
 
48 48
 // I'm searching something
49
-if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) ) {
49
+if ($query != '' || ($query_vars['search_type'] == '1' && count($query_vars) > 2)) {
50 50
     $itemPerPage = 8;
51 51
 
52
-    if ($_GET['search_type']=='0' || $_GET['search_type']=='1') {
52
+    if ($_GET['search_type'] == '0' || $_GET['search_type'] == '1') {
53 53
         $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1;
54 54
         $totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true);
55 55
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage);
59 59
     }
60 60
 
61
-    if ($_GET['search_type']=='0' || $_GET['search_type']=='2') {
61
+    if ($_GET['search_type'] == '0' || $_GET['search_type'] == '2') {
62 62
         $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1;
63 63
         // Groups
64 64
         $fromGroups = intval(($pageGroup - 1) * $itemPerPage);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             // Show send invitation icon if they are not friends yet
86 86
             if ($relation_type != 3 && $relation_type != 4 && $user_info['user_id'] != api_get_user_id()) {
87
-                $send_inv = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="' . $user_info['user_id'] . '">
87
+                $send_inv = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="'.$user_info['user_id'].'">
88 88
                              <em class="fa fa-user"></em> '.get_lang('SendInvitation').'</a>';
89 89
             }
90 90
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                                 </div>
131 131
                                 <div class="user-info">
132 132
                                    <p>'.$user_info['complete_name'].'</p>
133
-                                   <div class="items-user-status">' . $status_icon . $user_icon . '</div>
133
+                                   <div class="items-user-status">' . $status_icon.$user_icon.'</div>
134 134
                                    <div class="toolbar">
135 135
                                     '.$invitations.'
136 136
                                    </div>
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             $tags = null;
188 188
             $group['picture'] = '<img class="img-responsive img-circle" src="'.$picture['file'].'" />';
189 189
 
190
-            $members = Display::returnFontAwesomeIcon('user') . '( ' .$count_users_group . ' )';
190
+            $members = Display::returnFontAwesomeIcon('user').'( '.$count_users_group.' )';
191 191
             $item_1  = Display::tag('p', $url_open.$name.$url_close);
192 192
 
193 193
             $block_groups .= '
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
                         </div>
199 199
                         <div class="user-info">
200 200
                             '.$item_1.'
201
-                            <p>' . $members . '</p>    
202
-                            <p>' . $group['description'] . '</p>
203
-                            <p>' . $tags . '</p>
204
-                            <p>' . $url_open.get_lang('SeeMore') . $url_close . '</p>
201
+                            <p>' . $members.'</p>    
202
+                            <p>' . $group['description'].'</p>
203
+                            <p>' . $tags.'</p>
204
+                            <p>' . $url_open.get_lang('SeeMore').$url_close.'</p>
205 205
                         </div>
206 206
                     </div>
207 207
                 </div>';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 $tpl->assign('social_search', $block_search);
242 242
 $tpl->assign('search_form', $searchForm);
243 243
 
244
-$formModalTpl =  new Template();
244
+$formModalTpl = new Template();
245 245
 $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
246 246
 $formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
247 247
 
Please login to merge, or discard this patch.