Completed
Push — 1.10.x ( 6b71ee...2a47c0 )
by Julito
45:30
created
main/admin/index.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -399,10 +399,10 @@
 block discarded – undo
399 399
     if(count($_plugins['menu_administrator']) > 0) {
400 400
         $blocks['plugins']['icon'] = Display::return_icon(
401 401
             'plugins.png',
402
-             get_lang('Plugins'),
403
-             array(),
404
-             ICON_SIZE_MEDIUM,
405
-             false
402
+                get_lang('Plugins'),
403
+                array(),
404
+                ICON_SIZE_MEDIUM,
405
+                false
406 406
         );
407 407
         $blocks['plugins']['label'] = api_ucfirst(get_lang('Plugins'));
408 408
         $blocks['plugins']['class'] = 'block-admin-platform';
Please login to merge, or discard this patch.
main/inc/lib/usermanager.lib.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1231,13 +1231,13 @@  discard block
 block discarded – undo
1231 1231
     }
1232 1232
 
1233 1233
     /**
1234
-    * Get the users by ID
1235
-    * @param array $ids student ids
1236
-    * @param string $active
1237
-    * @param string $order
1238
-    * @param string $limit
1239
-    * @return array $result student information
1240
-    */
1234
+     * Get the users by ID
1235
+     * @param array $ids student ids
1236
+     * @param string $active
1237
+     * @param string $order
1238
+     * @param string $limit
1239
+     * @return array $result student information
1240
+     */
1241 1241
     public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null)
1242 1242
     {
1243 1243
         if (empty($ids)) {
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
      *
2276 2276
      * @return array with extra data info of a user i.e array('field_variable'=>'value');
2277 2277
      */
2278
-     public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true)
2278
+        public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true)
2279 2279
     {
2280 2280
         $extraField = new ExtraFieldValue('user');
2281 2281
 
@@ -3352,12 +3352,12 @@  discard block
 block discarded – undo
3352 3352
         if ($tag_id == 0) {
3353 3353
             //the tag doesn't exist
3354 3354
             $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)";
3355
-             Database::query($sql);
3355
+                Database::query($sql);
3356 3356
             $last_insert_id = Database::insert_id();
3357 3357
         } else {
3358 3358
             //the tag exists we update it
3359 3359
             $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id  = $tag_id";
3360
-             Database::query($sql);
3360
+                Database::query($sql);
3361 3361
             $last_insert_id = $tag_id;
3362 3362
         }
3363 3363
 
@@ -3552,9 +3552,9 @@  discard block
 block discarded – undo
3552 3552
     }
3553 3553
 
3554 3554
     /**
3555
-      * Get extra filtrable user fields (only type select)
3556
-      * @return array
3557
-      */
3555
+     * Get extra filtrable user fields (only type select)
3556
+     * @return array
3557
+     */
3558 3558
     public static function get_extra_filtrable_fields()
3559 3559
     {
3560 3560
         $extraFieldList = UserManager::get_extra_fields();
@@ -3579,9 +3579,9 @@  discard block
 block discarded – undo
3579 3579
     }
3580 3580
 
3581 3581
     /**
3582
-      * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3583
-      * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3584
-      */
3582
+     * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3583
+     * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3584
+     */
3585 3585
     public static function get_search_form_where_extra_fields()
3586 3586
     {
3587 3587
         $useExtraFields = false;
@@ -3900,23 +3900,23 @@  discard block
 block discarded – undo
3900 3900
     }
3901 3901
 
