Completed
Pull Request — 1.11.x (#1628)
by José
97:30 queued 69:06
created
main/lp/lp_edit.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 }
21 21
 
22 22
 if (!empty($gradebook) && $gradebook == 'view') {
23
-    $interbreadcrumb[] = array (
23
+    $interbreadcrumb[] = array(
24 24
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
25 25
         'name' => get_lang('ToolGradebook')
26 26
     );
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 );
77 77
 if (api_get_setting('allow_course_theme') === 'true') {
78 78
     $mycourselptheme = api_get_course_setting('allow_learning_path_theme');
79
-    if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1) {
79
+    if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
80 80
         //LP theme picker
81 81
         $theme_select = $form->addElement('SelectTheme', 'lp_theme', get_lang('Theme'));
82 82
         $form->applyFilter('lp_theme', 'trim');
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 $label = ($_SESSION['oLP']->get_preview_image() != '' ? get_lang('UpdateImage') : get_lang('AddImage'));
106 106
 $form->addElement('file', 'lp_preview_image', array($label, get_lang('ImageWillResizeMsg')));
107 107
 
108
-$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
108
+$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif'));
109 109
 
110 110
 // Search terms (only if search is activated).
111 111
 if (api_get_setting('search_enabled') === 'true') {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 $defaults['lp_author'] = Security::remove_XSS($_SESSION['oLP']->get_author());
135 135
 $defaults['hide_toc_frame'] = Security::remove_XSS($_SESSION['oLP']->get_hide_toc_frame());
136 136
 $defaults['category_id'] = intval($_SESSION['oLP']->getCategoryId());
137
-$defaults['accumulate_scorm_time']  = $_SESSION['oLP']->getAccumulateScormTime();
137
+$defaults['accumulate_scorm_time'] = $_SESSION['oLP']->getAccumulateScormTime();
138 138
 
139 139
 $expired_on = $_SESSION['oLP']->expired_on;
140 140
 $publicated_on = $_SESSION['oLP']->publicated_on;
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 if ($enableLpExtraFields) {
215 215
     $htmlHeadXtra[] = '<script>
216 216
     $(function() {
217
-        ' . $extra['jquery_ready_content'] . '
217
+        ' . $extra['jquery_ready_content'].'
218 218
     });
219 219
     </script>';
220 220
 }
221 221
 
222 222
 
223 223
 $defaults['publicated_on'] = !empty($publicated_on) && $publicated_on !== '0000-00-00 00:00:00' ? api_get_local_time($publicated_on) : null;
224
-$defaults['expired_on'] = (!empty($expired_on) )? api_get_local_time($expired_on): date('Y-m-d 12:00:00', time()+84600);
224
+$defaults['expired_on'] = (!empty($expired_on)) ? api_get_local_time($expired_on) : date('Y-m-d 12:00:00', time() + 84600);
225 225
 $defaults['subscribe_users'] = $_SESSION['oLP']->getSubscribeUsers();
226 226
 $form->setDefaults($defaults);
227 227
 
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/Color.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public function toHtml()
36 36
     {
37
-        return parent::toHtml() . <<<JS
37
+        return parent::toHtml().<<<JS
38 38
             <script>
39 39
                 $(document).on('ready', function () {
40 40
                     var txtColor = $('#{$this->getAttribute('id')}'),
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/DatePicker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
         return '
47 47
             <div class="input-group">
48 48
                 <span class="input-group-addon cursor-pointer">
49
-                    <input ' . $this->_getAttrString($this->_attributes) . '>
49
+                    <input ' . $this->_getAttrString($this->_attributes).'>
50 50
                 </span>
51
-                <p class="form-control disabled" id="' . $id . '_alt_text">' . $value . '</p>
52
-                <input class="form-control" type="hidden" id="' . $id . '_alt" value="' . $value . '">
51
+                <p class="form-control disabled" id="' . $id.'_alt_text">'.$value.'</p>
52
+                <input class="form-control" type="hidden" id="' . $id.'_alt" value="'.$value.'">
53 53
                 <span class="input-group-btn">
54 54
                     <button class="btn btn-default" type="button">
55 55
                         <span class="fa fa-times text-danger" aria-hidden="true"></span>
56
-                        <span class="sr-only">' . get_lang('Reset') . '</span>
56
+                        <span class="sr-only">' . get_lang('Reset').'</span>
57 57
                     </button>
58 58
                 </span>
59 59
             </div>
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
                 txtDate
93 93
                     .hide()
94 94
                     .datepicker({
95
-                        defaultDate: '" . $this->getValue() . "',
95
+                        defaultDate: '".$this->getValue()."',
96 96
                         dateFormat: 'yy-mm-dd',
97 97
                         altField: '#{$id}_alt',
98
-                        altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
98
+                        altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
99 99
                         showOn: 'both',
100
-                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
100
+                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
101 101
                         buttonImageOnly: true,
102
-                        buttonText: '" . get_lang('SelectDate') . "',
102
+                        buttonText: '" . get_lang('SelectDate')."',
103 103
                         changeMonth: true,
104 104
                         changeYear: true,
105 105
                         yearRange: 'c-60y:c+5y'
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/DateTimePicker.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
         return '
40 40
             <div class="input-group">
41 41
                 <span class="input-group-addon cursor-pointer">
42
-                    <input ' . $this->_getAttrString($this->_attributes) . '>
42
+                    <input ' . $this->_getAttrString($this->_attributes).'>
43 43
                 </span>
44
-                <p class="form-control disabled" id="' . $id . '_alt_text">' . $value . '</p>
45
-                <input class="form-control" type="hidden" id="' . $id . '_alt" value="' . $value . '">
44
+                <p class="form-control disabled" id="' . $id.'_alt_text">'.$value.'</p>
45
+                <input class="form-control" type="hidden" id="' . $id.'_alt" value="'.$value.'">
46 46
                 <span class="input-group-btn">
47 47
                     <button class="btn btn-default" type="button">
48 48
                         <span class="fa fa-times text-danger" aria-hidden="true"></span>
49
-                        <span class="sr-only">' . get_lang('Reset') . '</span>
49
+                        <span class="sr-only">' . get_lang('Reset').'</span>
50 50
                     </button>
51 51
                 </span>
52 52
             </div>
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
                 txtDateTime
86 86
                     .hide()
87 87
                     .datetimepicker({
88
-                        defaultDate: '" . $this->getValue() . "',
88
+                        defaultDate: '".$this->getValue()."',
89 89
                         dateFormat: 'yy-mm-dd',
90 90
                         timeFormat: 'HH:mm',
91 91
                         altField: '#{$id}_alt',
92
-                        altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
93
-                        altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\",
94
-                        altSeparator: \" " . get_lang('AtTime') . " \",
92
+                        altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
93
+                        altTimeFormat: \"" . get_lang('TimeFormatNoSecJS')."\",
94
+                        altSeparator: \" " . get_lang('AtTime')." \",
95 95
                         altFieldTimeOnly: false,
96 96
                         showOn: 'both',
97
-                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
97
+                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
98 98
                         buttonImageOnly: true,
99
-                        buttonText: '" . get_lang('SelectDate') . "',
99
+                        buttonText: '" . get_lang('SelectDate')."',
100 100
                         changeMonth: true,
101 101
                         changeYear: true
102 102
                     })
Please login to merge, or discard this patch.
main/survey/survey_question.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         if ($surveyData['survey_type'] == 1) {
65 65
             $table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
66 66
             $sql = 'SELECT id,name FROM '.$table_survey_question_group.'
67
-                    WHERE survey_id = '.(int)$_GET['survey_id'].'
67
+                    WHERE survey_id = '.(int) $_GET['survey_id'].'
68 68
                     ORDER BY name';
69 69
             $rs = Database::query($sql);
70 70
             $glist = null;
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
             $grouplist = $grouplist1 = $grouplist2 = $glist;
76 76
 
77 77
             if (!empty($formData['assigned'])) {
78
-                $grouplist = str_replace('<option value="'.$formData['assigned'].'"','<option value="'.$formData['assigned'].'" selected',$glist);
78
+                $grouplist = str_replace('<option value="'.$formData['assigned'].'"', '<option value="'.$formData['assigned'].'" selected', $glist);
79 79
             }
80 80
 
81 81
             if (!empty($formData['assigned1'])) {
82
-                $grouplist1 = str_replace('<option value="'.$formData['assigned1'].'"','<option value="'.$formData['assigned1'].'" selected',$glist);
82
+                $grouplist1 = str_replace('<option value="'.$formData['assigned1'].'"', '<option value="'.$formData['assigned1'].'" selected', $glist);
83 83
             }
84 84
 
85 85
             if (!empty($formData['assigned2'])) {
86
-                $grouplist2 = str_replace('<option value="'.$formData['assigned2'].'"','<option value="'.$formData['assigned2'].'" selected',$glist);
86
+                $grouplist2 = str_replace('<option value="'.$formData['assigned2'].'"', '<option value="'.$formData['assigned2'].'" selected', $glist);
87 87
             }
88 88
 
89 89
             $this->html .= '	<tr><td colspan="">
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
             $this->html .= '
97 97
 			<b>'.get_lang('Secondary').'</b><br />
98
-			'.'<input type="radio" name="choose" value="2" '.(($formData['choose']==2)?'checked':'').
98
+			'.'<input type="radio" name="choose" value="2" '.(($formData['choose'] == 2) ? 'checked' : '').
99 99
                 '><select name="assigned1">'.$grouplist1.'</select> '.
100 100
                 '<select name="assigned2">'.$grouplist2.'</select>'
101 101
                 .'</fieldset><br />';
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                     <div class="form-group">
132 132
                         <label class="col-sm-2 control-label"></label>
133 133
                         <div class="col-sm-8">
134
-                            <div class="alert alert-info">' . get_lang('YouCantNotEditThisQuestionBecauseAlreadyExistAnswers') . '</div>
134
+                            <div class="alert alert-info">' . get_lang('YouCantNotEditThisQuestionBecauseAlreadyExistAnswers').'</div>
135 135
                         </div>
136 136
                         <div class="col-sm-2"></div>
137 137
                     </div>
Please login to merge, or discard this patch.
main/inc/lib/userportal.lib.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
                 );
73 73
 
74 74
                 foreach ($exercises as $exercise_item) {
75
-                    $exercise_item['course_code']     = $course_code;
76
-                    $exercise_item['session_id']     = $session_id;
77
-                    $exercise_item['tms']     = api_strtotime($exercise_item['end_time'], 'UTC');
75
+                    $exercise_item['course_code'] = $course_code;
76
+                    $exercise_item['session_id'] = $session_id;
77
+                    $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
78 78
 
79 79
                     $exercise_list[] = $exercise_item;
80 80
                 }
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
         if ($show_menu) {
215 215
             $html .= '<ul class="nav nav-pills nav-stacked">';
216 216
             if ($show_create_link) {
217
-                $html .= '<li class="add-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'create_course/add_course.php">'.
218
-                    Display::return_icon('new-course.png',  get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
217
+                $html .= '<li class="add-course"><a href="'.api_get_path(WEB_CODE_PATH).'create_course/add_course.php">'.
218
+                    Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
219 219
             }
220 220
 
221 221
             if ($show_course_link) {
222 222
                 if (!api_is_drh() && !api_is_session_admin()) {
223
-                    $html .=  '<li class="list-course"><a href="'. api_get_path(WEB_CODE_PATH) . 'auth/courses.php">'.
224
-                        Display::return_icon('catalog-course.png', get_lang('CourseCatalog')) .get_lang('CourseCatalog').'</a></li>';
223
+                    $html .= '<li class="list-course"><a href="'.api_get_path(WEB_CODE_PATH).'auth/courses.php">'.
224
+                        Display::return_icon('catalog-course.png', get_lang('CourseCatalog')).get_lang('CourseCatalog').'</a></li>';
225 225
                 } else {
226
-                    $html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
226
+                    $html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
227 227
                 }
228 228
             }
229 229
             $html .= '</ul>';
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         // Including the page for the news
254 254
         $html = '';
255 255
         if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) {
256
-            $open = @(string)file_get_contents($this->home.$_GET['include']);
256
+            $open = @(string) file_get_contents($this->home.$_GET['include']);
257 257
             $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
258 258
         } else {
259 259
             // Hiding home top when user not connected.
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
                     $home_top_temp = file_get_contents($this->home.'home_top.html');
284 284
                 } else {
285 285
                     if (file_exists($this->default_home.'home_top.html')) {
286
-                        $home_top_temp = file_get_contents($this->default_home . 'home_top.html');
286
+                        $home_top_temp = file_get_contents($this->default_home.'home_top.html');
287 287
                     }
288 288
                 }
289 289
             }
290 290
 
291 291
 			if (trim($home_top_temp) == '' && api_is_platform_admin()) {
292
-				$home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
292
+				$home_top_temp = '<div class="welcome-mascot">'.get_lang('PortalHomepageDefaultIntroduction').'</div>';
293 293
 			} else {
294
-				$home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>';
294
+				$home_top_temp = '<div class="welcome-home-top-temp">'.$home_top_temp.'</div>';
295 295
 			}
296 296
 			$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
297 297
 			$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 
310 310
         $html = '';
311 311
         // Notice
312
-        $home_notice = @(string)file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
312
+        $home_notice = @(string) file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
313 313
         if (empty($home_notice)) {
314
-            $home_notice = @(string)file_get_contents($this->home.'home_notice.html');
314
+            $home_notice = @(string) file_get_contents($this->home.'home_notice.html');
315 315
         }
316 316
 
317 317
         if (!empty($home_notice)) {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         }
345 345
 
346 346
         $html = '';
347
-        $home_menu = @(string)file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
347
+        $home_menu = @(string) file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
348 348
         if (!empty($home_menu)) {
349 349
             $home_menu_content = '<ul class="nav nav-pills nav-stacked">';
350 350
             $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
         if (api_get_setting('allow_public_certificates') == 'true') {
396 396
             $searchItem = Display::tag(
397 397
                 'li',
398
-                Display::url(Display::return_icon('search_graduation.png',get_lang('Search'),null,ICON_SIZE_SMALL).
398
+                Display::url(Display::return_icon('search_graduation.png', get_lang('Search'), null, ICON_SIZE_SMALL).
399 399
                     get_lang('Search'),
400
-                    api_get_path(WEB_CODE_PATH) . "gradebook/search.php"
400
+                    api_get_path(WEB_CODE_PATH)."gradebook/search.php"
401 401
                 )
402 402
             );
403 403
         }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
             $content .= Display::tag(
414 414
                 'li',
415 415
                 Display::url(
416
-                    Display::return_icon('skill-badges.png',get_lang('MySkills'),null,ICON_SIZE_SMALL).get_lang('MySkills'),
416
+                    Display::return_icon('skill-badges.png', get_lang('MySkills'), null, ICON_SIZE_SMALL).get_lang('MySkills'),
417 417
                     api_get_path(WEB_CODE_PATH).'social/my_skills_report.php'
418 418
                 )
419 419
             );
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
             if (($allowSkillsManagement && api_is_drh()) || api_is_platform_admin()) {
422 422
                 $content .= Display::tag('li',
423 423
                     Display::url(Display::return_icon('edit-skill.png', get_lang('MySkills'), null,
424
-                            ICON_SIZE_SMALL) . get_lang('ManageSkills'),
425
-                        api_get_path(WEB_CODE_PATH) . 'admin/skills_wheel.php'));
424
+                            ICON_SIZE_SMALL).get_lang('ManageSkills'),
425
+                        api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php'));
426 426
             }
427 427
         }
428 428
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
         // Get list of courses in category $category.
477 477
         $sql = "SELECT * FROM $main_course_table cours
478
-                WHERE category_code = '" . $category . "'
478
+                WHERE category_code = '".$category."'
479 479
                 ORDER BY title, UPPER(visual_code)";
480 480
 
481 481
         // Showing only the courses of the current access_url_id.
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                     FROM $main_category_table t1
522 522
                     LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id
523 523
                     LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses)
524
-                    WHERE t1.parent_id ". (empty($category) ? "IS NULL" : "='$category'")."
524
+                    WHERE t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")."
525 525
                     GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count 
526 526
                     ORDER BY t1.tree_pos, t1.name";
527 527
 
@@ -596,10 +596,10 @@  discard block
 block discarded – undo
596 596
         }
597 597
         $result .= $htmlTitre;
598 598
         if ($thereIsSubCat) {
599
-            $result .=  $htmlListCat;
599
+            $result .= $htmlListCat;
600 600
         }
601 601
         while ($categoryName = Database::fetch_array($resCats)) {
602
-            $result .= '<h3>' . $categoryName['name'] . "</h3>\n";
602
+            $result .= '<h3>'.$categoryName['name']."</h3>\n";
603 603
         }
604 604
         $numrows = Database::num_rows($sql_result_courses);
605 605
         $courses_list_string = '';
@@ -697,12 +697,12 @@  discard block
 block discarded – undo
697 697
         if ($courses_shown > 0) {
698 698
             // Only display the list of courses and categories if there was more than
699 699
                     // 0 courses visible to the world (we're in the anonymous list here).
700
-            $result .=  $courses_list_string;
700
+            $result .= $courses_list_string;
701 701
         }
702 702
         if ($category != '') {
703
-            $result .=  '<p><a href="'.api_get_self().'"> ' .
703
+            $result .= '<p><a href="'.api_get_self().'"> '.
704 704
                 Display :: return_icon('back.png', get_lang('BackToHomePage')).
705
-                get_lang('BackToHomePage') . '</a></p>';
705
+                get_lang('BackToHomePage').'</a></p>';
706 706
         }
707 707
         return $result;
708 708
     }
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
             if (!empty($title)) {
798 798
                 $html .= '<div class="panel-heading">'.$title.'</div>';
799 799
             }
800
-            $html.= '<div class="panel-body">'.$content.'</div>';
800
+            $html .= '<div class="panel-body">'.$content.'</div>';
801 801
             $html = Display::div($html, $params);
802 802
         }
803 803
 
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
             $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
845 845
             $classes = '';
846 846
             if (!empty($usergroup_list)) {
847
-                foreach($usergroup_list as $group_id) {
847
+                foreach ($usergroup_list as $group_id) {
848 848
                     $data = $usergroup->get($group_id);
849 849
                     $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']);
850 850
                     $classes .= Display::tag('li', $data['name']);
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
             if (api_is_platform_admin()) {
854 854
                 $classes .= Display::tag(
855 855
                     'li',
856
-                    Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
856
+                    Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
857 857
                 );
858 858
             }
859 859
             if (!empty($classes)) {
@@ -875,11 +875,11 @@  discard block
 block discarded – undo
875 875
             $content = null;
876 876
 
877 877
             if (api_get_setting('allow_social_tool') == 'true') {
878
-                $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php">
879
-                <img class="img-circle" src="' . $userPicture . '" ></a>';
878
+                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/social/home.php">
879
+                <img class="img-circle" src="' . $userPicture.'" ></a>';
880 880
             } else {
881
-                $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php">
882
-                <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture. '" ></a>';
881
+                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php">
882
+                <img class="img-circle" title="' . get_lang('EditProfile').'" src="'.$userPicture.'" ></a>';
883 883
             }
884 884
 
885 885
             $html = self::show_right_block(
@@ -932,19 +932,19 @@  discard block
 block discarded – undo
932 932
                 $link = '?f=social';
933 933
             }
934 934
             $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.
935
-                Display::return_icon('inbox.png',get_lang('Inbox'),null,ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>';
935
+                Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>';
936 936
             $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.
937
-                Display::return_icon('new-message.png',get_lang('Compose'),null,ICON_SIZE_SMALL).get_lang('Compose').' </a></li>';
937
+                Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL).get_lang('Compose').' </a></li>';
938 938
 
939 939
             if (api_get_setting('allow_social_tool') == 'true') {
940 940
                 $total_invitations = Display::badge($total_invitations);
941 941
                 $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.
942
-                    Display::return_icon('invitations.png',get_lang('PendingInvitations'),null,ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>';
942
+                    Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>';
943 943
             }
944 944
 
945 945
             if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
946 946
                 $myFiles = '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.
947
-                    Display::return_icon('sn-files.png',get_lang('Files'),null,ICON_SIZE_SMALL).get_lang('MyFiles').'</a></li>';
947
+                    Display::return_icon('sn-files.png', get_lang('Files'), null, ICON_SIZE_SMALL).get_lang('MyFiles').'</a></li>';
948 948
 
949 949
                 if (api_get_setting('allow_my_files') === 'false') {
950 950
                     $myFiles = '';
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 
957 957
         $editProfileUrl = Display::getProfileEditionLink($user_id);
958 958
 
959
-        $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.
959
+        $profile_content .= '<li class="profile-social"><a href="'.$editProfileUrl.'">'.
960 960
             Display::return_icon(
961 961
                 'edit-profile.png',
962 962
                 get_lang('EditProfile'),
@@ -1046,17 +1046,17 @@  discard block
 block discarded – undo
1046 1046
         if ($show_create_link) {
1047 1047
             $my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">';
1048 1048
             if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) {
1049
-                $my_account_content .= Display::return_icon('new-course.png',get_lang('CreateCourseRequest'),null,ICON_SIZE_SMALL);
1049
+                $my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'), null, ICON_SIZE_SMALL);
1050 1050
                 $my_account_content .= get_lang('CreateCourseRequest');
1051 1051
             } else {
1052
-                $my_account_content .= Display::return_icon('new-course.png',get_lang('CourseCreate'),null,ICON_SIZE_SMALL);
1052
+                $my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'), null, ICON_SIZE_SMALL);
1053 1053
                 $my_account_content .= get_lang('CourseCreate');
1054 1054
             }
1055 1055
             $my_account_content .= '</a></li>';
1056 1056
 
1057 1057
             if (SessionManager::allowToManageSessions()) {
1058 1058
                 $my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">';
1059
-                $my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL);
1059
+                $my_account_content .= Display::return_icon('session.png', get_lang('AddSession'), null, ICON_SIZE_SMALL);
1060 1060
                 $my_account_content .= get_lang('AddSession');
1061 1061
                 $my_account_content .= '</a></li>';
1062 1062
             }
@@ -1064,20 +1064,20 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
         //Sort courses
1066 1066
         $url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses';
1067
-        $img_order= Display::return_icon('order-course.png',get_lang('SortMyCourses'),null,ICON_SIZE_SMALL);
1067
+        $img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'), null, ICON_SIZE_SMALL);
1068 1068
         $my_account_content .= '<li class="order-course">'.Display::url($img_order.get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>';
1069 1069
 
1070 1070
         // Session history
1071 1071
         if (isset($_GET['history']) && intval($_GET['history']) == 1) {
1072
-            $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png',get_lang('DisplayTrainingList'),null,ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>';
1072
+            $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png', get_lang('DisplayTrainingList'), null, ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>';
1073 1073
         } else {
1074
-            $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png',get_lang('HistoryTrainingSessions'),null,ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>';
1074
+            $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions'), null, ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>';
1075 1075
         }
1076 1076
 
1077 1077
         // Course catalog
1078 1078
         if ($show_course_link) {
1079 1079
             if (!api_is_drh()) {
1080
-                $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png',get_lang('CourseCatalog'),null,ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>';
1080
+                $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog'), null, ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>';
1081 1081
             } else {
1082 1082
                 $my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
1083 1083
             }
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
 
1283 1283
                             $actions = null;
1284 1284
                             if (api_is_platform_admin()) {
1285
-                                $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id;
1285
+                                $actions = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id;
1286 1286
                             }
1287 1287
 
1288 1288
                             $coachId = $session_box['id_coach'];
@@ -1292,12 +1292,12 @@  discard block
 block discarded – undo
1292 1292
                             $params['category_id'] = $session_box['category_id'];
1293 1293
                             $params['title'] = $session_box['title'];
1294 1294
                             $params['id_coach'] = $coachId;
1295
-                            $params['coach_url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId;
1295
+                            $params['coach_url'] = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId;
1296 1296
                             $params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;
1297 1297
                             $params['coach_avatar'] = UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL);
1298 1298
                             $params['date'] = $session_box['dates'];
1299 1299
                             $params['image'] = isset($imageField['value']) ? $imageField['value'] : null;
1300
-                            $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null;
1300
+                            $params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
1301 1301
                             $params['edit_actions'] = $actions;
1302 1302
                             $params['show_description'] = $session_box['show_description'];
1303 1303
                             $params['description'] = $session_box['description'];
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
                                 $sessionParams[0]['date'] = $session_box['dates'];
1402 1402
                                 $sessionParams[0]['course_list_session_style'] = $coursesListSessionStyle;
1403 1403
                                 $sessionParams[0]['title'] = $session_box['title'];
1404
-                                $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates'];
1404
+                                $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'].' | ' : '').$session_box['dates'];
1405 1405
                                 $sessionParams[0]['show_actions'] = api_is_platform_admin();
1406 1406
                                 $sessionParams[0]['courses'] = $html_courses_session;
1407 1407
                                 $sessionParams[0]['show_simple_session_info'] = false;
@@ -1452,13 +1452,13 @@  discard block
 block discarded – undo
1452 1452
                             if (
1453 1453
                                 !empty($session_category_start_date)
1454 1454
                             ) {
1455
-                                $categoryParams['subtitle'] = get_lang('From') . ' ' . $session_category_start_date;
1455
+                                $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date;
1456 1456
                             }
1457 1457
 
1458 1458
                             if (
1459 1459
                                 !empty($session_category_end_date)
1460 1460
                             ) {
1461
-                                $categoryParams['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date;
1461
+                                $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date;
1462 1462
                             }
1463 1463
                         }
1464 1464
 
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 
1484 1484
             $this->tpl->assign('all_courses', $allCoursesInSessions);
1485 1485
             $this->tpl->assign('session', $listSession);
1486
-            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
1486
+            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
1487 1487
             $this->tpl->assign('gamification_mode', $gameModeIsActive);
1488 1488
 
1489 1489
             if (api_get_configuration_value('view_grid_courses')) {
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
         }
1499 1499
 
1500 1500
         return [
1501
-            'html' => $specialCourseList . $sessions_with_category.$sessions_with_no_category.$listCourse,
1501
+            'html' => $specialCourseList.$sessions_with_category.$sessions_with_no_category.$listCourse,
1502 1502
             'session_count' => $sessionCount,
1503 1503
             'course_count' => $courseCount
1504 1504
         ];
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
                         $htmlCategory .= '<div class="panel panel-default">';
1633 1633
                     }
1634 1634
                     $htmlCategory .= '<div class="panel-body">';
1635
-                    $coursesInfo =  $listCourse['course'];
1635
+                    $coursesInfo = $listCourse['course'];
1636 1636
 
1637 1637
                     $htmlCategory .= self::getHtmlForCourse(
1638 1638
                         $coursesInfo,
@@ -1649,7 +1649,7 @@  discard block
 block discarded – undo
1649 1649
                             $listCategorySession['catSessionName']
1650 1650
                         );
1651 1651
                         // list of session
1652
-                        $htmlSession = '';    // start
1652
+                        $htmlSession = ''; // start
1653 1653
                         foreach ($listCategorySession['sessionList'] as $k => $listSession) {
1654 1654
                             // add session
1655 1655
                             $htmlSession .= '<div class="session-view-row">';
@@ -1666,8 +1666,8 @@  discard block
 block discarded – undo
1666 1666
                         $htmlSessionCategory .= $htmlSession;
1667 1667
                     }
1668 1668
                     $htmlSessionCategory .= '</div>'; // end session cat block
1669
-                    $htmlCategory .=  $htmlSessionCategory .'</div></div>' ;
1670
-                    $htmlCategory .= '';   // end course block
1669
+                    $htmlCategory .= $htmlSessionCategory.'</div></div>';
1670
+                    $htmlCategory .= ''; // end course block
1671 1671
                 }
1672 1672
                 $userCategoryHtml .= $htmlCategory;
1673 1673
             }
@@ -1694,11 +1694,11 @@  discard block
 block discarded – undo
1694 1694
                 }
1695 1695
             }
1696 1696
             $htmlCategory .= '';
1697
-            $userCategoryHtml .= $htmlCategory;   // end user cat block
1697
+            $userCategoryHtml .= $htmlCategory; // end user cat block
1698 1698
             if ($userCategoryId != 0) {
1699 1699
                 $userCategoryHtml .= '</div>';
1700 1700
             }
1701
-            $html .= $userCategoryHtml;   //
1701
+            $html .= $userCategoryHtml; //
1702 1702
         }
1703 1703
         $html .= '</div>';
1704 1704
 
@@ -1839,11 +1839,11 @@  discard block
 block discarded – undo
1839 1839
         $html = '';
1840 1840
 
1841 1841
         if ($categorySessionId == 0) {
1842
-            $class1 = 'session-view-lvl-2';    // session
1843
-            $class2 = 'session-view-lvl-4';    // got to course in session link
1842
+            $class1 = 'session-view-lvl-2'; // session
1843
+            $class2 = 'session-view-lvl-4'; // got to course in session link
1844 1844
         } else {
1845
-            $class1 = 'session-view-lvl-3';    // session
1846
-            $class2 = 'session-view-lvl-5';    // got to course in session link
1845
+            $class1 = 'session-view-lvl-3'; // session
1846
+            $class2 = 'session-view-lvl-5'; // got to course in session link
1847 1847
         }
1848 1848
 
1849 1849
         $icon = Display::return_icon(
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
         if ($listA['userCatTitle'] == $listB['userCatTitle']) {
1872 1872
             if ($listA['title'] == $listB['title']) {
1873 1873
                 return 0;
1874
-            } else if($listA['title'] > $listB['title']) {
1874
+            } else if ($listA['title'] > $listB['title']) {
1875 1875
                 return 1;
1876 1876
             } else {
1877 1877
                 return -1;
@@ -1892,7 +1892,7 @@  discard block
 block discarded – undo
1892 1892
     {
1893 1893
         if ($listA['title'] == $listB['title']) {
1894 1894
             return 0;
1895
-        } else if($listA['title'] > $listB['title']) {
1895
+        } else if ($listA['title'] > $listB['title']) {
1896 1896
             return 1;
1897 1897
         } else {
1898 1898
             return -1;
Please login to merge, or discard this patch.
main/inc/lib/AnnouncementManager.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                             ip.tool='announcement' AND
229 229
                             (
230 230
                                 ip.toUser = $userId OR
231
-                                ip.group IN ('0', '" . implode("', '", $group_list) . "') OR
231
+                                ip.group IN ('0', '".implode("', '", $group_list)."') OR
232 232
                                 ip.group IS NULL
233 233
                             ) AND
234 234
                             ip.visibility = '1' AND                       
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
         $content = $announcement->getContent();
294 294
 
295 295
         $html .= "<table height=\"100\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" class=\"data_table\">";
296
-        $html .= "<tr><td><h2>" . $title . "</h2></td></tr>";
296
+        $html .= "<tr><td><h2>".$title."</h2></td></tr>";
297 297
 
298 298
         if (api_is_allowed_to_edit(false, true) ||
299 299
             (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())
300 300
         ) {
301
-            $modify_icons = "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=modify&id=" . $announcement_id . "\">" .
302
-                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>";
301
+            $modify_icons = "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=modify&id=".$announcement_id."\">".
302
+                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>";
303 303
             if ($itemProperty->getVisibility() === 1) {
304 304
                 $image_visibility = "visible";
305 305
                 $alt_visibility = get_lang('Hide');
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
             }
310 310
             global $stok;
311 311
 
312
-            $modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=showhide&id=" . $announcement_id . "&sec_token=" . $stok . "\">" .
313
-                Display::return_icon($image_visibility . '.png', $alt_visibility, '', ICON_SIZE_SMALL) . "</a>";
312
+            $modify_icons .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=showhide&id=".$announcement_id."&sec_token=".$stok."\">".
313
+                Display::return_icon($image_visibility.'.png', $alt_visibility, '', ICON_SIZE_SMALL)."</a>";
314 314
 
315 315
             if (api_is_allowed_to_edit(false, true)) {
316
-                $modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=delete&id=" . $announcement_id . "&sec_token=" . $stok . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "')) return false;\">" .
317
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) .
316
+                $modify_icons .= "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete&id=".$announcement_id."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset))."')) return false;\">".
317
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).
318 318
                     "</a>";
319 319
             }
320 320
             $html .= "<tr><th style='text-align:right'>$modify_icons</th></tr>";
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
         $lastEdit = $itemProperty->getLasteditDate();
334 334
 
335 335
         $html .= "<tr><td>$content</td></tr>";
336
-        $html .= "<tr><td class=\"announcements_datum\">" . get_lang('LastUpdateDate') . " : " .
336
+        $html .= "<tr><td class=\"announcements_datum\">".get_lang('LastUpdateDate')." : ".
337 337
             Display::dateToStringAgoAndLongDate(
338 338
                 !empty($lastEdit) ? $lastEdit->format('Y-m-d h:i:s') : ''
339
-            ) . "</td></tr>";
339
+            )."</td></tr>";
340 340
 
341 341
         if ($itemProperty->getGroup() !== null) {
342 342
             $sent_to_icon = Display::return_icon('group.gif', get_lang('AnnounceSentToUserSelection'));
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $sent_to_form = self::sent_to_form($sent_to);
348 348
             $html .= Display::tag(
349 349
                 'td',
350
-                get_lang('SentTo').': ' . $sent_to_form,
350
+                get_lang('SentTo').': '.$sent_to_form,
351 351
                 array('class' => 'announcements_datum')
352 352
             );
353 353
         }
@@ -357,15 +357,15 @@  discard block
 block discarded – undo
357 357
             $html .= "<tr><td>";
358 358
             $realname = $attachment_list['path'];
359 359
             $user_filename = $attachment_list['filename'];
360
-            $full_file_name = 'download.php?'.api_get_cidreq().'&file=' . $realname;
360
+            $full_file_name = 'download.php?'.api_get_cidreq().'&file='.$realname;
361 361
             $html .= '<br/>';
362 362
             $html .= Display::return_icon('attachment.gif', get_lang('Attachment'));
363
-            $html .= '<a href="' . $full_file_name . ' "> ' . $user_filename . ' </a>';
364
-            $html .= ' - <span class="forum_attach_comment" >' . $attachment_list['comment'] . '</span>';
363
+            $html .= '<a href="'.$full_file_name.' "> '.$user_filename.' </a>';
364
+            $html .= ' - <span class="forum_attach_comment" >'.$attachment_list['comment'].'</span>';
365 365
             if (api_is_allowed_to_edit(false, true)) {
366 366
                 $html .= Display::url(
367 367
                     Display::return_icon('delete.png', get_lang('Delete'), '', 16),
368
-                    api_get_self() . "?" . api_get_cidreq() . "&action=delete_attachment&id_attach=" . $attachment_list['id'] . "&sec_token=" . $stok
368
+                    api_get_self()."?".api_get_cidreq()."&action=delete_attachment&id_attach=".$attachment_list['id']."&sec_token=".$stok
369 369
                 );
370 370
             }
371 371
             $html .= '</td></tr>';
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
         $order = 0;
391 391
         if (Database::num_rows($res_max)) {
392 392
             $row_max = Database::fetch_array($res_max);
393
-            $order = intval($row_max[0])+1;
393
+            $order = intval($row_max[0]) + 1;
394 394
         }
395 395
 
396 396
         return $order;
@@ -831,8 +831,8 @@  discard block
 block discarded – undo
831 831
             $result = array();
832 832
             if ($num_rows > 0) {
833 833
                 while ($myrow = Database::fetch_array($rs)) {
834
-                    $content.= '<strong>' . $myrow['title'] . '</strong><br /><br />';
835
-                    $content.= $myrow['content'];
834
+                    $content .= '<strong>'.$myrow['title'].'</strong><br /><br />';
835
+                    $content .= $myrow['content'];
836 836
                     $i++;
837 837
                 }
838 838
                 $result['content'] = $content;
@@ -954,14 +954,14 @@  discard block
 block discarded – undo
954 954
             switch ($to_group) {
955 955
                 // it was send to one specific user
956 956
                 case null:
957
-                    $to[] = "USER:" . $row['to_user_id'];
957
+                    $to[] = "USER:".$row['to_user_id'];
958 958
                     break;
959 959
                 // it was sent to everyone
960 960
                 case 0:
961 961
                     return "everyone";
962 962
                     break;
963 963
                 default:
964
-                    $to[] = "GROUP:" . $row['to_group_id'];
964
+                    $to[] = "GROUP:".$row['to_group_id'];
965 965
             }
966 966
         }
967 967
         return $to;
@@ -1024,10 +1024,10 @@  discard block
 block discarded – undo
1024 1024
                 $sent_to_array['groups'][0] !== 0
1025 1025
             ) {
1026 1026
                 $group_id = $sent_to_array['groups'][0];
1027
-                $output[] = "&nbsp;" . $group_names[$group_id]['name'];
1027
+                $output[] = "&nbsp;".$group_names[$group_id]['name'];
1028 1028
             }
1029 1029
             if (empty($sent_to_array['groups']) and empty($sent_to_array['users'])) {
1030
-                $output[] = "&nbsp;" . get_lang('Everybody');
1030
+                $output[] = "&nbsp;".get_lang('Everybody');
1031 1031
             }
1032 1032
         }
1033 1033
 
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
         $sql = "SELECT to_group_id, to_user_id
1062 1062
                 FROM $tbl_item_property
1063
-                WHERE c_id = $course_id AND tool = '$tool' AND ref=" . $id;
1063
+                WHERE c_id = $course_id AND tool = '$tool' AND ref=".$id;
1064 1064
         $result = Database::query($sql);
1065 1065
 
1066 1066
         while ($row = Database::fetch_array($result)) {
@@ -1102,8 +1102,8 @@  discard block
 block discarded – undo
1102 1102
         $course_id = api_get_course_int_id();
1103 1103
         $row = array();
1104 1104
         $sql = 'SELECT id, path, filename, comment 
1105
-                FROM ' . $tbl_announcement_attachment . '
1106
-				WHERE c_id = ' . $course_id . ' AND announcement_id = ' . $announcementId;
1105
+                FROM ' . $tbl_announcement_attachment.'
1106
+				WHERE c_id = ' . $course_id.' AND announcement_id = '.$announcementId;
1107 1107
         $result = Database::query($sql);
1108 1108
         if (Database::num_rows($result) != 0) {
1109 1109
             $row = Database::fetch_array($result, 'ASSOC');
@@ -1128,9 +1128,9 @@  discard block
 block discarded – undo
1128 1128
 
1129 1129
         if (is_array($file) && $file['error'] == 0) {
1130 1130
             // TODO: This path is obsolete. The new document repository scheme should be kept in mind here.
1131
-            $courseDir = $_course['path'] . '/upload/announcements';
1131
+            $courseDir = $_course['path'].'/upload/announcements';
1132 1132
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
1133
-            $updir = $sys_course_path . $courseDir;
1133
+            $updir = $sys_course_path.$courseDir;
1134 1134
 
1135 1135
             // Try to add an extension to the file if it hasn't one
1136 1136
             $new_file_name = add_ext_on_mime(stripslashes($file['name']), $file['type']);
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
                 Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
1143 1143
             } else {
1144 1144
                 $new_file_name = uniqid('');
1145
-                $new_path = $updir . '/' . $new_file_name;
1145
+                $new_path = $updir.'/'.$new_file_name;
1146 1146
 
1147 1147
                 // This file is copy here but its cleaned in api_mail_html in api.lib.php
1148 1148
                 copy($file['tmp_name'], $new_path);
@@ -1185,9 +1185,9 @@  discard block
 block discarded – undo
1185 1185
 
1186 1186
         if (is_array($file) && $file['error'] == 0) {
1187 1187
             // TODO: This path is obsolete. The new document repository scheme should be kept in mind here.
1188
-            $courseDir = $_course['path'] . '/upload/announcements';
1188
+            $courseDir = $_course['path'].'/upload/announcements';
1189 1189
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
1190
-            $updir = $sys_course_path . $courseDir;
1190
+            $updir = $sys_course_path.$courseDir;
1191 1191
 
1192 1192
             // Try to add an extension to the file if it hasn't one
1193 1193
             $new_file_name = add_ext_on_mime(stripslashes($file['name']), $file['type']);
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
                 Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
1200 1200
             } else {
1201 1201
                 $new_file_name = uniqid('');
1202
-                $new_path = $updir . '/' . $new_file_name;
1202
+                $new_path = $updir.'/'.$new_file_name;
1203 1203
                 copy($file['tmp_name'], $new_path);
1204 1204
                 $safe_file_comment = Database::escape_string($file_comment);
1205 1205
                 $safe_file_name = Database::escape_string($file_name);
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
                             filename = '$safe_file_name', 
1210 1210
                             comment = '$safe_file_comment', 
1211 1211
                             path = '$safe_new_file_name', 
1212
-                            size ='" . intval($file['size']) . "'
1212
+                            size ='".intval($file['size'])."'
1213 1213
 					 	WHERE c_id = $course_id AND id = '$id_attach'";
1214 1214
                 $result = Database::query($sql);
1215 1215
                 if ($result === false) {
@@ -1527,8 +1527,8 @@  discard block
 block discarded – undo
1527 1527
                 if ($myrow['email_sent'] == '1') {
1528 1528
                     $sent_to_icon = ' '.Display::return_icon('email.gif', get_lang('AnnounceSentByEmail'));
1529 1529
                 }
1530
-                $groupReference = ($myrow['to_group_id'] > 0) ? ' <span class="label label-info">' . get_lang('Group') . '</span> ' : '' ;
1531
-                $title = $myrow['title'] . $groupReference . $sent_to_icon;
1530
+                $groupReference = ($myrow['to_group_id'] > 0) ? ' <span class="label label-info">'.get_lang('Group').'</span> ' : '';
1531
+                $title = $myrow['title'].$groupReference.$sent_to_icon;
1532 1532
                 $item_visibility = api_get_item_visibility($_course, TOOL_ANNOUNCEMENT, $myrow['id'], $session_id);
1533 1533
                 $myrow['visibility'] = $item_visibility;
1534 1534
 
@@ -1536,8 +1536,8 @@  discard block
 block discarded – undo
1536 1536
                 $attachment_list = AnnouncementManager::get_attachment($myrow['id']);
1537 1537
 
1538 1538
                 $attachment_icon = '';
1539
-                if (count($attachment_list)>0) {
1540
-                    $attachment_icon = ' '.Display::return_icon('attachment.gif',get_lang('Attachment'));
1539
+                if (count($attachment_list) > 0) {
1540
+                    $attachment_icon = ' '.Display::return_icon('attachment.gif', get_lang('Attachment'));
1541 1541
                 }
1542 1542
 
1543 1543
                 /* TITLE */
@@ -1556,16 +1556,16 @@  discard block
 block discarded – undo
1556 1556
                     || (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())
1557 1557
                 ) {
1558 1558
                     $modify_icons = "<a href=\"".$actionUrl."&action=modify&id=".$myrow['id']."\">".
1559
-                        Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL)."</a>";
1560
-                    if ($myrow['visibility']==1) {
1561
-                        $image_visibility="visible";
1562
-                        $alt_visibility=get_lang('Hide');
1559
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>";
1560
+                    if ($myrow['visibility'] == 1) {
1561
+                        $image_visibility = "visible";
1562
+                        $alt_visibility = get_lang('Hide');
1563 1563
                     } else {
1564
-                        $image_visibility="invisible";
1565
-                        $alt_visibility=get_lang('Visible');
1564
+                        $image_visibility = "invisible";
1565
+                        $alt_visibility = get_lang('Visible');
1566 1566
                     }
1567
-                    $modify_icons .=  "<a href=\"".$actionUrl."&action=showhide&id=".$myrow['id']."&sec_token=".$stok."\">".
1568
-                        Display::return_icon($image_visibility.'.png', $alt_visibility,'',ICON_SIZE_SMALL)."</a>";
1567
+                    $modify_icons .= "<a href=\"".$actionUrl."&action=showhide&id=".$myrow['id']."&sec_token=".$stok."\">".
1568
+                        Display::return_icon($image_visibility.'.png', $alt_visibility, '', ICON_SIZE_SMALL)."</a>";
1569 1569
 
1570 1570
                     // DISPLAY MOVE UP COMMAND only if it is not the top announcement
1571 1571
                     if ($iterator != 1) {
@@ -1580,12 +1580,12 @@  discard block
 block discarded – undo
1580 1580
                     } else {
1581 1581
                         $modify_icons .= Display::return_icon('down_na.gif', get_lang('Down'));
1582 1582
                     }
1583
-                    if (api_is_allowed_to_edit(false,true)) {
1584
-                        $modify_icons .= "<a href=\"".$actionUrl."&action=delete&id=".$myrow['id']."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,api_get_system_encoding()))."')) return false;\">".
1585
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).
1583
+                    if (api_is_allowed_to_edit(false, true)) {
1584
+                        $modify_icons .= "<a href=\"".$actionUrl."&action=delete&id=".$myrow['id']."&sec_token=".$stok."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, api_get_system_encoding()))."')) return false;\">".
1585
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).
1586 1586
                             "</a>";
1587 1587
                     }
1588
-                    $iterator ++;
1588
+                    $iterator++;
1589 1589
                 } else {
1590 1590
                     $modify_icons = Display::url(
1591 1591
                         Display::return_icon('default.png'),
@@ -1631,7 +1631,7 @@  discard block
 block discarded – undo
1631 1631
             'announcement.session_id'
1632 1632
         );
1633 1633
 
1634
-        if (api_is_allowed_to_edit(false,true))  {
1634
+        if (api_is_allowed_to_edit(false, true)) {
1635 1635
             // check teacher status
1636 1636
             if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
1637 1637
 
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
 
1701 1701
                 // the user is member of several groups => display personal announcements AND
1702 1702
                 // his group announcements AND the general announcements
1703
-                if (is_array($group_memberships) && count($group_memberships)>0) {
1703
+                if (is_array($group_memberships) && count($group_memberships) > 0) {
1704 1704
                     $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
1705 1705
                             FROM $tbl_announcement announcement 
1706 1706
                             INNER JOIN $tbl_item_property ip
Please login to merge, or discard this patch.
main/exercise/admin.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  */
49 49
 
50 50
 require_once __DIR__.'/../inc/global.inc.php';
51
-$current_course_tool  = TOOL_QUIZ;
51
+$current_course_tool = TOOL_QUIZ;
52 52
 $this_section = SECTION_COURSES;
53 53
 
54 54
 // Access control
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 
65 65
 /*  stripslashes POST data  */
66 66
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
67
-    foreach($_POST as $key=>$val) {
68
-        if(is_string($val)) {
69
-            $_POST[$key]=stripslashes($val);
70
-        } elseif(is_array($val)) {
71
-            foreach($val as $key2=>$val2) {
72
-                $_POST[$key][$key2]=stripslashes($val2);
67
+    foreach ($_POST as $key=>$val) {
68
+        if (is_string($val)) {
69
+            $_POST[$key] = stripslashes($val);
70
+        } elseif (is_array($val)) {
71
+            foreach ($val as $key2=>$val2) {
72
+                $_POST[$key][$key2] = stripslashes($val2);
73 73
             }
74 74
         }
75
-        $GLOBALS[$key]=$_POST[$key];
75
+        $GLOBALS[$key] = $_POST[$key];
76 76
     }
77 77
 }
78 78
 
79 79
 if (empty($exerciseId)) {
80
-    $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']):'0';
80
+    $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']) : '0';
81 81
 }
82 82
 
83 83
 $newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) {
152 152
     require_once 'export/qti2/qti2_export.php';
153 153
     $export = export_question_qti($_GET['questionId'], true);
154
-    $qid = (int)$_GET['questionId'];
154
+    $qid = (int) $_GET['questionId'];
155 155
     $archive_path = api_get_path(SYS_ARCHIVE_PATH);
156 156
     $temp_dir_short = uniqid();
157 157
     $temp_zip_dir = $archive_path."/".$temp_dir_short;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 if (!$fromExercise) {
196 196
     // gets the right exercise ID, and if 0 creates a new exercise
197 197
     if (!$exerciseId = $objExercise->selectId()) {
198
-        $modifyExercise='yes';
198
+        $modifyExercise = 'yes';
199 199
     }
200 200
 }
201 201
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     } else {
246 246
         // goes back to the question viewing
247 247
         $editQuestion = $modifyQuestion;
248
-        unset($newQuestion,$modifyQuestion);
248
+        unset($newQuestion, $modifyQuestion);
249 249
     }
250 250
 }
251 251
 
@@ -281,27 +281,27 @@  discard block
 block discarded – undo
281 281
     $nameTools = get_lang('QuestionManagement');
282 282
 }
283 283
 
284
-if (isset($_SESSION['gradebook'])){
285
-    $gradebook=	$_SESSION['gradebook'];
284
+if (isset($_SESSION['gradebook'])) {
285
+    $gradebook = $_SESSION['gradebook'];
286 286
 }
287 287
 
288
-if (!empty($gradebook) && $gradebook=='view') {
289
-    $interbreadcrumb[]= array(
288
+if (!empty($gradebook) && $gradebook == 'view') {
289
+    $interbreadcrumb[] = array(
290 290
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
291 291
         'name' => get_lang('ToolGradebook')
292 292
     );
293 293
 }
294 294
 
295
-$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
296
-if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) {
295
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
296
+if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) {
297 297
     $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name);
298 298
 } else {
299 299
     $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
300 300
 }
301 301
 
302 302
 // shows a link to go back to the question pool
303
-if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){
304
-    $interbreadcrumb[]=array(
303
+if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) {
304
+    $interbreadcrumb[] = array(
305 305
         "url" => api_get_path(WEB_CODE_PATH)."exercise/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(),
306 306
         "name" => get_lang('QuestionPool')
307 307
     );
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
 
310 310
 // if the question is duplicated, disable the link of tool name
311 311
 if ($modifyIn == 'thisExercise') {
312
-    if($buttonBack)	{
313
-        $modifyIn='allExercises';
312
+    if ($buttonBack) {
313
+        $modifyIn = 'allExercises';
314 314
     } else {
315
-        $noPHP_SELF=true;
315
+        $noPHP_SELF = true;
316 316
     }
317 317
 }
318 318
 $htmlHeadXtra[] = '<script>
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 $htmlHeadXtra[] = $template->fetch($templateName);
345 345
 $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');
346 346
 
347
-$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
348
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
347
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
348
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
349 349
 
350
-Display::display_header($nameTools,'Exercise');
350
+Display::display_header($nameTools, 'Exercise');
351 351
 /*
352 352
 if ($objExercise->exercise_was_added_in_lp) {
353 353
     if ($objExercise->force_edit_exercise_in_lp == true) {
@@ -364,22 +364,22 @@  discard block
 block discarded – undo
364 364
     echo '<div class="actions">';
365 365
     if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid']))
366 366
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
367
-            Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
367
+            Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
368 368
 
369
-    if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) &&  !isset($_GET['editQuestion'])) {
369
+    if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) {
370 370
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'">'.
371
-            Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
371
+            Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
372 372
     }
373 373
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'.
374
-        Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).'</a>';
374
+        Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).'</a>';
375 375
 
376 376
     echo Display::url(
377
-        Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM),
377
+        Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM),
378 378
         api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id
379 379
     );
380 380
 
381 381
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'.
382
-        Display::return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
382
+        Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>';
383 383
 
384 384
     $maxScoreAllQuestions = 0;
385 385
     if (!empty($objExercise->questionList)) {
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     echo '<div class="alert alert-info">'.
396 396
         sprintf(get_lang('XQuestionsWithTotalScoreY'), $objExercise->selectNbrQuestions(), $maxScoreAllQuestions);
397 397
     if ($objExercise->random > 0) {
398
-        echo '<br />' .
398
+        echo '<br />'.
399 399
             sprintf(get_lang('OnlyXQuestionsPickedRandomly'), $objExercise->random);
400 400
     }
401 401
     echo '</div>';
@@ -404,13 +404,13 @@  discard block
 block discarded – undo
404 404
     // we are in create a new question from question pool not in a test
405 405
     echo '<div class="actions">';
406 406
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'">'.
407
-        Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
407
+        Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
408 408
     echo '</div>';
409 409
 } else {
410 410
     // If we are in question_pool but not in an test, go back to question create in pool
411 411
     echo '<div class="actions">';
412 412
     echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/question_pool.php?'.api_get_cidreq().'">'.
413
-        Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).
413
+        Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).
414 414
         '</a>';
415 415
     echo '</div>';
416 416
 }
Please login to merge, or discard this patch.
main/exercise/exercise.class.php 1 patch
Spacing   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     public $feedback_type;
31 31
     public $end_time;
32 32
     public $start_time;
33
-    public $questionList;  // array with the list of this exercise's questions
33
+    public $questionList; // array with the list of this exercise's questions
34 34
     /* including question list of the media */
35 35
     public $questionListUncompressed;
36 36
     public $results_disabled;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
131 131
         $table_lp_item = Database::get_course_table(TABLE_LP_ITEM);
132 132
 
133
-        $id  = intval($id);
133
+        $id = intval($id);
134 134
         if (empty($this->course_id)) {
135 135
 
136 136
             return false;
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      */
467 467
     public function isRandom()
468 468
     {
469
-        if($this->random > 0 || $this->random == -1) {
469
+        if ($this->random > 0 || $this->random == -1) {
470 470
             return true;
471 471
         } else {
472 472
             return false;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
                     $question_media = null;
628 628
                     if (!empty($objQuestionTmp->parent_id)) {
629 629
                         $objQuestionMedia = Question::read($objQuestionTmp->parent_id);
630
-                        $question_media  = Question::getMediaLabel($objQuestionMedia->question);
630
+                        $question_media = Question::getMediaLabel($objQuestionMedia->question);
631 631
                     }
632 632
 
633 633
                     $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM).$question_media);
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
                 $cat = new TestCategory();
1026 1026
                 $cat = $cat->getCategory($categoryId);
1027 1027
 
1028
-                $cat = (array)$cat;
1028
+                $cat = (array) $cat;
1029 1029
                 $cat['iid'] = $cat['id'];
1030 1030
                 //*$cat['name'] = $cat['name'];
1031 1031
 
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
      */
1240 1240
     public function updateTitle($title)
1241 1241
     {
1242
-        $this->exercise=$title;
1242
+        $this->exercise = $title;
1243 1243
     }
1244 1244
 
1245 1245
     /**
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
      */
1250 1250
     public function updateAttempts($attempts)
1251 1251
     {
1252
-        $this->attempts=$attempts;
1252
+        $this->attempts = $attempts;
1253 1253
     }
1254 1254
 
1255 1255
     /**
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
      */
1260 1260
     public function updateFeedbackType($feedback_type)
1261 1261
     {
1262
-        $this->feedback_type=$feedback_type;
1262
+        $this->feedback_type = $feedback_type;
1263 1263
     }
1264 1264
 
1265 1265
     /**
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
      */
1271 1271
     public function updateDescription($description)
1272 1272
     {
1273
-        $this->description=$description;
1273
+        $this->description = $description;
1274 1274
     }
1275 1275
 
1276 1276
     /**
@@ -1406,23 +1406,23 @@  discard block
 block discarded – undo
1406 1406
      * @param string $sound - exercise sound file
1407 1407
      * @param string $delete - ask to delete the file
1408 1408
      */
1409
-    public function updateSound($sound,$delete)
1409
+    public function updateSound($sound, $delete)
1410 1410
     {
1411 1411
         global $audioPath, $documentPath;
1412 1412
         $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
1413 1413
 
1414
-        if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) {
1415
-            $this->sound=$sound['name'];
1414
+        if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) {
1415
+            $this->sound = $sound['name'];
1416 1416
 
1417
-            if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) {
1417
+            if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) {
1418 1418
                 $sql = "SELECT 1 FROM $TBL_DOCUMENT
1419
-                        WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'";
1419
+                        WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'";
1420 1420
                 $result = Database::query($sql);
1421 1421
 
1422 1422
                 if (!Database::num_rows($result)) {
1423 1423
                     $id = add_document(
1424 1424
                         $this->course,
1425
-                        str_replace($documentPath,'',$audioPath).'/'.$this->sound,
1425
+                        str_replace($documentPath, '', $audioPath).'/'.$this->sound,
1426 1426
                         'file',
1427 1427
                         $sound['size'],
1428 1428
                         $sound['name']
@@ -1441,8 +1441,8 @@  discard block
 block discarded – undo
1441 1441
                     );
1442 1442
                 }
1443 1443
             }
1444
-        } elseif($delete && is_file($audioPath.'/'.$this->sound)) {
1445
-            $this->sound='';
1444
+        } elseif ($delete && is_file($audioPath.'/'.$this->sound)) {
1445
+            $this->sound = '';
1446 1446
         }
1447 1447
     }
1448 1448
 
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
      */
1491 1491
     public function enable()
1492 1492
     {
1493
-        $this->active=1;
1493
+        $this->active = 1;
1494 1494
     }
1495 1495
 
1496 1496
     /**
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
      */
1501 1501
     public function disable()
1502 1502
     {
1503
-        $this->active=0;
1503
+        $this->active = 0;
1504 1504
     }
1505 1505
 
1506 1506
     /**
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
                 api_get_user_id()
1629 1629
             );
1630 1630
 
1631
-            if (api_get_setting('search_enabled')=='true') {
1631
+            if (api_get_setting('search_enabled') == 'true') {
1632 1632
                 $this->search_engine_edit();
1633 1633
             }
1634 1634
         } else {
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
     public function removeFromList($questionId)
1778 1778
     {
1779 1779
         // searches the position of the question ID in the list
1780
-        $pos = array_search($questionId,$this->questionList);
1780
+        $pos = array_search($questionId, $this->questionList);
1781 1781
 
1782 1782
         // question not found
1783 1783
         if ($pos === false) {
@@ -1813,7 +1813,7 @@  discard block
 block discarded – undo
1813 1813
         api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id());
1814 1814
         api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id());
1815 1815
 
1816
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) {
1816
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
1817 1817
             $this->search_engine_delete();
1818 1818
         }
1819 1819
     }
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
      * Creates the form to create / edit an exercise
1823 1823
      * @param FormValidator $form
1824 1824
      */
1825
-    public function createForm($form, $type='full')
1825
+    public function createForm($form, $type = 'full')
1826 1826
     {
1827 1827
         if (empty($type)) {
1828 1828
             $type = 'full';
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
             'Width' => '100%',
1854 1854
             'Height' => '150',
1855 1855
         );
1856
-        if (is_array($type)){
1856
+        if (is_array($type)) {
1857 1857
             $editor_config = array_merge($editor_config, $type);
1858 1858
         }
1859 1859
 
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
                     '2',
1908 1908
                     array('id' => 'exerciseType_2')
1909 1909
                 );
1910
-                $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')));
1910
+                $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')));
1911 1911
 
1912 1912
                 // Type of results display on the final page
1913 1913
                 $radios_results_disabled = array();
@@ -1951,8 +1951,8 @@  discard block
 block discarded – undo
1951 1951
                 // Type of questions disposition on page
1952 1952
                 $radios = array();
1953 1953
 
1954
-                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
1955
-                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
1954
+                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
1955
+                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
1956 1956
 
1957 1957
                 $form->addGroup($radios, null, get_lang('QuestionsPerPage'));
1958 1958
 
@@ -1962,32 +1962,32 @@  discard block
 block discarded – undo
1962 1962
 
1963 1963
                     // feedback type
1964 1964
                     $radios_feedback = array();
1965
-                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()'));
1965
+                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()'));
1966 1966
 
1967 1967
                     if (api_get_setting('enable_quiz_scenario') == 'true') {
1968
-                        $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()'));
1968
+                        $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()'));
1969 1969
                     }
1970
-                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2'));
1971
-                    $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')));
1970
+                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2'));
1971
+                    $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')));
1972 1972
 
1973 1973
                     //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
1974 1974
                     $radios_results_disabled = array();
1975 1975
                     $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
1976
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
1977
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
1978
-                    $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),'');
1976
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()'));
1977
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()'));
1978
+                    $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
1979 1979
 
1980 1980
                     // Type of questions disposition on page
1981 1981
                     $radios = array();
1982
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1');
1983
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2');
1982
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1');
1983
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2');
1984 1984
                     $form->addGroup($radios, null, get_lang('ExerciseType'));
1985 1985
 
1986 1986
                 } else {
1987 1987
                     //Show options freeze
1988 1988
                     $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
1989
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
1990
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
1989
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()'));
1990
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()'));
1991 1991
                     $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'));
1992 1992
                     $result_disable_group->freeze();
1993 1993
 
@@ -1996,8 +1996,8 @@  discard block
 block discarded – undo
1996 1996
                     $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE);
1997 1997
 
1998 1998
                     // Type of questions disposition on page
1999
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
2000
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
1999
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
2000
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
2001 2001
 
2002 2002
                     $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'));
2003 2003
                     $type_group->freeze();
@@ -2103,7 +2103,7 @@  discard block
 block discarded – undo
2103 2103
                 $cat = new TestCategory();
2104 2104
                 $cat_form = $cat->returnCategoryForm($this);
2105 2105
                 if (empty($cat_form)) {
2106
-                    $cat_form = '<span class="label label-warning">' . get_lang('NoCategoriesDefined') . '</span>';
2106
+                    $cat_form = '<span class="label label-warning">'.get_lang('NoCategoriesDefined').'</span>';
2107 2107
                 }
2108 2108
                 $form->addElement('label', null, $cat_form);
2109 2109
                 $form->addElement('html', '</div>');
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
             );
2173 2173
 
2174 2174
             // Exercise time limit
2175
-            $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
2175
+            $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
2176 2176
 
2177 2177
             $var = Exercise::selectTimeLimit();
2178 2178
 
@@ -2184,9 +2184,9 @@  discard block
 block discarded – undo
2184 2184
 
2185 2185
             $form->addElement('date_time_picker', 'start_time');
2186 2186
 
2187
-            $form->addElement('html','</div>');
2187
+            $form->addElement('html', '</div>');
2188 2188
 
2189
-            $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
2189
+            $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
2190 2190
 
2191 2191
             if (!empty($this->end_time)) {
2192 2192
                 $form->addElement('html', '<div id="end_date_div" style="display:block;">');
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
             }
2196 2196
 
2197 2197
             $form->addElement('date_time_picker', 'end_time');
2198
-            $form->addElement('html','</div>');
2198
+            $form->addElement('html', '</div>');
2199 2199
 
2200 2200
             //$check_option=$this->selectType();
2201 2201
             $diplay = 'block';
@@ -2205,10 +2205,10 @@  discard block
 block discarded – undo
2205 2205
                 null,
2206 2206
                 get_lang('SaveTheCorrectAnswersForTheNextAttempt')
2207 2207
             );
2208
-            $form->addElement('html','<div class="clear">&nbsp;</div>');
2208
+            $form->addElement('html', '<div class="clear">&nbsp;</div>');
2209 2209
             $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers'));
2210 2210
 
2211
-            $form->addElement('html','<div id="divtimecontrol"  style="display:'.$diplay.';">');
2211
+            $form->addElement('html', '<div id="divtimecontrol"  style="display:'.$diplay.';">');
2212 2212
 
2213 2213
             //Timer control
2214 2214
             //$time_hours_option = range(0,12);
@@ -2225,12 +2225,12 @@  discard block
 block discarded – undo
2225 2225
                 )
2226 2226
             );
2227 2227
 
2228
-            $expired_date = (int)$this->selectExpiredTime();
2228
+            $expired_date = (int) $this->selectExpiredTime();
2229 2229
 
2230
-            if (($expired_date!='0')) {
2231
-                $form->addElement('html','<div id="timercontrol" style="display:block;">');
2230
+            if (($expired_date != '0')) {
2231
+                $form->addElement('html', '<div id="timercontrol" style="display:block;">');
2232 2232
             } else {
2233
-                $form->addElement('html','<div id="timercontrol" style="display:none;">');
2233
+                $form->addElement('html', '<div id="timercontrol" style="display:none;">');
2234 2234
             }
2235 2235
             $form->addText(
2236 2236
                 'enabletimercontroltotalminutes',
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
                     'cols-size' => [2, 2, 8]
2242 2242
                 ]
2243 2243
             );
2244
-            $form->addElement('html','</div>');
2244
+            $form->addElement('html', '</div>');
2245 2245
 
2246 2246
             $form->addElement(
2247 2247
                 'text',
@@ -2266,7 +2266,7 @@  discard block
 block discarded – undo
2266 2266
             $defaults = array();
2267 2267
 
2268 2268
             if (api_get_setting('search_enabled') === 'true') {
2269
-                require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
2269
+                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2270 2270
 
2271 2271
                 $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
2272 2272
                 $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
@@ -2274,15 +2274,15 @@  discard block
 block discarded – undo
2274 2274
                 $specific_fields = get_specific_field_list();
2275 2275
 
2276 2276
                 foreach ($specific_fields as $specific_field) {
2277
-                    $form->addElement ('text', $specific_field['code'], $specific_field['name']);
2277
+                    $form->addElement('text', $specific_field['code'], $specific_field['name']);
2278 2278
                     $filter = array(
2279 2279
                         'c_id' => api_get_course_int_id(),
2280 2280
                         'field_id' => $specific_field['id'],
2281 2281
                         'ref_id' => $this->id,
2282
-                        'tool_id' => "'" . TOOL_QUIZ . "'"
2282
+                        'tool_id' => "'".TOOL_QUIZ."'"
2283 2283
                     );
2284 2284
                     $values = get_specific_field_values_list($filter, array('value'));
2285
-                    if ( !empty($values) ) {
2285
+                    if (!empty($values)) {
2286 2286
                         $arr_str_values = array();
2287 2287
                         foreach ($values as $value) {
2288 2288
                             $arr_str_values[] = $value['value'];
@@ -2292,8 +2292,8 @@  discard block
 block discarded – undo
2292 2292
                 }
2293 2293
             }
2294 2294
 
2295
-            $form->addElement('html','</div>');  //End advanced setting
2296
-            $form->addElement('html','</div>');
2295
+            $form->addElement('html', '</div>'); //End advanced setting
2296
+            $form->addElement('html', '</div>');
2297 2297
         }
2298 2298
 
2299 2299
         // submit
@@ -2313,10 +2313,10 @@  discard block
 block discarded – undo
2313 2313
         }
2314 2314
 
2315 2315
         // defaults
2316
-        if ($type=='full') {
2316
+        if ($type == 'full') {
2317 2317
             if ($this->id > 0) {
2318 2318
                 if ($this->random > $this->selectNbrQuestions()) {
2319
-                    $defaults['randomQuestions'] =  $this->selectNbrQuestions();
2319
+                    $defaults['randomQuestions'] = $this->selectNbrQuestions();
2320 2320
                 } else {
2321 2321
                     $defaults['randomQuestions'] = $this->random;
2322 2322
                 }
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
                 }
2347 2347
 
2348 2348
                 $defaults['start_time'] = !empty($this->start_time) ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00');
2349
-                $defaults['end_time'] = empty($this->end_time) ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600);
2349
+                $defaults['end_time'] = empty($this->end_time) ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600);
2350 2350
 
2351 2351
                 // Get expired time
2352 2352
                 if ($this->expired_time != '0') {
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
                 $defaults['text_when_finished'] = '';
2368 2368
                 $defaults['start_time'] = date('Y-m-d 12:00:00');
2369 2369
                 $defaults['display_category_name'] = 1;
2370
-                $defaults['end_time']   = date('Y-m-d 12:00:00', time()+84600);
2370
+                $defaults['end_time']   = date('Y-m-d 12:00:00', time() + 84600);
2371 2371
                 $defaults['pass_percentage'] = '';
2372 2372
                 $defaults['end_button'] = $this->selectEndButton();
2373 2373
                 $defaults['question_selection_type'] = 1;
@@ -2467,9 +2467,9 @@  discard block
 block discarded – undo
2467 2467
         }
2468 2468
 
2469 2469
         if ($form->getSubmitValue('randomAnswers') == 1) {
2470
-            $this->random_answers=1;
2470
+            $this->random_answers = 1;
2471 2471
         } else {
2472
-            $this->random_answers=0;
2472
+            $this->random_answers = 0;
2473 2473
         }
2474 2474
         $this->save($type);
2475 2475
     }
@@ -2481,9 +2481,9 @@  discard block
 block discarded – undo
2481 2481
         }
2482 2482
         $course_id = api_get_course_id();
2483 2483
 
2484
-        require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
2485
-        require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
2486
-        require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
2484
+        require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
2485
+        require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
2486
+        require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2487 2487
 
2488 2488
         $specific_fields = get_specific_field_list();
2489 2489
         $ic_slide = new IndexableChunk();
@@ -2493,7 +2493,7 @@  discard block
 block discarded – undo
2493 2493
             if (isset($_REQUEST[$specific_field['code']])) {
2494 2494
                 $sterms = trim($_REQUEST[$specific_field['code']]);
2495 2495
                 if (!empty($sterms)) {
2496
-                    $all_specific_terms .= ' '. $sterms;
2496
+                    $all_specific_terms .= ' '.$sterms;
2497 2497
                     $sterms = explode(',', $sterms);
2498 2498
                     foreach ($sterms as $sterm) {
2499 2499
                         $ic_slide->addTerm(trim($sterm), $specific_field['code']);
@@ -2510,15 +2510,15 @@  discard block
 block discarded – undo
2510 2510
         $xapian_data = array(
2511 2511
             SE_COURSE_ID => $course_id,
2512 2512
             SE_TOOL_ID => TOOL_QUIZ,
2513
-            SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id),
2514
-            SE_USER => (int)api_get_user_id(),
2513
+            SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id),
2514
+            SE_USER => (int) api_get_user_id(),
2515 2515
         );
2516 2516
         $ic_slide->xapian_data = serialize($xapian_data);
2517
-        $exercise_description = $all_specific_terms .' '. $this->description;
2517
+        $exercise_description = $all_specific_terms.' '.$this->description;
2518 2518
         $ic_slide->addValue("content", $exercise_description);
2519 2519
 
2520 2520
         $di = new ChamiloIndexer();
2521
-        isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
2521
+        isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
2522 2522
         $di->connectDb(NULL, NULL, $lang);
2523 2523
         $di->addChunk($ic_slide);
2524 2524
 
@@ -2537,7 +2537,7 @@  discard block
 block discarded – undo
2537 2537
     function search_engine_edit()
2538 2538
     {
2539 2539
         // update search enchine and its values table if enabled
2540
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
2540
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
2541 2541
             $course_id = api_get_course_id();
2542 2542
 
2543 2543
             // actually, it consists on delete terms from db,
@@ -2549,9 +2549,9 @@  discard block
 block discarded – undo
2549 2549
             $res = Database::query($sql);
2550 2550
 
2551 2551
             if (Database::num_rows($res) > 0) {
2552
-                require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
2553
-                require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
2554
-                require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
2552
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
2553
+                require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
2554
+                require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');
2555 2555
 
2556 2556
                 $se_ref = Database::fetch_array($res);
2557 2557
                 $specific_fields = get_specific_field_list();
@@ -2562,7 +2562,7 @@  discard block
 block discarded – undo
2562 2562
                     delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id);
2563 2563
                     if (isset($_REQUEST[$specific_field['code']])) {
2564 2564
                         $sterms = trim($_REQUEST[$specific_field['code']]);
2565
-                        $all_specific_terms .= ' '. $sterms;
2565
+                        $all_specific_terms .= ' '.$sterms;
2566 2566
                         $sterms = explode(',', $sterms);
2567 2567
                         foreach ($sterms as $sterm) {
2568 2568
                             $ic_slide->addTerm(trim($sterm), $specific_field['code']);
@@ -2578,17 +2578,17 @@  discard block
 block discarded – undo
2578 2578
                 $xapian_data = array(
2579 2579
                     SE_COURSE_ID => $course_id,
2580 2580
                     SE_TOOL_ID => TOOL_QUIZ,
2581
-                    SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id),
2582
-                    SE_USER => (int)api_get_user_id(),
2581
+                    SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id),
2582
+                    SE_USER => (int) api_get_user_id(),
2583 2583
                 );
2584 2584
                 $ic_slide->xapian_data = serialize($xapian_data);
2585
-                $exercise_description = $all_specific_terms .' '. $this->description;
2585
+                $exercise_description = $all_specific_terms.' '.$this->description;
2586 2586
                 $ic_slide->addValue("content", $exercise_description);
2587 2587
 
2588 2588
                 $di = new ChamiloIndexer();
2589
-                isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
2589
+                isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
2590 2590
                 $di->connectDb(NULL, NULL, $lang);
2591
-                $di->remove_document((int)$se_ref['search_did']);
2591
+                $di->remove_document((int) $se_ref['search_did']);
2592 2592
                 $di->addChunk($ic_slide);
2593 2593
 
2594 2594
                 //index and return search engine document id
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
     function search_engine_delete()
2614 2614
     {
2615 2615
         // remove from search engine if enabled
2616
-        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) {
2616
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
2617 2617
             $course_id = api_get_course_id();
2618 2618
             $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
2619 2619
             $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1';
@@ -2621,19 +2621,19 @@  discard block
 block discarded – undo
2621 2621
             $res = Database::query($sql);
2622 2622
             if (Database::num_rows($res) > 0) {
2623 2623
                 $row = Database::fetch_array($res);
2624
-                require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php');
2624
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
2625 2625
                 $di = new ChamiloIndexer();
2626
-                $di->remove_document((int)$row['search_did']);
2626
+                $di->remove_document((int) $row['search_did']);
2627 2627
                 unset($di);
2628 2628
                 $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
2629
-                foreach ( $this->questionList as $question_i) {
2629
+                foreach ($this->questionList as $question_i) {
2630 2630
                     $sql = 'SELECT type FROM %s WHERE id=%s';
2631 2631
                     $sql = sprintf($sql, $tbl_quiz_question, $question_i);
2632 2632
                     $qres = Database::query($sql);
2633 2633
                     if (Database::num_rows($qres) > 0) {
2634 2634
                         $qrow = Database::fetch_array($qres);
2635 2635
                         $objQuestion = Question::getInstance($qrow['type']);
2636
-                        $objQuestion = Question::read((int)$question_i);
2636
+                        $objQuestion = Question::read((int) $question_i);
2637 2637
                         $objQuestion->search_engine_edit($this->id, FALSE, TRUE);
2638 2638
                         unset($objQuestion);
2639 2639
                     }
@@ -2644,7 +2644,7 @@  discard block
 block discarded – undo
2644 2644
             Database::query($sql);
2645 2645
 
2646 2646
             // remove terms from db
2647
-            require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php';
2647
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2648 2648
             delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id);
2649 2649
         }
2650 2650
     }
@@ -2810,25 +2810,25 @@  discard block
 block discarded – undo
2810 2810
             $lp_id = 0;
2811 2811
         }
2812 2812
         if (empty($lp_item_id)) {
2813
-            $lp_item_id   = 0;
2813
+            $lp_item_id = 0;
2814 2814
         }
2815 2815
         if (empty($lp_item_view_id)) {
2816 2816
             $lp_item_view_id = 0;
2817 2817
         }
2818
-        $condition = ' WHERE exe_exo_id 	= ' . "'" . $this->id . "'" .' AND
2819
-					   exe_user_id 			= ' . "'" . api_get_user_id() . "'" . ' AND
2820
-					   c_id                 = ' . api_get_course_int_id() . ' AND
2821
-					   status 				= ' . "'" . Database::escape_string($status). "'" . ' AND
2822
-					   orig_lp_id 			= ' . "'" . $lp_id . "'" . ' AND
2823
-					   orig_lp_item_id 		= ' . "'" . $lp_item_id . "'" . ' AND
2824
-                       orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND
2825
-					   session_id 			= ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case
2818
+        $condition = ' WHERE exe_exo_id 	= '."'".$this->id."'".' AND
2819
+					   exe_user_id 			= ' . "'".api_get_user_id()."'".' AND
2820
+					   c_id                 = ' . api_get_course_int_id().' AND
2821
+					   status 				= ' . "'".Database::escape_string($status)."'".' AND
2822
+					   orig_lp_id 			= ' . "'".$lp_id."'".' AND
2823
+					   orig_lp_item_id 		= ' . "'".$lp_item_id."'".' AND
2824
+                       orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND
2825
+					   session_id 			= ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case
2826 2826
 
2827 2827
         $sql_track = 'SELECT * FROM '.$track_exercises.$condition;
2828 2828
 
2829 2829
         $result = Database::query($sql_track);
2830 2830
         $new_array = array();
2831
-        if (Database::num_rows($result) > 0 ) {
2831
+        if (Database::num_rows($result) > 0) {
2832 2832
             $new_array = Database::fetch_array($result, 'ASSOC');
2833 2833
             $new_array['num_exe'] = Database::num_rows($result);
2834 2834
         }
@@ -2872,12 +2872,12 @@  discard block
 block discarded – undo
2872 2872
         $questionList = array_map('intval', $questionList);
2873 2873
 
2874 2874
         $params = array(
2875
-            'exe_exo_id' => $this->id ,
2875
+            'exe_exo_id' => $this->id,
2876 2876
             'exe_user_id' => api_get_user_id(),
2877 2877
             'c_id' => api_get_course_int_id(),
2878 2878
             'status' =>  'incomplete',
2879 2879
             'session_id'  => api_get_session_id(),
2880
-            'data_tracking'  => implode(',', $questionList) ,
2880
+            'data_tracking'  => implode(',', $questionList),
2881 2881
             'start_date' => api_get_utc_datetime(),
2882 2882
             'orig_lp_id' => $safe_lp_id,
2883 2883
             'orig_lp_item_id'  => $safe_lp_item_id,
@@ -2911,7 +2911,7 @@  discard block
 block discarded – undo
2911 2911
         $nbrQuestions = $this->get_count_question_list();
2912 2912
 
2913 2913
         $all_button = $html = $label = '';
2914
-        $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null;
2914
+        $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null;
2915 2915
 
2916 2916
         if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) {
2917 2917
             $urlTitle = get_lang('ContinueTest');
@@ -2922,7 +2922,7 @@  discard block
 block discarded – undo
2922 2922
 
2923 2923
             $html .= Display::url(
2924 2924
                 $urlTitle,
2925
-                'exercise_submit_modal.php?' . http_build_query([
2925
+                'exercise_submit_modal.php?'.http_build_query([
2926 2926
                     'learnpath_id' => $safe_lp_id,
2927 2927
                     'learnpath_item_id' => $safe_lp_item_id,
2928 2928
                     'learnpath_item_view_id' => $safe_lp_item_view_id,
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
                     'data-size' => 'md'
2940 2940
                 ]
2941 2941
             );
2942
-            $html .='<br />';
2942
+            $html .= '<br />';
2943 2943
         } else {
2944 2944
             // User
2945 2945
             if (api_is_allowed_to_session_edit()) {
@@ -2964,7 +2964,7 @@  discard block
 block discarded – undo
2964 2964
 
2965 2965
                     //Next question
2966 2966
                     if (!empty($questions_in_media)) {
2967
-                        $questions_in_media = "['".implode("','",$questions_in_media)."']";
2967
+                        $questions_in_media = "['".implode("','", $questions_in_media)."']";
2968 2968
                         $all_button .= '&nbsp;<a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>';
2969 2969
                     } else {
2970 2970
                         $all_button .= '&nbsp;<a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>';
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
                     }
2983 2983
 					$class .= ' question-validate-btn'; // used to select it with jquery
2984 2984
                     $all_button = '&nbsp;<a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
2985
-                    $all_button .= '&nbsp;' . Display::span(null, ['id' => 'save_all_reponse']);
2985
+                    $all_button .= '&nbsp;'.Display::span(null, ['id' => 'save_all_reponse']);
2986 2986
                     $html .= $all_button;
2987 2987
                 }
2988 2988
             }
@@ -3273,11 +3273,11 @@  discard block
 block discarded – undo
3273 3273
             $answer = $objAnswerTmp->selectAnswer($answerId);
3274 3274
             $answerComment = $objAnswerTmp->selectComment($answerId);
3275 3275
             $answerCorrect = $objAnswerTmp->isCorrect($answerId);
3276
-            $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId);
3276
+            $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId);
3277 3277
             $answerAutoId = $objAnswerTmp->selectAutoId($answerId);
3278 3278
             $answerIid = isset($objAnswerTmp->iid[$answerId]) ? $objAnswerTmp->iid[$answerId] : '';
3279 3279
 
3280
-            $answer_correct_array[$answerId] = (bool)$answerCorrect;
3280
+            $answer_correct_array[$answerId] = (bool) $answerCorrect;
3281 3281
 
3282 3282
             if ($debug) {
3283 3283
                 error_log("answer auto id: $answerAutoId ");
@@ -3286,7 +3286,7 @@  discard block
 block discarded – undo
3286 3286
 
3287 3287
             // Delineation
3288 3288
             $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1);
3289
-            $answer_delineation_destination=$objAnswerTmp->selectDestination(1);
3289
+            $answer_delineation_destination = $objAnswerTmp->selectDestination(1);
3290 3290
 
3291 3291
             switch ($answerType) {
3292 3292
                 // for unique answer
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
                                     exe_id = '".$exeId."' AND
3300 3300
                                     question_id= '".$questionId."'";
3301 3301
                         $result = Database::query($sql);
3302
-                        $choice = Database::result($result,0,"answer");
3302
+                        $choice = Database::result($result, 0, "answer");
3303 3303
 
3304 3304
                         $studentChoice = $choice == $answerAutoId ? 1 : 0;
3305 3305
                         if ($studentChoice) {
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
                     } else {
3351 3351
                         // If no result then the user just hit don't know
3352 3352
                         $studentChoice = 3;
3353
-                        $questionScore  +=  $doubt_score;
3353
+                        $questionScore += $doubt_score;
3354 3354
                     }
3355 3355
                     $totalScore = $questionScore;
3356 3356
                     break;
@@ -3366,17 +3366,17 @@  discard block
 block discarded – undo
3366 3366
                         }
3367 3367
 
3368 3368
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3369
-                        $real_answers[$answerId] = (bool)$studentChoice;
3369
+                        $real_answers[$answerId] = (bool) $studentChoice;
3370 3370
 
3371 3371
                         if ($studentChoice) {
3372
-                            $questionScore  +=$answerWeighting;
3372
+                            $questionScore += $answerWeighting;
3373 3373
                         }
3374 3374
                     } else {
3375 3375
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3376
-                        $real_answers[$answerId] = (bool)$studentChoice;
3376
+                        $real_answers[$answerId] = (bool) $studentChoice;
3377 3377
 
3378 3378
                         if (isset($studentChoice)) {
3379
-                            $questionScore  += $answerWeighting;
3379
+                            $questionScore += $answerWeighting;
3380 3380
                         }
3381 3381
                     }
3382 3382
                     $totalScore += $answerWeighting;
@@ -3394,16 +3394,16 @@  discard block
 block discarded – undo
3394 3394
                             $choice[$ind] = 1;
3395 3395
                         }
3396 3396
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3397
-                        $real_answers[$answerId] = (bool)$studentChoice;
3397
+                        $real_answers[$answerId] = (bool) $studentChoice;
3398 3398
                         if ($studentChoice) {
3399
-                            $questionScore +=$answerWeighting;
3399
+                            $questionScore += $answerWeighting;
3400 3400
                         }
3401 3401
                     } else {
3402 3402
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3403 3403
                         if (isset($studentChoice)) {
3404 3404
                             $questionScore += $answerWeighting;
3405 3405
                         }
3406
-                        $real_answers[$answerId] = (bool)$studentChoice;
3406
+                        $real_answers[$answerId] = (bool) $studentChoice;
3407 3407
                     }
3408 3408
                     $totalScore += $answerWeighting;
3409 3409
                     if ($debug) error_log("studentChoice: $studentChoice");
@@ -3415,7 +3415,7 @@  discard block
 block discarded – undo
3415 3415
                         $resultans = Database::query($sql);
3416 3416
                         while ($row = Database::fetch_array($resultans)) {
3417 3417
                             $ind = $row['answer'];
3418
-                            $result = explode(':',$ind);
3418
+                            $result = explode(':', $ind);
3419 3419
                             if (isset($result[0])) {
3420 3420
                                 $my_answer_id = isset($result[0]) ? $result[0] : '';
3421 3421
                                 $option = isset($result[1]) ? $result[1] : '';
@@ -3536,10 +3536,10 @@  discard block
 block discarded – undo
3536 3536
                             }
3537 3537
                             // adds the piece of text that is before the blank
3538 3538
                             //and ends with '[' into a general storage array
3539
-                            $real_text[] = api_substr($temp, 0, $pos +1);
3540
-                            $answer .= api_substr($temp, 0, $pos +1);
3539
+                            $real_text[] = api_substr($temp, 0, $pos + 1);
3540
+                            $answer .= api_substr($temp, 0, $pos + 1);
3541 3541
                             //take the string remaining (after the last "[" we found)
3542
-                            $temp = api_substr($temp, $pos +1);
3542
+                            $temp = api_substr($temp, $pos + 1);
3543 3543
                             // quit the loop if there are no more blanks, and update $pos to the position of next ']'
3544 3544
                             if (($pos = api_strpos($temp, ']')) === false) {
3545 3545
                                 // adds the end of the text
@@ -3575,7 +3575,7 @@  discard block
 block discarded – undo
3575 3575
                             //put the contents of the [] answer tag into correct_tags[]
3576 3576
                             $correct_tags[] = api_substr($temp, 0, $pos);
3577 3577
                             $j++;
3578
-                            $temp = api_substr($temp, $pos +1);
3578
+                            $temp = api_substr($temp, $pos + 1);
3579 3579
                         }
3580 3580
                         $answer = '';
3581 3581
                         $real_correct_tags = $correct_tags;
@@ -3598,7 +3598,7 @@  discard block
 block discarded – undo
3598 3598
                                 } elseif (!empty($user_tags[$i])) {
3599 3599
                                     // else if the word entered by the student IS NOT the same as the one defined by the professor
3600 3600
                                     // adds the word in red at the end of the string, and strikes it
3601
-                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3601
+                                    $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>';
3602 3602
                                 } else {
3603 3603
                                     // adds a tabulation if no word has been typed by the student
3604 3604
                                     $answer .= ''; // remove &nbsp; that causes issue
@@ -3617,17 +3617,17 @@  discard block
 block discarded – undo
3617 3617
                                 } elseif (!empty ($user_tags[$i])) {
3618 3618
                                     // else if the word entered by the student IS NOT the same as the one defined by the professor
3619 3619
                                     // adds the word in red at the end of the string, and strikes it
3620
-                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3620
+                                    $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>';
3621 3621
                                 } else {
3622 3622
                                     // adds a tabulation if no word has been typed by the student
3623
-                                    $answer .= '';  // remove &nbsp; that causes issue
3623
+                                    $answer .= ''; // remove &nbsp; that causes issue
3624 3624
                                 }
3625 3625
                             }
3626 3626
 
3627 3627
                             // adds the correct word, followed by ] to close the blank
3628
-                            $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]';
3629
-                            if (isset($real_text[$i +1])) {
3630
-                                $answer .= $real_text[$i +1];
3628
+                            $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
3629
+                            if (isset($real_text[$i + 1])) {
3630
+                                $answer .= $real_text[$i + 1];
3631 3631
                             }
3632 3632
                         }
3633 3633
                     } else {
@@ -3748,10 +3748,10 @@  discard block
 block discarded – undo
3748 3748
                         }
3749 3749
                         // adds the piece of text that is before the blank
3750 3750
                         //and ends with '[' into a general storage array
3751
-                        $realText[] = api_substr($temp, 0, $pos +1);
3752
-                        $answer .= api_substr($temp, 0, $pos +1);
3751
+                        $realText[] = api_substr($temp, 0, $pos + 1);
3752
+                        $answer .= api_substr($temp, 0, $pos + 1);
3753 3753
                         //take the string remaining (after the last "[" we found)
3754
-                        $temp = api_substr($temp, $pos +1);
3754
+                        $temp = api_substr($temp, $pos + 1);
3755 3755
                         // quit the loop if there are no more blanks, and update $pos to the position of next ']'
3756 3756
                         if (($pos = api_strpos($temp, ']')) === false) {
3757 3757
                             // adds the end of the text
@@ -3792,7 +3792,7 @@  discard block
 block discarded – undo
3792 3792
                         //put the contents of the [] answer tag into correct_tags[]
3793 3793
                         $correctTags[] = api_substr($temp, 0, $pos);
3794 3794
                         $j++;
3795
-                        $temp = api_substr($temp, $pos +1);
3795
+                        $temp = api_substr($temp, $pos + 1);
3796 3796
                     }
3797 3797
                     $answer = '';
3798 3798
                     $realCorrectTags = $correctTags;
@@ -3812,7 +3812,7 @@  discard block
 block discarded – undo
3812 3812
                         } elseif (!empty($userTags[$i])) {
3813 3813
                             // else if the word entered by the student IS NOT the same as the one defined by the professor
3814 3814
                             // adds the word in red at the end of the string, and strikes it
3815
-                            $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>';
3815
+                            $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>';
3816 3816
                         } else {
3817 3817
                             // adds a tabulation if no word has been typed by the student
3818 3818
                             $answer .= ''; // remove &nbsp; that causes issue
@@ -3822,19 +3822,19 @@  discard block
 block discarded – undo
3822 3822
                         if (
3823 3823
                             $this->results_disabled != EXERCISE_FEEDBACK_TYPE_EXAM
3824 3824
                         ) {
3825
-                            $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>';
3825
+                            $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>';
3826 3826
                         }
3827 3827
 
3828 3828
                         $answer .= ']';
3829 3829
 
3830
-                        if (isset($realText[$i +1])) {
3831
-                            $answer .= $realText[$i +1];
3830
+                        if (isset($realText[$i + 1])) {
3831
+                            $answer .= $realText[$i + 1];
3832 3832
                         }
3833 3833
                     }
3834 3834
                     break;
3835 3835
                 case FREE_ANSWER:
3836 3836
                     if ($from_database) {
3837
-                        $query  = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
3837
+                        $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
3838 3838
                                    WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'";
3839 3839
                         $resq = Database::query($query);
3840 3840
                         $data = Database::fetch_array($resq);
@@ -3845,9 +3845,9 @@  discard block
 block discarded – undo
3845 3845
                         $questionScore = $data['marks'];
3846 3846
 
3847 3847
                         if ($questionScore == -1) {
3848
-                            $totalScore+= 0;
3848
+                            $totalScore += 0;
3849 3849
                         } else {
3850
-                            $totalScore+= $questionScore;
3850
+                            $totalScore += $questionScore;
3851 3851
                         }
3852 3852
                         if ($questionScore == '') {
3853 3853
                             $questionScore = 0;
@@ -3926,7 +3926,7 @@  discard block
 block discarded – undo
3926 3926
 
3927 3927
                         while ($a_answers = Database::fetch_array($res_answers)) {
3928 3928
                             $i_answer_id = $a_answers['id']; //3
3929
-                            $s_answer_label = $a_answers['answer'];  // your daddy - your mother
3929
+                            $s_answer_label = $a_answers['answer']; // your daddy - your mother
3930 3930
                             $i_answer_correct_answer = $a_answers['correct']; //1 - 2
3931 3931
                             $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4
3932 3932
 
@@ -3996,8 +3996,8 @@  discard block
 block discarded – undo
3996 3996
                                     $user_answer = '';
3997 3997
                                 }
3998 3998
                                 echo '<tr>';
3999
-                                echo '<td>' . $s_answer_label . '</td>';
4000
-                                echo '<td>' . $user_answer;
3999
+                                echo '<td>'.$s_answer_label.'</td>';
4000
+                                echo '<td>'.$user_answer;
4001 4001
 
4002 4002
                                 if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
4003 4003
                                     if (isset($real_list[$i_answer_correct_answer]) &&
@@ -4159,7 +4159,7 @@  discard block
 block discarded – undo
4159 4159
                     if ($from_database) {
4160 4160
                         // getting the user answer
4161 4161
                         $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
4162
-                        $query   = "SELECT hotspot_correct, hotspot_coordinate
4162
+                        $query = "SELECT hotspot_correct, hotspot_coordinate
4163 4163
                                     FROM $TBL_TRACK_HOTSPOT
4164 4164
                                     WHERE
4165 4165
                                         hotspot_exe_id = '".$exeId."' AND
@@ -4167,20 +4167,20 @@  discard block
 block discarded – undo
4167 4167
                                         hotspot_answer_id='1'";
4168 4168
                         //by default we take 1 because it's a delineation
4169 4169
                         $resq = Database::query($query);
4170
-                        $row = Database::fetch_array($resq,'ASSOC');
4170
+                        $row = Database::fetch_array($resq, 'ASSOC');
4171 4171
 
4172 4172
                         $choice = $row['hotspot_correct'];
4173 4173
                         $user_answer = $row['hotspot_coordinate'];
4174 4174
 
4175 4175
                         // THIS is very important otherwise the poly_compile will throw an error!!
4176 4176
                         // round-up the coordinates
4177
-                        $coords = explode('/',$user_answer);
4177
+                        $coords = explode('/', $user_answer);
4178 4178
                         $user_array = '';
4179 4179
                         foreach ($coords as $coord) {
4180
-                            list($x,$y) = explode(';',$coord);
4180
+                            list($x, $y) = explode(';', $coord);
4181 4181
                             $user_array .= round($x).';'.round($y).'/';
4182 4182
                         }
4183
-                        $user_array = substr($user_array,0,-1);
4183
+                        $user_array = substr($user_array, 0, -1);
4184 4184
                     } else {
4185 4185
                         if (!empty($studentChoice)) {
4186 4186
                             $newquestionList[] = $questionId;
@@ -4190,13 +4190,13 @@  discard block
 block discarded – undo
4190 4190
                             $studentChoice = $choice[$answerId];
4191 4191
                             $questionScore += $answerWeighting;
4192 4192
 
4193
-                            if ($hotspot_delineation_result[1]==1) {
4193
+                            if ($hotspot_delineation_result[1] == 1) {
4194 4194
                                 $totalScore += $answerWeighting; //adding the total
4195 4195
                             }
4196 4196
                         }
4197 4197
                     }
4198
-                    $_SESSION['hotspot_coord'][1]	= $delineation_cord;
4199
-                    $_SESSION['hotspot_dest'][1]	= $answer_delineation_destination;
4198
+                    $_SESSION['hotspot_coord'][1] = $delineation_cord;
4199
+                    $_SESSION['hotspot_dest'][1] = $answer_delineation_destination;
4200 4200
                     break;
4201 4201
             } // end switch Answertype
4202 4202
 
@@ -4248,7 +4248,7 @@  discard block
 block discarded – undo
4248 4248
                                 $results_disabled,
4249 4249
                                 $showTotalScoreAndUserChoicesInLastAttempt
4250 4250
                             );
4251
-                        } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) {
4251
+                        } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
4252 4252
                             ExerciseShowFunctions::display_multiple_answer_combination_true_false(
4253 4253
                                 $feedback_type,
4254 4254
                                 $answerType,
@@ -4330,13 +4330,13 @@  discard block
 block discarded – undo
4330 4330
                             $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId];
4331 4331
 
4332 4332
                             //round-up the coordinates
4333
-                            $coords = explode('/',$user_answer);
4333
+                            $coords = explode('/', $user_answer);
4334 4334
                             $user_array = '';
4335 4335
                             foreach ($coords as $coord) {
4336
-                                list($x,$y) = explode(';',$coord);
4336
+                                list($x, $y) = explode(';', $coord);
4337 4337
                                 $user_array .= round($x).';'.round($y).'/';
4338 4338
                             }
4339
-                            $user_array = substr($user_array,0,-1);
4339
+                            $user_array = substr($user_array, 0, -1);
4340 4340
 
4341 4341
                             if ($next) {
4342 4342
 
@@ -4363,7 +4363,7 @@  discard block
 block discarded – undo
4363 4363
                                 //$overlap = round(polygons_overlap($poly_answer,$poly_user));
4364 4364
                                 // //this is an area in pixels
4365 4365
                                 if ($debug > 0) {
4366
-                                    error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0);
4366
+                                    error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0);
4367 4367
                                 }
4368 4368
 
4369 4369
                                 if ($overlap < 1) {
@@ -4376,43 +4376,43 @@  discard block
 block discarded – undo
4376 4376
                                     // that is overlapped by the user's polygon
4377 4377
                                     $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
4378 4378
                                     if ($debug > 1) {
4379
-                                        error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0);
4379
+                                        error_log(__LINE__.' - Final overlap is '.$final_overlap, 0);
4380 4380
                                     }
4381 4381
                                     // the final missing area is the percentage of the initial polygon
4382 4382
                                     // that is not overlapped by the user's polygon
4383 4383
                                     $final_missing = 100 - $final_overlap;
4384 4384
                                     if ($debug > 1) {
4385
-                                        error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0);
4385
+                                        error_log(__LINE__.' - Final missing is '.$final_missing, 0);
4386 4386
                                     }
4387 4387
                                     // the final excess area is the percentage of the initial polygon's size
4388 4388
                                     // that is covered by the user's polygon outside of the initial polygon
4389 4389
                                     $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
4390 4390
                                     if ($debug > 1) {
4391
-                                        error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0);
4391
+                                        error_log(__LINE__.' - Final excess is '.$final_excess, 0);
4392 4392
                                     }
4393 4393
                                 }
4394 4394
 
4395 4395
                                 //checking the destination parameters parsing the "@@"
4396
-                                $destination_items= explode('@@', $answerDestination);
4396
+                                $destination_items = explode('@@', $answerDestination);
4397 4397
                                 $threadhold_total = $destination_items[0];
4398
-                                $threadhold_items=explode(';',$threadhold_total);
4398
+                                $threadhold_items = explode(';', $threadhold_total);
4399 4399
                                 $threadhold1 = $threadhold_items[0]; // overlap
4400 4400
                                 $threadhold2 = $threadhold_items[1]; // excess
4401
-                                $threadhold3 = $threadhold_items[2];	 //missing
4401
+                                $threadhold3 = $threadhold_items[2]; //missing
4402 4402
 
4403 4403
                                 // if is delineation
4404
-                                if ($answerId===1) {
4404
+                                if ($answerId === 1) {
4405 4405
                                     //setting colors
4406
-                                    if ($final_overlap>=$threadhold1) {
4407
-                                        $overlap_color=true; //echo 'a';
4406
+                                    if ($final_overlap >= $threadhold1) {
4407
+                                        $overlap_color = true; //echo 'a';
4408 4408
                                     }
4409 4409
                                     //echo $excess.'-'.$threadhold2;
4410
-                                    if ($final_excess<=$threadhold2) {
4411
-                                        $excess_color=true; //echo 'b';
4410
+                                    if ($final_excess <= $threadhold2) {
4411
+                                        $excess_color = true; //echo 'b';
4412 4412
                                     }
4413 4413
                                     //echo '--------'.$missing.'-'.$threadhold3;
4414
-                                    if ($final_missing<=$threadhold3) {
4415
-                                        $missing_color=true; //echo 'c';
4414
+                                    if ($final_missing <= $threadhold3) {
4415
+                                        $missing_color = true; //echo 'c';
4416 4416
                                     }
4417 4417
 
4418 4418
                                     // if pass
@@ -4421,67 +4421,67 @@  discard block
 block discarded – undo
4421 4421
                                         $final_missing <= $threadhold3 &&
4422 4422
                                         $final_excess <= $threadhold2
4423 4423
                                     ) {
4424
-                                        $next=1; //go to the oars
4425
-                                        $result_comment=get_lang('Acceptable');
4426
-                                        $final_answer = 1;	// do not update with  update_exercise_attempt
4424
+                                        $next = 1; //go to the oars
4425
+                                        $result_comment = get_lang('Acceptable');
4426
+                                        $final_answer = 1; // do not update with  update_exercise_attempt
4427 4427
                                     } else {
4428
-                                        $next=0;
4429
-                                        $result_comment=get_lang('Unacceptable');
4430
-                                        $comment=$answerDestination=$objAnswerTmp->selectComment(1);
4431
-                                        $answerDestination=$objAnswerTmp->selectDestination(1);
4428
+                                        $next = 0;
4429
+                                        $result_comment = get_lang('Unacceptable');
4430
+                                        $comment = $answerDestination = $objAnswerTmp->selectComment(1);
4431
+                                        $answerDestination = $objAnswerTmp->selectDestination(1);
4432 4432
                                         //checking the destination parameters parsing the "@@"
4433
-                                        $destination_items= explode('@@', $answerDestination);
4433
+                                        $destination_items = explode('@@', $answerDestination);
4434 4434
                                     }
4435
-                                } elseif($answerId>1) {
4435
+                                } elseif ($answerId > 1) {
4436 4436
                                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
4437
-                                        if ($debug>0) {
4438
-                                            error_log(__LINE__.' - answerId is of type noerror',0);
4437
+                                        if ($debug > 0) {
4438
+                                            error_log(__LINE__.' - answerId is of type noerror', 0);
4439 4439
                                         }
4440 4440
                                         //type no error shouldn't be treated
4441 4441
                                         $next = 1;
4442 4442
                                         continue;
4443 4443
                                     }
4444
-                                    if ($debug>0) {
4445
-                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);
4444
+                                    if ($debug > 0) {
4445
+                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0);
4446 4446
                                     }
4447 4447
                                     //check the intersection between the oar and the user
4448 4448
                                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
4449 4449
                                     //echo 'official';print_r($x_list);print_r($y_list);
4450 4450
                                     //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
4451
-                                    $inter= $result['success'];
4451
+                                    $inter = $result['success'];
4452 4452
 
4453 4453
                                     //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
4454
-                                    $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
4454
+                                    $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId);
4455 4455
 
4456
-                                    $poly_answer = convert_coordinates($delineation_cord,'|');
4457
-                                    $max_coord = poly_get_max($poly_user,$poly_answer);
4458
-                                    $poly_answer_compiled = poly_compile($poly_answer,$max_coord);
4459
-                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
4456
+                                    $poly_answer = convert_coordinates($delineation_cord, '|');
4457
+                                    $max_coord = poly_get_max($poly_user, $poly_answer);
4458
+                                    $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
4459
+                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
4460 4460
 
4461 4461
                                     if ($overlap == false) {
4462 4462
                                         //all good, no overlap
4463 4463
                                         $next = 1;
4464 4464
                                         continue;
4465 4465
                                     } else {
4466
-                                        if ($debug>0) {
4467
-                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);
4466
+                                        if ($debug > 0) {
4467
+                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0);
4468 4468
                                         }
4469 4469
                                         $organs_at_risk_hit++;
4470 4470
                                         //show the feedback
4471
-                                        $next=0;
4472
-                                        $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
4473
-                                        $answerDestination=$objAnswerTmp->selectDestination($answerId);
4474
-
4475
-                                        $destination_items= explode('@@', $answerDestination);
4476
-                                        $try_hotspot=$destination_items[1];
4477
-                                        $lp_hotspot=$destination_items[2];
4478
-                                        $select_question_hotspot=$destination_items[3];
4479
-                                        $url_hotspot=$destination_items[4];
4471
+                                        $next = 0;
4472
+                                        $comment = $answerDestination = $objAnswerTmp->selectComment($answerId);
4473
+                                        $answerDestination = $objAnswerTmp->selectDestination($answerId);
4474
+
4475
+                                        $destination_items = explode('@@', $answerDestination);
4476
+                                        $try_hotspot = $destination_items[1];
4477
+                                        $lp_hotspot = $destination_items[2];
4478
+                                        $select_question_hotspot = $destination_items[3];
4479
+                                        $url_hotspot = $destination_items[4];
4480 4480
                                     }
4481 4481
                                 }
4482 4482
                             } else {	// the first delineation feedback
4483
-                                if ($debug>0) {
4484
-                                    error_log(__LINE__.' first',0);
4483
+                                if ($debug > 0) {
4484
+                                    error_log(__LINE__.' first', 0);
4485 4485
                                 }
4486 4486
                             }
4487 4487
                         } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
@@ -4489,7 +4489,7 @@  discard block
 block discarded – undo
4489 4489
                             echo Display::tag('td', $answerMatching[$answerId]);
4490 4490
                             echo Display::tag(
4491 4491
                                 'td',
4492
-                                "$user_answer / " . Display::tag(
4492
+                                "$user_answer / ".Display::tag(
4493 4493
                                     'strong',
4494 4494
                                     $answerMatching[$answerCorrect],
4495 4495
                                     ['style' => 'color: #008000; font-weight: bold;']
@@ -4641,7 +4641,7 @@  discard block
 block discarded – undo
4641 4641
                                     $questionId,
4642 4642
                                     $objQuestionTmp->getFileUrl(),
4643 4643
                                     $results_disabled
4644
-                                ) . '</td>
4644
+                                ).'</td>
4645 4645
                                 </tr>
4646 4646
                                 </table>';
4647 4647
                             break;
@@ -4703,7 +4703,7 @@  discard block
 block discarded – undo
4703 4703
 
4704 4704
                                 //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
4705 4705
                                 if ($debug > 0) {
4706
-                                    error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0);
4706
+                                    error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0);
4707 4707
                                 }
4708 4708
                                 if ($overlap < 1) {
4709 4709
                                     //shortcut to avoid complicated calculations
@@ -4714,17 +4714,17 @@  discard block
 block discarded – undo
4714 4714
                                     // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
4715 4715
                                     $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
4716 4716
                                     if ($debug > 1) {
4717
-                                        error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0);
4717
+                                        error_log(__LINE__.' - Final overlap is '.$final_overlap, 0);
4718 4718
                                     }
4719 4719
                                     // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
4720 4720
                                     $final_missing = 100 - $final_overlap;
4721 4721
                                     if ($debug > 1) {
4722
-                                        error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0);
4722
+                                        error_log(__LINE__.' - Final missing is '.$final_missing, 0);
4723 4723
                                     }
4724 4724
                                     // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon
4725 4725
                                     $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
4726 4726
                                     if ($debug > 1) {
4727
-                                        error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0);
4727
+                                        error_log(__LINE__.' - Final excess is '.$final_excess, 0);
4728 4728
                                     }
4729 4729
                                 }
4730 4730
 
@@ -4734,7 +4734,7 @@  discard block
 block discarded – undo
4734 4734
                                 $threadhold_items = explode(';', $threadhold_total);
4735 4735
                                 $threadhold1 = $threadhold_items[0]; // overlap
4736 4736
                                 $threadhold2 = $threadhold_items[1]; // excess
4737
-                                $threadhold3 = $threadhold_items[2];  //missing
4737
+                                $threadhold3 = $threadhold_items[2]; //missing
4738 4738
                                 // if is delineation
4739 4739
                                 if ($answerId === 1) {
4740 4740
                                     //setting colors
@@ -4766,14 +4766,14 @@  discard block
 block discarded – undo
4766 4766
                                 } elseif ($answerId > 1) {
4767 4767
                                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
4768 4768
                                         if ($debug > 0) {
4769
-                                            error_log(__LINE__ . ' - answerId is of type noerror', 0);
4769
+                                            error_log(__LINE__.' - answerId is of type noerror', 0);
4770 4770
                                         }
4771 4771
                                         //type no error shouldn't be treated
4772 4772
                                         $next = 1;
4773 4773
                                         continue;
4774 4774
                                     }
4775 4775
                                     if ($debug > 0) {
4776
-                                        error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0);
4776
+                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0);
4777 4777
                                     }
