Completed
Push — 1.11.x ( 79bd65...73103f )
by José
30:45
created
main/session/index.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     api_not_allowed();
17 17
 }
18 18
 
19
-$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']): null;
19
+$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
20 20
 $sessionField = new ExtraFieldValue('session');
21 21
 $valueAllowVisitors = $sessionField->get_values_by_handler_and_field_variable($session_id, 'allow_visitors');
22 22
 $allowVisitors = $valueAllowVisitors != false;
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 $this_section = SECTION_COURSES;
30 30
 $htmlHeadXtra[] = api_get_jqgrid_js();
31
-$course_id  = isset($_GET['course_id'])  ? intval($_GET['course_id']) : null;
31
+$course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
32 32
 Session::write('id_session', $session_id);
33 33
 
34 34
 // Clear the exercise session just in case
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
     $sessionCourses = $session->getCourses();
238 238
     $sessionCourse = $sessionCourses[0]->getCourse();
239 239
 
240
-    $courseUrl = $sessionCourse->getDirectory() . '/index.php?';
240
+    $courseUrl = $sessionCourse->getDirectory().'/index.php?';
241 241
     $courseUrl .= http_build_query([
242 242
         'id_session' => $session->getId()
243 243
     ]);
244 244
 
245
-    header('Location: ' . api_get_path(WEB_COURSE_PATH) . $courseUrl);
245
+    header('Location: '.api_get_path(WEB_COURSE_PATH).$courseUrl);
246 246
     exit;
247 247
 }
248 248
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
 $session_select = array();
252 252
 foreach ($session_list as $item) {
253
-    $session_select[$item['id']] =  $item['name'];
253
+    $session_select[$item['id']] = $item['name'];
254 254
 }
255 255
 
256 256
 // Session list form
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 $my_real_array = $new_exercises = array();
279 279
 $now = time();
280 280
 foreach ($final_array as $session_data) {
281
-    $my_course_list = isset($session_data['data']) ? $session_data['data']: array();
281
+    $my_course_list = isset($session_data['data']) ? $session_data['data'] : array();
282 282
     if (!empty($my_course_list)) {
283 283
         foreach ($my_course_list as $my_course_code=>$course_data) {
284 284
             $courseInfo = api_get_course_info($my_course_code);
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
                                     $exercise_result['exe_weighting']
323 323
                                 );
324 324
                                 $my_score = 0;
325
-                                if(!empty($exercise_result['exe_weighting']) && intval($exercise_result['exe_weighting']) != 0) {
326
-                                    $my_score = $exercise_result['exe_result']/$exercise_result['exe_weighting'];
325
+                                if (!empty($exercise_result['exe_weighting']) && intval($exercise_result['exe_weighting']) != 0) {
326
+                                    $my_score = $exercise_result['exe_result'] / $exercise_result['exe_weighting'];
327 327
                                 }
328 328
                                 $position = ExerciseLib::get_exercise_result_ranking(
329 329
                                     $my_score,
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
                                 $exercise_info->exercise = Display::url(
338 338
                                     $exercise_info->exercise,
339
-                                    api_get_path(WEB_CODE_PATH) . "exercise/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1",
339
+                                    api_get_path(WEB_CODE_PATH)."exercise/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1",
340 340
                                     array('target' => SESSION_LINK_TARGET, 'class'=>'exercise-result-link')
341 341
                                 );
342 342
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                             }
368 368
                             $exercise_info->exercise = Display::url(
369 369
                                 $exercise_info->exercise,
370
-                                api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id",
370
+                                api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id",
371 371
                                 array('target' => SESSION_LINK_TARGET)
372 372
                             );
373 373
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     $my_real_array = array_merge($new_exercises, $my_real_array);
400 400
 }
401 401
 
402
-$start = $end = $start_only = $end_only ='';
402
+$start = $end = $start_only = $end_only = '';
403 403
 
404 404
 if (!empty($session_info['access_start_date'])) {
405 405
     $start = api_convert_and_format_date($session_info['access_start_date'], DATE_FORMAT_SHORT);
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
     get_lang('Title'), get_lang('NumberOfPublishedExercises'), get_lang('NumberOfPublishedLps')
438 438
 );
439 439
 $column_model_courses = array(
440
-    array('name'=>'title',              'index'=>'title',               'width'=>'400px',  'align'=>'left',  'sortable'=>'true'),
440
+    array('name'=>'title', 'index'=>'title', 'width'=>'400px', 'align'=>'left', 'sortable'=>'true'),
441 441
     //array('name'=>'recent_lps',         'index'=>'recent_lps',          'width'=>'10px',  'align'=>'left',  'sortable'=>'false'),
442 442
 //    array('name'=>'max_mutation_date',  'index'=>'max_mutation_date',   'width'=>'120px',  'align'=>'left',  'sortable'=>'true'),
443
-    array('name'=>'exercise_count',     'index'=>'exercise_count',      'width'=>'180px',  'align'=>'left',  'sortable'=>'true'),
444
-    array('name'=>'lp_count',           'index'=>'lp_count',            'width'=>'180px',  'align'=>'left',  'sortable'=>'true')
443
+    array('name'=>'exercise_count', 'index'=>'exercise_count', 'width'=>'180px', 'align'=>'left', 'sortable'=>'true'),
444
+    array('name'=>'lp_count', 'index'=>'lp_count', 'width'=>'180px', 'align'=>'left', 'sortable'=>'true')
445 445
 );
446 446
 
447 447
 $extra_params_courses['height'] = '100%';
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
     get_lang('LearningPaths')
466 466
 );
467 467
 
468
-$column_model   = array(
469
-    array('name'=>'date',   'index'=>'date',   'width'=>'120', 'align'=>'left', 'sortable'=>'true'),
468
+$column_model = array(
469
+    array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'true'),
470 470
     array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
471
-    array('name'=>'lp',     'index'=>'lp',     'width'=>'440', 'align'=>'left', 'sortable'=>'true')
471
+    array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true')
472 472
 );
473 473
 
474 474
 $extra_params = array();
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
     get_lang('LearningPaths')
515 515
 );