3902 3902
     /**
3903
-    * Get users followed by human resource manager
3904
-    * @param int $userId
3905
-    * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3906
-    * @param bool $getOnlyUserId
3907
-    * @param bool $getSql
3908
-    * @param bool $getCount
3909
-    * @param int $from
3910
-    * @param int $numberItems
3911
-    * @param int $column
3912
-    * @param string $direction
3913
-    * @param int $active
3914
-    * @param string $lastConnectionDate
3915
-    * @param int $status the function is called by who? COURSEMANAGER, DRH?
3916
-    * @param string $keyword
3903
+     * Get users followed by human resource manager
3904
+     * @param int $userId
3905
+     * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3906
+     * @param bool $getOnlyUserId
3907
+     * @param bool $getSql
3908
+     * @param bool $getCount
3909
+     * @param int $from
3910
+     * @param int $numberItems
3911
+     * @param int $column
3912
+     * @param string $direction
3913
+     * @param int $active
3914
+     * @param string $lastConnectionDate
3915
+     * @param int $status the function is called by who? COURSEMANAGER, DRH?
3916
+     * @param string $keyword
3917 3917
      *
3918
-    * @return array user list
3919
-    */
3918
+     * @return array user list
3919
+     */
3920 3920
     public static function getUsersFollowedByUser(
3921 3921
         $userId,
3922 3922
         $userStatus = null,
Please login to merge, or discard this patch.
main/coursecopy/classes/DummyCourseCreator.class.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -291,16 +291,16 @@
 block discarded – undo
291 291
         Duis bibendum elementum justo. Duis posuere. Fusce nulla odio, posuere eget, condimentum nec, venenatis eu, elit. In hac habitasse platea dictumst. Aenean ac sem in enim imperdiet feugiat. Integer tincidunt lectus at elit. Integer magna lacus, vehicula quis, eleifend eget, suscipit vitae, leo. Nunc porta augue nec enim. Curabitur vehicula volutpat enim. Aliquam consequat. Vestibulum rhoncus tellus vitae erat. Integer est. Quisque fermentum leo nec odio. Suspendisse lobortis sollicitudin augue. Nullam urna mi, suscipit eu, sagittis laoreet, ultrices ac, sem. Aliquam enim tortor, hendrerit non, cursus a, tristique sit amet, sapien. Suspendisse potenti. Aenean semper placerat neque.';
292 292
         switch($type)
293 293
         {
294
-         case 'description':
294
+            case 'description':
295 295
             $descriptions = explode(".",$dummy_text);
296 296
             return $descriptions[rand(0,count($descriptions)-1)];
297 297
             break;
298
-         case 'title':
298
+            case 'title':
299 299
             $dummy_text = str_replace(array("\n",'.',',',"\t"),array(' ','','',' '),$dummy_text);
300 300
             $titles = explode(" ",$dummy_text);
301 301
             return trim($titles[rand(0,count($titles)-1)]);
302 302
             break;
303
-         case 'text':
303
+            case 'text':
304 304
             $texts = explode("\n",$dummy_text);
305 305
             return $texts[rand(0,count($texts)-1)];
306 306
             break;
Please login to merge, or discard this patch.
main/coursecopy/classes/Thematic.class.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
 {
12 12
     public $params = array();
13 13
     public $thematic_advance_list = array();
14
-	public $thematic_plan_list = array();
14
+    public $thematic_plan_list = array();
15 15
 
16 16
     /**
17
-    * Create a new Thematic
18
-    *
19
-    * @param array $params
20
-    */
17
+     * Create a new Thematic
18
+     *
19
+     * @param array $params
20
+     */
21 21
     public function __construct($params)
22 22
     {
23 23
         parent::__construct($params['id'], RESOURCE_THEMATIC);
Please login to merge, or discard this patch.
main/coursecopy/classes/CourseSelectForm.class.php 1 patch
Indentation   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class CourseSelectForm
13 13
 {
14
-	/**
15
-	 * Display the form
16
-	 * @param array $hidden_fields Hidden fields to add to the form.
17
-	 * @param boolean the document array will be serialize. This is used in the course_copy.php file
18
-	 */
19
-	public static function display_form($course, $hidden_fields = null, $avoid_serialize = false)
14
+    /**
15
+     * Display the form
16
+     * @param array $hidden_fields Hidden fields to add to the form.
17
+     * @param boolean the document array will be serialize. This is used in the course_copy.php file
18
+     */
19
+    public static function display_form($course, $hidden_fields = null, $avoid_serialize = false)
20 20
     {
21 21
         global $charset;
22 22
         $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook');
@@ -134,50 +134,50 @@  discard block
 block discarded – undo
134 134
 		</script>
135 135
 		<?php
136 136
 
137
-		//get destination course title
138
-		if (!empty($hidden_fields['destination_course'])) {
137
+        //get destination course title
138
+        if (!empty($hidden_fields['destination_course'])) {
139 139
             $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name(
140 140
                 $hidden_fields['destination_session']
141 141
             ) . ')' : null;
142 142
 
143 143
             $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
144
-			echo '<h3>';
145
-			echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle;
146
-			echo '</h3>';
147
-		}
144
+            echo '<h3>';
145
+            echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle;
146
+            echo '</h3>';
147
+        }
148 148
         echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
149
-		echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
149
+        echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
150 150
         $icon = Display::returnIconPath('myprogress_bar.gif');
151
-		echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">';
152
-		echo '<input type="hidden" name="action" value="course_select_form"/>';
151
+        echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">';
152
+        echo '<input type="hidden" name="action" value="course_select_form"/>';
153 153
 
154
-		if (!empty($hidden_fields['destination_course']) &&
154
+        if (!empty($hidden_fields['destination_course']) &&
155 155
             !empty($hidden_fields['origin_course']) &&
156 156
             !empty($hidden_fields['destination_session']) &&
157 157
             !empty($hidden_fields['origin_session'])
158 158
         ) {
159
-			echo '<input type="hidden" name="destination_course" 	value="'.$hidden_fields['destination_course'].'"/>';
160
-			echo '<input type="hidden" name="origin_course" 		value="'.$hidden_fields['origin_course'].'"/>';
161
-			echo '<input type="hidden" name="destination_session" 	value="'.$hidden_fields['destination_session'].'"/>';
162
-			echo '<input type="hidden" name="origin_session" 		value="'.$hidden_fields['origin_session'].'"/>';
163
-		}
159
+            echo '<input type="hidden" name="destination_course" 	value="'.$hidden_fields['destination_course'].'"/>';
160
+            echo '<input type="hidden" name="origin_course" 		value="'.$hidden_fields['origin_course'].'"/>';
161
+            echo '<input type="hidden" name="destination_session" 	value="'.$hidden_fields['destination_session'].'"/>';
162
+            echo '<input type="hidden" name="origin_session" 		value="'.$hidden_fields['origin_session'].'"/>';
163
+        }
164 164
 
165
-		$element_count = 0;
165
+        $element_count = 0;
166 166
         $forum_categories = array();
167 167
         $forums = array();
168 168
         $forum_topics = array();
169 169
 
170 170
         echo '<p>';
171
-		echo get_lang('SelectResources');
172
-		echo '</p>';
171
+        echo get_lang('SelectResources');
172
+        echo '</p>';
173 173
 
174 174
         Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt'));
175 175
 
176 176
         foreach ($course->resources as $type => $resources) {
177 177
             if (count($resources) > 0) {
178
-				switch ($type) {
179
-					//Resources to avoid
180
-					case RESOURCE_FORUMCATEGORY:
178
+                switch ($type) {
179
+                    //Resources to avoid
180
+                    case RESOURCE_FORUMCATEGORY:
181 181
                         foreach ($resources as $id => $resource) {
182 182
                             $forum_categories[$id] = $resource;
183 183
                         }
@@ -196,33 +196,33 @@  discard block
 block discarded – undo
196 196
                         $element_count++;
197 197
                         break;
198 198
                     case RESOURCE_LINKCATEGORY:
199
-					case RESOURCE_FORUMPOST:
200
-					case RESOURCE_QUIZQUESTION:
201
-					case RESOURCE_SURVEYQUESTION:
202
-					case RESOURCE_SURVEYINVITATION:
203
-					case RESOURCE_SCORM:
204
-						break;
199
+                    case RESOURCE_FORUMPOST:
200
+                    case RESOURCE_QUIZQUESTION:
201
+                    case RESOURCE_SURVEYQUESTION:
202
+                    case RESOURCE_SURVEYINVITATION:
203
+                    case RESOURCE_SCORM:
204
+                        break;
205 205
                     default :
206
-						echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
207
-						echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />';
208
-						echo '<div id="div_'.$type.'">';
209
-						if ($type == RESOURCE_LEARNPATH) {
210
-    						Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz'));
211
-    						Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments'));
212
-						}
213
-						if ($type == RESOURCE_DOCUMENT) {
206
+                        echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
207
+                        echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />';
208
+                        echo '<div id="div_'.$type.'">';
209
+                        if ($type == RESOURCE_LEARNPATH) {
210
+                            Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz'));
211
+                            Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments'));
212
+                        }
213
+                        if ($type == RESOURCE_DOCUMENT) {
214 214
                             if (api_get_setting('show_glossary_in_documents') != 'none') {
215 215
                                 Display::display_warning_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary'));
216 216
                             }
217
-						}
217
+                        }
218 218
 
219
-						echo '<blockquote>';
219
+                        echo '<blockquote>';
220 220
                         echo '<div class="btn-group">';
221
-						echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>";
221
+                        echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>";
222 222
                         echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>";
223
-						echo '</div><br />';
223
+                        echo '</div><br />';
224 224
 
225
-						foreach ($resources as $id => $resource) {
225
+                        foreach ($resources as $id => $resource) {
226 226
                             if ($resource) {
227 227
                                 Coursecopy\Resource::setClassType($resource);
228 228
                                 echo '<label class="checkbox">';
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
                                 $resource->show();
231 231
                                 echo '</label>';
232 232
                             }
233
-						}
234
-						echo '</blockquote>';
235
-						echo '</div>';
236
-						echo '<script language="javascript">exp('."'$type'".')</script>';
237
-						$element_count++;
233
+                        }
234
+                        echo '</blockquote>';
235
+                        echo '</div>';
236
+                        echo '<script language="javascript">exp('."'$type'".')</script>';
237
+                        $element_count++;
238 238
                 }
239
-			}
240
-		}
239
+            }
240
+        }
241 241
 
242 242
         //Fixes forum order
243 243
         if (!empty($forum_categories)) {
@@ -293,65 +293,65 @@  discard block
 block discarded – undo
293 293
             echo '<script language="javascript">exp('."'$type'".')</script>';
294 294
         }
295 295
 
296
-		if ($avoid_serialize) {
297
-			/*Documents are avoided due the huge amount of memory that the serialize php function "eats"
296
+        if ($avoid_serialize) {
297
+            /*Documents are avoided due the huge amount of memory that the serialize php function "eats"
298 298
 			(when there are directories with hundred/thousand of files) */
299
-			// this is a known issue of serialize
300
-			$course->resources['document']= null;
301
-		}
299
+            // this is a known issue of serialize
300
+            $course->resources['document']= null;
301
+        }
302 302
 
303
-		echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
303
+        echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
304 304
 
305
-		if (is_array($hidden_fields)) {
306
-			foreach ($hidden_fields as $key => $value) {
307
-				echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
308
-			}
309
-		}
305
+        if (is_array($hidden_fields)) {
306
+            foreach ($hidden_fields as $key => $value) {
307
+                echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
308
+            }
309
+        }
310 310
 
311 311
         $recycleOption = isset($_POST['recycle_option']) ? true : false;
312 312
 
313
-		if (empty($element_count)) {
314
-		    Display::display_warning_message(get_lang('NoDataAvailable'));
315
-		} else {
316
-    		if (!empty($hidden_fields['destination_session'])) {
317
-    			echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'.
313
+        if (empty($element_count)) {
314
+            Display::display_warning_message(get_lang('NoDataAvailable'));
315
+        } else {
316
+            if (!empty($hidden_fields['destination_session'])) {
317
+                echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'.
318 318
                     get_lang('Ok').'</button>';
319
-    		} else {
319
+            } else {
320 320
                 if ($recycleOption) {
321 321
                     echo '<br /><button class="save" type="submit">'.
322 322
                         get_lang('Ok').'</button>';
323 323
                 } else {
324
-    			    echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.
324
+                    echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.
325 325
                     get_lang('Ok').'</button>';
326 326
                 }
327
-    		}
328
-		}
327
+            }
328
+        }
329 329
 
330
-		CourseSelectForm :: display_hidden_quiz_questions($course);
331
-		CourseSelectForm :: display_hidden_scorm_directories($course);
332
-		echo '</form>';
333
-		echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
334
-	}
330
+        CourseSelectForm :: display_hidden_quiz_questions($course);
331
+        CourseSelectForm :: display_hidden_scorm_directories($course);
332
+        echo '</form>';
333
+        echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
334
+    }
335 335
 
336 336
     /**
337 337
      * @param $course
338 338
      */
339 339
     static function display_hidden_quiz_questions($course)
340 340
     {
341
-		if(is_array($course->resources)){
342
-			foreach ($course->resources as $type => $resources) {
343
-				if (count($resources) > 0) {
344
-					switch ($type) {
345
-						case RESOURCE_QUIZQUESTION:
346
-							foreach ($resources as $id => $resource) {
347
-								echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />';
348
-							}
349
-							break;
350
-					}
351
-				}
352
-			}
353
-		}
354
-	}
341
+        if(is_array($course->resources)){
342
+            foreach ($course->resources as $type => $resources) {
343
+                if (count($resources) > 0) {
344
+                    switch ($type) {
345
+                        case RESOURCE_QUIZQUESTION:
346
+                            foreach ($resources as $id => $resource) {
347
+                                echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />';
348
+                            }
349
+                            break;
350
+                    }
351
+                }
352
+            }
353
+        }
354
+    }
355 355
 
356 356
     /**
357 357
      * @param $course
@@ -359,30 +359,30 @@  discard block
 block discarded – undo
359 359
     static function display_hidden_scorm_directories($course)
360 360
     {
361 361
         if (is_array($course->resources)){
362
-			foreach ($course->resources as $type => $resources) {
363
-				if (count($resources) > 0) {
364
-					switch($type) {
365
-						case RESOURCE_SCORM:
366
-							foreach ($resources as $id => $resource) {
367
-								echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />';
368
-							}
369
-							break;
370
-					}
371
-				}
372
-			}
373
-		}
374
-	}
362
+            foreach ($course->resources as $type => $resources) {
363
+                if (count($resources) > 0) {
364
+                    switch($type) {
365
+                        case RESOURCE_SCORM:
366
+                            foreach ($resources as $id => $resource) {
367
+                                echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />';
368
+                            }
369
+                            break;
370
+                    }
371
+                }
372
+            }
373
+        }
374
+    }
375 375
 
376
-	/**
377
-	 * Get the posted course
378
-	 * @param string $from who calls the function?
376
+    /**
377
+     * Get the posted course
378
+     * @param string $from who calls the function?
379 379
      * It can be copy_course, create_backup, import_backup or recycle_course
380 380
      * @param int $session_id
381 381
      * @param string $course_code
382
-	 * @return course The course-object with all resources selected by the user
383
-	 * in the form given by display_form(...)
384
-	 */
385
-	public static function get_posted_course($from = '', $session_id = 0, $course_code = '')
382
+     * @return course The course-object with all resources selected by the user
383
+     * in the form given by display_form(...)
384
+     */
385
+    public static function get_posted_course($from = '', $session_id = 0, $course_code = '')
386 386
     {
387 387
         $course = null;
388 388
 
@@ -392,30 +392,30 @@  discard block
 block discarded – undo
392 392
             return false;
393 393
         }
394 394
 
395
-		// Create the resource DOCUMENT objects
396
-		// Loading the results from the checkboxes of ethe javascript
397
-		$resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
395
+        // Create the resource DOCUMENT objects
396
+        // Loading the results from the checkboxes of ethe javascript
397
+        $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
398 398
 
399
-		$course_info = api_get_course_info($course_code);
400
-		$table_doc = Database::get_course_table(TABLE_DOCUMENT);
401
-		$table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
402
-		$course_id = $course_info['real_id'];
399
+        $course_info = api_get_course_info($course_code);
400
+        $table_doc = Database::get_course_table(TABLE_DOCUMENT);
401
+        $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
402
+        $course_id = $course_info['real_id'];
403 403
 
404
-		/* Searching the documents resource that have been set to null because
404
+        /* Searching the documents resource that have been set to null because
405 405
         $avoid_serialize is true in the display_form() function*/
406
-		if ($from == 'copy_course') {
407
-			if (is_array($resource)) {
408
-				$resource = array_keys($resource);
406
+        if ($from == 'copy_course') {
407
+            if (is_array($resource)) {
408
+                $resource = array_keys($resource);
409 409
 
410
-				foreach	($resource as $resource_item) {
410
+                foreach	($resource as $resource_item) {
411 411
 
412
-					$condition_session = '';
413
-					if (!empty($session_id)) {
414
-						$session_id = intval($session_id);
415
-						$condition_session = ' AND d.session_id ='.$session_id;
416
-					}
412
+                    $condition_session = '';
413
+                    if (!empty($session_id)) {
414
+                        $session_id = intval($session_id);
415
+                        $condition_session = ' AND d.session_id ='.$session_id;
416
+                    }
417 417
 
418
-					$sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
418
+                    $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
419 419
 							FROM '.$table_doc.' d, '.$table_prop.' p
420 420
 							WHERE
421 421
 							    d.c_id = '.$course_id.' AND
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
                                 p.ref = d.id AND p.visibility != 2 AND
425 425
                                 d.id = '.$resource_item.$condition_session.'
426 426
 							ORDER BY path';
427
-					$db_result = Database::query($sql);
428
-					while ($obj = Database::fetch_object($db_result)) {
427
+                    $db_result = Database::query($sql);
428
+                    while ($obj = Database::fetch_object($db_result)) {
429 429
                         $doc = new Document(
430 430
                             $obj->id,
431 431
                             $obj->path,
@@ -449,25 +449,25 @@  discard block
 block discarded – undo
449 449
                             }
450 450
                             $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties;
451 451
                         }
452
-					}
453
-				}
454
-			}
455
-		}
452
+                    }
453
+                }
454
+            }
455
+        }
456 456
 