4778 4778
                                     //check the intersection between the oar and the user
4779 4779
                                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
@@ -4787,7 +4787,7 @@  discard block
 block discarded – undo
4787 4787
                                     $poly_answer = convert_coordinates($delineation_cord, '|');
4788 4788
                                     $max_coord = poly_get_max($poly_user, $poly_answer);
4789 4789
                                     $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
4790
-                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
4790
+                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
4791 4791
 
4792 4792
                                     if ($overlap == false) {
4793 4793
                                         //all good, no overlap
@@ -4795,7 +4795,7 @@  discard block
 block discarded – undo
4795 4795
                                         continue;
4796 4796
                                     } else {
4797 4797
                                         if ($debug > 0) {
4798
-                                            error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0);
4798
+                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0);
4799 4799
                                         }
4800 4800
                                         $organs_at_risk_hit++;
4801 4801
                                         //show the feedback
@@ -4807,12 +4807,12 @@  discard block
 block discarded – undo
4807 4807
                                         $try_hotspot = $destination_items[1];
4808 4808
                                         $lp_hotspot = $destination_items[2];
4809 4809
                                         $select_question_hotspot = $destination_items[3];
4810
-                                        $url_hotspot=$destination_items[4];
4810
+                                        $url_hotspot = $destination_items[4];
4811 4811
                                     }