516 516
 
517
-$column_week_model  = array(
518
-    array('name'=>'week',     'index'=>'week',    'width'=>'40',  'align'=>'left', 'sortable'=>'false'),
519
-    array('name'=>'date',     'index'=>'date',    'width'=>'120', 'align'=>'left', 'sortable'=>'false'),
520
-    array('name'=>'course',   'index'=>'course',  'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
521
-    array('name'=>'lp',       'index'=>'lp',      'width'=>'440', 'align'=>'left', 'sortable'=>'true')
517
+$column_week_model = array(
518
+    array('name'=>'week', 'index'=>'week', 'width'=>'40', 'align'=>'left', 'sortable'=>'false'),
519
+    array('name'=>'date', 'index'=>'date', 'width'=>'120', 'align'=>'left', 'sortable'=>'false'),
520
+    array('name'=>'course', 'index'=>'course', 'width'=>'300', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
521
+    array('name'=>'lp', 'index'=>'lp', 'width'=>'440', 'align'=>'left', 'sortable'=>'true')
522 522
 );
523 523
 
524 524
 $extra_params_week = array();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
     'groupField' => array('week'),
531 531
     'groupOrder' => array('desc'),
532 532
     'groupColumnShow' => 'false',
533
-    'groupText' => array('<b>' . get_lang('PeriodWeek') . ' {0}</b>')
533
+    'groupText' => array('<b>'.get_lang('PeriodWeek').' {0}</b>')
534 534
 );
535 535
 $extra_params_week['autowidth'] = 'true'; //use the width of the parent
536 536
 $extra_params_week['height'] = '100%';
@@ -547,15 +547,15 @@  discard block
 block discarded – undo
547 547
         get_lang('BestResultInCourse'),
548 548
         get_lang('Ranking')
549 549
     );
550
-    $column_exercise_model  = array(
551
-        array('name'=>'status',     'index'=>'status',     'width'=>'40', 'align'=>'left',   'sortable'=>'false'),
552
-        array('name'=>'date',       'index'=>'date',       'width'=>'130','align'=>'left',   'sortable'=>'true'),
553
-        array('name'=>'course',     'index'=>'course',     'width'=>'200','align'=>'left',   'sortable'=>'true', 'wrap_cell' => 'true'),
554
-        array('name'=>'exercise',   'index'=>'exercise',   'width'=>'200','align'=>'left',   'sortable'=>'false'),
555
-        array('name'=>'attempt',    'index'=>'attempt',    'width'=>'60', 'align'=>'center', 'sortable'=>'true'),
556
-        array('name'=>'result',     'index'=>'result',     'width'=>'120','align'=>'center', 'sortable'=>'true'),
557
-        array('name'=>'best_result','index'=>'best_result','width'=>'140','align'=>'center', 'sortable'=>'true'),
558
-        array('name'=>'position',   'index'=>'position',   'width'=>'55', 'align'=>'center', 'sortable'=>'true')
550
+    $column_exercise_model = array(
551
+        array('name'=>'status', 'index'=>'status', 'width'=>'40', 'align'=>'left', 'sortable'=>'false'),
552
+        array('name'=>'date', 'index'=>'date', 'width'=>'130', 'align'=>'left', 'sortable'=>'true'),
553
+        array('name'=>'course', 'index'=>'course', 'width'=>'200', 'align'=>'left', 'sortable'=>'true', 'wrap_cell' => 'true'),
554
+        array('name'=>'exercise', 'index'=>'exercise', 'width'=>'200', 'align'=>'left', 'sortable'=>'false'),
555
+        array('name'=>'attempt', 'index'=>'attempt', 'width'=>'60', 'align'=>'center', 'sortable'=>'true'),
556
+        array('name'=>'result', 'index'=>'result', 'width'=>'120', 'align'=>'center', 'sortable'=>'true'),
557
+        array('name'=>'best_result', 'index'=>'best_result', 'width'=>'140', 'align'=>'center', 'sortable'=>'true'),
558
+        array('name'=>'position', 'index'=>'position', 'width'=>'55', 'align'=>'center', 'sortable'=>'true')
559 559
     );
560 560
     $extra_params_exercise['height'] = '100%';
561 561
     $extra_params_exercise['autowidth'] = 'true';
@@ -597,10 +597,10 @@  discard block
 block discarded – undo
597 597
     });