457
-		if (is_array($course->resources)) {
458
-			foreach ($course->resources as $type => $resources) {
457
+        if (is_array($course->resources)) {
458
+            foreach ($course->resources as $type => $resources) {
459 459
 
460
-				switch ($type) {
461
-					case RESOURCE_SURVEYQUESTION:
462
-						foreach($resources as $id => $obj) {
463
-						    if (isset($_POST['resource'][RESOURCE_SURVEY]) &&
460
+                switch ($type) {
461
+                    case RESOURCE_SURVEYQUESTION:
462
+                        foreach($resources as $id => $obj) {
463
+                            if (isset($_POST['resource'][RESOURCE_SURVEY]) &&
464 464
                                 is_array($_POST['resource'][RESOURCE_SURVEY]) &&
465 465
                                 !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY]))
466 466
                             ) {
467
-								unset($course->resources[$type][$id]);
468
-							}
469
-						}
470
-						break;
467
+                                unset($course->resources[$type][$id]);
468
+                            }
469
+                        }
470
+                        break;
471 471
                     case RESOURCE_FORUMTOPIC:
472 472
                     case RESOURCE_FORUMPOST:
473 473
                        //Add post from topic
@@ -519,62 +519,62 @@  discard block
 block discarded – undo
519 519
                                 }
520 520
                             }
521 521
                         }