4812 4812
                                 }
4813 4813
                             } else {	// the first delineation feedback
4814 4814
                                 if ($debug > 0) {
4815
-                                    error_log(__LINE__ . ' first', 0);
4815
+                                    error_log(__LINE__.' first', 0);
4816 4816
                                 }
4817 4817
                             }
4818 4818
                             break;
@@ -4834,7 +4834,7 @@  discard block
 block discarded – undo
4834 4834
                             echo Display::tag('td', $answerMatching[$answerId]);
4835 4835
                             echo Display::tag(
4836 4836
                                 'td',
4837
-                                "$user_answer / " . Display::tag(
4837
+                                "$user_answer / ".Display::tag(
4838 4838
                                     'strong',
4839 4839
                                     $answerMatching[$answerCorrect],
4840 4840
                                     ['style' => 'color: #008000; font-weight: bold;']
@@ -4920,7 +4920,7 @@  discard block
 block discarded – undo
4920 4920
             //  we use the results from the session (from_db=0)
4921 4921
             // TODO Change this, because it is wrong to show the user
4922 4922
             //  some results that haven't been stored in the database yet
4923
-            if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) {
4923
+            if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) {
4924 4924
 
4925 4925
                 if ($debug) error_log('$from AND this is a hotspot kind of question ');
4926 4926
 
@@ -4929,19 +4929,19 @@  discard block
 block discarded – undo
4929 4929
                 if ($answerType == HOT_SPOT_DELINEATION) {
4930 4930
                     if (0) {
4931 4931
                         if ($overlap_color) {
4932
-                            $overlap_color='green';
4932
+                            $overlap_color = 'green';
4933 4933
                         } else {
4934
-                            $overlap_color='red';
4934
+                            $overlap_color = 'red';
4935 4935
                         }
4936 4936
                         if ($missing_color) {
4937
-                            $missing_color='green';
4937
+                            $missing_color = 'green';
4938 4938
                         } else {
4939
-                            $missing_color='red';
4939
+                            $missing_color = 'red';
4940 4940
                         }
4941 4941
                         if ($excess_color) {
4942
-                            $excess_color='green';
4942
+                            $excess_color = 'green';
4943 4943
                         } else {
4944
-                            $excess_color='red';
4944
+                            $excess_color = 'red';
4945 4945
                         }
4946 4946
                         if (!is_numeric($final_overlap)) {
4947 4947
                             $final_overlap = 0;
@@ -4953,33 +4953,33 @@  discard block
 block discarded – undo
4953 4953
                             $final_excess = 0;
4954 4954
                         }
4955 4955
 
4956
-                        if ($final_overlap>100) {
4956
+                        if ($final_overlap > 100) {
4957 4957
                             $final_overlap = 100;
4958 4958
                         }
4959 4959
 
4960
-                        $table_resume='<table class="data_table">
4960
+                        $table_resume = '<table class="data_table">
4961 4961
                                 <tr class="row_odd" >
4962 4962
                                     <td></td>
4963
-                                    <td ><b>' . get_lang('Requirements') . '</b></td>
4964
-                                    <td><b>' . get_lang('YourAnswer') . '</b></td>
4963
+                                    <td ><b>' . get_lang('Requirements').'</b></td>
4964
+                                    <td><b>' . get_lang('YourAnswer').'</b></td>
4965 4965
                                 </tr>
4966 4966
                                 <tr class="row_even">
4967
-                                    <td><b>' . get_lang('Overlap') . '</b></td>
4968
-                                    <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td>
4969
-                                    <td><div style="color:' . $overlap_color . '">'
4970
-                                        . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td>
4967
+                                    <td><b>' . get_lang('Overlap').'</b></td>
4968
+                                    <td>' . get_lang('Min').' '.$threadhold1.'</td>
4969
+                                    <td><div style="color:' . $overlap_color.'">'
4970
+                                        . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
4971 4971
                                 </tr>
4972 4972
                                 <tr>
4973
-                                    <td><b>' . get_lang('Excess') . '</b></td>
4974
-                                    <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td>
4975
-                                    <td><div style="color:' . $excess_color . '">'
4976
-                                        . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td>
4973
+                                    <td><b>' . get_lang('Excess').'</b></td>
4974
+                                    <td>' . get_lang('Max').' '.$threadhold2.'</td>
4975
+                                    <td><div style="color:' . $excess_color.'">'
4976
+                                        . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
4977 4977
                                 </tr>
4978 4978
                                 <tr class="row_even">
4979
-                                    <td><b>' . get_lang('Missing') . '</b></td>
4980
-                                    <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td>
4981
-                                    <td><div style="color:' . $missing_color . '">'
4982
-                                        . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td>
4979
+                                    <td><b>' . get_lang('Missing').'</b></td>
4980
+                                    <td>' . get_lang('Max').' '.$threadhold3.'</td>
4981
+                                    <td><div style="color:' . $missing_color.'">'
4982
+                                        . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
4983 4983
                                 </tr>
4984 4984
                             </table>';
4985 4985
                         if ($next == 0) {
@@ -4994,20 +4994,20 @@  discard block
 block discarded – undo
4994 4994
                             $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
4995 4995
                         }
4996 4996
 
4997
-                        echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1>
4997
+                        echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>
4998 4998
                             <p style="text-align:center">';
4999 4999
 
5000
-                        $message = '<p>' . get_lang('YourDelineation') . '</p>';
5000
+                        $message = '<p>'.get_lang('YourDelineation').'</p>';
5001 5001
                         $message .= $table_resume;
5002
-                        $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />';
5002
+                        $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />';
5003 5003
                         if ($organs_at_risk_hit > 0) {
5004
-                            $message .= '<p><b>' . get_lang('OARHit') . '</b></p>';
5004
+                            $message .= '<p><b>'.get_lang('OARHit').'</b></p>';
5005 5005
                         }
5006
-                        $message .='<p>' . $comment . '</p>';
5006
+                        $message .= '<p>'.$comment.'</p>';
5007 5007
                         echo $message;
5008 5008
                     } else {
5009 5009
                         echo $hotspot_delineation_result[0]; //prints message
5010
-                        $from_database = 1;  // the hotspot_solution.swf needs this variable
5010
+                        $from_database = 1; // the hotspot_solution.swf needs this variable
5011 5011
                     }
5012 5012
 
5013 5013
                     //save the score attempts
@@ -5030,12 +5030,12 @@  discard block
 block discarded – undo
5030 5030
                             $exerciseResultCoordinates[$quesId]
5031 5031
                         );
5032 5032
                     } else {
5033
-                        if ($final_answer==0) {
5033
+                        if ($final_answer == 0) {
5034 5034
                             $questionScore = 0;
5035
-                            $answer=0;
5035
+                            $answer = 0;
5036 5036
                             Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
5037 5037
                             if (is_array($exerciseResultCoordinates[$quesId])) {
5038
-                                foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
5038
+                                foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
5039 5039
                                     Event::saveExerciseAttemptHotspot(
5040 5040
                                         $exeId,
5041 5041
                                         $quesId,
@@ -5048,7 +5048,7 @@  discard block
 block discarded – undo
5048 5048
                         } else {
5049 5049
                             Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
5050 5050
                             if (is_array($exerciseResultCoordinates[$quesId])) {
5051
-                                foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
5051
+                                foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
5052 5052
                                     $hotspotValue = (int) $choice[$idx] === 1 ? 1 : 0;
5053 5053
                                     Event::saveExerciseAttemptHotspot(
5054 5054
                                         $exeId,
@@ -5075,7 +5075,7 @@  discard block
 block discarded – undo
5075 5075
                     echo "
5076 5076
                         <tr>
5077 5077
                             <td colspan=\"2\">
5078
-                                <p><em>" . get_lang('HotSpot') . "</em></p>
5078
+                                <p><em>" . get_lang('HotSpot')."</em></p>
5079 5079
                                 <div id=\"hotspot-solution-$questionId\"></div>
5080 5080
                                 <script>
5081 5081
                                     $(document).on('ready', function () {
@@ -5110,7 +5110,7 @@  discard block
 block discarded – undo
5110 5110
 
5111 5111
         if ($saved_results) {
5112 5112
             if ($debug) error_log("Save question results $saved_results");
5113
-            if ($debug) error_log(print_r($choice ,1 ));
5113
+            if ($debug) error_log(print_r($choice, 1));
5114 5114
 
5115 5115
             if (empty($choice)) {
5116 5116
                 $choice = 0;
@@ -5122,14 +5122,14 @@  discard block
 block discarded – undo
5122 5122
                         $ans = $reply[$i];
5123 5123
                         Event::saveQuestionAttempt(
5124 5124
                             $questionScore,
5125
-                            $ans . ':' . $choice[$ans],
5125
+                            $ans.':'.$choice[$ans],
5126 5126
                             $quesId,
5127 5127
                             $exeId,
5128 5128
                             $i,
5129 5129
                             $this->id
5130 5130
                         );
5131 5131
                         if ($debug) {
5132
-                            error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]);
5132
+                            error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]);
5133 5133
                         }
5134 5134
                     }
5135 5135
                 } else {
@@ -5140,7 +5140,7 @@  discard block
 block discarded – undo
5140 5140
                     $reply = array_keys($choice);
5141 5141
 
5142 5142
                     if ($debug) {
5143
-                        error_log("reply " . print_r($reply, 1) . "");
5143
+                        error_log("reply ".print_r($reply, 1)."");
5144 5144
                     }
5145 5145
                     for ($i = 0; $i < sizeof($reply); $i++) {
5146 5146
                         $ans = $reply[$i];
@@ -5215,7 +5215,7 @@  discard block
 block discarded – undo
5215 5215
 
5216 5216
                 Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id);
5217 5217
             } else {
5218
-                Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id);
5218
+                Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
5219 5219
             }
5220 5220
         }
5221 5221
 
@@ -5225,8 +5225,8 @@  discard block
 block discarded – undo
5225 5225
 
5226 5226
         if ($saved_results) {
5227 5227
             $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
5228
-            $sql = 'UPDATE ' . $stat_table . ' SET
5229
-                        exe_result = exe_result + ' . floatval($questionScore) . '
5228
+            $sql = 'UPDATE '.$stat_table.' SET
5229
+                        exe_result = exe_result + ' . floatval($questionScore).'
5230 5230
                     WHERE exe_id = ' . $exeId;
5231 5231
             Database::query($sql);
5232 5232
         }
@@ -5317,7 +5317,7 @@  discard block
 block discarded – undo
5317 5317
         $msg = str_replace("#course#", $courseInfo['name'], $msg1);
5318 5318
 
5319 5319
         if ($origin != 'learnpath') {
5320
-            $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5320
+            $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5321 5321
         }
5322 5322
         $msg1 = str_replace("#url#", $url_email, $msg);
5323 5323
         $mail_content = $msg1;
@@ -5356,7 +5356,7 @@  discard block
 block discarded – undo
5356 5356
      */
5357 5357
     public function send_notification_for_open_questions($question_list_answers, $origin, $exe_id)
5358 5358
     {
5359
-        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
5359
+        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
5360 5360
             return null;
5361 5361
         }
5362 5362
         // Email configuration settings
@@ -5419,11 +5419,11 @@  discard block
 block discarded – undo
5419 5419
             $msg .= '</table><br />';
5420 5420
 
5421 5421
 
5422
-            $msg1   = str_replace("#exercise#",    $this->exercise, $msg);
5423
-            $msg    = str_replace("#firstName#",   $user_info['firstname'],$msg1);
5424
-            $msg1   = str_replace("#lastName#",    $user_info['lastname'],$msg);
5425
-            $msg    = str_replace("#mail#",        $user_info['email'],$msg1);
5426
-            $msg    = str_replace("#course#",      $course_info['name'],$msg1);
5422
+            $msg1   = str_replace("#exercise#", $this->exercise, $msg);
5423
+            $msg    = str_replace("#firstName#", $user_info['firstname'], $msg1);
5424
+            $msg1   = str_replace("#lastName#", $user_info['lastname'], $msg);
5425
+            $msg    = str_replace("#mail#", $user_info['email'], $msg1);
5426
+            $msg    = str_replace("#course#", $course_info['name'], $msg1);
5427 5427
 
5428 5428
             if ($origin != 'learnpath') {
5429 5429
                 $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
@@ -5452,7 +5452,7 @@  discard block
 block discarded – undo
5452 5452
 
5453 5453
     function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id)
5454 5454
     {
5455
-        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
5455
+        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
5456 5456
             return null;
5457 5457
         }
5458 5458
         // Email configuration settings
@@ -5476,7 +5476,7 @@  discard block
 block discarded – undo
5476 5476
             $answer_type = $item['answer_type'];
5477 5477
 
5478 5478
             if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) {
5479
-                $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
5479
+                $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
5480 5480
                     .'<tr>'
5481 5481
                         .'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>'
5482 5482
                         .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>'
@@ -5509,7 +5509,7 @@  discard block
 block discarded – undo
5509 5509
                             .'<td>&nbsp;#mail#</td>'
5510 5510
                         .'</tr>'
5511 5511
                     .'</table>';
5512
-            $msg .=  '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />';
5512
+            $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />';
5513 5513
             $msg1 = str_replace("#exercise#", $this->exercise, $msg);
5514 5514
             $msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
5515 5515
             $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);
@@ -5517,7 +5517,7 @@  discard block
 block discarded – undo
5517 5517
             $msg = str_replace("#course#", $course_info['name'], $msg1);
5518 5518
 
5519 5519
             if ($origin != 'learnpath') {
5520
-                $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5520
+                $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5521 5521
             }
5522 5522
             $msg1 = str_replace("#url#", $url_email, $msg);
5523 5523
             $mail_content = $msg1;
@@ -5583,10 +5583,10 @@  discard block
 block discarded – undo
5583 5583
         }
5584 5584
         $html  = '<div class="question-result">';
5585 5585
         $html .= Display::page_header(
5586
-            Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result')
5586
+            Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result')
5587 5587
         );
5588 5588
         $html .= Display::description($array);
5589
-        $html .="</div>";
5589
+        $html .= "</div>";
5590 5590
         return $html;
5591 5591
     }
5592 5592
 
@@ -5703,7 +5703,7 @@  discard block
 block discarded – undo
5703 5703
                     false,
5704 5704
                     $objExercise->selectPropagateNeg()
5705 5705
                 );
5706
-                $totalScore      += $question_result['score'];
5706
+                $totalScore += $question_result['score'];
5707 5707
             }
5708 5708
 
5709 5709
             if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) {
@@ -5907,7 +5907,7 @@  discard block
 block discarded – undo
5907 5907
         }
