Passed
Push — 1.10.x ( 2d286e...59f957 )
by Yannick
48:16
created
main/exercice/hotspot_admin.inc.php 1 patch
Braces   +32 added lines, -13 removed lines patch added patch discarded remove patch
@@ -366,8 +366,9 @@  discard block
 block discarded – undo
366 366
         if ($answerType == HOT_SPOT_DELINEATION) {
367 367
             // the magic happens here ...
368 368
             // we do this to not count the if no error section
369
-            if ($nbrAnswers >= 2)
370
-                $nbrAnswers--;
369
+            if ($nbrAnswers >= 2) {
370
+                            $nbrAnswers--;
371
+            }
371 372
         }
372 373
 
373 374
         $reponse = array();
@@ -679,12 +680,15 @@  discard block
 block discarded – undo
679 680
 
680 681
                                     for ($k = 1; $k <= 100; $k++) {
681 682
                                         $selected1 = $selected2 = $selected3 = '';
682
-                                        if ($k == $threadhold1[$i])
683
-                                            $selected1 = 'selected="selected"';
684
-                                        if ($k == $threadhold2[$i])
685
-                                            $selected2 = 'selected="selected"';
686
-                                        if ($k == $threadhold3[$i])
687
-                                            $selected3 = 'selected="selected"';
683
+                                        if ($k == $threadhold1[$i]) {
684
+                                                                                    $selected1 = 'selected="selected"';
685
+                                        }
686
+                                        if ($k == $threadhold2[$i]) {
687
+                                                                                    $selected2 = 'selected="selected"';
688
+                                        }
689
+                                        if ($k == $threadhold3[$i]) {
690
+                                                                                    $selected3 = 'selected="selected"';
691
+                                        }
688 692
                                         $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
689 693
                                         $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
690 694
                                         $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
@@ -731,7 +735,10 @@  discard block
 block discarded – undo
731 735
                                                 <div class="checkbox">
732 736
                                                     <p>
733 737
                                                         <label>
734
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
738
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) {
739
+    echo'checked';
740
+}
741
+?> />
735 742
                                                             <?php echo get_lang('TryAgain'); ?>
736 743
                                                         </label>
737 744
                                                     </p>
@@ -784,7 +791,10 @@  discard block
 block discarded – undo
784 791
                                                             <div class="checkbox">
785 792
                                                                 <p>
786 793
                                                                     <label>
787
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
794
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) {
795
+    echo'checked';
796
+}
797
+?> />
788 798
                                                                         <?php echo get_lang('TryAgain'); ?>
789 799
                                                                     </label>
790 800
                                                                 </p>
@@ -823,7 +833,10 @@  discard block
 block discarded – undo
823 833
                                             <th ><?php echo get_lang('OAR'); ?>*</th>
824 834
                                             <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?>
825 835
                                                 <th colspan="2" ><?php echo get_lang('Comment'); ?></th>
826
-                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th>
836
+                                                <th ><?php if ($answerType == HOT_SPOT_DELINEATION) {
837
+    echo get_lang('Scenario');
838
+}
839
+?></th>
827 840
                                             <?php } else { ?>
828 841
                                                 <th colspan="3" ><?php echo get_lang('Comment'); ?></th>
829 842
                                             <?php } ?>
@@ -849,7 +862,10 @@  discard block
 block discarded – undo
849 862
                                                 <div class="checkbox">
850 863
                                                     <p>
851 864
                                                         <label>
852
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
865
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) {
866
+    echo'checked';
867
+}
868
+?> />
853 869
                                                             <?php echo get_lang('TryAgain'); ?>
854 870
                                                         </label>
855 871
                                                     </p>
@@ -998,7 +1014,10 @@  discard block
 block discarded – undo
998 1014
                                         <div class="checkbox">
999 1015
                                             <p>
1000 1016
                                                 <label>
1001
-                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> />
1017
+                                                    <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) {
1018
+    echo'checked';
1019
+}
1020
+?> />
1002 1021
                                                     <?php echo get_lang('TryAgain'); ?>
1003 1022
                                                 </label>
1004 1023
                                             </p>