522
-					case RESOURCE_LINKCATEGORY :
523
-					case RESOURCE_FORUMCATEGORY :
524
-					case RESOURCE_QUIZQUESTION :
525
-					case RESOURCE_DOCUMENT:
526
-						// Mark folders to import which are not selected by the user to import,
527
-						// but in which a document was selected.
528
-						$documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
529
-						if (!empty($resources) && is_array($resources))
530
-							foreach ($resources as $id => $obj) {
531
-								if (isset($obj->file_type) && $obj->file_type == 'folder' &&
522
+                    case RESOURCE_LINKCATEGORY :
523
+                    case RESOURCE_FORUMCATEGORY :
524
+                    case RESOURCE_QUIZQUESTION :
525
+                    case RESOURCE_DOCUMENT:
526
+                        // Mark folders to import which are not selected by the user to import,
527
+                        // but in which a document was selected.
528
+                        $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
529
+                        if (!empty($resources) && is_array($resources))
530
+                            foreach ($resources as $id => $obj) {
531
+                                if (isset($obj->file_type) && $obj->file_type == 'folder' &&
532 532
                                     !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) &&
533 533
                                     is_array($documents)
534 534
                                 ) {
535
-									foreach ($documents as $id_to_check => $post_value) {
536
-										$obj_to_check = $resources[$id_to_check];
537
-										$shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
538
-										if ($id_to_check != $id && $obj->path == $shared_path_part) {
539
-											$_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
540
-											break;
541
-										}
542
-									}
543
-								}
544
-							}
545
-					default :
546
-						if (!empty($resources) && is_array($resources)) {
547
-							foreach ($resources as $id => $obj) {
548
-								$resource_is_used_elsewhere = $course->is_linked_resource($obj);
549
-								// check if document is in a quiz (audio/video)
550
-								if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) {
551
-									foreach($course->resources[RESOURCE_QUIZ] as $quiz) {
535
+                                    foreach ($documents as $id_to_check => $post_value) {
536
+                                        $obj_to_check = $resources[$id_to_check];
537
+                                        $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
538
+                                        if ($id_to_check != $id && $obj->path == $shared_path_part) {
539
+                                            $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
540
+                                            break;
541
+                                        }
542
+                                    }
543
+                                }
544
+                            }
545
+                    default :
546
+                        if (!empty($resources) && is_array($resources)) {
547
+                            foreach ($resources as $id => $obj) {
548
+                                $resource_is_used_elsewhere = $course->is_linked_resource($obj);
549
+                                // check if document is in a quiz (audio/video)
550
+                                if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) {
551
+                                    foreach($course->resources[RESOURCE_QUIZ] as $quiz) {
552 552
                                         $quiz = $quiz->obj;
553
-										if (isset($quiz->media) && $quiz->media == $id) {
554
-											$resource_is_used_elsewhere = true;
555
-										}
556
-									}
557
-								}
558
-								if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) {
559
-									unset($course->resources[$type][$id]);
560
-								}
561
-							}
562
-						}
563
-				}
564
-			}
565
-		}
566
-
567
-		return $course;
568
-	}
569
-
570
-	/**
571
-	 * Display the form session export
572
-	 * @param array $hidden_fields Hidden fields to add to the form.
573
-	 * @param boolean the document array will be serialize. This is used in the course_copy.php file
574
-	 */
575
-	 public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false)
576
-     {
577
-         ?>
553
+                                        if (isset($quiz->media) && $quiz->media == $id) {
554
+                                            $resource_is_used_elsewhere = true;
555
+                                        }
556
+                                    }
557
+                                }
558
+                                if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) {
559
+                                    unset($course->resources[$type][$id]);
560
+                                }
561
+                            }
562
+                        }
563
+                }
564
+            }
565
+        }
566
+
567
+        return $course;
568
+    }
569
+
570
+    /**
571
+     * Display the form session export
572
+     * @param array $hidden_fields Hidden fields to add to the form.
573
+     * @param boolean the document array will be serialize. This is used in the course_copy.php file
574
+     */
575
+        public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false)
576
+        {
577
+            ?>
578 578
 		<script>
579 579
 			function exp(item) {
580 580
 				el = document.getElementById('div_'+item);
@@ -616,65 +616,65 @@  discard block
 block discarded – undo
616 616
 		</script>
617 617
 		<?php
618 618
 
619
-		//get destination course title
620
-		if(!empty($hidden_fields['destination_course'])) {
621
-             if (!empty($hidden_fields['destination_session'])) {
622
-                 $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')';
623
-             } else {
624
-                 $sessionTitle = null;
625
-             }
619
+        //get destination course title
620
+        if(!empty($hidden_fields['destination_course'])) {
621
+                if (!empty($hidden_fields['destination_session'])) {
622
+                    $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')';
623
+                } else {
624
+                    $sessionTitle = null;
625
+                }
626 626
             $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
627
-			echo '<h3>';
628
-				echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle;
629
-			echo '</h3>';
630
-		}
627
+            echo '<h3>';
628
+                echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle;
629
+            echo '</h3>';
630
+        }
631 631
 
632
-		echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
633
-		echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
632
+        echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
633
+        echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
634 634
         $icon = Display::returnIconPath('progress_bar.gif');
635
-		echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
636
-		echo '<input type="hidden" name="action" value="course_select_form"/>';
637
-		foreach ($list_course as $course){
638
-			foreach ($course->resources as $type => $resources) {
639
-				if (count($resources) > 0) {
640
-					echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />';
641
-					echo '<b  onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />';
642
-					echo '<div id="div_'.$course->code.'">';
643
-					echo '<blockquote>';
635
+        echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
636
+        echo '<input type="hidden" name="action" value="course_select_form"/>';
637
+        foreach ($list_course as $course){
638
+            foreach ($course->resources as $type => $resources) {
639
+                if (count($resources) > 0) {
640
+                    echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />';
641
+                    echo '<b  onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />';
642
+                    echo '<div id="div_'.$course->code.'">';
643
+                    echo '<blockquote>';
644 644
 
645 645
                     echo '<div class="btn-group">';
646
-					echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>";
646
+                    echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>";
647 647
                     echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',false);\" >".get_lang('None')."</a>";
648
-					echo '</div><br />';
648
+                    echo '</div><br />';
649 649
 
650
-					foreach ($resources as $id => $resource) {
651
-						echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">';
650
+                    foreach ($resources as $id => $resource) {
651
+                        echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">';
652 652
                         echo '<input type="checkbox" name="resource['.$course->code.']['.$id.']" id="resource['.$course->code.']['.$id.']"/>';
653
-						$resource->show();
654
-						echo '</label>';
655
-					}
656
-					echo '</blockquote>';
657
-					echo '</div>';
658
-					echo '<script type="text/javascript">exp('."'$course->code'".')</script>';
659
-				}
660
-			}
661
-		}
662
-		if ($avoid_serialize) {
663
-			//Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
664
-			// this is a known issue of serialize
665
-			$course->resources['document']= null;
666
-		}
667
-		echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
668
-		if (is_array($hidden_fields)) {
669
-			foreach ($hidden_fields as $key => $value) {
670
-				echo "\n";
671
-				echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
672
-			}
673
-		}
674
-		echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>';
675
-		CourseSelectForm :: display_hidden_quiz_questions($course);
676
-		CourseSelectForm :: display_hidden_scorm_directories($course);
677
-		echo '</form>';
678
-		echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
679
-	}
653
+                        $resource->show();
654
+                        echo '</label>';
655
+                    }
656
+                    echo '</blockquote>';
657
+                    echo '</div>';
658
+                    echo '<script type="text/javascript">exp('."'$course->code'".')</script>';
659
+                }
660
+            }
661
+        }
662
+        if ($avoid_serialize) {
663
+            //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
664
+            // this is a known issue of serialize
665
+            $course->resources['document']= null;
666
+        }
667
+        echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
668
+        if (is_array($hidden_fields)) {
669
+            foreach ($hidden_fields as $key => $value) {
670
+                echo "\n";
671
+                echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
672
+            }
673
+        }
674
+        echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>';
675
+        CourseSelectForm :: display_hidden_quiz_questions($course);
676
+        CourseSelectForm :: display_hidden_scorm_directories($course);
677
+        echo '</form>';
678
+        echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
679
+    }
680 680
 }