5908 5908
 
5909 5909
         $rawMessage = "";
5910
-        if (!empty($message)){
5910
+        if (!empty($message)) {
5911 5911
             $rawMessage = $message;
5912 5912
             $message = Display::return_message($message, 'warning', false);
5913 5913
         }
@@ -5923,7 +5923,7 @@  discard block
 block discarded – undo
5923 5923
     {
5924 5924
         $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
5925 5925
         $sql = "SELECT max_score FROM $TBL_LP_ITEM
5926
-            WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'";
5926
+            WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'";
5927 5927
         $result = Database::query($sql);
5928 5928
         if (Database::num_rows($result) > 0) {
5929 5929
             return true;
@@ -6253,7 +6253,7 @@  discard block
 block discarded – undo
6253 6253
         $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id ";
6254 6254
         $result = Database::query($sql_track);
6255 6255
         $new_array = array();
6256
-        if (Database::num_rows($result) > 0 ) {
6256
+        if (Database::num_rows($result) > 0) {
6257 6257
             $new_array = Database::fetch_array($result, 'ASSOC');
6258 6258
 
6259 6259
             $new_array['duration'] = null;
@@ -6265,11 +6265,11 @@  discard block
 block discarded – undo
6265 6265
                 $start_date = api_strtotime($start_date, 'UTC');
6266 6266
                 $end_date = api_strtotime($end_date, 'UTC');
6267 6267
                 if ($start_date && $end_date) {
6268
-                    $mytime = $end_date- $start_date;
6268
+                    $mytime = $end_date - $start_date;
6269 6269
                     $new_learnpath_item = new learnpathItem(null);
6270 6270
                     $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime);
6271 6271
                     $h = get_lang('h');
6272
-                    $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
6272
+                    $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp);
6273 6273
                     $new_array['duration'] = $time_attemp;
6274 6274
                 }
6275 6275
             }
@@ -6291,7 +6291,7 @@  discard block
 block discarded – undo
6291 6291
                     Database::query($sql);
6292 6292
                 }
6293 6293
             } else {
6294
-                $remind_list = explode(',',$exercise_info['questions_to_check']);
6294
+                $remind_list = explode(',', $exercise_info['questions_to_check']);
6295 6295
 
6296 6296
                 $remind_list_string = '';
6297 6297
                 if ($action == 'add') {
@@ -6303,7 +6303,7 @@  discard block
 block discarded – undo
6303 6303
                         }
6304 6304
                         $remind_list_string = implode(',', $remind_list);
6305 6305
                     }