598 598
 <?php
599 599
      //Displays js code to use a jqgrid
600
-     echo Display::grid_js('courses',       '',             $columns_courses, $column_model_courses, $extra_params_courses, $new_course_list);
601
-     echo Display::grid_js('list_default',  $url,           $columns,         $column_model,$extra_params,array(), '');
602
-     echo Display::grid_js('list_course',   $url_by_course, $columns,         $column_model,$extra_params_course,array(),'');
603
-     echo Display::grid_js('list_week',     $url_week,      $column_week,     $column_week_model, $extra_params_week,array(),'');
600
+     echo Display::grid_js('courses', '', $columns_courses, $column_model_courses, $extra_params_courses, $new_course_list);
601
+     echo Display::grid_js('list_default', $url, $columns, $column_model, $extra_params, array(), '');
602
+     echo Display::grid_js('list_course', $url_by_course, $columns, $column_model, $extra_params_course, array(), '');
603
+     echo Display::grid_js('list_week', $url_week, $column_week, $column_week_model, $extra_params_week, array(), '');
604 604
 
605 605
     if (!api_is_anonymous()) {
606 606
         echo Display::grid_js('exercises', '', $column_exercise, $column_exercise_model, $extra_params_exercise, $my_real_array);
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
         false,
622 622
         false
623 623
     );
624
-    if (!empty($reportingTab))  {
624
+    if (!empty($reportingTab)) {
625 625
         $reportingTab .= '<br />'.Tracking::show_course_detail(
626 626
                 api_get_user_id(),
627 627
                 $courseCode,
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
             );
630 630
     }
631 631
     if (empty($reportingTab)) {
632
-        $reportingTab  = Display::return_message(get_lang('NoDataAvailable'), 'warning');
632
+        $reportingTab = Display::return_message(get_lang('NoDataAvailable'), 'warning');
633 633
     }
634 634
 }
635 635
 
Please login to merge, or discard this patch.
main/admin/access_url_edit_usergroup_to_url.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 function send() {
57 57
 	if (document.formulaire.access_url_id.value!=0) {
58 58
 		document.formulaire.form_sent.value=0;
59
-		document.formulaire.add_type.value=\'' . $add_type . '\';
59
+		document.formulaire.add_type.value=\'' . $add_type.'\';
60 60
 		document.formulaire.submit();
61 61
 	}
62 62
 }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 echo '<div class="actions">';
103 103
 echo Display::url(
104 104
     Display::return_icon('view_more_stats.gif', get_lang('AddUserGroupToURL'), ''),
105
-    api_get_path(WEB_CODE_PATH) . 'admin/access_url_add_usergroup_to_url.php'
105
+    api_get_path(WEB_CODE_PATH).'admin/access_url_add_usergroup_to_url.php'
106 106
 );
107 107
 echo '</div>';