Please login to merge, or discard this patch.
main/inc/ajax/course_home.ajax.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
             echo json_encode($response_data);
64 64
         }
65 65
         break;
66
-	case 'show_course_information' :
67
-		require_once '../global.inc.php';
66
+    case 'show_course_information' :
67
+        require_once '../global.inc.php';
68 68
 
69
-		// Get the name of the database course.
70
-		$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
71
-		$course_info = api_get_course_info($_GET['code']);
69
+        // Get the name of the database course.
70
+        $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
71
+        $course_info = api_get_course_info($_GET['code']);
72 72
 
73 73
         if (
74 74
             api_get_setting('course_catalog_hide_private') === 'true' &&
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
             break;
79 79
         }
80 80
 
81
-		$sql = "SELECT * FROM $tbl_course_description
81
+        $sql = "SELECT * FROM $tbl_course_description
82 82
 		        WHERE c_id = ".$course_info['real_id']." AND session_id = 0
83 83
 		        ORDER BY id";
84
-		$result = Database::query($sql);
85
-		if (Database::num_rows($result) > 0 ) {
86
-		    while ($description = Database::fetch_object($result)) {
87
-			    $descriptions[$description->id] = $description;
88
-		    }
84
+        $result = Database::query($sql);
85
+        if (Database::num_rows($result) > 0 ) {
86
+            while ($description = Database::fetch_object($result)) {
87
+                $descriptions[$description->id] = $description;
88
+            }
89 89
             // Function that displays the details of the course description in html.
90
-		    echo CourseManager::get_details_course_description_html(
90
+            echo CourseManager::get_details_course_description_html(
91 91
                 $descriptions,
92 92
                 api_get_system_encoding(),
93 93
                 false
94 94
             );
95
-		} else {
96
-		    echo get_lang('NoDescription');
97
-		}
98
-	    break;
95
+        } else {
96
+            echo get_lang('NoDescription');
97
+        }
98
+        break;
99 99
     case 'session_courses_lp_default':
100 100
         /**
101 101
          * @todo this functions need to belong to a class or a special
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $sidx  = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
111 111
         $sord  = $_REQUEST['sord'];    //asc or desc
112 112
         if (!in_array($sord, array('asc','desc'))) {
113
-        	$sord = 'desc';
113
+            $sord = 'desc';
114 114
         }
115 115
         $session_id  = intval($_REQUEST['session_id']);
116 116
         $course_id   = intval($_REQUEST['course_id']);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                     $my_session_list[] = $item['id_session'];
125 125
             }
126 126
             if (!in_array($session_id, $my_session_list)) {
127
-            	break;
127
+                break;
128 128
             }
129 129
         }
130 130
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                     $date = '-';
446 446
                 }
447 447
 
448
-                 //Checking LP publicated and expired_on dates
448
+                    //Checking LP publicated and expired_on dates
449 449
                 if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') {
450 450
                     if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
451 451
                         continue;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
         echo json_encode($response);
501 501
         break;
502
-	default:
503
-		echo '';
502
+    default:
503
+        echo '';
504 504
 }
505 505
 exit;
Please login to merge, or discard this patch.
main/exercice/hotspot.class.php 1 patch
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -12,31 +12,31 @@  discard block
 block discarded – undo
12 12
  **/
13 13
 class HotSpot extends Question
14 14
 {
15
-	public static $typePicture = 'hotspot.png';
16
-	public static $explanationLangVar = 'HotSpot';
15
+    public static $typePicture = 'hotspot.png';
16
+    public static $explanationLangVar = 'HotSpot';
17 17
 
18 18
     /**
19 19
      * HotSpot constructor.
20 20
      */
21
-	public function __construct()
22
-	{
23
-		parent::__construct();
24
-		$this -> type = HOT_SPOT;
25
-	}
26
-
27
-	public function display()
28
-	{
29
-	}
30
-
31
-	/**
32
-	 * @param FormValidator $form
33
-	 * @param int $fck_config
34
-	 */
35
-	public function createForm (&$form, $fck_config=0)
36
-	{
37
-		parent::createForm($form, $fck_config);
38
-
39
-		if (!isset($_GET['editQuestion'])) {
21
+    public function __construct()
22
+    {
23
+        parent::__construct();
24
+        $this -> type = HOT_SPOT;
25
+    }
26
+
27
+    public function display()
28
+    {
29
+    }
30
+
31
+    /**
32
+     * @param FormValidator $form
33
+     * @param int $fck_config
34
+     */
35
+    public function createForm (&$form, $fck_config=0)
36
+    {
37
+        parent::createForm($form, $fck_config);
38
+
39
+        if (!isset($_GET['editQuestion'])) {
40 40
             $form->addElement(
41 41
                 'file',
42 42
                 'imageUpload',
@@ -46,54 +46,54 @@  discard block
 block discarded – undo
46 46
                 )
47 47
             );
48 48
 
49
-			// setting the save button here and not in the question class.php
50
-			// Saving a question
51
-			$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
-			//$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
-			$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
-			$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
-		} else {
56
-			// setting the save button here and not in the question class.php
57
-			// Editing a question
58
-			$form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
-		}
60
-	}
61
-
62
-	/**
63
-	 * @param FormValidator $form
64
-	 * @param null $objExercise
65
-	 * @return null|false
66
-	 */
67
-	public function processCreation($form, $objExercise = null)
68
-	{
69
-		$file_info = $form->getSubmitValue('imageUpload');
70
-		$_course = api_get_course_info();
71
-		parent::processCreation($form, $objExercise);
72
-
73
-		if(!empty($file_info['tmp_name'])) {
74
-			$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
-			$documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
-			$picturePath   = $documentPath.'/images';
77
-
78
-			// fixed width ang height
79
-			if (file_exists($picturePath.'/'.$this->picture)) {
80
-				$this->resizePicture('width', 800);
81
-				$this->save();
82
-			} else {
83
-				return false;
84
-			}
85
-		}
86
-	}
87
-
88
-	function createAnswersForm($form)
89
-	{
90
-		// nothing
91
-	}
92
-
93
-	function processAnswersCreation($form)
94
-	{
95
-		// nothing
96
-	}
49
+            // setting the save button here and not in the question class.php
50
+            // Saving a question
51
+            $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
+            //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
+            $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
+            $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
+        } else {
56
+            // setting the save button here and not in the question class.php
57
+            // Editing a question
58
+            $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
+        }
60
+    }
61
+
62
+    /**
63
+     * @param FormValidator $form
64
+     * @param null $objExercise
65
+     * @return null|false
66
+     */
67
+    public function processCreation($form, $objExercise = null)
68
+    {
69
+        $file_info = $form->getSubmitValue('imageUpload');
70
+        $_course = api_get_course_info();
71
+        parent::processCreation($form, $objExercise);
72
+
73
+        if(!empty($file_info['tmp_name'])) {
74
+            $this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
+            $documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
+            $picturePath   = $documentPath.'/images';
77
+
78
+            // fixed width ang height
79
+            if (file_exists($picturePath.'/'.$this->picture)) {
80
+                $this->resizePicture('width', 800);
81
+                $this->save();
82
+            } else {
83
+                return false;
84
+            }
85
+        }
86
+    }
87
+
88
+    function createAnswersForm($form)
89
+    {
90
+        // nothing
91
+    }
92
+
93
+    function processAnswersCreation($form)
94
+    {
95
+        // nothing
96
+    }
97 97
 }