6306
-                } elseif ($action == 'delete')  {
6306
+                } elseif ($action == 'delete') {
6307 6307
                     if (!empty($remind_list)) {
6308 6308
                         if (in_array($question_id, $remind_list)) {
6309 6309
                             $remind_list = array_flip($remind_list);
@@ -6532,7 +6532,7 @@  discard block
 block discarded – undo
6532 6532
                     true
6533 6533
                 );
6534 6534
 
6535
-                $counter += count($mediaQuestions[$questionId]) - 1 ;
6535
+                $counter += count($mediaQuestions[$questionId]) - 1;
6536 6536
                 $before = count($questionList);
6537 6537
                 $wasMedia = true;
6538 6538
                 $nextValue += count($questionList);
@@ -6611,7 +6611,7 @@  discard block
 block discarded – undo
6611 6611
                         // If it was already seen, then merge the previous with
6612 6612
                         // the current category
6613 6613
                         $oldQuestionList = $newCategoryList[$rootElement]['question_list'];
6614
-                        $category['question_list'] = array_merge($oldQuestionList , $category['question_list']);
6614
+                        $category['question_list'] = array_merge($oldQuestionList, $category['question_list']);
6615 6615
                         $newCategoryList[$rootElement] = $category;
6616 6616
                     }
6617 6617
                 }
