Completed
Push — 1.11.x ( 78f130...f6f5c2 )
by José
50:40 queued 24:26
created
main/lp/lp_edit_item.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 if (!empty($gradebook) && $gradebook == 'view') {
102
-    $interbreadcrumb[] = array (
102
+    $interbreadcrumb[] = array(
103 103
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
104 104
         'name' => get_lang('ToolGradebook')
105 105
     );
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 $show_learn_path = true;
113 113
 $lp_theme_css = $_SESSION['oLP']->get_theme();
114 114
 
115
-Display::display_header(get_lang('Edit'),'Path');
115
+Display::display_header(get_lang('Edit'), 'Path');
116 116
 $suredel = trim(get_lang('AreYouSureToDeleteJS'));
117 117
 
118 118
 ?>
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 $path_item = isset($_GET['path_item']) ? $_GET['path_item'] : 0;
166 166
 $path_item = Database::escape_string($path_item);
167 167
 $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
168
-$sql_doc = "SELECT path FROM " . $tbl_doc . "
169
-            WHERE c_id = $course_id AND id = '". $path_item."' ";
168
+$sql_doc = "SELECT path FROM ".$tbl_doc."
169
+            WHERE c_id = $course_id AND id = '".$path_item."' ";
170 170
 
171 171
 $res_doc = Database::query($sql_doc);
172 172
 $path_file = Database::result($res_doc, 0, 0);
Please login to merge, or discard this patch.
main/lp/lp_impress.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     api_get_group_id()
37 37
 );
38 38
 if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
39
-     api_not_allowed();
39
+        api_not_allowed();
40 40
 }
41 41
 
42 42
 if (empty($_SESSION['oLP'])) {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     null,
36 36
     api_get_group_id()
37 37
 );
38
-if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
38
+if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0) {
39 39
      api_not_allowed();
40 40
 }
41 41
 
@@ -73,22 +73,22 @@  discard block
 block discarded – undo
73 73
 $html = '';
74 74
 $step = 1;
75 75
 foreach ($list as $toc) {
76
-    $x = 1000*$step;
76
+    $x = 1000 * $step;
77 77
     $html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500"  >';
78 78
     $html .= '<div class="impress-content">';
79 79
     $src = $_SESSION['oLP']->get_link('http', $toc['id']);
80 80
     if ($toc['type'] !== 'dokeos_chapter') {
81 81
         //just showing the src in a iframe ...
82 82
         $html .= '<h2>'.$toc['title'].'</h2>';
83
-        $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
84
-    }else{
83
+        $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="'.$src.'"></iframe>';
84
+    } else {
85 85
         $html .= "<div class='impress-title'>";
86 86
         $html .= '<h1>'.$toc['title'].'</h1>';
87 87
         $html .= "</div>";
88 88
     }
89 89
     $html .= "</div>";
90 90
     $html .= "</div>";
91
-    $step ++;
91
+    $step++;
92 92
 }
93 93
 
94 94
 //Setting the template
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
         //just showing the src in a iframe ...
82 82
         $html .= '<h2>'.$toc['title'].'</h2>';
83 83
         $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
84
-    }else{
84
+    } else{
85 85
         $html .= "<div class='impress-title'>";
86 86
         $html .= '<h1>'.$toc['title'].'</h1>';
87 87
         $html .= "</div>";
Please login to merge, or discard this patch.
main/lp/lp_ajax_save_objectives.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
         error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0);
29 29
     }
30 30
     $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id);
31
-    $mylpi =& $mylp->items[$item_id];
32
-    if (is_array($objectives) && count($objectives)>0){
33
-        foreach ($objectives as $index=>$objective){
34
-            $mylpi->add_objective($index,$objectives[$index]);
31
+    $mylpi = & $mylp->items[$item_id];
32
+    if (is_array($objectives) && count($objectives) > 0) {
33
+        foreach ($objectives as $index=>$objective) {
34
+            $mylpi->add_objective($index, $objectives[$index]);
35 35
         }
36 36
         $mylpi->write_objectives_to_db();
37 37
     }
Please login to merge, or discard this patch.
main/lp/lp_add_audio.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
18 18
 
19
-$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null;
20
-$learnpath_id = (int)$_REQUEST['lp_id'];
19
+$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
20
+$learnpath_id = (int) $_REQUEST['lp_id'];
21 21
 $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
22 22
 
23 23
 $type = isset($_GET['type']) ? $_GET['type'] : null;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 }
42 42
 
43 43
 if (!empty($gradebook) && $gradebook == 'view') {
44
-    $interbreadcrumb[] = array (
44
+    $interbreadcrumb[] = array(
45 45
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
46 46
         'name' => get_lang('ToolGradebook')
47 47
     );
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
         );
66 66
         break;
67 67
     default:
68
-        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep'));
68
+        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewStep'));
69 69
         break;
70 70
 }
71 71
 
72 72
 if ($action == 'add_item' && $type == 'document') {
73
-    $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewDocumentCreated'));
73
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewDocumentCreated'));
74 74
 }
75 75
 
76 76
 // Theme calls.
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 $form = new FormValidator(
87 87
     'add_audio',
88 88
     'post',
89
-    api_get_self() . '?action=add_audio&id=' . $lp_item_id . '&' . api_get_cidreq().'&lp_id='.$learnpath_id,
89
+    api_get_self().'?action=add_audio&id='.$lp_item_id.'&'.api_get_cidreq().'&lp_id='.$learnpath_id,
90 90
     null,
91 91
     array('enctype' => 'multipart/form-data')
92 92
 );
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
     $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document/audio/'.$lp_item->audio.'?'.api_get_cidreq();
101 101
 
102 102
     if (!file_exists($file)) {
103
-        $file = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'] . '/' . $lp_item->audio;
104
-        $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'] . '/' . $lp_item->audio.'?'.api_get_cidreq();
103
+        $file = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'].'/'.$lp_item->audio;
104
+        $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'].'/'.$lp_item->audio.'?'.api_get_cidreq();
105 105
     }
106 106
 }
107 107
 
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 
118 118
 $page .= '<div id="doc_form" class="col-md-8">';
119 119
 
120
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'rtc/RecordRTC.js"></script>';
121
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/recorder.js"></script>';
122
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/gui.js"></script>';
123
-$htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>';
120
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
121
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
122
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
123
+$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'swfobject/swfobject.js"></script>';
124 124
 
125 125
 $tpl = new Template(null);
126 126
 $tpl->assign('unique_file_id', api_get_unique_id());
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         Display::getMediaPlayer($file, array('url' => $urlFile)).
142 142
         "</div>";
143 143
     $form->addElement('label', get_lang('Listen'), $audioPlayer);
144
-    $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq();
144
+    $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq();
145 145
     $form->addElement('label', null, Display::url(get_lang('RemoveAudio'), $url, array('class' => 'btn btn-danger')));
146 146
 } else {
147 147
     $form->addElement('file', 'file');
Please login to merge, or discard this patch.
main/lp/openoffice_document.class.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         // Create the directory
50 50
         $result = $this->generate_lp_folder($_course, $this->file_name);
51 51
 
52
-         // Create the directory
52
+            // Create the directory
53 53
         $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
54 54
         ///learning_path/ppt_dirname directory
55 55
         $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) -1);
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,9 +186,9 @@
 block discarded – undo
186 186
 