98 98
 
99 99
 /**
@@ -101,35 +101,35 @@  discard block
 block discarded – undo
101 101
  */
102 102
 class HotSpotDelineation extends HotSpot
103 103
 {
104
-	static $typePicture = 'hotspot-delineation.png';
105
-	static $explanationLangVar = 'HotspotDelineation';
106
-
107
-	function __construct()
108
-	{
109
-		parent::__construct();
110
-		$this -> type = HOT_SPOT_DELINEATION;
111
-
112
-	}
113
-
114
-	function createForm (&$form, $fck_config=0)
115
-	{
116
-		parent::createForm ($form, $fck_config);
117
-	}
118
-
119
-	function processCreation ($form, $objExercise = null)
120
-	{
121
-		$file_info = $form -> getSubmitValue('imageUpload');
122
-		parent::processCreation ($form, $objExercise);
123
-	}
124
-
125
-	function createAnswersForm ($form)
126
-	{
127
-		parent::createAnswersForm ($form);
128
-	}
129
-
130
-	function processAnswersCreation ($form)
131
-	{
132
-		parent::processAnswersCreation ($form);
133
-	}
104
+    static $typePicture = 'hotspot-delineation.png';
105
+    static $explanationLangVar = 'HotspotDelineation';
106
+
107
+    function __construct()
108
+    {
109
+        parent::__construct();
110
+        $this -> type = HOT_SPOT_DELINEATION;
111
+
112
+    }
113
+
114
+    function createForm (&$form, $fck_config=0)
115
+    {
116
+        parent::createForm ($form, $fck_config);
117
+    }
118
+
119
+    function processCreation ($form, $objExercise = null)
120
+    {
121
+        $file_info = $form -> getSubmitValue('imageUpload');
122
+        parent::processCreation ($form, $objExercise);
123
+    }
124
+
125
+    function createAnswersForm ($form)
126
+    {
127
+        parent::createAnswersForm ($form);
128
+    }
129
+
130
+    function processAnswersCreation ($form)
131
+    {
132
+        parent::processAnswersCreation ($form);
133
+    }
134 134
 }
135 135
 
Please login to merge, or discard this patch.
main/exercice/hotpotatoes_exercise_result.class.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
     //stores the results
15 15
     private $results = array();
16 16
 