@@ -6637,7 +6637,7 @@  discard block
 block discarded – undo
6637 6637
 
6638 6638
                 if ($useRootAsCategoryTitle) {
6639 6639
                     if (isset($category['parent_info'])) {
6640
-                        $categoryName  = $category['parent_info']['title'];
6640
+                        $categoryName = $category['parent_info']['title'];
6641 6641
                     }
6642 6642
                 }
6643 6643
                 $html .= '<div class="row">';
@@ -6780,7 +6780,7 @@  discard block
 block discarded – undo
6780 6780
         // end foreach()
6781 6781
 
6782 6782
         if ($this->type == ALL_ON_ONE_PAGE) {
6783
-            $exercise_actions =  $this->show_button($questionId, $currentQuestion);
6783
+            $exercise_actions = $this->show_button($questionId, $currentQuestion);
6784 6784
             echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
6785 6785
         }
6786 6786
     }
@@ -6866,7 +6866,7 @@  discard block
 block discarded – undo
6866 6866
 
6867 6867
             // Showing the question
6868 6868
 
6869
-            $exercise_actions  = null;
6869
+            $exercise_actions = null;
6870 6870
 
6871 6871
             echo '<a id="questionanchor'.$questionId.'"></a><br />';
6872 6872
             echo '<div id="question_div_'.$questionId.'" class="main_question '.$remind_highlight.'" >';