Please login to merge, or discard this patch.
main/admin/user_move_stats.php 1 patch
Braces   +111 added lines, -47 removed lines patch added patch discarded remove patch
@@ -106,7 +106,9 @@  discard block
 block discarded – undo
106 106
                 //Check if the user is registered in the session otherwise we will add it
107 107
                 $result = SessionManager::get_users_by_session($new_session_id);
108 108
                 if (empty($result) || !in_array($user_id, array_keys($result))) {
109
-                    if ($debug) echo 'User added to the session';
109
+                    if ($debug) {
110
+                        echo 'User added to the session';
111
+                    }
110 112
                     //Registering user to the new session
111 113
                     SessionManager::suscribe_users_to_session($new_session_id,array($user_id),false);
112 114
                 }
@@ -141,10 +143,11 @@  discard block
 block discarded – undo
141 143
                     $list[$row['exe_id']]= $row;
142 144
                 }
143 145
 
144
-                if (!empty($list))
145
-                    foreach ($list as $exe_id =>$data) {
146
+                if (!empty($list)) {
147
+                                    foreach ($list as $exe_id =>$data) {
146 148
                         if ($update_database) {
147 149
                             $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
150
+                }
148 151
                             $res = Database::query($sql);
149 152
                             $result_message[$TABLETRACK_EXERCICES]++;
150 153
                         } else {
@@ -168,10 +171,11 @@  discard block
 block discarded – undo
168 171
                         $list[$row['exe_id']]= $row;
169 172
                     }
170 173
 
171
-                    if (!empty($list))
172
-                        foreach ($list as $exe_id =>$data) {
174
+                    if (!empty($list)) {
175
+                                            foreach ($list as $exe_id =>$data) {
173 176
                             if ($update_database) {
174 177
                                 $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
178
+                    }
175 179
                                 $res = Database::query($sql);
176 180
                                 $result_message[$TABLETRACK_EXERCICES]++;
177 181
                             } else {
@@ -196,10 +200,11 @@  discard block
 block discarded – undo
196 200
                     $list[$row['course_access_id']] = $row;
197 201
                 }
198 202
 
199
-                if (!empty($list))
200
-                    foreach ($list as $id => $data) {
203
+                if (!empty($list)) {
204
+                                    foreach ($list as $id => $data) {
201 205
                         if ($update_database) {
202 206
                             $sql = "UPDATE $TBL_TRACK_E_COURSE_ACCESS SET session_id = $new_session_id WHERE course_access_id = $id";
207
+                }
203 208
                             if ($debug) {
204 209
                                 echo $sql;
205 210
                             }
@@ -218,13 +223,18 @@  discard block
 block discarded – undo
218 223
                 while($row = Database::fetch_array($res,'ASSOC')) {
219 224
                     $list[] = $row['access_id'];
220 225
                 }
221
-                if (!empty($list))
222
-                    foreach ($list as $id) {
226
+                if (!empty($list)) {
227
+                                    foreach ($list as $id) {
223 228
                         if ($update_database) {
224 229
                             $sql = "UPDATE $TBL_TRACK_E_LAST_ACCESS SET access_session_id = $new_session_id WHERE access_id = $id";
225
-                            if ($debug) echo $sql;
230
+                }
231
+                            if ($debug) {
232
+                                echo $sql;
233
+                            }
226 234
                             $res = Database::query($sql);
227
-                            if ($debug) var_dump($res);
235
+                            if ($debug) {
236
+                                var_dump($res);
237
+                            }
228 238
                             $result_message[$TBL_TRACK_E_LAST_ACCESS]++;
229 239
                         }
230 240
                     }
@@ -248,13 +258,18 @@  discard block
 block discarded – undo
248 258
                     }
249 259
                 }
250 260
 
251
-                if (!empty($list))
252
-                    foreach ($list as $id=>$data) {
261
+                if (!empty($list)) {
262
+                                    foreach ($list as $id=>$data) {
253 263
                         if ($update_database) {
254 264
                             $sql = "UPDATE $TBL_LP_VIEW SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
255
-                            if ($debug) var_dump($sql);
265
+                }
266
+                            if ($debug) {
267
+                                var_dump($sql);
268
+                            }
256 269
                             $res = Database::query($sql);
257
-                            if ($debug) var_dump($res);
270
+                            if ($debug) {
271
+                                var_dump($res);
272
+                            }
258 273
                             $result_message[$TBL_LP_VIEW]++;
259 274
                         } else {
260 275
                             //Getting all information of that lp_item_id
@@ -281,10 +296,11 @@  discard block
 block discarded – undo
281 296
                             $list[$row['id']] = $row;
282 297
                         }
283 298
                     }
284
-                    if (!empty($list))
285
-                        foreach ($list as $id=>$data) {
299
+                    if (!empty($list)) {
300
+                                            foreach ($list as $id=>$data) {
286 301
                             //Getting all information of that lp_item_id
287 302
                             $score    = Tracking::get_avg_student_score($user_id, $origin_course_code,        array($data['lp_id']), $new_session_id);
303
+                    }
288 304
                             $progress = Tracking::get_avg_student_progress($user_id, $origin_course_code,     array($data['lp_id']), $new_session_id);
289 305
                             $result_message_compare['LP_VIEW'][$data['lp_id']] = array('score' => $score, 'progress' =>$progress);
290 306
                         }
@@ -300,9 +316,13 @@  discard block
 block discarded – undo
300 316
                     $id = $row['ref'];
301 317
                     if ($update_database) {
302 318
                         $sql = "UPDATE $TBL_AGENDA SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
303
-                        if ($debug) var_dump($sql);
319
+                        if ($debug) {
320
+                            var_dump($sql);
321
+                        }
304 322
                         $res_update = Database::query($sql);
305
-                        if ($debug) var_dump($res_update);
323
+                        if ($debug) {
324
+                            var_dump($res_update);
325
+                        }
306 326
                         $result_message['agenda']++;
307 327
                     }
308 328
                 }
@@ -314,22 +334,30 @@  discard block
 block discarded – undo
314 334
                 //echo '<h1>Student publication</h1>';
315 335
 
316 336
                 $sql = "SELECT ref FROM $TBL_ITEM_PROPERTY WHERE tool = 'work' AND insert_user_id = $user_id AND c_id = $course_id";
317
-                if ($debug) echo $sql;
337
+                if ($debug) {
338
+                    echo $sql;
339
+                }
318 340
                 $res = Database::query($sql);
319 341
                 while($row = Database::fetch_array($res,'ASSOC')) {
320 342
                     $id = $row['ref'];
321 343
                     $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $id AND session_id = $origin_session_id AND c_id = $course_id";
322
-                    if ($debug) var_dump($sql);
344
+                    if ($debug) {
345
+                        var_dump($sql);
346
+                    }
323 347
                     $sub_res = Database::query($sql);
324 348
                     if (Database::num_rows($sub_res) > 0 ) {
325 349
                         $data = Database::fetch_array($sub_res,'ASSOC');
326
-                        if ($debug) var_dump($data);
350
+                        if ($debug) {
351
+                            var_dump($data);
352
+                        }
327 353
                         $parent_id = $data['parent_id'];
328 354
                         if (isset($data['parent_id']) && !empty($data['parent_id'])) {
329 355
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $parent_id AND c_id = $course_id";
330 356
                             $select_res     = Database::query($sql);
331 357
                             $parent_data    = Database::fetch_array($select_res,'ASSOC');
332
-                            if ($debug)     var_dump($parent_data);
358
+                            if ($debug) {
359
+                                var_dump($parent_data);
360
+                            }
333 361
 
334 362
                             $sys_course_path = api_get_path(SYS_COURSE_PATH);
335 363
                             $course_dir = $sys_course_path . $course_info['path'];
@@ -344,7 +372,9 @@  discard block
 block discarded – undo
344 372
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION
345 373
                             		WHERE description like '%$search_this%' AND url LIKE '%$search_this2%' AND session_id = $new_session_id AND c_id = $course_id
346 374
                             		ORDER BY id desc  LIMIT 1";
347
-                            if ($debug) echo $sql;
375
+                            if ($debug) {
376
+                                echo $sql;
377
+                            }
348 378
                             $sub_res = Database::query($sql);
349 379
                             $num_rows = Database::num_rows($sub_res);
350 380
 
@@ -377,12 +407,16 @@  discard block
 block discarded – undo
377 407
 	                                       date_of_qualification    = '0000-00-00 00:00:00',
378 408
 	                                       session_id   = ".$new_session_id;
379 409
                                     $rest_insert     = Database::query($sql_add_publication);
380
-                                    if ($debug) echo ($sql_add_publication);
410
+                                    if ($debug) {
411
+                                        echo ($sql_add_publication);
412
+                                    }
381 413
                                     // add the directory
382 414
                                     $id = Database::insert_id();
383 415
                                     //Folder created
384 416
                                     api_item_property_update($course_info, 'work', $id, 'DirectoryCreated', api_get_user_id());
385
-                                    if ($debug) var_dump($rest_insert);
417
+                                    if ($debug) {
418
+                                        var_dump($rest_insert);
419
+                                    }
386 420
                                     $new_parent_id = $id;
387 421
                                     $result_message[$TBL_STUDENT_PUBLICATION.' - new folder created called: '.$created_dir]++;
388 422
                                 }
@@ -390,7 +424,9 @@  discard block
 block discarded – undo
390 424
 
391 425
                             //Creating student_publication_assignment if exists
392 426
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION_ASSIGNMENT WHERE publication_id = $parent_id AND c_id = $course_id";
393
-                            if ($debug) var_dump($sql);
427
+                            if ($debug) {
428
+                                var_dump($sql);
429
+                            }
394 430
                             $rest_select     = Database::query($sql);
395 431
                             if (Database::num_rows($rest_select) > 0 ) {
396 432
                                 if ($update_database) {
@@ -402,7 +438,9 @@  discard block
 block discarded – undo
402 438
                                        add_to_calendar      = '".$assignment_data['add_to_calendar']."',
403 439
                                        enable_qualification = '".$assignment_data['enable_qualification']."',
404 440
                                        publication_id       = '".$new_parent_id."'";
405
-                                    if ($debug) echo $sql_add_publication;
441
+                                    if ($debug) {
442
+                                        echo $sql_add_publication;
443
+                                    }
406 444
                                     $rest_select     = Database::query($sql_add_publication);
407 445
                                     $id = Database::insert_id();
408 446
 
@@ -410,11 +448,15 @@  discard block
 block discarded – undo
410 448
                                         "has_properties         = '".$id."',
411 449
                                        view_properties    = '1'
412 450
                                        WHERE id   = ".$new_parent_id;
413
-                                    if ($debug) echo $sql_update;
451
+                                    if ($debug) {
452
+                                        echo $sql_update;
453
+                                    }
414 454
                                     $rest_update     = Database::query($sql_update);
415 455
 
416 456
 
417
-                                    if ($debug) var_dump($sql_update);
457
+                                    if ($debug) {
458
+                                        var_dump($sql_update);
459
+                                    }
418 460
                                     $result_message[$TBL_STUDENT_PUBLICATION_ASSIGNMENT]++;
419 461
                                 }
420 462
                             }
@@ -437,9 +479,13 @@  discard block
 block discarded – undo
437 479
                                                parent_id    =  ".$new_parent_id ." ,
438 480
                                                session_id = ".$new_session_id;
439 481
 
440
-                                if ($debug) echo $sql_add_publication;
482
+                                if ($debug) {
483
+                                    echo $sql_add_publication;
484
+                                }
441 485
                                 $rest_insert     = Database::query($sql_add_publication);
442
-                                if ($debug) var_dump($rest_insert);
486
+                                if ($debug) {
487
+                                    var_dump($rest_insert);
488
+                                }
443 489
                                 $id = Database::insert_id();
444 490
                                 api_item_property_update($course_info, 'work', $id, 'DocumentAdded', $user_id);
445 491
                                 $result_message[$TBL_STUDENT_PUBLICATION]++;
@@ -453,7 +499,9 @@  discard block
 block discarded – undo
453 499
                                     if ($result) {
454 500
                                         unlink($full_file_name);
455 501
                                         $sql = "DELETE FROM $TBL_STUDENT_PUBLICATION WHERE id= ".$data['id'];
456
-                                        if ($debug) var_dump($sql);
502
+                                        if ($debug) {
503
+                                            var_dump($sql);
504
+                                        }
457 505
                                         $result_delete     = Database::query($sql);
458 506
                                         api_item_property_update($course_info, 'work', $data['id'], 'DocumentDeleted', api_get_user_id());
459 507
                                     }
@@ -469,22 +517,30 @@  discard block
 block discarded – undo
469 517
                 //10. Dropbox - not neccesary to move categories (no presence of session_id)
470 518
 
471 519
                 $sql = "SELECT id FROM $TBL_DROPBOX_FILE WHERE uploader_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id";
472
-                if ($debug) var_dump($sql);
520
+                if ($debug) {
521
+                    var_dump($sql);
522
+                }
473 523
                 $res = Database::query($sql);
474 524
                 while($row = Database::fetch_array($res,'ASSOC')) {
475 525
                     $id = $row['id'];
476 526
                     if ($update_database) {
477 527
                         $sql = "UPDATE $TBL_DROPBOX_FILE SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id";
478
-                        if ($debug) var_dump($sql);
528
+                        if ($debug) {
529
+                            var_dump($sql);
530
+                        }
479 531
                         $res = Database::query($sql);
480
-                        if ($debug) var_dump($res);
532
+                        if ($debug) {
533
+                            var_dump($res);
534
+                        }
481 535
 
482 536
                         $sql = "UPDATE $TBL_DROPBOX_POST SET session_id = $new_session_id WHERE file_id = $id";
483
-                        if ($debug)
484
-                            var_dump($sql);
537
+                        if ($debug) {
538
+                                                    var_dump($sql);
539
+                        }
485 540
                         $res = Database::query($sql);
486
-                        if ($debug)
487
-                            var_dump($res);
541
+                        if ($debug) {
542
+                                                    var_dump($res);
543
+                        }
488 544
                         $result_message[$TBL_DROPBOX_FILE]++;
489 545
                     }
490 546
                 }
@@ -493,23 +549,30 @@  discard block
 block discarded – undo
493 549
 
494 550
                 $sql = "SELECT notebook_id FROM $TBL_NOTEBOOK
495 551
                         WHERE user_id = $user_id AND session_id = $origin_session_id AND course = '$origin_course_code' AND c_id = $course_id";
496
-                if ($debug) var_dump($sql);
552
+                if ($debug) {
553
+                    var_dump($sql);
554
+                }
497 555
                 $res = Database::query($sql);
498 556
                 while($row = Database::fetch_array($res,'ASSOC')) {
499 557
                     $id = $row['notebook_id'];
500 558
                     if ($update_database) {
501 559
                         $sql = "UPDATE $TBL_NOTEBOOK SET session_id = $new_session_id WHERE c_id = $course_id AND notebook_id = $id";
502
-                        if ($debug) var_dump($sql);
560
+                        if ($debug) {
561
+                            var_dump($sql);
562
+                        }
503 563
                         $res = Database::query($sql);
504
-                        if ($debug) var_dump($res);
564
+                        if ($debug) {
565
+                            var_dump($res);
566
+                        }
505 567
                     }
506 568
                 }
507 569
 
508 570
                 if ($update_database) {
509 571
                     echo '<h2>'.get_lang('StatsMoved').'</h2>';
510
-                    if (is_array($result_message))
511
-                        foreach ($result_message as $table=>$times) {
572
+                    if (is_array($result_message)) {
573
+                                            foreach ($result_message as $table=>$times) {
512 574
                             echo 'Table '.$table.' - '.$times.' records updated <br />';
575
+                    }
513 576
                         }
514 577
                 } else {
515 578
                     echo '<h2>'.get_lang('UserInformationOfThisCourse').'</h2>';
@@ -626,10 +689,11 @@  discard block
 block discarded – undo
626 689
 }
627 690
 $navigation .= '&nbsp;';
628 691
 $page ++;
629
-if ($page < $nro_pages)
692
+if ($page < $nro_pages) {
630 693
     $navigation .= '<a href="'.api_get_self().'?page='.$page.'">'.get_lang('Next').'</a>';
631
-else
694
+} else {
632 695
     $navigation .= get_lang('Next');
696
+}
633 697
 
634 698
 echo $navigation;
635 699
 $user_list      = UserManager::get_user_list(array(), array(), $begin, $default);
Please login to merge, or discard this patch.