187 187
     /**
188 188
      * Get images files from remote host (with webservices)
189
-     * @param   array $file current ppt file details
189
+     * @param   string $file current ppt file details
190 190
      * @param   string  $size The expected final size of the rendered slides
191
-     * @return  array images files
191
+     * @return  string images files
192 192
      */
193 193
     private function _get_remote_ppt2lp_files($file, $size = null)
194 194
     {
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         ///learning_path/ppt_dirname directory
59 59
         $this->created_dir = $result['dir'];
60 60
         if (substr($this->created_dir, -1, 1) == '/') {
61
-            $this->file_path = $this->created_dir . api_replace_dangerous_char($file['name']);
61
+            $this->file_path = $this->created_dir.api_replace_dangerous_char($file['name']);
62 62
         } else {
63
-            $this->file_path = $this->created_dir . '/' . api_replace_dangerous_char($file['name']);
63
+            $this->file_path = $this->created_dir.'/'.api_replace_dangerous_char($file['name']);
64 64
         }
65 65
 
66 66
         //var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir);
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
             $perm = api_get_setting('permissions_for_new_files');
105 105
 
106 106
             if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
107
-                $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
108
-                $class_path = $converter_path . ';' . $converter_path . '/jodconverter-2.2.2.jar;' . $converter_path . '/jodconverter-cli-2.2.2.jar';
107
+                $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
108
+                $class_path = $converter_path.';'.$converter_path.'/jodconverter-2.2.2.jar;'.$converter_path.'/jodconverter-cli-2.2.2.jar';
109 109
                 //$cmd = 'java -cp "'.$class_path.'" DokeosConverter';
110
-                $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $class_path . '" DokeosConverter';
110
+                $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$class_path.'" DokeosConverter';
111 111
             } else {
112
-                $converter_path = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
112
+                $converter_path = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
113 113
                 //$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar';
114 114
                 $class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
115
-                $cmd = 'cd ' . $converter_path . ' && java ' . $class_path . ' DokeosConverter';
115
+                $cmd = 'cd '.$converter_path.' && java '.$class_path.' DokeosConverter';
116 116
             }
117 117
 
118
-            $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
118
+            $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
119 119
             // Call to the function implemented by child.
120 120
             $cmd .= $this->add_command_parameters();
121 121
             // To allow openoffice to manipulate docs.
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             @chmod($this->base_work_dir.$this->file_path, 0777);
125 125
 
126 126
             $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere.
127
-            putenv('LC_ALL=' . $locale);
127
+            putenv('LC_ALL='.$locale);
128 128
 
129 129
             $files = array();
130 130
             $return = 0;
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
             $result = $this->_get_remote_ppt2lp_files($file, $size);
151 151
             $result = unserialize($result);
152 152
             // Save remote images to server
153
-            chmod($this->base_work_dir . $this->created_dir, api_get_permissions_for_new_directories());
153
+            chmod($this->base_work_dir.$this->created_dir, api_get_permissions_for_new_directories());
154 154
             if (!empty($result['images'])) {
155 155
                 foreach ($result['images'] as $image => $img_data) {
156 156
                     $image_path = $this->base_work_dir.$this->created_dir;
157
-                    @file_put_contents($image_path . '/' . $image, base64_decode($img_data));
158
-                    @chmod($image_path . '/' . $image, 0777);
157
+                    @file_put_contents($image_path.'/'.$image, base64_decode($img_data));
158
+                    @chmod($image_path.'/'.$image, 0777);
159 159
                 }
160 160
             }
161 161
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         $uri = '';
200 200
         $result = preg_match('/^([a-zA-Z0-9]*):\/\/([^\/]*)\//', $ppt2lp_host, $matches);
201 201
         if ($result) {
202
-            $uri = $matches[1] . '://' . $matches[2] . '/';
202
+            $uri = $matches[1].'://'.$matches[2].'/';
203 203
         } else {
204 204
             $uri = $ppt2lp_host;
205 205
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9,
219 219
         );
220 220
         if (substr($ppt2lp_host, 0, 5) === 'https') {
221
-            $options['ssl_method'] =  SOAP_SSL_METHOD_TLS;
221
+            $options['ssl_method'] = SOAP_SSL_METHOD_TLS;
222 222
         }
223 223
         $client = new SoapClient(null, $options);
224 224
         $result = '';
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             //error_log('['.time().'] Calling wsConvertPpt webservice on ' . $ppt2lp_host);
240 240
             $result = $client->__call('wsConvertPpt', array('pptData' => $params));
241 241
         } catch (Exception $e) {
242
-            error_log('['.time().'] Chamilo SOAP call error: ' . $e->getMessage());
242
+            error_log('['.time().'] Chamilo SOAP call error: '.$e->getMessage());
243 243
         }
244 244
         // Make sure we destroy the SOAP client as it may generate SSL connection
245 245
         // binding issue (if using SSL)
@@ -272,38 +272,38 @@  discard block
 block discarded – undo
272 272
         $ppt2lpHost = api_get_setting('service_ppt2lp', 'host');
273 273
         $permissionFile = api_get_permissions_for_new_files();
274 274
         $permissionFolder = api_get_permissions_for_new_directories();
275
-        if (file_exists($this->base_work_dir . '/' . $this->created_dir)) {
275
+        if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
276 276
 
277 277
             return $ids;
278 278
         }
279 279
 
280 280
         if ($ppt2lpHost == 'localhost') {
281 281
             if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
282
-                $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
283
-                $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
284
-                $cmd = 'java -Dfile.encoding=UTF-8 -jar "' . $classPath . '/jodconverter-2.2.2.jar"';
282
+                $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
283
+                $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar';
284
+                $cmd = 'java -Dfile.encoding=UTF-8 -jar "'.$classPath.'/jodconverter-2.2.2.jar"';
285 285
             } else {
286
-                $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
286
+                $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
287 287
                 $classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar';
288
-                $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' ';
288
+                $cmd = 'cd '.$converterPath.' && java '.$classPath.' ';
289 289
             }
290 290
 
291
-            $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
291
+            $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
292 292
             // Call to the function implemented by child.
293
-            $cmd .= ' "' . $this->base_work_dir . '/' . $this->file_path . '"  "' . $this->base_work_dir . '/' . $this->created_dir . '"';
293
+            $cmd .= ' "'.$this->base_work_dir.'/'.$this->file_path.'"  "'.$this->base_work_dir.'/'.$this->created_dir.'"';
294 294
             // To allow openoffice to manipulate docs.
295 295
             @chmod($this->base_work_dir, $permissionFolder);
296
-            @chmod($this->base_work_dir . '/' . $this->file_path, $permissionFile);
296
+            @chmod($this->base_work_dir.'/'.$this->file_path, $permissionFile);
297 297
 
298 298
             $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere.
299
-            putenv('LC_ALL=' . $locale);
299
+            putenv('LC_ALL='.$locale);
300 300
 
301 301
             $files = array();
302 302
             $return = 0;
303 303
             $shell = exec($cmd, $files, $return);
304 304
             // TODO: Chown is not working, root keep user privileges, should be www-data
305
-            @chown($this->base_work_dir . '/' . $this->created_dir, 'www-data');
306
-            @chmod($this->base_work_dir . '/' . $this->created_dir, $permissionFile);
305
+            @chown($this->base_work_dir.'/'.$this->created_dir, 'www-data');
306
+            @chmod($this->base_work_dir.'/'.$this->created_dir, $permissionFile);
307 307
 