@@ -7142,7 +7142,7 @@  discard block
 block discarded – undo
7142 7142
                         $header .= Display::tag('th', get_lang('Feedback'));
7143 7143
                     }
7144 7144
                     $s .= '<table class="data_table">';
7145
-                    $s.= Display::tag('tr', $header, array('style' => 'text-align:left;'));
7145
+                    $s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
7146 7146
                 }
7147 7147
             }
7148 7148
 
@@ -7242,7 +7242,7 @@  discard block
 block discarded – undo
7242 7242
                             $s .= '<td>';
7243 7243
                             $s .= $comment;
7244 7244
                             $s .= '</td>';
7245
-                            $s .='</tr>';
7245
+                            $s .= '</tr>';
7246 7246
                         } else {
7247 7247
                             $s .= $answer_input;
7248 7248
                         }
@@ -7256,7 +7256,7 @@  discard block
 block discarded – undo
7256 7256
                             }
7257 7257
                         }
7258 7258
 
7259
-                        $s .='<tr>';
7259
+                        $s .= '<tr>';
7260 7260
                         $s .= Display::tag('td', $answer);
7261 7261
 
7262 7262
                         if (!empty($quiz_question_options)) {
@@ -7283,7 +7283,7 @@  discard block
 block discarded – undo
7283 7283
                             $s .= $comment;
7284 7284
                             $s .= '</td>';
7285 7285
                         }