17
-	/**
18
-	 * Gets the results of all students (or just one student if access is limited)
19
-	 * @param	string		The document path (for HotPotatoes retrieval)
20
-	 * @param	integer		User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
21
-	 * @param string $document_path
22
-	 */
23
-	public function getExercisesReporting($document_path, $hotpotato_name)
17
+    /**
18
+     * Gets the results of all students (or just one student if access is limited)
19
+     * @param	string		The document path (for HotPotatoes retrieval)
20
+     * @param	integer		User ID. Optional. If no user ID is provided, we take all the results. Defauts to null
21
+     * @param string $document_path
22
+     */
23
+    public function getExercisesReporting($document_path, $hotpotato_name)
24 24
     {
25
-		$return = array();
25
+        $return = array();
26 26
         $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
27 27
         $TBL_TRACK_HOTPOTATOES	= Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
28 28
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $hotpotato_name  = Database::escape_string($hotpotato_name);
35 35
 
36 36
         if (!empty($exercise_id)) {
37
-          $session_id_and .= " AND exe_exo_id = $exercise_id ";
37
+            $session_id_and .= " AND exe_exo_id = $exercise_id ";
38 38
         }
39 39
 
40 40
         if (empty($user_id)) {
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
         $this->results = $return;
112 112
 
113 113
         return true;
114
-	}
114
+    }
115 115
 
116 116
 
117
-	/**
118
-	 * Exports the complete report as a CSV file
119
-	 * @param	string		Document path inside the document tool
120
-	 * @param	integer		Optional user ID
121
-	 * @param	boolean		Whether to include user fields or not
122
-	 * @return	boolean		False on error
123
-	 */
124
-	public function exportCompleteReportCSV($document_path = '', $hotpotato_name)
117
+    /**
118
+     * Exports the complete report as a CSV file
119
+     * @param	string		Document path inside the document tool
120
+     * @param	integer		Optional user ID
121
+     * @param	boolean		Whether to include user fields or not
122
+     * @return	boolean		False on error
123
+     */
124
+    public function exportCompleteReportCSV($document_path = '', $hotpotato_name)
125 125
     {
126
-		global $charset;
127
-		$this->getExercisesReporting($document_path, $hotpotato_name);
128
-		$filename = 'exercise_results_'.date('YmdGis').'.csv';
129
-		if (!empty($user_id)) {
130
-			$filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
131
-		}
132
-		$data = '';
126
+        global $charset;
127
+        $this->getExercisesReporting($document_path, $hotpotato_name);
128
+        $filename = 'exercise_results_'.date('YmdGis').'.csv';
129
+        if (!empty($user_id)) {
130
+            $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv';
131
+        }
132
+        $data = '';
133 133
 
134 134
         if (api_is_western_name_order()) {
135 135
             if(!empty($this->results[0]['first_name'])) {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         }
149 149
         $data .= get_lang('Email').';';
150 150
 
151
-		/*if ($export_user_fields) {
151
+        /*if ($export_user_fields) {
152 152
 			//show user fields section with a big th colspan that spans over all fields
153 153
 			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
154 154
 			$num = count($extra_user_fields);
@@ -157,25 +157,25 @@  discard block
 block discarded – undo
157 157
 			}
158 158
 		}*/
159 159
 
160
-		$data .= get_lang('Title').';';
161
-		$data .= get_lang('StartDate').';';
162
-		$data .= get_lang('Score').';';
163
-		$data .= get_lang('Total').';';
164
-		$data .= "\n";
160
+        $data .= get_lang('Title').';';
161
+        $data .= get_lang('StartDate').';';
162
+        $data .= get_lang('Score').';';
163
+        $data .= get_lang('Total').';';
164
+        $data .= "\n";
165 165
 
166
-		//results
167
-		foreach($this->results as $row) {
166
+        //results
167
+        foreach($this->results as $row) {
168 168
             if (api_is_western_name_order()) {
169
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
170
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
169
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
170
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
171 171
             } else {
172
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
173
-              $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
172
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
173
+                $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
174 174
             }
175 175
 
176 176
             $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
177 177
 
178
-			/*if ($export_user_fields) {
178
+            /*if ($export_user_fields) {
179 179
 				//show user fields data, if any, for this user
180 180
 				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
181 181
 				foreach($user_fields_values as $value) {
@@ -183,40 +183,40 @@  discard block
 block discarded – undo
183 183
 				}
184 184
 			}*/
185 185
 
186
-			$data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
187
-			$data .= str_replace("\r\n",'  ',$row['exe_date']).';';
188
-			$data .= str_replace("\r\n",'  ',$row['result']).';';
189
-			$data .= str_replace("\r\n",'  ',$row['max']).';';
190
-			$data .= "\n";
191
-		}
192
-
193
-		//output the results
194
-		$len = strlen($data);
195
-		header('Content-type: application/octet-stream');
196
-		header('Content-Type: application/force-download');
197
-		header('Content-length: '.$len);
198
-		if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
199
-			header('Content-Disposition: filename= '.$filename);
200
-		} else {
201
-			header('Content-Disposition: attachment; filename= '.$filename);
202
-		}
203
-		if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
204
-			header('Pragma: ');
205
-			header('Cache-Control: ');
206
-			header('Cache-Control: public'); // IE cannot download from sessions without a cache
207
-		}
208
-		header('Content-Description: '.$filename);
209
-		header('Content-transfer-encoding: binary');
210
-		// @todo add this utf-8 header for all csv files
211
-		echo "\xEF\xBB\xBF";  // force utf-8 header of csv file
212
-		echo $data;
213
-		return true;
214
-	}
215
-
216
-	/**
217
-	 * Exports the complete report as an XLS file
218
-	 * @return	boolean		False on error
219
-	 */
186
+            $data .= str_replace("\r\n",'  ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
187
+            $data .= str_replace("\r\n",'  ',$row['exe_date']).';';
188
+            $data .= str_replace("\r\n",'  ',$row['result']).';';
189
+            $data .= str_replace("\r\n",'  ',$row['max']).';';
190
+            $data .= "\n";
191
+        }
192
+
193
+        //output the results
194
+        $len = strlen($data);
195
+        header('Content-type: application/octet-stream');
196
+        header('Content-Type: application/force-download');
197
+        header('Content-length: '.$len);
198
+        if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
199
+            header('Content-Disposition: filename= '.$filename);
200
+        } else {
201
+            header('Content-Disposition: attachment; filename= '.$filename);
202
+        }
203
+        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
204
+            header('Pragma: ');
205
+            header('Cache-Control: ');
206
+            header('Cache-Control: public'); // IE cannot download from sessions without a cache
207
+        }
208
+        header('Content-Description: '.$filename);
209
+        header('Content-transfer-encoding: binary');
210
+        // @todo add this utf-8 header for all csv files
211
+        echo "\xEF\xBB\xBF";  // force utf-8 header of csv file
212
+        echo $data;
213
+        return true;
214
+    }
215
+
216
+    /**
217
+     * Exports the complete report as an XLS file
218
+     * @return	boolean		False on error
219
+     */
220 220
     public function exportCompleteReportXLS(
221 221
         $document_path = '',
222 222
         $user_id = null,
@@ -225,37 +225,37 @@  discard block
 block discarded – undo
225 225
         $exercise_id = 0,
226 226
         $hotpotato_name = null
227 227
     ) {
228
-		global $charset;
229
-		$this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
230
-		$filename = 'exercise_results_'.api_get_local_time().'.xls';
231
-		if (!empty($user_id)) {
232
-			$filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
233
-		}
228
+        global $charset;
229
+        $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name);
230
+        $filename = 'exercise_results_'.api_get_local_time().'.xls';
231
+        if (!empty($user_id)) {
232
+            $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls';
233
+        }
234 234
 