108 108
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             <?php
141 141
             echo Display::toolbarButton(
142 142
                 get_lang('SessionAddTypeUnique'),
143
-                api_get_self() . '?' . http_build_query([
143
+                api_get_self().'?'.http_build_query([
144 144
                     'add_type' => 'unique',
145 145
                     'access_url_id' => $access_url_id
146 146
                 ]),
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             );
151 151
             echo Display::toolbarButton(
152 152
                 get_lang('SessionAddTypeMultiple'),
153
-                api_get_self() . '?' . http_build_query([
153
+                api_get_self().'?'.http_build_query([
154 154
                     'add_type' => 'multiple',
155 155
                     'access_url_id' => $access_url_id
156 156
                 ]),
Please login to merge, or discard this patch.
main/glossary/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         if (!api_is_allowed_to_edit(null, true)) {
54 54
             api_not_allowed(true);
55 55
         }
56
-        $tool_name =  get_lang('Add');
56
+        $tool_name = get_lang('Add');
57 57
         $form = new FormValidator(
58 58
             'glossary',
59 59
             'post',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         if (!api_is_allowed_to_edit(null, true)) {
191 191
             api_not_allowed(true);
192 192
         }
193
-        $tool_name =  get_lang('ImportGlossary');
193
+        $tool_name = get_lang('ImportGlossary');
194 194
         $form = new FormValidator(
195 195
             'glossary',
196 196
             'post',
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 foreach (GlossaryManager::get_glossary_terms() as $term) {
219 219
                     if (!GlossaryManager::delete_glossary($term['id'], false)) {
220 220
                         Display::addFlash(
221
-                            Display::return_message(get_lang("CannotDeleteGlossary") . ':' . $term['id'], 'error')
221
+                            Display::return_message(get_lang("CannotDeleteGlossary").':'.$term['id'], 'error')
222 222
                         );
223 223
                     } else {
224 224
                         $termsDeleted[] = $term['name'];
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
             if (count($badList) > 0) {
316 316
                 Display::addFlash(
317 317
                     Display::return_message(
318
-                        get_lang("GlossaryTermAlreadyExists").': ' . implode(', ', $badList),
318
+                        get_lang("GlossaryTermAlreadyExists").': '.implode(', ', $badList),
319 319
                         'error'
320 320
                     )
321 321
                 );
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         GlossaryManager::export_to_pdf();
359 359
         break;
360 360
     case 'changeview':
361
-        if (in_array($_GET['view'], array('list','table'))) {
361
+        if (in_array($_GET['view'], array('list', 'table'))) {
362 362
             Session::write('glossary_view', $_GET['view']);
363 363
         } else {
364 364
             $view = Session::read('glossary_view');
Please login to merge, or discard this patch.
main/announcements/download.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 $doc_url = str_replace(' ', '+', $doc_url);
29 29
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
30 30
 
31
-if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) {
31
+if (strpos($doc_url, '../') OR strpos($doc_url, '/..')) {
32 32
     $doc_url = '';
33 33
 }
34 34
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     //remove last slash if present
44 44
     //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
45 45
     //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
46
-    while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
46
+    while ($doc_url{$dul = strlen($doc_url) - 1} == '/') $doc_url = substr($doc_url, 0, $dul);
47 47
     //create the path
48 48
     $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
49 49
     //redirect
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 
65 65
 $result = Database::query($sql);
66 66
 if (Database::num_rows($result) > 0) {
67
-    $row= Database::fetch_array($result);
68
-    $title = str_replace(' ','_', $row['filename']);
67
+    $row = Database::fetch_array($result);
68
+    $title = str_replace(' ', '_', $row['filename']);
69 69
     if (Security::check_abs_path($full_file_name,
70
-        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/upload/announcements/')
70
+        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/')
71 71
     ) {
72 72
         $result = DocumentManager::file_send_for_download($full_file_name, true, $title);
73 73
         if ($result === false) {
Please login to merge, or discard this patch.
main/exercise/exercise.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 if (!empty($gradebook) && $gradebook == 'view') {
101 101
     $interbreadcrumb[] = array(
102
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
102
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
103 103
         'name' => get_lang('ToolGradebook')
104 104
     );
105 105
 }
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
                     );
742 742
 
743 743
                     // Exercise results
744
-                    $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
744
+                    $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
745 745
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
746 746
 
747 747
                     // Export
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
                         }
806 806
                     }
807 807
 
808
-                    $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
808
+                    $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
809 809
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
810 810
                     $actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
811 811
                 }
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
                 $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
1005 1005
             } else {
1006 1006
                 if ($isDrhOfCourse) {
1007
-                    $actions ='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
1007
+                    $actions = '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
1008 1008
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
1009 1009
                     $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
1010 1010
                 }
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
                 'tr',
1015 1015
                 $item,
1016 1016
                 array(
1017
-                    'id' => 'exercise_list_' . $my_exercise_id,
1017
+                    'id' => 'exercise_list_'.$my_exercise_id,
1018 1018
                 )
1019 1019
             );
1020 1020
         }
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
                     Display::return_icon('hotpotatoes_s.png', "HotPotatoes"),
1079 1079
                     Display::url(
1080 1080
                         $title,
1081
-                        'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([
1081
+                        'showinframes.php?'.api_get_cidreq().'&'.http_build_query([
1082 1082
                             'file' => $path,
1083 1083
                             'uid' => $userId
1084 1084
                         ]),
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
                 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path
1094 1094
             );
1095 1095
 
1096
-            $actions .='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1096
+            $actions .= '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1097 1097
                 Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
1098 1098
 
1099 1099
             // if active
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
                 $actions .= '      <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
1103 1103
                     Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
1104 1104
             } else { // else if not active
1105
-                $actions .='    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
1105
+                $actions .= '    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
1106 1106
                     Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>';
1107 1107
             }
1108 1108
             $actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'.
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
                     'td',
1125 1125
                     Display::url(
1126 1126
                         $title,
1127
-                        'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([
1127
+                        'showinframes.php?'.api_get_cidreq().'&'.http_build_query([
1128 1128
                             'file' => $path,
1129 1129
                             'cid' => api_get_course_id(),
1130 1130
                             'uid' => $userId
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
                 $item .= Display::tag('td', $attemptText);
1146 1146
 
1147 1147
                 if ($isDrhOfCourse) {
1148
-                    $actions ='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1148
+                    $actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
1149 1149
                         Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
1150 1150
 
1151 1151
                     $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
Please login to merge, or discard this patch.
main/forum/editpost.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
 if (!api_is_allowed_to_edit(null, true) &&
154 154
     (
155
-        ($current_forum_category && $current_forum_category['locked'] <> 0 ) ||
155
+        ($current_forum_category && $current_forum_category['locked'] <> 0) ||
156 156
         $current_forum['locked'] <> 0 ||
157 157
         $current_thread['locked'] <> 0
158 158
     )
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 echo '<h1>';
205 205
 echo Display::url(
206 206
     prepare4display($current_forum['forum_title']),
207
-    'viewforum.php?' . api_get_cidreq() . '&' . http_build_query([
207
+    'viewforum.php?'.api_get_cidreq().'&'.http_build_query([
208 208
         'origin' => $origin,
209 209
         'forum' => $current_forum['forum_id']
210 210
     ]),
Please login to merge, or discard this patch.
main/install/ajax.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 ini_set('log_errors', '1');
12 12
 error_reporting(-1);
13 13
 
14
-require_once __DIR__ . '/../../vendor/autoload.php';
14
+require_once __DIR__.'/../../vendor/autoload.php';
15 15
 
16 16
 define('SYSTEM_INSTALLATION', 1);
17 17
 define('INSTALL_TYPE_UPDATE', 'update');
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 session_start();
26 26
 
27
-require_once api_get_path(LIBRARY_PATH) . 'database.constants.inc.php';
27
+require_once api_get_path(LIBRARY_PATH).'database.constants.inc.php';
28 28
 require_once 'install.lib.php';
29 29
 
30 30
 $action = isset($_POST['a']) ? $_POST['a'] : null;
Please login to merge, or discard this patch.
main/inc/ajax/exercise.ajax.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         $exercise_id = intval($_GET['exercise_id']);
33 33
         $page = intval($_REQUEST['page']); //page
34 34
         $limit = intval($_REQUEST['rows']); //quantity of rows
35
-        $sidx = $_REQUEST['sidx'];         //index to filter
36
-        $sord = $_REQUEST['sord'];         //asc or desc
35
+        $sidx = $_REQUEST['sidx']; //index to filter
36
+        $sord = $_REQUEST['sord']; //asc or desc
37 37
 
38
-        if (!in_array($sord, array('asc','desc'))) {
38
+        if (!in_array($sord, array('asc', 'desc'))) {
39 39
             $sord = 'desc';
40 40
         }
41 41
         // get index row - i.e. user click to sort $sord = $_GET['sord'];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $total_pages = 0;
65 65
         if ($count > 0) {
66 66
             if (!empty($limit)) {
67
-                $total_pages = ceil($count/$limit);
67
+                $total_pages = ceil($count / $limit);
68 68
             }
69 69
         }
70 70
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $response->page = $page;
127 127
         $response->total = $total_pages;
128 128
         $response->records = $count;
129
-        $i=0;
129
+        $i = 0;
130 130
 
131 131
         if (!empty($results)) {
132 132
             foreach ($results as $row) {
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
                             GROUP by question_id
141 141
                         ) as count_table";
142 142
                 $result_count = Database::query($sql);
143
-                $count_questions = Database::fetch_array($result_count,'ASSOC');
143
+                $count_questions = Database::fetch_array($result_count, 'ASSOC');
144 144
                 $count_questions = $count_questions['count_question_id'];
145 145
 
146 146
                 $row['count_questions'] = $count_questions;
147 147
 
148 148
                 $response->rows[$i]['id'] = $row['exe_id'];
149
-                $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time()));
150
-                $h = floor($remaining/3600);
151
-                $m = floor(($remaining - ($h*3600))/60);
152
-                $s = ($remaining - ($h*3600) - ($m*60));
149
+                $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time()));
150
+                $h = floor($remaining / 3600);
151
+                $m = floor(($remaining - ($h * 3600)) / 60);
152
+                $s = ($remaining - ($h * 3600) - ($m * 60));
153 153
                 $array = array(
154 154
                     $row['firstname'],
155 155
                     $row['lastname'],
156
-                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']',
156
+                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']',
157 157
                     $row['count_questions'],
158
-                    round($row['score']*100).'%'
158
+                    round($row['score'] * 100).'%'
159 159
                 );
160 160
                 $response->rows[$i]['cell'] = $array;
161 161
                 $i++;
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
                 $objQuestionTmp = Question::read($my_question_id, $course_id);
362 362
 
363 363
                 // Getting free choice data.
364
-                if ($objQuestionTmp->type  == FREE_ANSWER && $type == 'all') {
365
-                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id]: null;
364
+                if ($objQuestionTmp->type == FREE_ANSWER && $type == 'all') {
365
+                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id] : null;
366 366
                 }
367 367
 
368 368
                 if ($type == 'all') {
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
         $objQuestion = Question::read($questionId);
519 519
         $objQuestion->get_question_type_name();
520 520
 
521
-        echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>';
521
+        echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
522 522
         //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
523 523
         ExerciseLib::showQuestion(
524 524
             $questionId,
Please login to merge, or discard this patch.
main/exercise/unique_answer_no_option.class.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         $editor_config = array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '125');
41 41
         //this line define how many question by default appear when creating a choice question
42
-        $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3;  // The previous default value was 2. See task #1759.
42
+        $nb_answers = isset($_POST['nb_answers']) ? (int) $_POST['nb_answers'] : 3; // The previous default value was 2. See task #1759.
43 43
         $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0));
44 44
 
45 45
         /*
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
         if ($obj_ex->selectFeedbackType() == 1) {
56 56
             $editor_config['Width'] = '250';
57 57
             $editor_config['Height'] = '110';
58
-            $comment_title = '<th width="50%" >' . get_lang('Comment') . '</th>';
59
-            $feedback_title = '<th width="50%" >' . get_lang('Scenario') . '</th>';
58
+            $comment_title = '<th width="50%" >'.get_lang('Comment').'</th>';
59
+            $feedback_title = '<th width="50%" >'.get_lang('Scenario').'</th>';
60 60
         } else {
61
-            $comment_title = '<th width="50%">' . get_lang('Comment') . '</th>';
61
+            $comment_title = '<th width="50%">'.get_lang('Comment').'</th>';
62 62
         }
63 63
 
64 64
         $html = '<table class="table table-striped table-hover">';
65 65
         $html .= '<thead>';
66 66
         $html .= '<tr>';
67
-        $html .= '<th>' . get_lang('Number') . '</th>';
68
-        $html .= '<th>' . get_lang('True') . '</th>';
69
-        $html .= '<th width="50%">' . get_lang('Answer') . '</th>';
70
-        $html .= $comment_title . $feedback_title;
71
-        $html .= '<th>' . get_lang('Weighting') . '</th>';
67
+        $html .= '<th>'.get_lang('Number').'</th>';
68
+        $html .= '<th>'.get_lang('True').'</th>';
69
+        $html .= '<th width="50%">'.get_lang('Answer').'</th>';
70
+        $html .= $comment_title.$feedback_title;
71
+        $html .= '<th>'.get_lang('Weighting').'</th>';
72 72
         $html .= '</tr>';
73 73
         $html .= '</thead>';
74 74
         $html .= '<tbody>';
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
                         $weight_result = '0';
136 136
                     }
137 137
 
138
-                    $defaults['answer[' . $i . ']'] = $answer_result;
139
-                    $defaults['comment[' . $i . ']'] = $answer->comment[$i];
140
-                    $defaults['weighting[' . $i . ']'] = $weight_result;
138
+                    $defaults['answer['.$i.']'] = $answer_result;
139
+                    $defaults['comment['.$i.']'] = $answer->comment[$i];
140
+                    $defaults['weighting['.$i.']'] = $weight_result;
141 141
 
142 142
                     $item_list = explode('@@', $answer->destination[$i]);
143 143
 
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
                     else
157 157
                         $url_result = $url;
158 158
 
159
-                    $temp_scenario['url' . $i] = $url_result;
160
-                    $temp_scenario['try' . $i] = $try_result;
161
-                    $temp_scenario['lp' . $i] = $lp;
162
-                    $temp_scenario['destination' . $i] = $list_dest;
159
+                    $temp_scenario['url'.$i] = $url_result;
160
+                    $temp_scenario['try'.$i] = $try_result;
161
+                    $temp_scenario['lp'.$i] = $lp;
162
+                    $temp_scenario['destination'.$i] = $list_dest;
163 163
                 }
164 164
             }
165 165
 
@@ -172,30 +172,30 @@  discard block
 block discarded – undo
172 172
             );
173 173
             $renderer->setElementTemplate(
174 174
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
175
-                'counter[' . $i . ']'
175
+                'counter['.$i.']'
176 176
             );
177 177
             $renderer->setElementTemplate(
178 178
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
179
-                'answer[' . $i . ']'
179
+                'answer['.$i.']'
180 180
             );
181 181
             $renderer->setElementTemplate(
182 182
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
183
-                'comment[' . $i . ']'
183
+                'comment['.$i.']'
184 184
             );
185 185
             $renderer->setElementTemplate(
186 186
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
187
-                'weighting[' . $i . ']'
187
+                'weighting['.$i.']'
188 188
             );
189 189
 
190
-            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
190
+            $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
191 191
             $answer_number->freeze();
192 192
 
193 193
 
194 194
             $form->addElement('radio', 'correct', null, null, $i, 'class="checkbox" style="margin-left: 0em;"');
195
-            $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
195
+            $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
196 196
 
197
-            $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
198
-            $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => 'width: 60px;', 'value' => '0'));
197
+            $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
198
+            $form->addElement('text', 'weighting['.$i.']', null, array('style' => 'width: 60px;', 'value' => '0'));
199 199
             $form->addElement('html', '</tr>');
200 200
             $i++;
201 201
         }
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
         $form->addHtml('<tr>');
211 211
 
212 212
         $defaults["counter[$i]"] = '-';
213
-        $defaults['answer[' . $i . ']'] = get_lang('DontKnow');
214
-        $defaults['weighting[' . $i . ']'] = '0';
213
+        $defaults['answer['.$i.']'] = get_lang('DontKnow');
214
+        $defaults['weighting['.$i.']'] = '0';
215 215
         $defaults['scenario'] = $temp_scenario;
216 216
         $renderer = & $form->defaultRenderer();
217 217
 
@@ -221,32 +221,32 @@  discard block
 block discarded – undo
221 221
         );
222 222
         $renderer->setElementTemplate(
223 223
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
224
-            'counter[' . $i . ']'
224
+            'counter['.$i.']'
225 225
         );
226 226
         $renderer->setElementTemplate(
227 227
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
228
-            'answer[' . $i . ']'
228
+            'answer['.$i.']'
229 229
         );
230 230
         $renderer->setElementTemplate(
231 231
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
232
-            'comment[' . $i . ']'
232
+            'comment['.$i.']'
233 233
         );
234 234
         $renderer->setElementTemplate(
235 235
             '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
236
-            'weighting[' . $i . ']'
236
+            'weighting['.$i.']'
237 237
         );
238 238
 
239 239
         $form
240
-            ->addElement('text', 'counter[' . $i . ']', null)
240
+            ->addElement('text', 'counter['.$i.']', null)
241 241
             ->freeze();
242 242
 
243
-        $form->addElement('hidden', 'position[' . $i . ']', '666');
243
+        $form->addElement('hidden', 'position['.$i.']', '666');
244 244
 
245 245
         $form->addElement('radio', 'correct', null, null, $i, ['class' => 'checkbox', 'disabled' => true]);
246
-        $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), $editor_config);
246
+        $form->addElement('html_editor', 'answer['.$i.']', null, array(), $editor_config);
247 247
 
248
-        $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
249
-        $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), $editor_config);
248
+        $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
249
+        $form->addElement('html_editor', 'comment['.$i.']', null, array(), $editor_config);
250 250
 
251 251
         //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
252 252
 
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 		    $minus = 0;
303 303
 		}
304 304
 
305
-		for ($i=1 ; $i <= $nb_answers - $minus; $i++) {
306
-		    $position   = trim($form -> getSubmitValue('position['.$i.']'));
307
-        	$answer     = trim($form -> getSubmitValue('answer['.$i.']'));
305
+		for ($i = 1; $i <= $nb_answers - $minus; $i++) {
306
+		    $position = trim($form -> getSubmitValue('position['.$i.']'));
307
+        	$answer = trim($form -> getSubmitValue('answer['.$i.']'));
308 308
             $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
309 309
             $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
310 310
             $scenario   = $form -> getSubmitValue('scenario');
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
            	//$list_destination = $form -> getSubmitValue('destination'.$i);
313 313
            	//$destination_str = $form -> getSubmitValue('destination'.$i);
314 314
 
315
- 		    $try           = $scenario['try'.$i];
316
-            $lp            = $scenario['lp'.$i];
315
+ 		    $try = $scenario['try'.$i];
316
+            $lp = $scenario['lp'.$i];
317 317
  			$destination   = $scenario['destination'.$i];
318 318
  			$url           = trim($scenario['url'.$i]);
319 319
 
@@ -337,34 +337,34 @@  discard block
 block discarded – undo
337 337
  				$destination_str.=$destination_id.';';
338 338
  			}*/
339 339
 
340
-        	$goodAnswer= ($correct == $i) ? true : false;
340
+        	$goodAnswer = ($correct == $i) ? true : false;
341 341
 
342 342
         	if ($goodAnswer) {
343 343
         		$nbrGoodAnswers++;
344 344
         		$weighting = abs($weighting);
345
-        		if($weighting > 0) {
345
+        		if ($weighting > 0) {
346 346
                     $questionWeighting += $weighting;
347 347
                 }
348 348
         	}
349 349
 
350 350
  			if (empty($try))
351
- 				$try=0;
351
+ 				$try = 0;
352 352
 
353 353
  			if (empty($lp)) {
354
- 				$lp=0;
354
+ 				$lp = 0;
355 355
  			}
356 356
 
357 357
  			if (empty($destination)) {
358
- 				$destination=0;
358
+ 				$destination = 0;
359 359
  			}
360 360
 
361
- 			if ($url=='') {
362
- 				$url=0;
361
+ 			if ($url == '') {
362
+ 				$url = 0;
363 363
  			}
364 364
 
365 365
  			//1@@1;2;@@2;4;4;@@http://www.chamilo.org
366
-			$dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
367
-        	$objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
366
+			$dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
367
+        	$objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest);
368 368
         }
369 369
 
370 370
         //Create 666 answer
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
         $answer     = trim($form -> getSubmitValue('answer['.$i.']'));
373 373
         $comment    = trim($form -> getSubmitValue('comment['.$i.']'));
374 374
         $weighting  = trim($form -> getSubmitValue('weighting['.$i.']'));
375
-        $goodAnswer= ($correct == $i) ? true : false;
375
+        $goodAnswer = ($correct == $i) ? true : false;
376 376
         $dest       = '';
377 377
 
378
-        $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest);
378
+        $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i, NULL, NULL, $dest);
379 379
 
380 380
     	// saves the answers into the data base
381 381
         $objAnswer -> save();
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	function return_header($feedback_type = null, $counter = null, $score = null)
389 389
     {
390 390
 	    $header = parent::return_header($feedback_type, $counter, $score);
391
-	    $header .= '<table class="'.$this->question_table_class .'">
391
+	    $header .= '<table class="'.$this->question_table_class.'">
392 392
 			<tr>
393 393
 				<th>'.get_lang("Choice").'</th>
394 394
 				<th>'. get_lang("ExpectedChoice").'</th>
Please login to merge, or discard this patch.