308 308
             if ($return != 0) { // If the java application returns an error code.
309 309
                 switch ($return) {
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
             */
343 343
         }
344 344
 
345
-        if (file_exists($this->base_work_dir . '/' . $this->created_dir)) {
345
+        if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
346 346
 
347 347
             // Register Files to Document tool
348 348
             $ids[] = add_document(
349 349
                 $_course,
350
-                '/' . $this->created_dir,
350
+                '/'.$this->created_dir,
351 351
                 'file',
352
-                filesize($this->base_work_dir . '/' . $this->created_dir),
352
+                filesize($this->base_work_dir.'/'.$this->created_dir),
353 353
                 $convertedTitle,
354 354
                 sprintf(
355 355
                     get_lang('FileConvertedFromXToY'),
Please login to merge, or discard this patch.
main/lp/lp_ajax_switch_item_toc.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -124,22 +124,22 @@
 block discarded – undo
124 124
     $coreExit = $myLPI->get_core_exit();
125 125
 
126 126
     $return .=
127
-        "olms.lms_lp_id=".$lpId.";" .
128
-        "olms.lms_item_id=".$newItemId.";" .
129
-        "olms.lms_old_item_id=".$oldItemId.";" .
130
-        "olms.lms_initialized=0;" .
131
-        "olms.lms_view_id=".$viewId.";" .
132
-        "olms.lms_user_id=".$userId.";" .
133
-        "olms.next_item=".$newItemId.";" . // This one is very important to replace possible literal strings.
134
-        "olms.lms_next_item=".$nextItemId.";" .
135
-        "olms.lms_previous_item=".$previousItemId.";" .
136
-        "olms.lms_item_type = '".$itemType."';" .
137
-        "olms.lms_item_credit = '".$credit."';" .
138
-        "olms.lms_item_lesson_mode = '".$lessonMode."';" .
139
-        "olms.lms_item_launch_data = '".$launchData."';" .
140
-        "olms.lms_item_interactions_count = '".$interactionsCount."';" .
141
-        "olms.lms_item_objectives_count = '".$objectivesCount."';" .
142
-        "olms.lms_item_core_exit = '".$coreExit."';" .
127
+        "olms.lms_lp_id=".$lpId.";".
128
+        "olms.lms_item_id=".$newItemId.";".
129
+        "olms.lms_old_item_id=".$oldItemId.";".
130
+        "olms.lms_initialized=0;".
131
+        "olms.lms_view_id=".$viewId.";".
132
+        "olms.lms_user_id=".$userId.";".
133
+        "olms.next_item=".$newItemId.";".// This one is very important to replace possible literal strings.
134
+        "olms.lms_next_item=".$nextItemId.";".
135
+        "olms.lms_previous_item=".$previousItemId.";".
136
+        "olms.lms_item_type = '".$itemType."';".
137
+        "olms.lms_item_credit = '".$credit."';".
138
+        "olms.lms_item_lesson_mode = '".$lessonMode."';".
139
+        "olms.lms_item_launch_data = '".$launchData."';".
140
+        "olms.lms_item_interactions_count = '".$interactionsCount."';".
141
+        "olms.lms_item_objectives_count = '".$objectivesCount."';".
142
+        "olms.lms_item_core_exit = '".$coreExit."';".
143 143
         "olms.asset_timer = 0;";
144 144
 
145 145
     $return .= "update_toc('unhighlight','".$currentItem."');".
Please login to merge, or discard this patch.
main/gradebook/exercise_jump.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 $doExerciseUrl = '';
23 23
 
24 24
 if (isset($_GET['doexercise'])) {
25
-    $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . http_build_query([
25
+    $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.http_build_query([
26 26
         'session_id' => $session_id,
27 27
         'cidReq' => $cidReq,
28 28
         'gradebook' => $gradebook,
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 
36 36
 // no support for hot potatoes
37 37
 if ($type == LINK_HOTPOTATOES) {
38
-    $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
38
+    $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercise/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
39 39
 }
40 40
 
41 41
 if (isset($_GET['doexercise'])) {
42 42
     header('Location: '.$doExerciseUrl);
43 43
     exit;
44 44
 } else {
45
-    $url = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
45
+    $url = api_get_path(WEB_CODE_PATH).'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
46 46
     if (isset($_GET['gradebook'])) {
47 47
         $url .= '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
48 48
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
                         // If the exercise was added once redirect to the LP
59 59
                         $firstLp = current($exercise->lpList);
60 60
                         if (isset($firstLp['lp_id'])) {
61
-                            $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&lp_id=' . $firstLp['lp_id'] . '&action=view&isStudentView=true';
61
+                            $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&lp_id='.$firstLp['lp_id'].'&action=view&isStudentView=true';
62 62
                         }
63 63
                     } else {
64 64
                         // If the exercise was added multiple times show the LP list
65
-                        $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq().'&action=list';
65
+                        $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=list';
66 66
                     }
67 67
                 }
68 68
             }
Please login to merge, or discard this patch.
main/exercise/exercise_submit_modal.php 2 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 $learnpath_id = 0;
44 44
 
45 45
 if (isset($_REQUEST['learnpath_id'])) {
46
-	$learnpath_id = intval($_REQUEST['learnpath_id']);
46
+    $learnpath_id = intval($_REQUEST['learnpath_id']);
47 47
 }
48 48
 
49 49
 $learnpath_item_id = 0;
50 50
 
51 51
 if (isset($_REQUEST['learnpath_item_id'])) {
52
-	$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
52
+    $learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
53 53
 }
54 54
 
55 55
 $_SESSION['hotspot_coord']=array();
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 // Getting the options by js
94 94
 if (empty($choice_value)) {
95 95
 
96
-	echo "<script>
96
+    echo "<script>
97 97
 		// this works for only radio buttons
98 98
 		var f = self.parent.window.document.frm_exercise;
99 99
 		var choice_js='';
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 		}
123 123
 
124 124
 	";
125
-	// IMPORTANT
126
-	//this is the real redirect function
127
-	//echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
125
+    // IMPORTANT
126
+    //this is the real redirect function
127
+    //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
128 128
     echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";';
129 129
     echo "$('#global-modal .modal-body').load(url);";
130
-	echo '</script>';
130
+    echo '</script>';
131 131
 
132 132
     exit;
133 133
 }
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 
181 181
 // creates a temporary Question object
182 182
 if (in_array($questionid, $questionList)) {
183
-	$objQuestionTmp 	= Question :: read($questionid);
184
-	$questionName		=$objQuestionTmp->selectTitle();
185
-	$questionDescription=$objQuestionTmp->selectDescription();
186
-	$questionWeighting	=$objQuestionTmp->selectWeighting();
187
-	$answerType			=$objQuestionTmp->selectType();
188
-	$quesId				=$objQuestionTmp->selectId(); //added by priya saini
183
+    $objQuestionTmp 	= Question :: read($questionid);
184
+    $questionName		=$objQuestionTmp->selectTitle();
185
+    $questionDescription=$objQuestionTmp->selectDescription();
186
+    $questionWeighting	=$objQuestionTmp->selectWeighting();
187
+    $answerType			=$objQuestionTmp->selectType();
188
+    $quesId				=$objQuestionTmp->selectId(); //added by priya saini
189 189
 }
190 190
 
191 191
 $objAnswerTmp=new Answer($questionid);
@@ -208,43 +208,43 @@  discard block
 block discarded – undo
208 208
 $totalScore = 0;
209 209
 
210 210
 if (!empty($choice_value)) {
211
-	for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
212
-		$answer            = $objAnswerTmp->selectAnswer($answerId);
213
-		$answerComment     = $objAnswerTmp->selectComment($answerId);
214
-		$answerDestination = $objAnswerTmp->selectDestination($answerId);
215
-
216
-		$answerCorrect     = $objAnswerTmp->isCorrect($answerId);
217
-		$answerWeighting   = $objAnswerTmp->selectWeighting($answerId);
218
-		$numAnswer         = $objAnswerTmp->selectAutoId($answerId);
219
-
220
-		//delineation
221
-		$delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
222
-		$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
211
+    for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
212
+        $answer            = $objAnswerTmp->selectAnswer($answerId);
213
+        $answerComment     = $objAnswerTmp->selectComment($answerId);
214
+        $answerDestination = $objAnswerTmp->selectDestination($answerId);
215
+
216
+        $answerCorrect     = $objAnswerTmp->isCorrect($answerId);
217
+        $answerWeighting   = $objAnswerTmp->selectWeighting($answerId);
218
+        $numAnswer         = $objAnswerTmp->selectAutoId($answerId);
219
+
220
+        //delineation
221
+        $delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
222
+        $answer_delineation_destination=$objAnswerTmp->selectDestination(1);
223 223
         if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
224 224
 
225
-		switch($answerType) {
226
-			// for unique answer
227
-			case UNIQUE_ANSWER :
228
-				$studentChoice = ($choice_value == $numAnswer)?1:0;
229
-				if ($studentChoice) {
230
-					$questionScore	+=$answerWeighting;
231
-					$totalScore		+=$answerWeighting;
232
-					$newquestionList[]=$questionid;
233
-				}
234
-				break;
235
-			case HOT_SPOT_DELINEATION :
236
-			    $studentChoice=$choice[$answerId];
237
-				if ($studentChoice) {
238
-					$newquestionList[]=$questionid;
239
-				}
240
-				if ($answerId===1) {
241
-					$questionScore	+=$answerWeighting;
242
-					$totalScore		+=$answerWeighting;
243
-					$_SESSION['hotspot_coord'][1]	=$delineation_cord;
244
-					$_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
245
-				}
246
-				break;
247
-		}
225
+        switch($answerType) {
226
+            // for unique answer
227
+            case UNIQUE_ANSWER :
228
+                $studentChoice = ($choice_value == $numAnswer)?1:0;
229
+                if ($studentChoice) {
230
+                    $questionScore	+=$answerWeighting;
231
+                    $totalScore		+=$answerWeighting;
232
+                    $newquestionList[]=$questionid;
233
+                }
234
+                break;
235
+            case HOT_SPOT_DELINEATION :
236
+                $studentChoice=$choice[$answerId];
237
+                if ($studentChoice) {
238
+                    $newquestionList[]=$questionid;
239
+                }
240
+                if ($answerId===1) {
241
+                    $questionScore	+=$answerWeighting;
242
+                    $totalScore		+=$answerWeighting;
243
+                    $_SESSION['hotspot_coord'][1]	=$delineation_cord;
244
+                    $_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
245
+                }
246
+                break;
247
+        }
248 248
 
249 249
 
250 250
         if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
                         $lp_hotspot=$destination_items[2];
342 342
                         $select_question_hotspot=$destination_items[3];
343 343
                         $url_hotspot=$destination_items[4];
344
-                         //echo 'show the feedback';
344
+                            //echo 'show the feedback';
345 345
                     }
346 346
                 } elseif($answerId>1) {
347 347
                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
@@ -398,41 +398,41 @@  discard block
 block discarded – undo
398 398
                 //we send the error
399 399
             }
400 400
         }
401
-	}
401
+    }
402 402
 
403
-	if ($overlap_color) {
404
-		$overlap_color='green';
403
+    if ($overlap_color) {
404
+        $overlap_color='green';
405 405
     } else {
406
-		$overlap_color='red';
406
+        $overlap_color='red';
407 407
     }
408
-	if ($missing_color) {
409
-		$missing_color='green';
408
+    if ($missing_color) {
409
+        $missing_color='green';
410 410
     } else {
411
-		$missing_color='red';
411
+        $missing_color='red';
412 412
     }
413
-	if ($excess_color) {
414
-		$excess_color='green';
413
+    if ($excess_color) {
414
+        $excess_color='green';
415 415
     } else {
416
-		$excess_color='red';
416
+        $excess_color='red';
417 417
     }
418 418
 
419 419
     if (!is_numeric($final_overlap)) {
420
-    	$final_overlap = 0;
420
+        $final_overlap = 0;
421 421
     }
422 422
 
423 423
     if (!is_numeric($final_missing)) {
424
-    	$final_missing = 0;
424
+        $final_missing = 0;
425 425
     }
426 426
     if (!is_numeric($final_excess)) {
427
-    	$final_excess = 0;
427
+        $final_excess = 0;
428 428
     }
429 429
 
430 430
     if ($final_excess>100) {
431
-    	$final_excess = 100;
431
+        $final_excess = 100;
432 432
     }
433 433
 
434 434
 
435
-	$table_resume = '<table class="data_table" >
435
+    $table_resume = '<table class="data_table" >
436 436
 	<tr class="row_odd" >
437 437
 		<td></td>
438 438
 		<td ><b>'.get_lang('Requirements').'</b></td>
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
458 458
 	</tr>
459 459
 	</table>';
460
-	//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
460
+    //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
461 461
 }
462 462
 $_SESSION['newquestionList'] = $newquestionList;
463 463
 
@@ -474,68 +474,68 @@  discard block
 block discarded – undo
474 474
 if ($answerType != HOT_SPOT_DELINEATION) {
475 475
     if (!empty($destination)) {
476 476
         $item_list = explode('@@',$destination);
477
-    	//print_R($item_list);
478
-    	$try = $item_list[0];
479
-    	$lp = $item_list[1];
480
-    	$destinationid= $item_list[2];
481
-    	$url=$item_list[3];
477
+        //print_R($item_list);
478
+        $try = $item_list[0];
479
+        $lp = $item_list[1];
480
+        $destinationid= $item_list[2];
481
+        $url=$item_list[3];
482 482
     }
483
-	$table_resume='';
483
+    $table_resume='';
484 484
 } else {
485
-		$try = $try_hotspot;
486
-		$lp = $lp_hotspot;
487
-		$destinationid= $select_question_hotspot;
488
-		$url=$url_hotspot;
489
-	if ($organs_at_risk_hit==0 && $wrong_results==false ) {
490
-		// no error = no oar and no wrong result for delineation
491
-		//show if no error
492
-		//echo 'no error';
493
-		$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
494
-		$answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
495
-
496
-		//we send the error
497
-		$destination_items= explode('@@', $answerDestination);
498
-		$try=$destination_items[1];
499
-		$lp=$destination_items[2];
500
-		$destinationid=$destination_items[3];
501
-		$url=$destination_items[4];
502
-		$exerciseResult[$questionid] = 1;
503
-	} else {
504
-		$exerciseResult[$questionid] = 0;
505
-	}
485
+        $try = $try_hotspot;
486
+        $lp = $lp_hotspot;
487
+        $destinationid= $select_question_hotspot;
488
+        $url=$url_hotspot;
489
+    if ($organs_at_risk_hit==0 && $wrong_results==false ) {
490
+        // no error = no oar and no wrong result for delineation
491
+        //show if no error
492
+        //echo 'no error';
493
+        $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
494
+        $answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
495
+
496
+        //we send the error
497
+        $destination_items= explode('@@', $answerDestination);
498
+        $try=$destination_items[1];
499
+        $lp=$destination_items[2];
500
+        $destinationid=$destination_items[3];
501
+        $url=$destination_items[4];
502
+        $exerciseResult[$questionid] = 1;
503
+    } else {
504
+        $exerciseResult[$questionid] = 0;
505
+    }
506 506
 }
507 507
 
508 508
 // the link to retry the question
509 509
 if (isset($try) && $try==1) {
510
-	$num_value_array= (array_keys($questionList, $questionid));
511
-	$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
510
+    $num_value_array= (array_keys($questionList, $questionid));
511
+    $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
512 512
 }
513 513
 
514 514
 // the link to theory (a learning path)
515 515
 if (!empty($lp)) {
516
-	$lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
517
-	$list = new LearnpathList(api_get_user_id());
518
-	$flat_list = $list->get_flat_list();
519
-	$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
516
+    $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
517
+    $list = new LearnpathList(api_get_user_id());
518
+    $flat_list = $list->get_flat_list();
519
+    $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
520 520
 }
521 521
 $links.='<br />';
522 522
 
523 523
 // the link to an external website or link
524 524
 if (!empty($url)) {
525
-	$links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
525
+    $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
526 526
 }
527 527
 
528 528
 // the link to finish the test
529 529
 if ($destinationid==-1) {
530
-	$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
530
+    $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
531 531
 } else {
532
-	// the link to other question
533
-	if (in_array($destinationid,$questionList)) {
534
-		$objQuestionTmp = Question :: read($destinationid);
535
-		$questionName=$objQuestionTmp->selectTitle();
536
-		$num_value_array= (array_keys($questionList, $destinationid));
537
-		$links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
538
-	}
532
+    // the link to other question
533
+    if (in_array($destinationid,$questionList)) {
534
+        $objQuestionTmp = Question :: read($destinationid);
535
+        $questionName=$objQuestionTmp->selectTitle();
536
+        $num_value_array= (array_keys($questionList, $destinationid));
537
+        $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
538
+    }
539 539
 }
540 540
 
541 541
 echo '<script>
@@ -552,43 +552,43 @@  discard block
 block discarded – undo
552 552
 </script>';
553 553
 
554 554
 if ($links!='') {
555
-	/*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
555
+    /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
556 556
     <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/
557
-	echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
558
-
559
-	if ($answerType == HOT_SPOT_DELINEATION) {
560
-		if ($organs_at_risk_hit > 0) {
561
-			//$message='<p>'.get_lang('YourDelineation').'</p>';
562
-			//$message.=$table_resume;
563
-			$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
564
-			//if ($wrong_results) { }
565
-			$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
566
-			$message.='<p>'.$comment.'</p>';
567
-		} else {
568
-			$message='<p>'.get_lang('YourDelineation').'</p>';
569
-			$message.=$table_resume;
570
-			$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
571
-			$message.='<p>'.$comment.'</p>';
572
-		}
573
-		echo $message;
574
-	} else {
575
-		echo '<p>'.$comment.'</p>';
576
-	}
577
-	echo '<h3>'.$links.'</h3>';
578
-	echo '</div>';
579
-
580
-	$_SESSION['hot_spot_result']=$message;
581
-	$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
582
-	//reseting the exerciseResult variable
583
-	Session::write('exerciseResult',$exerciseResult);
584
-
585
-	//save this variables just in case the exercise loads an LP with other exercise
586
-	$_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
587
-	$_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
588
-	$_SESSION['questionListExtra'.$exerciseId]	 = $_SESSION['questionList'];
557
+    echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
558
+
559
+    if ($answerType == HOT_SPOT_DELINEATION) {
560
+        if ($organs_at_risk_hit > 0) {
561
+            //$message='<p>'.get_lang('YourDelineation').'</p>';
562
+            //$message.=$table_resume;
563
+            $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
564
+            //if ($wrong_results) { }
565
+            $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
566
+            $message.='<p>'.$comment.'</p>';
567
+        } else {
568
+            $message='<p>'.get_lang('YourDelineation').'</p>';
569
+            $message.=$table_resume;
570
+            $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
571
+            $message.='<p>'.$comment.'</p>';
572
+        }
573
+        echo $message;
574
+    } else {
575
+        echo '<p>'.$comment.'</p>';
576
+    }
577
+    echo '<h3>'.$links.'</h3>';
578
+    echo '</div>';
579
+
580
+    $_SESSION['hot_spot_result']=$message;
581
+    $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
582
+    //reseting the exerciseResult variable
583
+    Session::write('exerciseResult',$exerciseResult);
584
+
585
+    //save this variables just in case the exercise loads an LP with other exercise
586
+    $_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
587
+    $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
588
+    $_SESSION['questionListExtra'.$exerciseId]	 = $_SESSION['questionList'];
589 589
 } else {
590
-	$questionNum++;
591
-	echo '<script>
590
+    $questionNum++;
591
+    echo '<script>
592 592
 			self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'";
593 593
    			//self.parent.tb_remove();
594 594
  	 	</script>';
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	$learnpath_item_id = intval($_REQUEST['learnpath_item_id']);
53 53
 }
54 54
 
55
-$_SESSION['hotspot_coord']=array();
56
-$newquestionList= isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : [];
57
-$questionList 	= $_SESSION['questionList'];
55
+$_SESSION['hotspot_coord'] = array();
56
+$newquestionList = isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : [];
57
+$questionList = $_SESSION['questionList'];
58 58
 
59 59
 $exerciseId		= intval($_GET['exerciseId']);
60 60
 $exerciseType	= intval($_GET['exerciseType']);
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 $choice_value = '';
86 86
 
87
-$user_array = substr($user_array,0,-1);
87
+$user_array = substr($user_array, 0, -1);
88 88
 
89
-if (isset($_GET['choice'])){
89
+if (isset($_GET['choice'])) {
90 90
     $choice_value = intval($_GET['choice']);
91 91
 }
92 92
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 }
134 134
 
135 135
 $choice = array();
136
-$questionid= $questionList[$questionNum];
136
+$questionid = $questionList[$questionNum];
137 137
 // $choice_value => value of the user selection
138 138
 $choice[$questionid] = isset($choice_value) ? $choice_value : null;
139 139
 
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
         $exerciseResult = $choice;
151 151
     } else {
152 152
         // gets the question ID from $choice. It is the key of the array
153
-        list($key)=array_keys($choice);
153
+        list($key) = array_keys($choice);
154 154
         // if the user didn't already answer this question
155
-        if(!isset($exerciseResult[$key])) {
155
+        if (!isset($exerciseResult[$key])) {
156 156
             // stores the user answer into the array
157
-            $exerciseResult[$key]=$choice[$key];
157
+            $exerciseResult[$key] = $choice[$key];
158 158
         }
159 159
     }
160 160
 }
@@ -180,26 +180,26 @@  discard block
 block discarded – undo
180 180
 
181 181
 // creates a temporary Question object
182 182
 if (in_array($questionid, $questionList)) {
183
-	$objQuestionTmp 	= Question :: read($questionid);
184
-	$questionName		=$objQuestionTmp->selectTitle();
185
-	$questionDescription=$objQuestionTmp->selectDescription();
186
-	$questionWeighting	=$objQuestionTmp->selectWeighting();
187
-	$answerType			=$objQuestionTmp->selectType();
188
-	$quesId				=$objQuestionTmp->selectId(); //added by priya saini
183
+	$objQuestionTmp = Question :: read($questionid);
184
+	$questionName = $objQuestionTmp->selectTitle();
185
+	$questionDescription = $objQuestionTmp->selectDescription();
186
+	$questionWeighting = $objQuestionTmp->selectWeighting();
187
+	$answerType = $objQuestionTmp->selectType();
188
+	$quesId = $objQuestionTmp->selectId(); //added by priya saini
189 189
 }
190 190
 
191
-$objAnswerTmp=new Answer($questionid);
192
-$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
191
+$objAnswerTmp = new Answer($questionid);
192
+$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
193 193
 //echo 'answe_type '.$answerType;echo '<br />';
194 194
 
195 195
 $choice = $exerciseResult[$questionid];
196
-$destination=array();
197
-$comment='';
198
-$next=1;
196
+$destination = array();
197
+$comment = '';
198
+$next = 1;
199 199
 $_SESSION['hotspot_coord'] = array();
200 200
 $_SESSION['hotspot_dest'] = array();
201 201
 
202
-$overlap_color = $missing_color = $excess_color=false;
202
+$overlap_color = $missing_color = $excess_color = false;
203 203
 $organs_at_risk_hit = 0;
204 204
 $wrong_results = false;
205 205
 $hot_spot_load = false;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 $totalScore = 0;
209 209
 
210 210
 if (!empty($choice_value)) {
211
-	for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
211
+	for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
212 212
 		$answer            = $objAnswerTmp->selectAnswer($answerId);
213 213
 		$answerComment     = $objAnswerTmp->selectComment($answerId);
214 214
 		$answerDestination = $objAnswerTmp->selectDestination($answerId);
@@ -219,29 +219,29 @@  discard block
 block discarded – undo
219 219
 
220 220
 		//delineation
221 221
 		$delineation_cord  = $objAnswerTmp->selectHotspotCoordinates(1);
222
-		$answer_delineation_destination=$objAnswerTmp->selectDestination(1);
223
-        if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
222
+		$answer_delineation_destination = $objAnswerTmp->selectDestination(1);
223
+        if ($dbg_local > 0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination, 0); }
224 224
 
225
-		switch($answerType) {
225
+		switch ($answerType) {
226 226
 			// for unique answer
227 227
 			case UNIQUE_ANSWER :
228
-				$studentChoice = ($choice_value == $numAnswer)?1:0;
228
+				$studentChoice = ($choice_value == $numAnswer) ? 1 : 0;
229 229
 				if ($studentChoice) {
230
-					$questionScore	+=$answerWeighting;
231
-					$totalScore		+=$answerWeighting;
232
-					$newquestionList[]=$questionid;
230
+					$questionScore += $answerWeighting;
231
+					$totalScore		+= $answerWeighting;
232
+					$newquestionList[] = $questionid;
233 233
 				}
234 234
 				break;
235 235
 			case HOT_SPOT_DELINEATION :
236
-			    $studentChoice=$choice[$answerId];
236
+			    $studentChoice = $choice[$answerId];
237 237
 				if ($studentChoice) {
238
-					$newquestionList[]=$questionid;
238
+					$newquestionList[] = $questionid;
239 239
 				}
240
-				if ($answerId===1) {
241
-					$questionScore	+=$answerWeighting;
242
-					$totalScore		+=$answerWeighting;
243
-					$_SESSION['hotspot_coord'][1]	=$delineation_cord;
244
-					$_SESSION['hotspot_dest'][1]	=$answer_delineation_destination;
240
+				if ($answerId === 1) {
241
+					$questionScore += $answerWeighting;
242
+					$totalScore += $answerWeighting;
243
+					$_SESSION['hotspot_coord'][1] = $delineation_cord;
244
+					$_SESSION['hotspot_dest'][1] = $answer_delineation_destination;
245 245
 				}
246 246
 				break;
247 247
 		}
@@ -253,27 +253,27 @@  discard block
 block discarded – undo
253 253
                 $destination = $answerDestination;
254 254
                 $comment = $answerComment;
255 255
             }
256
-        } elseif($answerType == HOT_SPOT_DELINEATION) {
256
+        } elseif ($answerType == HOT_SPOT_DELINEATION) {
257 257
             if ($next) {
258
-                if ($dbg_local>0) { error_log(__LINE__.' - next',0);}
258
+                if ($dbg_local > 0) { error_log(__LINE__.' - next', 0); }
259 259
                 $hot_spot_load = true; //apparently the script is called twice
260 260
                 $user_answer = $user_array;
261
-                $_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php
261
+                $_SESSION['exerciseResultCoordinates'][$questionid] = $user_answer; //needed for exercise_result.php
262 262
 
263 263
                 // we compare only the delineation not the other points
264
-                $answer_question	= $_SESSION['hotspot_coord'][1];
265
-                $answerDestination	= $_SESSION['hotspot_dest'][1];
264
+                $answer_question = $_SESSION['hotspot_coord'][1];
265
+                $answerDestination = $_SESSION['hotspot_dest'][1];
266 266
 
267
-                $poly_user 				= convert_coordinates($user_answer,'/');
268
-                $poly_answer 			= convert_coordinates($answer_question,'|');
269
-                $max_coord 				= poly_get_max($poly_user,$poly_answer);
267
+                $poly_user 				= convert_coordinates($user_answer, '/');
268
+                $poly_answer = convert_coordinates($answer_question, '|');
269
+                $max_coord 				= poly_get_max($poly_user, $poly_answer);
270 270
 
271 271
                 if (empty($_GET['hotspot'])) { //no user response
272 272
                     $overlap = -2;
273 273
                 } else {
274
-                    $poly_user_compiled 	= poly_compile($poly_user,$max_coord);
275
-                    $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord);
276
-                    $poly_results 			= poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
274
+                    $poly_user_compiled = poly_compile($poly_user, $max_coord);
275
+                    $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
276
+                    $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord);
277 277
 
278 278
                     $overlap = $poly_results['both'];
279 279
                     $poly_answer_area = $poly_results['s1'];
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 }
284 284
 
285 285
                 //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
286
-                if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);}
286
+                if ($dbg_local > 0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); }
287 287
                 if ($overlap < 1) {
288 288
                     //shortcut to avoid complicated calculations
289 289
                     $final_overlap = 0;
@@ -291,27 +291,27 @@  discard block
 block discarded – undo
291 291
                     $final_excess  = 100;
292 292
                 } else {
293 293
                     // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
294
-                    $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100);
295
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);}
294
+                    $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
295
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); }
296 296
                     // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
297 297
                     $final_missing = 100 - $final_overlap;
298
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);}
298
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final missing is '.$final_missing, 0); }
299 299
                     // 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
300
-                    $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100);
301
-                    if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);}
300
+                    $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
301
+                    if ($dbg_local > 1) { error_log(__LINE__.' - Final excess is '.$final_excess, 0); }
302 302
                 }
303 303
 
304
-                $destination_items= explode('@@', $answerDestination);
304
+                $destination_items = explode('@@', $answerDestination);
305 305
                 $threadhold_total = $destination_items[0];
306
-                $threadhold_items=explode(';',$threadhold_total);
306
+                $threadhold_items = explode(';', $threadhold_total);
307 307
                 $threadhold1 = $threadhold_items[0]; // overlap
308 308
                 $threadhold2 = $threadhold_items[1]; // excess
309
-                $threadhold3 = $threadhold_items[2];	 //missing
309
+                $threadhold3 = $threadhold_items[2]; //missing
310 310
 
311 311
                 // echo $final_overlap.'  '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.'  '. $threadhold3;
312 312
 
313 313
                 // if is delineation
314
-                if ($answerId===1) {
314
+                if ($answerId === 1) {
315 315
                     //setting colors
316 316
                     if ($final_overlap >= $threadhold1) {
317 317
                         $overlap_color = true; //echo 'a';
@@ -327,40 +327,40 @@  discard block
 block discarded – undo
327 327
 
328 328
                     // if pass
329 329
                     //if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) {
330
-                    if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) {
331
-                        $next=1; //go to the oars
332
-                        $result_comment=get_lang('Acceptable');
330
+                    if ($final_overlap >= $threadhold1 && $final_missing <= $threadhold3 && $final_excess <= $threadhold2) {
331
+                        $next = 1; //go to the oars
332
+                        $result_comment = get_lang('Acceptable');
333 333
                     } else {
334
-                        $next=1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
334
+                        $next = 1; //Go to the oars. If $next =  0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
335 335
                         $wrong_results = true;
336
-                        $result_comment=get_lang('Unacceptable');
337
-                        $special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1);
338
-                        $answerDestination=$objAnswerTmp->selectDestination(1);
339
-                        $destination_items= explode('@@', $answerDestination);
340
-                        $try_hotspot=$destination_items[1];
341
-                        $lp_hotspot=$destination_items[2];
342
-                        $select_question_hotspot=$destination_items[3];
343
-                        $url_hotspot=$destination_items[4];
336
+                        $result_comment = get_lang('Unacceptable');
337
+                        $special_comment = $comment = $answerDestination = $objAnswerTmp->selectComment(1);
338
+                        $answerDestination = $objAnswerTmp->selectDestination(1);
339
+                        $destination_items = explode('@@', $answerDestination);
340
+                        $try_hotspot = $destination_items[1];
341
+                        $lp_hotspot = $destination_items[2];
342
+                        $select_question_hotspot = $destination_items[3];
343
+                        $url_hotspot = $destination_items[4];
344 344
                          //echo 'show the feedback';
345 345
                     }
346
-                } elseif($answerId>1) {
346
+                } elseif ($answerId > 1) {
347 347
                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
348
-                        if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);}
348
+                        if ($dbg_local > 0) { error_log(__LINE__.' - answerId is of type noerror', 0); }
349 349
                         //type no error shouldn't be treated
350 350
                         $next = 1;
351 351
                         continue;
352 352
                     }
353
-                    if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);}
353
+                    if ($dbg_local > 0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); }
354 354
                     //check the intersection between the oar and the user
355 355
                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
356 356
                     //echo 'official';print_r($x_list);print_r($y_list);
357 357
                     //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
358 358
 
359 359
                     //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
360
-                    $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
360
+                    $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
361 361
 
362
-                    $poly_answer 			= convert_coordinates($delineation_cord,'|');
363
-                    $max_coord 				= poly_get_max($poly_user,$poly_answer); //getting max coordinates
362
+                    $poly_answer = convert_coordinates($delineation_cord, '|');
363
+                    $max_coord = poly_get_max($poly_user, $poly_answer); //getting max coordinates
364 364
                     $test = false;
365 365
                     // if ($answerId == 2 ){$test = true;} for test oars
366 366
 
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
                         $overlap = false;
369 369
                     } else {
370 370
                         //	poly_compile really works tested with gnuplot
371
-                        $poly_user_compiled	  	= poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1
372
-                        $poly_answer_compiled 	= poly_compile($poly_answer,$max_coord,$test);
373
-                        $overlap 			  	= poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
371
+                        $poly_user_compiled	  	= poly_compile($poly_user, $max_coord, $test); //$poly_user is already set when answerid = 1
372
+                        $poly_answer_compiled 	= poly_compile($poly_answer, $max_coord, $test);
373
+                        $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
374 374
                     }
375 375
 
376 376
                     if ($overlap == false) {
@@ -378,42 +378,42 @@  discard block
 block discarded – undo
378 378
                         $next = 1;
379 379
                         continue;
380 380
                     } else {
381
-                        if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);}
381
+                        if ($dbg_local > 0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); }
382 382
 
383 383
                         $organs_at_risk_hit++;
384 384
                         //show the feedback
385
-                        $next=1;
386
-                        $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
387
-                        $answerDestination=$objAnswerTmp->selectDestination($answerId);
388
-                        $destination_items= explode('@@', $answerDestination);
389
-                        $try_hotspot=$destination_items[1];
390
-                        $lp_hotspot=$destination_items[2];
391
-                        $select_question_hotspot=$destination_items[3];
392
-                        $url_hotspot=$destination_items[4];
385
+                        $next = 1;
386
+                        $comment = $answerDestination = $objAnswerTmp->selectComment($answerId);
387
+                        $answerDestination = $objAnswerTmp->selectDestination($answerId);
388
+                        $destination_items = explode('@@', $answerDestination);
389
+                        $try_hotspot = $destination_items[1];
390
+                        $lp_hotspot = $destination_items[2];
391
+                        $select_question_hotspot = $destination_items[3];
392
+                        $url_hotspot = $destination_items[4];
393 393
                     }
394 394
                 }
395 395
             } else {
396 396
                 // the first delineation feedback
397
-                if ($dbg_local>0) { error_log(__LINE__.' first',0);}
397
+                if ($dbg_local > 0) { error_log(__LINE__.' first', 0); }
398 398
                 //we send the error
399 399
             }
400 400
         }
401 401
 	}
402 402
 
403 403
 	if ($overlap_color) {
404
-		$overlap_color='green';
404
+		$overlap_color = 'green';
405 405
     } else {
406
-		$overlap_color='red';
406
+		$overlap_color = 'red';
407 407
     }
408 408
 	if ($missing_color) {
409
-		$missing_color='green';
409
+		$missing_color = 'green';
410 410
     } else {
411
-		$missing_color='red';
411
+		$missing_color = 'red';
412 412
     }
413 413
 	if ($excess_color) {
414
-		$excess_color='green';
414
+		$excess_color = 'green';
415 415
     } else {
416
-		$excess_color='red';
416
+		$excess_color = 'red';
417 417
     }
418 418
 
419 419
     if (!is_numeric($final_overlap)) {
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
     	$final_excess = 0;
428 428
     }
429 429
 
430
-    if ($final_excess>100) {
430
+    if ($final_excess > 100) {
431 431
     	$final_excess = 100;
432 432
     }
433 433
 
@@ -442,26 +442,26 @@  discard block
 block discarded – undo
442 442
 	<tr class="row_even">
443 443
 		<td><b>'.get_lang('Overlap').'</b></td>
444 444
 		<td>'.get_lang('Min').' '.$threadhold1.'</td>
445
-		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
445
+		<td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
446 446
 	</tr>
447 447
 
448 448
 	<tr>
449 449
 		<td><b>'.get_lang('Excess').'</b></td>
450 450
 		<td>'.get_lang('Max').' '.$threadhold2.'</td>
451
-		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
451
+		<td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
452 452
 	</tr>
453 453
 
454 454
 	<tr class="row_even">
455 455
 		<td><b>'.get_lang('Missing').'</b></td>
456 456
 		<td>'.get_lang('Max').' '.$threadhold3.'</td>
457
-		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
457
+		<td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
458 458
 	</tr>
459 459
 	</table>';
460 460
 	//var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
461 461
 }
462 462
 $_SESSION['newquestionList'] = $newquestionList;
463 463
 
464
-$links='';
464
+$links = '';
465 465
 
466 466
 if (isset($choice_value) && $choice_value == -1) {
467 467
     if ($answerType != HOT_SPOT_DELINEATION) {
@@ -473,32 +473,32 @@  discard block
 block discarded – undo
473 473
 
474 474
 if ($answerType != HOT_SPOT_DELINEATION) {
475 475
     if (!empty($destination)) {
476
-        $item_list = explode('@@',$destination);
476
+        $item_list = explode('@@', $destination);
477 477
     	//print_R($item_list);
478 478
     	$try = $item_list[0];
479 479
     	$lp = $item_list[1];
480
-    	$destinationid= $item_list[2];
481
-    	$url=$item_list[3];
480
+    	$destinationid = $item_list[2];
481
+    	$url = $item_list[3];
482 482
     }
483
-	$table_resume='';
483
+	$table_resume = '';
484 484
 } else {
485 485
 		$try = $try_hotspot;
486 486
 		$lp = $lp_hotspot;
487
-		$destinationid= $select_question_hotspot;
488
-		$url=$url_hotspot;
489
-	if ($organs_at_risk_hit==0 && $wrong_results==false ) {
487
+		$destinationid = $select_question_hotspot;
488
+		$url = $url_hotspot;
489
+	if ($organs_at_risk_hit == 0 && $wrong_results == false) {
490 490
 		// no error = no oar and no wrong result for delineation
491 491
 		//show if no error
492 492
 		//echo 'no error';
493
-		$comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
494
-		$answerDestination		 = $objAnswerTmp->selectDestination($nbrAnswers);
493
+		$comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
494
+		$answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
495 495
 
496 496
 		//we send the error
497
-		$destination_items= explode('@@', $answerDestination);
498
-		$try=$destination_items[1];
499
-		$lp=$destination_items[2];
500
-		$destinationid=$destination_items[3];
501
-		$url=$destination_items[4];
497
+		$destination_items = explode('@@', $answerDestination);
498
+		$try = $destination_items[1];
499
+		$lp = $destination_items[2];
500
+		$destinationid = $destination_items[3];
501
+		$url = $destination_items[4];
502 502
 		$exerciseResult[$questionid] = 1;
503 503
 	} else {
504 504
 		$exerciseResult[$questionid] = 0;
@@ -506,35 +506,35 @@  discard block
 block discarded – undo
506 506
 }
507 507
 
508 508
 // the link to retry the question
509
-if (isset($try) && $try==1) {
510
-	$num_value_array= (array_keys($questionList, $questionid));
511
-	$links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
509
+if (isset($try) && $try == 1) {
510
+	$num_value_array = (array_keys($questionList, $questionid));
511
+	$links .= Display :: return_icon('reload.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />';
512 512
 }
513 513
 
514 514
 // the link to theory (a learning path)
515 515
 if (!empty($lp)) {
516
-	$lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
516
+	$lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
517 517
 	$list = new LearnpathList(api_get_user_id());
518 518
 	$flat_list = $list->get_flat_list();
519
-	$links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
519
+	$links .= Display :: return_icon('theory.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />';
520 520
 }
521
-$links.='<br />';
521
+$links .= '<br />';
522 522
 
523 523
 // the link to an external website or link
524 524
 if (!empty($url)) {
525
-	$links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
525
+	$links .= Display :: return_icon('link.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />';
526 526
 }
527 527
 
528 528
 // the link to finish the test
529
-if ($destinationid==-1) {
530
-	$links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
529
+if ($destinationid == -1) {
530
+	$links .= Display :: return_icon('finish.gif', '', array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />';
531 531
 } else {
532 532
 	// the link to other question
533
-	if (in_array($destinationid,$questionList)) {
533
+	if (in_array($destinationid, $questionList)) {
534 534
 		$objQuestionTmp = Question :: read($destinationid);
535
-		$questionName=$objQuestionTmp->selectTitle();
536
-		$num_value_array= (array_keys($questionList, $destinationid));
537
-		$links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
535
+		$questionName = $objQuestionTmp->selectTitle();
536
+		$num_value_array = (array_keys($questionList, $destinationid));
537
+		$links .= Display :: return_icon('quiz.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />';
538 538
 	}
539 539
 }
540 540
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 }
552 552
 </script>';
553 553
 
554
-if ($links!='') {
554
+if ($links != '') {
555 555
 	/*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
556 556
     <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/
557 557
 	echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
@@ -560,15 +560,15 @@  discard block
 block discarded – undo
560 560
 		if ($organs_at_risk_hit > 0) {
561 561
 			//$message='<p>'.get_lang('YourDelineation').'</p>';
562 562
 			//$message.=$table_resume;
563
-			$message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
563
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
564 564
 			//if ($wrong_results) { }
565
-			$message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
566
-			$message.='<p>'.$comment.'</p>';
565
+			$message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
566
+			$message .= '<p>'.$comment.'</p>';
567 567
 		} else {
568
-			$message='<p>'.get_lang('YourDelineation').'</p>';
569
-			$message.=$table_resume;
570
-			$message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
571
-			$message.='<p>'.$comment.'</p>';
568
+			$message = '<p>'.get_lang('YourDelineation').'</p>';
569
+			$message .= $table_resume;
570
+			$message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
571
+			$message .= '<p>'.$comment.'</p>';
572 572
 		}
573 573
 		echo $message;
574 574
 	} else {
@@ -577,10 +577,10 @@  discard block
 block discarded – undo
577 577
 	echo '<h3>'.$links.'</h3>';
578 578
 	echo '</div>';
579 579
 
580
-	$_SESSION['hot_spot_result']=$message;
580
+	$_SESSION['hot_spot_result'] = $message;
581 581
 	$_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
582 582
 	//reseting the exerciseResult variable
583
-	Session::write('exerciseResult',$exerciseResult);
583
+	Session::write('exerciseResult', $exerciseResult);
584 584
 
585 585
 	//save this variables just in case the exercise loads an LP with other exercise
586 586
 	$_SESSION['objExerciseExtra'.$exerciseId] 	 = $_SESSION['objExercise'];
Please login to merge, or discard this patch.
main/upload/form.document.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
  */
13 13
 $noPHP_SELF = false;
14 14
 $nameTools = get_lang('FileUpload');
15
-$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT));
16
-Display::display_header($nameTools,"Doc");
15
+$interbreadcrumb[] = array("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT));
16
+Display::display_header($nameTools, "Doc");
17 17
 //show the title
18 18
 api_display_tool_title($nameTools.$add_group_to_title);
19 19
 ?>
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 <div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;">
22 22
 </div>
23 23
 <div id="upload_form_div" name="form_div" style="display:block;">
24
-	<form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', ''));?>','upload_form_div');">
24
+	<form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', '')); ?>','upload_form_div');">
25 25
 		<input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
26 26
 		<input type="hidden" name="tool" value="<?php echo $my_tool; ?>">
27 27
 		<input type="file" name="user_file">
Please login to merge, or discard this patch.