235 235
         $spreadsheet = new PHPExcel();
236 236
         $spreadsheet->setActiveSheetIndex(0);
237 237
         $worksheet = $spreadsheet->getActiveSheet();
238 238
 
239 239
 
240
-		$line = 0;
241
-		$column = 0; //skip the first column (row titles)
240
+        $line = 0;
241
+        $column = 0; //skip the first column (row titles)
242 242
 
243
-		// check if exists column 'user'
244
-		$with_column_user = false;
245
-		foreach ($this->results as $result) {
246
-			if (!empty($result['last_name']) && !empty($result['first_name'])) {
247
-				$with_column_user = true;
248
-				break;
249
-			}
250
-		}
243
+        // check if exists column 'user'
244
+        $with_column_user = false;
245
+        foreach ($this->results as $result) {
246
+            if (!empty($result['last_name']) && !empty($result['first_name'])) {
247
+                $with_column_user = true;
248
+                break;
249
+            }
250
+        }
251 251
 
252
-		if ($with_column_user) {
253
-		    $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email'));
254
-		    $column++;
252
+        if ($with_column_user) {
253
+            $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email'));
254
+            $column++;
255 255
 
256 256
             if (api_is_western_name_order()) {
257
-    			$worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
258
-    			$column++;
257
+                $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
258
+                $column++;
259 259
                 $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName'));
260 260
                 $column++;
261 261
             } else {
@@ -264,36 +264,36 @@  discard block
 block discarded – undo
264 264
                 $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName'));
265 265
                 $column++;
266 266
             }
267
-		}
267
+        }
268 268
 
269
-		if ($export_user_fields) {
270
-			//show user fields section with a big th colspan that spans over all fields
271
-			$extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
269
+        if ($export_user_fields) {
270
+            //show user fields section with a big th colspan that spans over all fields
271
+            $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1);
272 272
 
273
-			//show the fields names for user fields
274
-			foreach ($extra_user_fields as $field) {
275
-				$worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
276
-				$column++;
277
-			}
278
-		}
273
+            //show the fields names for user fields
274
+            foreach ($extra_user_fields as $field) {
275
+                $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
276
+                $column++;
277
+            }
278
+        }
279 279
 
280
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title'));
281
-		$column++;
282
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate'));
280
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title'));
281
+        $column++;
282
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate'));
283 283
         $column++;
284 284
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate'));
285 285
         $column++;
286 286
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')');
287
-		$column++;
288
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score'));
289
-		$column++;
290
-		$worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total'));
291
-		$column++;
287
+        $column++;
288
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score'));
289
+        $column++;
290
+        $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total'));
291
+        $column++;
292 292
         $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status'));
293
-		$line++;
293
+        $line++;
294 294
 
295
-		foreach ($this->results as $row) {
296
-			$column = 0;
295
+        foreach ($this->results as $row) {
296
+            $column = 0;
297 297
 
298 298
             if ($with_column_user) {
299 299
                 $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset));
@@ -310,38 +310,38 @@  discard block
 block discarded – undo
310 310
                     $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
311 311
                     $column++;
312 312
                 }
313
-			}
313
+            }
314 314
 
315
-			if ($export_user_fields) {
316
-				//show user fields data, if any, for this user
317
-				$user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
318
-				foreach($user_fields_values as $value) {
319
-					$worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
320
-					$column++;
321
-				}
322
-			}
315
+            if ($export_user_fields) {
316
+                //show user fields data, if any, for this user
317
+                $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true);
318
+                foreach($user_fields_values as $value) {
319
+                    $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset));
320
+                    $column++;
321
+                }
322
+            }
323 323
 
324
-			$worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
325
-			$column++;
326
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']);
324
+            $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
325
+            $column++;
326
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']);
327 327
             $column++;
328
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']);
328
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']);
329
+            $column++;
330
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']);
331
+            $column++;
332
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']);
333
+            $column++;
334
+            $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']);
329 335
             $column++;
330
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']);
331
-			$column++;
332
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']);
333
-			$column++;
334
-			$worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']);
335
-			$column++;
336 336
             $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']);
337
-			$line++;
338
-		}
337
+            $line++;
338
+        }
339 339
 
340 340
         $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
341 341
         $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
342 342
         $writer->save($file);
343 343
         DocumentManager::file_send_for_download($file, true, $filename);
344 344
 
345
-		return true;
346
-	}
345
+        return true;
346
+    }
347 347
 }
Please login to merge, or discard this patch.
main/exercice/addlimits.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 $is_allowedToEdit=$is_courseAdmin;
55 55
 
56 56
 if (isset($_SESSION['gradebook'])){
57
-	$gradebook=	$_SESSION['gradebook'];
57
+    $gradebook=	$_SESSION['gradebook'];
58 58
 }
59 59
 
60 60
 if (!empty($gradebook) && $gradebook=='view') {
61
-	$interbreadcrumb[]= array (
61
+    $interbreadcrumb[]= array (
62 62
         'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
63 63
         'name' => get_lang('ToolGradebook')
64 64
     );
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 Display::display_header($nameTools,"Exercises");
72 72
 
73 73
 if (isset($_POST['ok'])) {
74
-	$message = get_lang('TestLimitsAdded');
75
-	Display::display_normal_message($message);
74
+    $message = get_lang('TestLimitsAdded');
75
+    Display::display_normal_message($message);
76 76
 }
77 77
 ?>
78 78
 <script type="text/javascript">
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
  * @todo shouldn't this be moved to the part above (around line 111: action handling)
140 140
  */
141 141
 if (isset($_POST['ok'])) {
142
-	$exercise_id = intval($_POST['exe_id']);
143
-	if ($_POST['limit']==1) {
144
-		$minutes = intval($_POST['minutes']);
145
-		$query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id";
146
-		Database::query($query);
147
-	} else {
148
-		$query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id";
149
-		Database::query($query);
150
-	}
142
+    $exercise_id = intval($_POST['exe_id']);
143
+    if ($_POST['limit']==1) {
144
+        $minutes = intval($_POST['minutes']);
145
+        $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id";
146
+        Database::query($query);
147
+    } else {
148
+        $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id";
149
+        Database::query($query);
150
+    }
151 151
 
152
-	if ($_POST['attempt']==1) {
153
-		$attempts = intval($_POST['attempts']);
154
-		$query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id";
155
-		Database::query($query);
156
-	} else {
157
-		$query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id";
158
-		Database::query($query);
159
-	}
152
+    if ($_POST['attempt']==1) {
153
+        $attempts = intval($_POST['attempts']);
154
+        $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id";
155
+        Database::query($query);
156
+    } else {
157
+        $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id";
158
+        Database::query($query);
159
+    }
160 160
 }
Please login to merge, or discard this patch.