7286
-                        $s.='</tr>';
7286
+                        $s .= '</tr>';
7287 7287
                     }
7288 7288
 
7289 7289
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
@@ -7312,16 +7312,16 @@  discard block
 block discarded – undo
7312 7312
                     $answer_input .= '</label>';
7313 7313
 
7314 7314
                     if ($show_comment) {
7315
-                        $s.= '<tr>';
7315
+                        $s .= '<tr>';
7316 7316
                         $s .= '<td>';
7317
-                        $s.= $answer_input;
7317
+                        $s .= $answer_input;
7318 7318
                         $s .= '</td>';
7319 7319
                         $s .= '<td>';
7320 7320
                         $s .= $comment;
7321 7321
                         $s .= '</td>';
7322
-                        $s.= '</tr>';
7322
+                        $s .= '</tr>';
7323 7323
                     } else {
7324
-                        $s.= $answer_input;
7324
+                        $s .= $answer_input;
7325 7325
                     }
7326 7326
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
7327 7327
                     $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
@@ -7334,7 +7334,7 @@  discard block
 block discarded – undo
7334 7334
                         }
7335 7335
                     }
7336 7336
                     $answer = Security::remove_XSS($answer);
7337
-                    $s .='<tr>';
7337
+                    $s .= '<tr>';
7338 7338
                     $s .= Display::tag('td', $answer);
7339 7339
 
7340 7340
                     foreach ($objQuestionTmp->options as $key => $item) {
@@ -7358,7 +7358,7 @@  discard block
 block discarded – undo
7358 7358
                         $s .= $comment;
7359 7359
                         $s .= '</td>';
7360 7360
                     }
7361
-                    $s.='</tr>';
7361
+                    $s .= '</tr>';
7362 7362
                 } elseif ($answerType == FILL_IN_BLANKS) {
7363 7363
                     list($answer) = explode('::', $answer);
7364 7364
 
@@ -7392,7 +7392,7 @@  discard block
 block discarded – undo
7392 7392
                                     $value = str_replace('&nbsp;', '', trim($value[0]));
7393 7393
                                 }
7394 7394
                                 $correct_item = preg_quote($correct_item);
7395
-                                $correct_item = api_preg_replace('|/|', '\/', $correct_item);   // to prevent error if there is a / in the text to find
7395
+                                $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find
7396 7396
                                 $answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer, 1);
7397 7397
                             }
7398 7398
                             $i++;
@@ -7449,7 +7449,7 @@  discard block
 block discarded – undo
7449 7449
                         }
7450 7450
 
7451 7451
                         if (!empty($answerCorrect) && !empty($selectedValue)) {
7452
-                            $s.= '<script>
7452
+                            $s .= '<script>
7453 7453
                                 jsPlumb.ready(function() {
7454 7454
                                     jsPlumb.connect({
7455 7455
                                         source: "window_'.$windowId.'",
@@ -7464,14 +7464,14 @@  discard block
 block discarded – undo
7464 7464
                         }
7465 7465
                         $s .= '</select></div></td>';
7466 7466
 
7467
-                        $s.='<td width="45%" valign="top" >';
7467
+                        $s .= '<td width="45%" valign="top" >';
7468 7468
 
7469 7469
                         if (isset($select_items[$lines_count])) {
7470
-                            $s.= '<div id="window_'.$windowId.'_answer" class="window window_right_question">
7470
+                            $s .= '<div id="window_'.$windowId.'_answer" class="window window_right_question">
7471 7471
                                     <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].'
7472 7472
                                   </div>';
7473 7473
                         } else {
7474
-                            $s.='&nbsp;';
7474
+                            $s .= '&nbsp;';
7475 7475
                         }
7476 7476
 
7477 7477
                         $s .= '</td>';
@@ -7485,16 +7485,16 @@  discard block
 block discarded – undo
7485 7485
                                 $s .= '<tr>
7486 7486
                                       <td colspan="2"></td>
7487 7487
                                       <td valign="top">';
7488
-                                $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>';
7488
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>';
7489 7489
                                 $s .= $select_items[$lines_count]['answer'];
7490
-                                $s.="</td>
7490
+                                $s .= "</td>
7491 7491
                                 </tr>";
7492 7492
                                 $lines_count++;
7493 7493
                             } // end while()
7494 7494
                         }  // end if()
7495 7495
                         $matching_correct_answer++;
7496 7496
                     }
7497
-                } elseif ($answerType ==  DRAGGABLE) {
7497
+                } elseif ($answerType == DRAGGABLE) {
7498 7498
                     // matching type, showing suggestions and answers
7499 7499
                     // TODO: replace $answerId by $numAnswer
7500 7500
 
@@ -7536,7 +7536,7 @@  discard block
 block discarded – undo
7536 7536
                         $s .= '</select>';
7537 7537
 
7538 7538
                         if (!empty($answerCorrect) && !empty($selectedValue)) {
7539
-                            $s.= '<script>
7539
+                            $s .= '<script>
7540 7540
                                 $(function() {
7541 7541
                                     deleteItem($("#'.$questionId.'_'.$selectedValue.'"), $("#drop_'.$windowId.'"));
7542 7542
                                 });
@@ -7544,11 +7544,11 @@  discard block
 block discarded – undo
7544 7544
                         }
7545 7545
 
7546 7546
                         if (isset($select_items[$lines_count])) {
7547
-                            $s.= '<div id="window_'.$windowId.'_answer" class="">
7547
+                            $s .= '<div id="window_'.$windowId.'_answer" class="">
7548 7548
                                     <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].'
7549 7549
                                   </div>';
7550 7550
                         } else {
7551
-                            $s.='&nbsp;';
7551
+                            $s .= '&nbsp;';
7552 7552
                         }
7553 7553
                         $lines_count++;
7554 7554
                         //if the left side of the "matching" has been completely
@@ -7557,7 +7557,7 @@  discard block
 block discarded – undo
7557 7557
                         if (($lines_count - 1) == $num_suggestions) {
7558 7558
                             // if it remains answers to shown at the right side
7559 7559
                             while (isset($select_items[$lines_count])) {
7560
-                                $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>';
7560
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>';
7561 7561
                                 $s .= $select_items[$lines_count]['answer'];
7562 7562
                                 $lines_count++;
7563 7563
                             }
@@ -7660,9 +7660,9 @@  discard block
 block discarded – undo
7660 7660
 
7661 7661
             if (!$only_questions) {
7662 7662
                 if ($show_title) {
7663
-                    $html .=  TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id);
7664
-                    $html .=  '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
7665
-                    $html .=  $questionDescription;
7663
+                    $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id);
7664
+                    $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
7665
+                    $html .= $questionDescription;
7666 7666
                 } else {
7667 7667
                     $html .= '<div class="media">';
7668 7668
                     $html .= '<div class="pull-left">';
@@ -7678,11 +7678,11 @@  discard block
 block discarded – undo
7678 7678
                     $html .= '</div>';
7679 7679
                 }
7680 7680
                 //@todo I need to the get the feedback type
7681
-                $html .=  '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />';
7682
-                $html .=  '<table class="exercise_questions">
7681
+                $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />';
7682
+                $html .= '<table class="exercise_questions">
7683 7683
                            <tr>
7684 7684
                             <td valign="top" colspan="2">';
7685
-                $html .=  '</td></tr>';
7685
+                $html .= '</td></tr>';
7686 7686
             }
7687 7687
 
7688 7688
             $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1');
Please login to merge, or discard this patch.