Passed
Push — 1.10.x ( e86630...7dd9ca )
by
unknown
53:41
created
main/document/edit_document.php 1 patch
Indentation   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 $sessionId = api_get_session_id();
66 66
 
67 67
 if (api_is_in_group()) {
68
-	$group_properties = GroupManager::get_group_properties($group_id);
68
+    $group_properties = GroupManager::get_group_properties($group_id);
69 69
 }
70 70
 
71 71
 $dir = '/';
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $_GET['id'],
78 78
         api_get_course_id(),
79 79
         true,
80
-		0
80
+        0
81 81
     );
82 82
 
83 83
     if (!empty($sessionId) && empty($document_data)) {
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
         );
90 90
     }
91 91
 
92
-	$document_id = $document_data['id'];
93
-	$file = $document_data['path'];
94
-	$parent_id = DocumentManager::get_document_id($course_info, dirname($file));
95
-	$dir = dirname($document_data['path']);
96
-	$dir_original = $dir;
97
-	$doc = basename($file);
98
-	$readonly = $document_data['readonly'];
92
+    $document_id = $document_data['id'];
93
+    $file = $document_data['path'];
94
+    $parent_id = DocumentManager::get_document_id($course_info, dirname($file));
95
+    $dir = dirname($document_data['path']);
96
+    $dir_original = $dir;
97
+    $doc = basename($file);
98
+    $readonly = $document_data['readonly'];
99 99
 }
100 100
 
101 101
 if (empty($document_data)) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 // Level correction for group documents.
119 119
 if (!empty($group_properties['directory'])) {
120
-	$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
120
+    $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
121 121
 }
122 122
 $relative_url = '';
123 123
 for ($i = 0; $i < ($count_dir); $i++) {
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 );
140 140
 
141 141
 if ($is_certificate_mode) {
142
-	$editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
143
-	$editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
144
-	$editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
142
+    $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
143
+    $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
144
+    $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
145 145
 }
146 146
 
147 147
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']||
148
-	DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId);
148
+    DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId);
149 149
 $noPHP_SELF = true;
150 150
 
151 151
 /*	Other initialization code */
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
         'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
159 159
         'name' => get_lang('GroupSpace'),
160 160
     );
161
-	$group_document = true;
162
-	$noPHP_SELF = true;
161
+    $group_document = true;
162
+    $noPHP_SELF = true;
163 163
 }
164 164
 
165 165
 if (!$is_certificate_mode) {
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
 //TODO:check the below code and his funcionality
195 195
 if (!api_is_allowed_to_edit()) {
196
-	if (DocumentManager::check_readonly($course_info, $user_id, $file)) {
197
-		api_not_allowed();
198
-	}
196
+    if (DocumentManager::check_readonly($course_info, $user_id, $file)) {
197
+        api_not_allowed();
198
+    }
199 199
 }
200 200
 
201 201
 /* MAIN TOOL CODE */
@@ -203,18 +203,18 @@  discard block
 block discarded – undo
203 203
 /*	Code to change the comment	*/
204 204
 
205 205
 if (isset($_POST['comment'])) {
206
-	// Fixing the path if it is wrong
207
-	$comment = trim($_POST['comment']);
208
-	$title = trim($_POST['title']);
206
+    // Fixing the path if it is wrong
207
+    $comment = trim($_POST['comment']);
208
+    $title = trim($_POST['title']);
209 209
 
210 210
     // Just in case see BT#3525
211 211
     if (empty($title)) {
212
-		$title = $document_data['title'];
213
-	}
212
+        $title = $document_data['title'];
213
+    }
214 214
 
215
-	if (empty($title)) {
216
-		$title = get_document_title($_POST['filename']);
217
-	}
215
+    if (empty($title)) {
216
+        $title = get_document_title($_POST['filename']);
217
+    }
218 218
 
219 219
     if (!empty($document_id)) {
220 220
         $params = [
@@ -226,43 +226,43 @@  discard block
 block discarded – undo
226 226
             $params,
227 227
             ['c_id = ? AND id = ?' => [$course_id, $document_id]]
228 228
         );
229
-		Display::addFlash(Display::return_message(get_lang('fileModified')));
229
+        Display::addFlash(Display::return_message(get_lang('fileModified')));
230 230
     }
231 231
 }
232 232
 
233 233
 /*	WYSIWYG HTML EDITOR - Program Logic */
234 234
 if ($is_allowed_to_edit) {
235
-	if (isset($_POST['formSent']) && $_POST['formSent'] == 1) {
235
+    if (isset($_POST['formSent']) && $_POST['formSent'] == 1) {
236 236
 
237
-		$filename = stripslashes($_POST['filename']);
237
+        $filename = stripslashes($_POST['filename']);
238 238
         $extension = $_POST['extension'];
239
-		$content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null;
240
-		$content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY);
239
+        $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null;
240
+        $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY);
241 241
 
242 242
         if ($dir == '/') {
243 243
             $dir = '';
244 244
         }
245 245
 
246
-		$file = $dir.'/'.$filename.'.'.$extension;
247
-		$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
248
-		$read_only_flag = empty($read_only_flag) ? 0 : 1;
246
+        $file = $dir.'/'.$filename.'.'.$extension;
247
+        $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
248
+        $read_only_flag = empty($read_only_flag) ? 0 : 1;
249 249
 
250
-		if (empty($filename)) {
250
+        if (empty($filename)) {
251 251
             Display::addFlash(Display::return_message(get_lang('NoFileName'), 'warning'));
252
-		} else {
252
+        } else {
253 253
 
254
-		    $file_size = filesize($document_data['absolute_path']);
254
+            $file_size = filesize($document_data['absolute_path']);
255 255
 
256
-			if ($read_only_flag == 0) {
257
-				if (!empty($content)) {
258
-					if ($fp = @fopen($document_data['absolute_path'], 'w')) {
259
-						// For flv player, change absolute path temporarily to prevent from erasing it in the following lines
260
-						$content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content);
261
- 						fputs($fp, $content);
262
-						fclose($fp);
256
+            if ($read_only_flag == 0) {
257
+                if (!empty($content)) {
258
+                    if ($fp = @fopen($document_data['absolute_path'], 'w')) {
259
+                        // For flv player, change absolute path temporarily to prevent from erasing it in the following lines
260
+                        $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content);
261
+                            fputs($fp, $content);
262
+                        fclose($fp);
263 263
 
264 264
                         $filepath = $document_data['absolute_parent_path'];
265
-						/*
265
+                        /*
266 266
 						if (!is_dir($filepath.'css')) {
267 267
 							mkdir($filepath.'css', api_get_permissions_for_new_directories());
268 268
 							$doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 							);
293 293
 						}*/
294 294
 
295
-						/*if (!is_file($filepath.'css/frames.css')) {
295
+                        /*if (!is_file($filepath.'css/frames.css')) {
296 296
 							$platform_theme = api_get_setting('stylesheets');
297 297
 							if (file_exists(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css')) {
298 298
 								copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css', $filepath.'css/frames.css');
@@ -330,54 +330,54 @@  discard block
 block discarded – undo
330 330
 							}
331 331
 						}*/
332 332
 
333
-						// "WHAT'S NEW" notification: update table item_property
334
-						$document_id = DocumentManager::get_document_id($_course, $file);
335
-
336
-						if ($document_id) {
337
-							update_existing_document(
338
-								$_course,
339
-								$document_id,
340
-								$file_size,
341
-								$read_only_flag
342
-							);
343
-							api_item_property_update(
344
-								$_course,
345
-								TOOL_DOCUMENT,
346
-								$document_id,
347
-								'DocumentUpdated',
348
-								api_get_user_id(),
349
-								null,
350
-								null,
351
-								null,
352
-								null,
353
-								$sessionId
354
-							);
355
-							// Update parent folders
356
-							item_property_update_on_folder(
357
-								$_course,
358
-								$dir,
359
-								api_get_user_id()
360
-							);
361
-							header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':''));
362
-							exit;
363
-						} else {
333
+                        // "WHAT'S NEW" notification: update table item_property
334
+                        $document_id = DocumentManager::get_document_id($_course, $file);
335
+
336
+                        if ($document_id) {
337
+                            update_existing_document(
338
+                                $_course,
339
+                                $document_id,
340
+                                $file_size,
341
+                                $read_only_flag
342
+                            );
343
+                            api_item_property_update(
344
+                                $_course,
345
+                                TOOL_DOCUMENT,
346
+                                $document_id,
347
+                                'DocumentUpdated',
348
+                                api_get_user_id(),
349
+                                null,
350
+                                null,
351
+                                null,
352
+                                null,
353
+                                $sessionId
354
+                            );
355
+                            // Update parent folders
356
+                            item_property_update_on_folder(
357
+                                $_course,
358
+                                $dir,
359
+                                api_get_user_id()
360
+                            );
361
+                            header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':''));
362
+                            exit;
363
+                        } else {
364 364
                             Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning'));
365
-						}
366
-					} else {
365
+                        }
366
+                    } else {
367 367
                         Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning'));
368
-					}
369
-				} else {
370
-					if ($document_id) {
368
+                    }
369
+                } else {
370
+                    if ($document_id) {
371 371
                         update_existing_document($_course, $document_id, $file_size, $read_only_flag);
372
-					}
373
-				}
374
-			} else {
372
+                    }
373
+                }
374
+            } else {
375 375
                 if ($document_id) {
376 376
                     update_existing_document($_course, $document_id, $file_size, $read_only_flag);
377 377
                 }
378
-			}
379
-		}
380
-	}
378
+            }
379
+        }
380
+    }
381 381
 }
382 382
 
383 383
 // Replace relative paths by absolute web paths (e.g. './' => 'http://www.chamilo.org/courses/ABC/document/')
@@ -431,35 +431,35 @@  discard block
 block discarded – undo
431 431
         api_get_group_id()
432 432
     )
433 433
 ) {
434
-	$action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq();
434
+    $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq();
435 435
     if ($is_certificate_mode) {
436 436
         $action .= '&curdirpath=/certificates&selectcat=1';
437 437
     }
438
-	$form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical'));
439
-
440
-	// Form title
441
-	$form->addElement('header', $nameTools);
442
-	$form->addElement('hidden', 'filename');
443
-	$form->addElement('hidden', 'extension');
444
-	$form->addElement('hidden', 'file_path');
445
-	$form->addElement('hidden', 'commentPath');
446
-	$form->addElement('hidden', 'showedit');
447
-	$form->addElement('hidden', 'origin');
448
-	$form->addElement('hidden', 'origin_opt');
438
+    $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical'));
439
+
440
+    // Form title
441
+    $form->addElement('header', $nameTools);
442
+    $form->addElement('hidden', 'filename');
443
+    $form->addElement('hidden', 'extension');
444
+    $form->addElement('hidden', 'file_path');
445
+    $form->addElement('hidden', 'commentPath');
446
+    $form->addElement('hidden', 'showedit');
447
+    $form->addElement('hidden', 'origin');
448
+    $form->addElement('hidden', 'origin_opt');
449 449
     $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
450 450
 
451
-	$defaults['title'] = $document_data['title'];
451
+    $defaults['title'] = $document_data['title'];
452 452
 
453
-	$form->addElement('hidden', 'formSent');
454
-	$defaults['formSent'] = 1;
453
+    $form->addElement('hidden', 'formSent');
454
+    $defaults['formSent'] = 1;
455 455
 
456
-	$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
456
+    $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
457 457
 
458
-	// Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
459
-	// This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
460
-	$defaults['content'] = str_replace('<!--[', '<!-- [', $content);
458
+    // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
459
+    // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
460
+    $defaults['content'] = str_replace('<!--[', '<!-- [', $content);
461 461
 
462
-	// HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
462
+    // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
463 463
 
464 464
     $showSystemFolders = api_get_course_setting('show_system_folders');
465 465
     $condition = stripos($dir, '/HotPotatoes_files') === false;
@@ -467,44 +467,44 @@  discard block
 block discarded – undo
467 467
         $condition = true;
468 468
     }
469 469
 
470
-	if (($extension == 'htm' || $extension == 'html') && $condition) {
471
-		if (empty($readonly) && $readonly == 0) {
470
+    if (($extension == 'htm' || $extension == 'html') && $condition) {
471
+        if (empty($readonly) && $readonly == 0) {
472 472
             $form->addHtmlEditor('content', '', true, true, $editorConfig);
473
-		}
474
-	}
473
+        }
474
+    }
475 475
 
476
-	if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) {
477
-		// Updated on field
478
-		$last_edit_date = api_get_local_time($last_edit_date);
476
+    if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) {
477
+        // Updated on field
478
+        $last_edit_date = api_get_local_time($last_edit_date);
479 479
         $display_date = date_to_str_ago($last_edit_date).' <span class="dropbox_date">'.api_format_date($last_edit_date).'</span>';
480
-		$form->addElement('static', null, get_lang('UpdatedOn'), $display_date);
481
-	}
480
+        $form->addElement('static', null, get_lang('UpdatedOn'), $display_date);
481
+    }
482 482
 
483
-	$form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]);
483
+    $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]);
484 484
 
485
-	if ($owner_id == api_get_user_id() || api_is_platform_admin()) {
486
-		$checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly'));
487
-		if ($readonly == 1) {
488
-			$checked->setChecked(true);
489
-		}
490
-	}
485
+    if ($owner_id == api_get_user_id() || api_is_platform_admin()) {
486
+        $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly'));
487
+        if ($readonly == 1) {
488
+            $checked->setChecked(true);
489
+        }
490
+    }
491 491
 
492
-	if ($is_certificate_mode) {
493
-		$form->addButtonUpdate(get_lang('SaveCertificate'));
492
+    if ($is_certificate_mode) {
493
+        $form->addButtonUpdate(get_lang('SaveCertificate'));
494 494
     } else {
495
-		$form->addButtonUpdate(get_lang('SaveDocument'));
495
+        $form->addButtonUpdate(get_lang('SaveDocument'));
496 496
     }
497 497
 
498
-	$defaults['filename'] = $filename;
499
-	$defaults['extension'] = $extension;
500
-	$defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
501
-	$defaults['commentPath'] = $file;
502
-	$defaults['renameTo'] = $file_name;
503
-	$defaults['comment'] = $document_data['comment'];
504
-	$defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
505
-	$defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
498
+    $defaults['filename'] = $filename;
499
+    $defaults['extension'] = $extension;
500
+    $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
501
+    $defaults['commentPath'] = $file;
502
+    $defaults['renameTo'] = $file_name;
503
+    $defaults['comment'] = $document_data['comment'];
504
+    $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
505
+    $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
506 506
 
507
-	$form->setDefaults($defaults);
507
+    $form->setDefaults($defaults);
508 508
 
509 509
     show_return(
510 510
         $parent_id,
@@ -514,25 +514,25 @@  discard block
 block discarded – undo
514 514
         $is_certificate_mode
515 515
     );
516 516
 
517
-	if ($is_certificate_mode) {
518
-		$all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
519
-			api_get_user_id(),
520
-			api_get_course_id()
521
-		);
522
-		$str_info = '';
523
-		foreach ($all_information_by_create_certificate[0] as $info_value) {
524
-			$str_info .= $info_value.'<br/>';
525
-		}
526
-		$create_certificate=get_lang('CreateCertificateWithTags');
527
-		Display::display_normal_message(
528
-			$create_certificate.': <br /><br />'.$str_info,
529
-			false
530
-		);
531
-	}
532
-
533
-	if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){
534
-		Display::display_warning_message(get_lang('BrowserDontSupportsSVG'));
535
-	}
517
+    if ($is_certificate_mode) {
518
+        $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
519
+            api_get_user_id(),
520
+            api_get_course_id()
521
+        );
522
+        $str_info = '';
523
+        foreach ($all_information_by_create_certificate[0] as $info_value) {
524
+            $str_info .= $info_value.'<br/>';
525
+        }
526
+        $create_certificate=get_lang('CreateCertificateWithTags');
527
+        Display::display_normal_message(
528
+            $create_certificate.': <br /><br />'.$str_info,
529
+            false
530
+        );
531
+    }
532
+
533
+    if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){
534
+        Display::display_warning_message(get_lang('BrowserDontSupportsSVG'));
535
+    }
536 536
     echo '<div class="row" style="overflow:hidden">
537 537
             <div id="template_col" class="col-md-2">
538 538
                 <div class="panel panel-default">
@@ -560,57 +560,57 @@  discard block
 block discarded – undo
560 560
 */
561 561
 function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc)
562 562
 {
563
-	$file_name_for_change = $base_work_dir.$dir.$source_file;
563
+    $file_name_for_change = $base_work_dir.$dir.$source_file;
564 564
     $rename_to = disable_dangerous_file($rename_to); // Avoid renaming to .htaccess file
565
-	$rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API
566
-
567
-	if ($rename_to) {
568
-		if (isset($dir) && $dir != '') {
569
-			$source_file = $dir.$source_file;
570
-			$new_full_file_name = dirname($source_file).'/'.$rename_to;
571
-		} else {
572
-			$source_file = '/'.$source_file;
573
-			$new_full_file_name = '/'.$rename_to;
574
-		}
575
-
576
-		update_db_info('update', $source_file, $new_full_file_name); // fileManage API
565
+    $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API
566
+
567
+    if ($rename_to) {
568
+        if (isset($dir) && $dir != '') {
569
+            $source_file = $dir.$source_file;
570
+            $new_full_file_name = dirname($source_file).'/'.$rename_to;
571
+        } else {
572
+            $source_file = '/'.$source_file;
573
+            $new_full_file_name = '/'.$rename_to;
574
+        }
575
+
576
+        update_db_info('update', $source_file, $new_full_file_name); // fileManage API
577 577
         Display::addFlash(Display::return_message(get_lang('fileModified')));
578 578
 
579
-		return true;
580
-	} else {
579
+        return true;
580
+    } else {
581 581
         Display::addFlash(Display::return_message(get_lang('FileExists')));
582
-	}
582
+    }
583 583
 }
584 584
 
585 585
 //return button back to
586 586
 function show_return($document_id, $path, $call_from_tool='', $slide_id=0, $is_certificate_mode=false)
587 587
 {
588 588
     global $parent_id;
589
-	echo '<div class="actions">';
589
+    echo '<div class="actions">';
590 590
 
591 591
     $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id;
592 592
 
593
-	if ($is_certificate_mode) {
594
-		echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['curdirpath']).'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
593
+    if ($is_certificate_mode) {
594
+        echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['curdirpath']).'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
595 595
             Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
596
-	} elseif($call_from_tool=='slideshow') {
597
-		echo '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'.
596
+    } elseif($call_from_tool=='slideshow') {
597
+        echo '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'.
598 598
             Display::return_icon('slideshow.png', get_lang('BackTo').' '.get_lang('ViewSlideshow'),'',ICON_SIZE_MEDIUM).'</a>';
599
-	} elseif($call_from_tool=='editdraw') {
600
-		echo '<a href="'.$url.'">'.
599
+    } elseif($call_from_tool=='editdraw') {
600
+        echo '<a href="'.$url.'">'.
601 601
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
602
-		echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>';
603
-	} elseif($call_from_tool=='editodf') {
602
+        echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>';
603
+    } elseif($call_from_tool=='editodf') {
604 604
         echo '<a href="'.$url.'">'.
605 605
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
606 606
         echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Write'), array(), 32).'</a>';
607 607
     } elseif($call_from_tool=='editpaint'){
608
-		echo '<a href="'.$url.'">'.
608
+        echo '<a href="'.$url.'">'.
609 609
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), array(), ICON_SIZE_MEDIUM).'</a>';
610
-		echo '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>';
611
-	} else {
612
-		echo '<a href="'.$url.'">'.
610
+        echo '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>';
611
+    } else {
612
+        echo '<a href="'.$url.'">'.
613 613
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
614
-	}
615
-	echo '</div>';
614
+    }
615
+    echo '</div>';
616 616
 }
Please login to merge, or discard this patch.
main/survey/survey.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 // Coach can't view this page
21 21
 $extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey');
22 22
 $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
23
-	api_get_user_id(),
24
-	api_get_course_info()
23
+    api_get_user_id(),
24
+    api_get_course_info()
25 25
 );
26 26
 
27 27
 if ($isDrhOfCourse) {
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 if (!api_is_allowed_to_edit(false, true) ||
32 32
     (api_is_course_coach() && $extend_rights_for_coachs == 'false')
33 33
 ) {
34
-	Display :: display_header(get_lang('ToolSurvey'));
35
-	Display :: display_error_message(get_lang('NotAllowed'), false);
36
-	Display :: display_footer();
37
-	exit;
34
+    Display :: display_header(get_lang('ToolSurvey'));
35
+    Display :: display_error_message(get_lang('NotAllowed'), false);
36
+    Display :: display_footer();
37
+    exit;
38 38
 }
39 39
 
40 40
 // Database table definitions
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 // Breadcrumbs
53 53
 $interbreadcrumb[] = array(
54
-		'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
55
-		'name' => get_lang('SurveyList'),
54
+        'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
55
+        'name' => get_lang('SurveyList'),
56 56
 );
57 57
 
58 58
 // Getting the survey information
59 59
 if (!empty($_GET['survey_id'])) {
60
-	$course_code = api_get_course_id();
61
-	if ($course_code!=-1) {
62
-		$survey_data = SurveyManager::get_survey($survey_id);
63
-	} else {
64
-		Display :: display_header(get_lang('ToolSurvey'));
65
-		Display :: display_error_message(get_lang('NotAllowed'), false);
66
-		Display :: display_footer();
67
-		exit;
68
-	}
60
+    $course_code = api_get_course_id();
61
+    if ($course_code!=-1) {
62
+        $survey_data = SurveyManager::get_survey($survey_id);
63
+    } else {
64
+        Display :: display_header(get_lang('ToolSurvey'));
65
+        Display :: display_error_message(get_lang('NotAllowed'), false);
66
+        Display :: display_footer();
67
+        exit;
68
+    }
69 69
 } else {
70 70
     Display :: display_header(get_lang('ToolSurvey'));
71 71
     Display :: display_error_message(get_lang('NotAllowed'), false);
@@ -78,30 +78,30 @@  discard block
 block discarded – undo
78 78
 $is_survey_type_1 = $survey_data['survey_type'] == 1;
79 79
 
80 80
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
81
-	$tool_name .= '...';
81
+    $tool_name .= '...';
82 82
 }
83 83
 
84 84
 if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
85
-	$_POST['name'] = trim($_POST['name']);
86
-	if ($action == 'addgroup') {
87
-		if (!empty($_POST['group_id'])) {
88
-			Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
85
+    $_POST['name'] = trim($_POST['name']);
86
+    if ($action == 'addgroup') {
87
+        if (!empty($_POST['group_id'])) {
88
+            Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
89 89
 			                 WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\'');
90
-			$sendmsg = 'GroupUpdatedSuccessfully';
91
-		} elseif(!empty($_POST['name'])) {
92
-			Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
93
-			$sendmsg = 'GroupCreatedSuccessfully';
94
-		} else {
95
-			$sendmsg = 'GroupNeedName';
96
-		}
97
-	}
98
-
99
-	if ($action == 'deletegroup') {
100
-		Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
101
-		$sendmsg = 'GroupDeletedSuccessfully';
102
-	}
103
-	header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
104
-	exit;
90
+            $sendmsg = 'GroupUpdatedSuccessfully';
91
+        } elseif(!empty($_POST['name'])) {
92
+            Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
93
+            $sendmsg = 'GroupCreatedSuccessfully';
94
+        } else {
95
+            $sendmsg = 'GroupNeedName';
96
+        }
97
+    }
98
+
99
+    if ($action == 'deletegroup') {
100
+        Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
101
+        $sendmsg = 'GroupDeletedSuccessfully';
102
+    }
103
+    header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
104
+    exit;
105 105
 }
106 106
 
107 107
 // Displaying the header
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 $message_information    = isset($_GET['message']) ? Security::remove_XSS($_GET['message']) : null;
116 116
 
117 117
 if (isset($action)) {
118
-	if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
119
-		SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
120
-		Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
121
-	}
122
-	if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
123
-		SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
124
-	}
118
+    if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
119
+        SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
120
+        Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
121
+    }
122
+    if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
123
+        SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
124
+    }
125 125
 }
126 126
 
127 127
 if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>';
@@ -139,26 +139,26 @@  discard block
 block discarded – undo
139 139
 echo '<div class="actions">'.$survey_actions.'</div>';
140 140
 
141 141
 if ($survey_data['survey_type'] == 0) {
142
-	echo '<div class="panel panel-default">';
142
+    echo '<div class="panel panel-default">';
143 143
         echo '<div class="panel-body">';
144
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>';
145
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>';
146
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>';
147
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>';
148
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>';
149
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>';
150
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>';
151
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>';
152
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>';
153
-	echo '</div>';
144
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>';
145
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>';
146
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>';
147
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>';
148
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>';
149
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>';
150
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>';
151
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>';
152
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>';
153
+    echo '</div>';
154 154
         echo '</div>';
155 155
 } else {
156
-	echo '<div class="panel panel-default">';
156
+    echo '<div class="panel panel-default">';
157 157
         echo '<div class="panel-body">';
158
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=personality&amp;survey_id='.$survey_id.'">';
159
-	echo Display::return_icon("yesno.png");
160
-	echo '</a></div>';
161
-	echo '</div>';
158
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=personality&amp;survey_id='.$survey_id.'">';
159
+    echo Display::return_icon("yesno.png");
160
+    echo '</a></div>';
161
+    echo '</div>';
162 162
         echo '</div>';
163 163
 }
164 164
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 echo '		<th width="50" >'.get_lang('NumberOfOptions').'</th>';
172 172
 echo '		<th width="100">'.get_lang('Modify').'</th>';
173 173
 if ($is_survey_type_1) {
174
-	echo '<th width="100">'.get_lang('Condition').'</th>';
174
+    echo '<th width="100">'.get_lang('Condition').'</th>';
175 175
     echo '<th width="40">'.get_lang('Group').'</th>';
176 176
 }
177 177
 echo '	</tr>';
@@ -198,97 +198,97 @@  discard block
 block discarded – undo
198 198
 $result = Database::query($sql);
199 199
 $question_counter_max = Database::num_rows($result);
200 200
 while ($row = Database::fetch_array($result, 'ASSOC')) {
201
-	echo '<tr>';
202
-	echo '	<td>'.$question_counter.'</td>';
203
-	echo '	<td>';
204
-	if (api_strlen($row['survey_question']) > 100) {
205
-		echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
206
-	} else {
207
-		echo $row['survey_question'];
208
-	}
209
-
210
-	if ($row['type'] == 'yesno') {
211
-		$tool_name = get_lang('YesNo');
212
-	} else if ($row['type'] == 'multiplechoice') {
213
-		$tool_name = get_lang('UniqueSelect');
214
-	} else {
215
-		$tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
216
-	}
217
-
218
-	echo '</td>';
219
-	echo '	<td>'.$tool_name.'</td>';
220
-	echo '	<td>'.$row['number_of_options'].'</td>';
221
-	echo '	<td>';
222
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
223
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
224
-	if ($question_counter > 1) {
225
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
226
-	} else {
227
-		Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
228
-	}
229
-	if ($question_counter < $question_counter_max) {
230
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
231
-	} else {
232
-		Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
233
-	}
234
-	echo '	</td>';
235
-	$question_counter++;
236
-
237
-	if ($is_survey_type_1) {
238
-    	echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
201
+    echo '<tr>';
202
+    echo '	<td>'.$question_counter.'</td>';
203
+    echo '	<td>';
204
+    if (api_strlen($row['survey_question']) > 100) {
205
+        echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
206
+    } else {
207
+        echo $row['survey_question'];
208
+    }
209
+
210
+    if ($row['type'] == 'yesno') {
211
+        $tool_name = get_lang('YesNo');
212
+    } else if ($row['type'] == 'multiplechoice') {
213
+        $tool_name = get_lang('UniqueSelect');
214
+    } else {
215
+        $tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
216
+    }
217
+
218
+    echo '</td>';
219
+    echo '	<td>'.$tool_name.'</td>';
220
+    echo '	<td>'.$row['number_of_options'].'</td>';
221
+    echo '	<td>';
222
+    echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
223
+    echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
224
+    if ($question_counter > 1) {
225
+        echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
226
+    } else {
227
+        Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
228
+    }
229
+    if ($question_counter < $question_counter_max) {
230
+        echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
231
+    } else {
232
+        Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
233
+    }
234
+    echo '	</td>';
235
+    $question_counter++;
236
+
237
+    if ($is_survey_type_1) {
238
+        echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
239 239
         echo '<td>'.(($row['survey_group_pri']==0)?$groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']]:$groups[$row['survey_group_pri']]).'</td>';
240 240
     }
241
-	echo '</tr>';
241
+    echo '</tr>';
242 242
 }
243 243
 
244 244
 echo '</table>';
245 245
 
246 246
 if ($is_survey_type_1) {
247
-	echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
248
-
249
-	if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
250
-		echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
251
-	}
252
-
253
-	if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
254
-		echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
255
-	}
256
-	echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
257
-	echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
258
-	if ($_GET['action'] == 'editgroup') {
259
-		$sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
260
-		$rs = Database::query($sql);
261
-		$editedrow = Database::fetch_array($rs,'ASSOC');
262
-		echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
263
-		echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
264
-		echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
265
-		echo	'<input type="submit" value="'.get_lang('Save').'"'.'<input type="button" value="'.get_lang('Cancel').'" onclick="window.location.href = \'survey.php?survey_id='.Security::remove_XSS($survey_id).'\';" />';
266
-	} else {
267
-		echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
268
-		echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
269
-		echo	'<input type="submit" value="'.get_lang('Create').'"';
270
-	}
271
-	echo	'</form><br />';
272
-
273
-	echo '<table class="data_table">';
274
-	echo '	<tr class="row_odd">';
275
-	echo '		<th width="200">'.get_lang('Name').'</th>';
276
-	echo '		<th>'.get_lang('Description').'</th>';
277
-	echo '		<th width="100">'.get_lang('Modify').'</th>';
278
-	echo '	</tr>';
279
-
280
-	$sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
281
-
282
-	$rs = Database::query($sql);
283
-	while($row = Database::fetch_array($rs,ASSOC)){
284
-		$grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
285
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
286
-		Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
287
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'.
288
-		Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
289
-		'</td></tr>';
290
-	}
291
-	echo $grouplist.'</table>';
247
+    echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
248
+
249
+    if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
250
+        echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
251
+    }
252
+
253
+    if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
254
+        echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
255
+    }
256
+    echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
257
+    echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
258
+    if ($_GET['action'] == 'editgroup') {
259
+        $sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
260
+        $rs = Database::query($sql);
261
+        $editedrow = Database::fetch_array($rs,'ASSOC');
262
+        echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
263
+        echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
264
+        echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
265
+        echo	'<input type="submit" value="'.get_lang('Save').'"'.'<input type="button" value="'.get_lang('Cancel').'" onclick="window.location.href = \'survey.php?survey_id='.Security::remove_XSS($survey_id).'\';" />';
266
+    } else {
267
+        echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
268
+        echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
269
+        echo	'<input type="submit" value="'.get_lang('Create').'"';
270
+    }
271
+    echo	'</form><br />';
272
+
273
+    echo '<table class="data_table">';
274
+    echo '	<tr class="row_odd">';
275
+    echo '		<th width="200">'.get_lang('Name').'</th>';
276
+    echo '		<th>'.get_lang('Description').'</th>';
277
+    echo '		<th width="100">'.get_lang('Modify').'</th>';
278
+    echo '	</tr>';
279
+
280
+    $sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
281
+
282
+    $rs = Database::query($sql);
283
+    while($row = Database::fetch_array($rs,ASSOC)){
284
+        $grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
285
+        '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
286
+        Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
287
+        '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'.
288
+        Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
289
+        '</td></tr>';
290
+    }
291
+    echo $grouplist.'</table>';
292 292
 }
293 293
 
294 294
 Session::erase('answer_count');
Please login to merge, or discard this patch.
main/inc/lib/statsUtils.lib.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $last_day = -1;
156 156
             while ($row = Database::fetch_row($res)) {
157 157
                 $date_array = getdate($row[0]);
158
-                $display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year'];
158
+                $display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
159 159
                 if ($date_array['mday'] == $last_day) {
160 160
                     $days_array[$display_date]++;
161 161
                 } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     &nbsp;
222 222
                 </td>
223 223
                 <td width='10%'>
224
-                    <b>" . get_lang('Hits') . "</b>
224
+                    <b>".get_lang('Hits')."</b>
225 225
                 </td>
226 226
                 <td width='15%'>
227 227
                     <b>%</b>
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     echo "<img src='".Display::returnIconPath('bar_1m.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
250 250
                 }
251 251
                 if ($pourcent != 100) {
252
-                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
252
+                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='".($maxSize - $barwidth)."' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
253 253
                 }
254 254
                 echo "<img src='".Display::returnIconPath('bar_1.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
255 255
                     </td>
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         }
266 266
         echo "<tr bgcolor='#E6E6E6'>
267 267
                 <td width='15%' align='center'>
268
-                    " . get_lang('Total') . "
268
+                    " . get_lang('Total')."
269 269
                 </td>
270 270
                 <td align='right' width='60%'>
271 271
                     &nbsp;
272 272
                 </td>
273 273
                 <td align='center' width='10%'>
274
-                    " . $period_array['total'] . "
274
+                    " . $period_array['total']."
275 275
                 </td>
276 276
                 <td width='15%'>
277 277
                     &nbsp;
Please login to merge, or discard this patch.
main/inc/lib/display.lib.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param string Optional help file name
56 56
      * @param string $page_header
57 57
      */
58
-    public static function display_header($tool_name ='', $help = null, $page_header = null)
58
+    public static function display_header($tool_name = '', $help = null, $page_header = null)
59 59
     {
60 60
         $origin = api_get_origin();
61 61
         $showHeader = true;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $grid_class = array(),
352 352
         $elementCount = 0
353 353
     ) {
354
-        $column =  0;
354
+        $column = 0;
355 355
         $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
356 356
 
357 357
         $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      * @param bool	Filter (true) or not (false)
477 477
      * @return void
478 478
      */
479
-    public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
479
+    public static function display_confirmation_message($message, $filter = true, $returnValue = false)
480 480
     {
481 481
         $message = self::return_message($message, 'confirm', $filter);
482 482
         if ($returnValue) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param bool	Filter (true) or not (false)
494 494
      * @return void
495 495
      */
496
-    public static function display_error_message ($message, $filter = true, $returnValue = false)
496
+    public static function display_error_message($message, $filter = true, $returnValue = false)
497 497
     {
498 498
         $message = self::return_message($message, 'error', $filter);
499 499
         if ($returnValue) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
      * @param string $type
509 509
      * @param bool $filter
510 510
      */
511
-    public static function return_message_and_translate($message, $type='normal', $filter = true)
511
+    public static function return_message_and_translate($message, $type = 'normal', $filter = true)
512 512
     {
513 513
         $message = get_lang($message);
514 514
         echo self::return_message($message, $type, $filter);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         }
533 533
 
534 534
         $class = "";
535
-        switch($type) {
535
+        switch ($type) {
536 536
             case 'warning':
537 537
                $class .= 'alert alert-warning';
538 538
                break;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
      * @param string  optional, class from stylesheet
561 561
      * @return string encrypted mailto hyperlink
562 562
      */
563
-    public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '')
563
+    public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '')
564 564
     {
565 565
         if (is_null($clickable_text)) {
566 566
             $clickable_text = $email;
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
         }
576 576
         // Encrypt email
577 577
         $hmail = '';
578
-        for ($i = 0; $i < strlen($email); $i ++) {
578
+        for ($i = 0; $i < strlen($email); $i++) {
579 579
             $hmail .= '&#'.ord($email {
580 580
             $i }).';';
581 581
         }
582 582
         $hclickable_text = null;
583 583
         // Encrypt clickable text if @ is present
584 584
         if (strpos($clickable_text, '@')) {
585
-            for ($i = 0; $i < strlen($clickable_text); $i ++) {
585
+            for ($i = 0; $i < strlen($clickable_text); $i++) {
586 586
                 $hclickable_text .= '&#'.ord($clickable_text {
587 587
                 $i }).';';
588 588
             }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         }
615 615
         // Encrypt email
616 616
         $hmail = '';
617
-        for ($i = 0; $i < strlen($email); $i ++) {
617
+        for ($i = 0; $i < strlen($email); $i++) {
618 618
             $hmail .= '&#'.ord($email {
619 619
             $i }).';';
620 620
         }
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     public static function get_alphabet_options($selected_letter = '')
648 648
     {
649 649
         $result = '';
650
-        for ($i = 65; $i <= 90; $i ++) {
650
+        for ($i = 65; $i <= 90; $i++) {
651 651
             $letter = chr($i);
652 652
             $result .= '<option value="'.$letter.'"';
653 653
             if ($selected_letter == $letter) {
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
     public static function get_numeric_options($min, $max, $selected_num = 0)
669 669
     {
670 670
         $result = '';
671
-        for ($i = $min; $i <= $max; $i ++) {
671
+        for ($i = $min; $i <= $max; $i++) {
672 672
             $result .= '<option value="'.$i.'"';
673 673
             if (is_int($selected_num))
674 674
                 if ($selected_num == $i) {
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
             $size = ICON_SIZE_SMALL;
746 746
         }
747 747
 
748
-        $size_extra = $size . '/';
748
+        $size_extra = $size.'/';
749 749
 
750 750
         // Checking the img/ folder
751 751
         $icon = $w_code_path.'img/'.$image;
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
         $theme = 'themes/chamilo/icons/';
754 754
 
755 755
         if ($loadThemeIcon) {
756
-            $theme = 'themes/' . api_get_visual_theme() . '/icons/';
756
+            $theme = 'themes/'.api_get_visual_theme().'/icons/';
757 757
             // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
758 758
             if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
759 759
                 $icon = $alternateWebCssPath.$theme.$size_extra.$image;
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
             }
860 860
         }
861 861
         //some tags don't have this </XXX>
862
-        if (in_array($tag, array('img','input','br'))) {
862
+        if (in_array($tag, array('img', 'input', 'br'))) {
863 863
             $return_value = '<'.$tag.' '.$attribute_list.' />';
864 864
         } else {
865 865
             $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>';
@@ -912,13 +912,13 @@  discard block
 block discarded – undo
912 912
     public static function input($type, $name, $value, $attributes = array())
913 913
     {
914 914
          if (isset($type)) {
915
-             $attributes['type']= $type;
915
+             $attributes['type'] = $type;
916 916
          }
917 917
          if (isset($name)) {
918
-             $attributes['name']= $name;
918
+             $attributes['name'] = $name;
919 919
          }
920 920
          if (isset($value)) {
921
-             $attributes['value']= $value;
921
+             $attributes['value'] = $value;
922 922
         }
923 923
         return self::tag('input', '', $attributes);
924 924
     }
@@ -951,14 +951,14 @@  discard block
 block discarded – undo
951 951
     ) {
952 952
         $html = '';
953 953
         $extra = '';
954
-        $default_id = 'id="' . $name . '" ';
954
+        $default_id = 'id="'.$name.'" ';
955 955
         foreach ($extra_attributes as $key => $parameter) {
956 956
             if ($key == 'id') {
957 957
                 $default_id = '';
958 958
             }
959
-            $extra .= $key . '="' . $parameter . '" ';
959
+            $extra .= $key.'="'.$parameter.'" ';
960 960
         }
961
-        $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>';
961
+        $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>';
962 962
 
963 963
         if ($show_blank_item) {
964 964
             if (empty($blank_item_text)) {
@@ -966,14 +966,14 @@  discard block
 block discarded – undo
966 966
             } else {
967 967
                 $blank_item_text = Security::remove_XSS($blank_item_text);
968 968
             }
969
-            $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1'));
969
+            $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1'));
970 970
         }
971 971
         if ($values) {
972 972
             foreach ($values as $key => $value) {
973 973
                 if (is_array($value) && isset($value['name'])) {
974 974
                     $value = $value['name'];
975 975
                 }
976
-                $html .= '<option value="' . $key . '"';
976
+                $html .= '<option value="'.$key.'"';
977 977
 
978 978
                 if (is_array($default)) {
979 979
                     foreach ($default as $item) {
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
                     }
989 989
                 }
990 990
 
991
-                $html .= '>' . $value . '</option>';
991
+                $html .= '>'.$value.'</option>';
992 992
             }
993 993
         }
994 994
         $html .= '</select>';
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
      */
1015 1015
     public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array())
1016 1016
     {
1017
-        if (empty($header_list) || count($header_list) == 0 ) {
1017
+        if (empty($header_list) || count($header_list) == 0) {
1018 1018
             return '';
1019 1019
         }
1020 1020
 
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
         $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes);
1053 1053
 
1054
-        return $main_div ;
1054
+        return $main_div;
1055 1055
     }
1056 1056
 
1057 1057
     /**
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
      */
1100 1100
     public static function grid_html($div_id)
1101 1101
     {
1102
-        $table  = self::tag('table','', array('id' => $div_id));
1103
-        $table .= self::tag('div','', array('id' => $div_id.'_pager'));
1102
+        $table  = self::tag('table', '', array('id' => $div_id));
1103
+        $table .= self::tag('div', '', array('id' => $div_id.'_pager'));
1104 1104
         return $table;
1105 1105
     }
1106 1106
 
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
         $obj->colNames      = $column_names;
1162 1162
         $obj->colModel      = $column_model;
1163 1163
         $obj->pager         = '#'.$div_id.'_pager';
1164
-        $obj->datatype  = 'json';
1164
+        $obj->datatype = 'json';
1165 1165
         $obj->viewrecords = 'true';
1166 1166
 
1167 1167
         $all_value = 10000000;
@@ -1222,10 +1222,10 @@  discard block
 block discarded – undo
1222 1222
         // Adding static data.
1223 1223
         if (!empty($data)) {
1224 1224
             $data_var = $div_id.'_data';
1225
-            $json.=' var '.$data_var.' = '.json_encode($data).';';
1225
+            $json .= ' var '.$data_var.' = '.json_encode($data).';';
1226 1226
             $obj->data = $data_var;
1227 1227
             $obj->datatype = 'local';
1228
-            $json.="\n";
1228
+            $json .= "\n";
1229 1229
         }
1230 1230
 
1231 1231
         $obj->end = 'end';
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
         }
1240 1240
 
1241 1241
         // Fixing true/false js values that doesn't need the ""
1242
-        $json_encode = str_replace(':"true"',':true',$json_encode);
1242
+        $json_encode = str_replace(':"true"', ':true', $json_encode);
1243 1243
         // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text
1244 1244
         $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode);
1245
-        $json_encode = str_replace(':"false"',':false',$json_encode);
1245
+        $json_encode = str_replace(':"false"', ':false', $json_encode);
1246 1246
         $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode);
1247
-        $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode);
1247
+        $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode);
1248 1248
 
1249 1249
         // Creating the jqgrid element.
1250 1250
         $json .= '$("#'.$div_id.'").jqGrid({';
@@ -1259,22 +1259,22 @@  discard block
 block discarded – undo
1259 1259
             $groups = '';
1260 1260
             foreach ($extra_params['groupHeaders'] as $group) {
1261 1261
                 //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" },
1262
-                $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText']  . '" },';
1262
+                $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },';
1263 1263
 
1264 1264
             }
1265 1265
             $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", {
1266 1266
                 "useColSpanStyle" : false,
1267 1267
                 "groupHeaders"    : [
1268
-                    ' . $groups . '
1268
+                    ' . $groups.'
1269 1269
                 ]
1270 1270
             });';
1271 1271
         }
1272 1272
 
1273 1273
         $all_text = addslashes(get_lang('All'));
1274 1274
         $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");';
1275
-        $json.= "\n";
1275
+        $json .= "\n";
1276 1276
         // Adding edit/delete icons.
1277
-        $json.= $formatter;
1277
+        $json .= $formatter;
1278 1278
 
1279 1279
         return $json;
1280 1280
     }
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
         }
1306 1306
 
1307 1307
         if (!empty($rows)) {
1308
-	        foreach($rows as $content) {
1308
+	        foreach ($rows as $content) {
1309 1309
 	            $table->setCellContents($row, $column, $content);
1310 1310
                 $row++;
1311 1311
             }
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 
1468 1468
         // Show all tool icons where there is something new.
1469 1469
         $return = '&nbsp;';
1470
-        foreach($notifications as $notification) {
1470
+        foreach ($notifications as $notification) {
1471 1471
             $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date']));
1472 1472
             $type = $notification['lastedit_type'];
1473 1473
             $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)";
@@ -1510,9 +1510,9 @@  discard block
 block discarded – undo
1510 1510
             $tbl_session            = Database :: get_main_table(TABLE_MAIN_SESSION);
1511 1511
             $active = false;
1512 1512
             // Request for the name of the general coach
1513
-            $sql ='SELECT tu.lastname, tu.firstname, ts.*
1513
+            $sql = 'SELECT tu.lastname, tu.firstname, ts.*
1514 1514
                     FROM '.$tbl_session.' ts
1515
-                    LEFT JOIN '.$main_user_table .' tu
1515
+                    LEFT JOIN '.$main_user_table.' tu
1516 1516
                     ON ts.id_coach = tu.user_id
1517 1517
                     WHERE ts.id = '.intval($session_id);
1518 1518
             $rs = Database::query($sql);
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
             $session = array();
1523 1523
             $session['title'] = $session_info['name'];
1524 1524
             $session['coach'] = '';
1525
-            $session['dates'] =  '';
1525
+            $session['dates'] = '';
1526 1526
 
1527 1527
             if (
1528 1528
                 (
@@ -1604,8 +1604,8 @@  discard block
 block discarded – undo
1604 1604
                     );
1605 1605
                 }
1606 1606
 
1607
-                if ( api_get_setting('show_session_coach') === 'true' ) {
1608
-                    $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name(
1607
+                if (api_get_setting('show_session_coach') === 'true') {
1608
+                    $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name(
1609 1609
                         $session_info['firstname'],
1610 1610
                         $session_info['lastname']
1611 1611
                     );
@@ -1657,9 +1657,9 @@  discard block
 block discarded – undo
1657 1657
 		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1658 1658
 
1659 1659
 		if (!empty($percentage)) {
1660
-            $percentage = $percentage*125/100;
1660
+            $percentage = $percentage * 125 / 100;
1661 1661
         }
1662
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1662
+		$accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1663 1663
 
1664 1664
 		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1665 1665
 
@@ -1674,19 +1674,19 @@  discard block
 block discarded – undo
1674 1674
 
1675 1675
 		$labels = array();
1676 1676
 
1677
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1678
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1677
+		$labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1678
+		$labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1679 1679
 		if (!empty($number_of_users_who_voted)) {
1680
-			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1680
+			$labels[] = get_lang('Average').' '.$point_info['point_average_star'].'/5';
1681 1681
 		}
1682 1682
 
1683
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1683
+		$labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] ';
1684 1684
 
1685 1685
 		if (!$add_div_wrapper && api_is_anonymous()) {
1686
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1686
+			$labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1687 1687
 		}
1688 1688
 
1689
-        $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1689
+        $html .= Display::div(implode(' | ', $labels), array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1690 1690
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1691 1691
 
1692 1692
         if ($add_div_wrapper) {
@@ -1764,8 +1764,8 @@  discard block
 block discarded – undo
1764 1764
         if (!empty($list)) {
1765 1765
             $html = '<dl class="dl-horizontal">';
1766 1766
             foreach ($list as $item) {
1767
-                $html .= '<dt>' . $item['title'] . '</dt>';
1768
-                $html .= '<dd>' . $item['content'] . '</dd>';
1767
+                $html .= '<dt>'.$item['title'].'</dt>';
1768
+                $html .= '<dd>'.$item['content'].'</dd>';
1769 1769
             }
1770 1770
             $html .= '</dl>';
1771 1771
         }
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
      * @param string $type
1808 1808
      * @return null|string
1809 1809
      */
1810
-    public static function badge($count, $type ="warning")
1810
+    public static function badge($count, $type = "warning")
1811 1811
     {
1812 1812
         $class = '';
1813 1813
 
@@ -1883,7 +1883,7 @@  discard block
 block discarded – undo
1883 1883
         if (!empty($content)) {
1884 1884
             $html = '<span class="label '.$class.'">';
1885 1885
             $html .= $content;
1886
-            $html .='</span>';
1886
+            $html .= '</span>';
1887 1887
         }
1888 1888
 
1889 1889
         return $html;
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
                     $class = 'class ="active"';
1905 1905
                 }
1906 1906
 
1907
-                if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) {
1907
+                if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) {
1908 1908
                     $class = 'class ="active"';
1909 1909
                 }
1910 1910
                 $html .= "<li $class >";
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
      */
2121 2121
     public static function getVCardUserLink($userId)
2122 2122
     {
2123
-        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);;
2123
+        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ;
2124 2124
 
2125 2125
         return $vCardUrl;
2126 2126
     }
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
     {
2139 2139
         $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : '';
2140 2140
         $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : '';
2141
-        $styles = ['primary','success','info','warning','danger'];
2141
+        $styles = ['primary', 'success', 'info', 'warning', 'danger'];
2142 2142
         $style = !in_array($style, $styles) ? 'default' : $style;
2143 2143
 
2144 2144
         return '
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
         $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass;
2184 2184
 
2185 2185
         if (!$includeText) {
2186
-            $text = '<span class="sr-only">' . $text . '</span>';
2186
+            $text = '<span class="sr-only">'.$text.'</span>';
2187 2187
         }
2188 2188
 
2189 2189
         return self::url("$icon $text", $url, $attributes);
@@ -2198,16 +2198,16 @@  discard block
 block discarded – undo
2198 2198
      */
2199 2199
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
2200 2200
     {
2201
-        $columns = 12/$col;
2201
+        $columns = 12 / $col;
2202 2202
         $html = '';
2203
-        $html .= '<div id="' . $id . '" class="actions">';
2203
+        $html .= '<div id="'.$id.'" class="actions">';
2204 2204
         $html .= '<div class="row">';
2205 2205
         if ($col > 4) {
2206 2206
             $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>';
2207 2207
         } else {
2208
-            for ( $i = 0; $i < $col; $i++ ) {
2209
-                $html .= '<div class="col-md-' . $columns . '">';
2210
-                if ( $col == 2 && $i == 1 ) {
2208
+            for ($i = 0; $i < $col; $i++) {
2209
+                $html .= '<div class="col-md-'.$columns.'">';
2210
+                if ($col == 2 && $i == 1) {
2211 2211
                     if ($right === true) {
2212 2212
                         $html .= '<div class="pull-right">';
2213 2213
                         $html .= (isset($content[$i]) ? $content[$i] : '');
@@ -2322,9 +2322,9 @@  discard block
 block discarded – undo
2322 2322
             $params['class'] = 'panel panel-default';
2323 2323
             $html = null;
2324 2324
             if (!empty($title)) {
2325
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
2325
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
2326 2326
             }
2327
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
2327
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
2328 2328
             $html = Display::div($html, $params);
2329 2329
         }
2330 2330
         return $html;
Please login to merge, or discard this patch.
main/inc/lib/upload.xajax.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @package chamilo.library
4
- */
3
+     * @package chamilo.library
4
+     */
5 5
 /**
6
- * Code
7
- */
6
+     * Code
7
+     */
8 8
 include(dirname(__FILE__).'/../global.inc.php');
9 9
 $xajax_upload = new Xajax();
10 10
 $xajax_upload -> registerFunction ('updateProgress');
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function updateProgress($div_id, $upload_id, $waitAfterupload = false) {
19 19
 
20
-	$objResponse = new xajaxResponse();
21
-	$ul_info = uploadprogress_get_info($upload_id);
22
-	$percent = intval($ul_info['bytes_uploaded']*100/$ul_info['bytes_total']);
23
-	if($waitAfterupload && $ul_info['est_sec']<2) {
24
-		$percent = 100;
25
-		$objResponse->addAssign($div_id.'_label' , 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
-		$objResponse->addAssign($div_id.'_waiter_frame','innerHTML', Display::return_icon('progress_bar.gif'));
27
-		$objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
28
-	}
29
-	$objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
30
-	$objResponse->addAssign($div_id.'_filled', 'style.width', $percent.'%');
20
+    $objResponse = new xajaxResponse();
21
+    $ul_info = uploadprogress_get_info($upload_id);
22
+    $percent = intval($ul_info['bytes_uploaded']*100/$ul_info['bytes_total']);
23
+    if($waitAfterupload && $ul_info['est_sec']<2) {
24
+        $percent = 100;
25
+        $objResponse->addAssign($div_id.'_label' , 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
+        $objResponse->addAssign($div_id.'_waiter_frame','innerHTML', Display::return_icon('progress_bar.gif'));
27
+        $objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
28
+    }
29
+    $objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
30
+    $objResponse->addAssign($div_id.'_filled', 'style.width', $percent.'%');
31 31
 
32
-	return $objResponse;
32
+    return $objResponse;
33 33
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 include(dirname(__FILE__).'/../global.inc.php');
9 9
 $xajax_upload = new Xajax();
10
-$xajax_upload -> registerFunction ('updateProgress');
10
+$xajax_upload -> registerFunction('updateProgress');
11 11
 $xajax_upload -> processRequests();
12 12
 
13 13
 /**
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 
20 20
 	$objResponse = new xajaxResponse();
21 21
 	$ul_info = uploadprogress_get_info($upload_id);
22
-	$percent = intval($ul_info['bytes_uploaded']*100/$ul_info['bytes_total']);
23
-	if($waitAfterupload && $ul_info['est_sec']<2) {
22
+	$percent = intval($ul_info['bytes_uploaded'] * 100 / $ul_info['bytes_total']);
23
+	if ($waitAfterupload && $ul_info['est_sec'] < 2) {
24 24
 		$percent = 100;
25
-		$objResponse->addAssign($div_id.'_label' , 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
-		$objResponse->addAssign($div_id.'_waiter_frame','innerHTML', Display::return_icon('progress_bar.gif'));
25
+		$objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
+		$objResponse->addAssign($div_id.'_waiter_frame', 'innerHTML', Display::return_icon('progress_bar.gif'));
27 27
 		$objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
28 28
 	}
29 29
 	$objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
Please login to merge, or discard this patch.
main/inc/lib/document.lib.php 1 patch
Spacing   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
             return true;
291 291
         } else {
292 292
             $tbl_document = Database::get_course_table(TABLE_DOCUMENT);
293
-            $tbl_item_property = $this_course . 'item_property';
293
+            $tbl_item_property = $this_course.'item_property';
294 294
             $doc_url = Database::escape_string($doc_url);
295 295
             $query = "SELECT 1 FROM $tbl_document AS docs,$tbl_item_property AS props
296 296
                       WHERE
@@ -340,18 +340,18 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             header('Content-type: application/octet-stream');
343
-            header('Content-length: ' . $len);
343
+            header('Content-length: '.$len);
344 344
             if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
345
-                header('Content-Disposition: filename= ' . $filename);
345
+                header('Content-Disposition: filename= '.$filename);
346 346
             } else {
347
-                header('Content-Disposition: attachment; filename= ' . $filename);
347
+                header('Content-Disposition: attachment; filename= '.$filename);
348 348
             }
349 349
             if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
350 350
                 header('Pragma: ');
351 351
                 header('Cache-Control: ');
352 352
                 header('Cache-Control: public'); // IE cannot download from sessions without a cache
353 353
             }
354
-            header('Content-Description: ' . $filename);
354
+            header('Content-Description: '.$filename);
355 355
             header('Content-Transfer-Encoding: binary');
356 356
 
357 357
             $res = fopen($full_file_name, 'r');
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             $lpFixedEncoding = api_get_configuration_value('lp_fixed_encoding');
366 366
 
367 367
             header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
368
-            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
368
+            header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
369 369
             // Commented to avoid double caching declaration when playing with IE and HTTPS
370 370
             //header('Cache-Control: no-cache, must-revalidate');
371 371
             //header('Pragma: no-cache');
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                     } else {
377 377
                         $encoding = @api_detect_encoding_html(file_get_contents($full_file_name));
378 378
                         if (!empty($encoding)) {
379
-                            $content_type .= '; charset=' . $encoding;
379
+                            $content_type .= '; charset='.$encoding;
380 380
                         }
381 381
                     }
382 382
                     break;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                     } else {
387 387
                         $encoding = @api_detect_encoding(strip_tags(file_get_contents($full_file_name)));
388 388
                         if (!empty($encoding)) {
389
-                            $content_type .= '; charset=' . $encoding;
389
+                            $content_type .= '; charset='.$encoding;
390 390
                         }
391 391
                     }
392 392
                     break;
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
                     header('Content-type: application/octet-stream');
396 396
                     break;
397 397
             }
398
-            header('Content-type: ' . $content_type);
399
-            header('Content-Length: ' . $len);
398
+            header('Content-type: '.$content_type);
399
+            header('Content-Length: '.$len);
400 400
             $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
401 401
             if (strpos($user_agent, 'msie')) {
402
-                header('Content-Disposition: ; filename= ' . $filename);
402
+                header('Content-Disposition: ; filename= '.$filename);
403 403
             } else {
404
-                header('Content-Disposition: inline; filename= ' . $filename);
404
+                header('Content-Disposition: inline; filename= '.$filename);
405 405
             }
406 406
 
407 407
             if ($fixLinksHttpToHttps) {
@@ -442,18 +442,18 @@  discard block
 block discarded – undo
442 442
 
443 443
             header('Content-type: application/octet-stream');
444 444
             //header('Content-Type: application/force-download');
445
-            header('Content-length: ' . $len);
445
+            header('Content-length: '.$len);
446 446
             if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
447
-                header('Content-Disposition: filename= ' . $filename);
447
+                header('Content-Disposition: filename= '.$filename);
448 448
             } else {
449
-                header('Content-Disposition: attachment; filename= ' . $filename);
449
+                header('Content-Disposition: attachment; filename= '.$filename);
450 450
             }
451 451
             if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
452 452
                 header('Pragma: ');
453 453
                 header('Cache-Control: ');
454 454
                 header('Cache-Control: public'); // IE cannot download from sessions without a cache
455 455
             }
456
-            header('Content-Description: ' . $filename);
456
+            header('Content-Description: '.$filename);
457 457
             header('Content-transfer-encoding: binary');
458 458
             echo $full_string;
459 459
 
@@ -466,30 +466,30 @@  discard block
 block discarded – undo
466 466
 
467 467
             $content_type = self::file_get_mime_type($filename);
468 468
             header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
469
-            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
469
+            header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
470 470
             header('Cache-Control: no-cache, must-revalidate');
471 471
             header('Pragma: no-cache');
472 472
             switch ($content_type) {
473 473
                 case 'text/html':
474 474
                     $encoding = @api_detect_encoding_html($full_string);
475 475
                     if (!empty($encoding)) {
476
-                        $content_type .= '; charset=' . $encoding;
476
+                        $content_type .= '; charset='.$encoding;
477 477
                     }
478 478
                     break;
479 479
                 case 'text/plain':
480 480
                     $encoding = @api_detect_encoding(strip_tags($full_string));
481 481
                     if (!empty($encoding)) {
482
-                        $content_type .= '; charset=' . $encoding;
482
+                        $content_type .= '; charset='.$encoding;
483 483
                     }
484 484
                     break;
485 485
             }
486
-            header('Content-type: ' . $content_type);
487
-            header('Content-Length: ' . $len);
486
+            header('Content-type: '.$content_type);
487
+            header('Content-Length: '.$len);
488 488
             $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
489 489
             if (strpos($user_agent, 'msie')) {
490
-                header('Content-Disposition: ; filename= ' . $filename);
490
+                header('Content-Disposition: ; filename= '.$filename);
491 491
             } else {
492
-                header('Content-Disposition: inline; filename= ' . $filename);
492
+                header('Content-Disposition: inline; filename= '.$filename);
493 493
             }
494 494
             echo($full_string);
495 495
             //You have to ensure that the calling script then stops processing (exit();)
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
             if (!empty($students)) {
583 583
                 $conditionList = array();
584 584
                 foreach ($students as $studentId => $studentInfo) {
585
-                    $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
585
+                    $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
586 586
                 }
587
-                $sharedCondition .= ' AND docs.path IN ("' . implode('","', $conditionList) . '")';
587
+                $sharedCondition .= ' AND docs.path IN ("'.implode('","', $conditionList).'")';
588 588
             }
589 589
         }
590 590
 
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
                     last.c_id = {$_course['real_id']}
611 611
                 )
612 612
                 WHERE
613
-                    docs.path LIKE '" . Database::escape_string($path . $added_slash.'%'). "' AND
614
-                    docs.path NOT LIKE '" . Database::escape_string($path . $added_slash.'%/%')."' AND
613
+                    docs.path LIKE '".Database::escape_string($path.$added_slash.'%')."' AND
614
+                    docs.path NOT LIKE '" . Database::escape_string($path.$added_slash.'%/%')."' AND
615 615
                     docs.path NOT LIKE '%_DELETED_%' AND
616 616
                     $userGroupFilter AND
617 617
                     last.visibility $visibility_bit
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
                     $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES);
653 653
                     $sql = "SELECT id FROM $table_template
654 654
                             WHERE
655
-                                course_code = '" . $_course['code'] . "' AND
655
+                                course_code = '".$_course['code']."' AND
656 656
                                 user_id = '".api_get_user_id()."' AND
657 657
                                 ref_doc = '".$row['id']."'";
658 658
                     $template_result = Database::query($sql);
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         if (!empty($students)) {
763 763
             $conditionList = array();
764 764
             foreach ($students as $studentId => $studentInfo) {
765
-                $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id'];
765
+                $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
766 766
             }
767 767
         }
768 768
 
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
                        INNER JOIN $TABLE_DOCUMENT  AS docs
787 787
                        ON (
788 788
                             docs.id = last.ref AND
789
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
789
+                            last.tool = '".TOOL_DOCUMENT."' AND
790 790
                             last.c_id = {$_course['real_id']} AND
791 791
                             docs.c_id = {$_course['real_id']}
792 792
                        )
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                         INNER JOIN $TABLE_DOCUMENT  AS docs
804 804
                         ON (
805 805
                             docs.id = last.ref AND
806
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
806
+                            last.tool = '".TOOL_DOCUMENT."' AND
807 807
                             last.c_id = {$_course['real_id']} AND
808 808
                             docs.c_id = {$_course['real_id']}
809 809
                         )
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
                     WHERE
851 851
                         docs.id = last.ref AND
852 852
                         docs.filetype = 'folder' AND
853
-                        last.tool = '" . TOOL_DOCUMENT . "' AND
853
+                        last.tool = '".TOOL_DOCUMENT."' AND
854 854
                         $groupCondition AND
855 855
                         last.visibility = 1
856 856
                         $condition_session AND
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
                     WHERE
872 872
                         docs.id = last.ref AND
873 873
                         docs.filetype = 'folder' AND
874
-                        last.tool = '" . TOOL_DOCUMENT . "' AND
874
+                        last.tool = '".TOOL_DOCUMENT."' AND
875 875
                         $groupCondition AND
876 876
                         last.visibility = 0 $condition_session AND
877 877
                         last.c_id = {$_course['real_id']} AND
@@ -887,9 +887,9 @@  discard block
 block discarded – undo
887 887
                         FROM $TABLE_ITEMPROPERTY AS last, $TABLE_DOCUMENT AS docs
888 888
                         WHERE
889 889
                             docs.id = last.ref AND
890
-                            docs.path LIKE '" . Database::escape_string($row['path'].'/%') . "' AND
890
+                            docs.path LIKE '".Database::escape_string($row['path'].'/%')."' AND
891 891
                             docs.filetype = 'folder' AND
892
-                            last.tool = '" . TOOL_DOCUMENT . "' AND
892
+                            last.tool = '" . TOOL_DOCUMENT."' AND
893 893
                             $groupCondition AND
894 894
                             last.visibility = 1 $condition_session AND
895 895
                             last.c_id = {$_course['real_id']} AND
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
                                 tp.c_id = $course_id AND
967 967
                                 td.session_id = $sessionId AND
968 968
                                 tp.ref= td.id AND
969
-                                (path='" . $path . "' OR path LIKE BINARY '" . $path . "/%' ) ";
969
+                                (path='".$path."' OR path LIKE BINARY '".$path."/%' ) ";
970 970
                     // Get all id's of documents that are deleted
971 971
                     $what_to_check_result = Database::query($sql);
972 972
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
             $res = Database::query($sql);
1309 1309
             if (Database::num_rows($res) > 0) {
1310 1310
                 $row2 = Database::fetch_array($res);
1311
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
1311
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
1312 1312
                 $di = new ChamiloIndexer();
1313 1313
                 $di->remove_document((int) $row2['search_did']);
1314 1314
             }
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
             Database::query($sql);
1318 1318
 
1319 1319
             // remove terms from db
1320
-            require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
1320
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
1321 1321
             delete_all_values_for_item($course_id, TOOL_DOCUMENT, $document_id);
1322 1322
         }
1323 1323
     }
@@ -1406,12 +1406,12 @@  discard block
 block discarded – undo
1406 1406
             $path = str_replace('%2F', '/', $url_path);
1407 1407
             $pathinfo = pathinfo($row['path']);
1408 1408
 
1409
-            $row['url'] = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?cidReq=' . $course_code . '&id=' . $id;
1410
-            $row['document_url'] = api_get_path(WEB_CODE_PATH) . 'document/document.php?cidReq=' . $course_code . '&id=' . $id;
1411
-            $row['absolute_path'] = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path'];
1412
-            $row['absolute_path_from_document'] = '/document' . $row['path'];
1413
-            $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'] . '/';
1414
-            $row['direct_url'] = $www . $path;
1409
+            $row['url'] = api_get_path(WEB_CODE_PATH).'document/showinframes.php?cidReq='.$course_code.'&id='.$id;
1410
+            $row['document_url'] = api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.$course_code.'&id='.$id;
1411
+            $row['absolute_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
1412
+            $row['absolute_path_from_document'] = '/document'.$row['path'];
1413
+            $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'].'/';
1414
+            $row['direct_url'] = $www.$path;
1415 1415
 
1416 1416
             if (dirname($row['path']) == '.') {
1417 1417
                 $row['parent_id'] = '0';
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
                 $real_dir = '';
1431 1431
 
1432 1432
                 for ($i = 1; $i < $array_len; $i++) {
1433
-                    $real_dir .= '/' . $dir_array[$i];
1433
+                    $real_dir .= '/'.$dir_array[$i];
1434 1434
                     $parent_id = self::get_document_id($course_info, $real_dir);
1435 1435
                     if ($session_id != 0 && empty($parent_id)) {
1436 1436
                         $parent_id = self::get_document_id($course_info, $real_dir, 0);
@@ -1504,21 +1504,21 @@  discard block
 block discarded – undo
1504 1504
         $user_id = intval($user_id);
1505 1505
         $document_id = intval($document_id);
1506 1506
 
1507
-        $sql = 'SELECT id FROM ' . $table_template . '
1507
+        $sql = 'SELECT id FROM '.$table_template.'
1508 1508
                 WHERE
1509
-                    course_code="' . $course_code . '" AND
1510
-                    user_id="' . $user_id . '" AND
1511
-                    ref_doc="' . $document_id . '"';
1509
+                    course_code="' . $course_code.'" AND
1510
+                    user_id="' . $user_id.'" AND
1511
+                    ref_doc="' . $document_id.'"';
1512 1512
         $result = Database::query($sql);
1513 1513
         $template_id = Database::result($result, 0, 0);
1514 1514
 
1515
-        my_delete(api_get_path(SYS_CODE_PATH) . 'upload/template_thumbnails/' . $template_id . '.jpg');
1515
+        my_delete(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/'.$template_id.'.jpg');
1516 1516
 
1517
-        $sql = 'DELETE FROM ' . $table_template . '
1517
+        $sql = 'DELETE FROM '.$table_template.'
1518 1518
                 WHERE
1519
-                    course_code="' . $course_code . '" AND
1520
-                    user_id="' . $user_id . '" AND
1521
-                    ref_doc="' . $document_id . '"';
1519
+                    course_code="' . $course_code.'" AND
1520
+                    user_id="' . $user_id.'" AND
1521
+                    ref_doc="' . $document_id.'"';
1522 1522
 
1523 1523
         Database::query($sql);
1524 1524
     }
@@ -1578,9 +1578,9 @@  discard block
 block discarded – undo
1578 1578
                 INNER JOIN $propTable ip
1579 1579
                 ON (d.id = ip.ref AND d.c_id  = $course_id AND ip.c_id = $course_id)
1580 1580
         		WHERE
1581
-        		    ip.tool = '" . TOOL_DOCUMENT . "' $condition AND
1581
+        		    ip.tool = '".TOOL_DOCUMENT."' $condition AND
1582 1582
         			filetype = '$file_type' AND
1583
-        			locate(concat(path,'/'), '" . Database::escape_string($doc_path.'/'). "')=1
1583
+        			locate(concat(path,'/'), '".Database::escape_string($doc_path.'/')."')=1
1584 1584
                 ";
1585 1585
 
1586 1586
         $result = Database::query($sql);
@@ -1743,12 +1743,12 @@  discard block
 block discarded – undo
1743 1743
         if (empty($session_id)) {
1744 1744
             $sql_session = 'AND (session_id = 0 OR isnull(session_id)) ';
1745 1745
         } elseif ($session_id > 0) {
1746
-            $sql_session = 'AND session_id=' . intval($session_id);
1746
+            $sql_session = 'AND session_id='.intval($session_id);
1747 1747
         } else {
1748 1748
             $sql_session = '';
1749 1749
         }
1750
-        $sql = 'UPDATE ' . $tbl_category . ' SET document_id="' . intval($document_id) . '"
1751
-                WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session;
1750
+        $sql = 'UPDATE '.$tbl_category.' SET document_id="'.intval($document_id).'"
1751
+                WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session;
1752 1752
         Database::query($sql);
1753 1753
     }
1754 1754
 
@@ -1770,12 +1770,12 @@  discard block
 block discarded – undo
1770 1770
         if (empty($session_id)) {
1771 1771
             $sql_session = 'AND (session_id = 0 OR isnull(session_id)) ';
1772 1772
         } elseif ($session_id > 0) {
1773
-            $sql_session = 'AND session_id=' . intval($session_id);
1773
+            $sql_session = 'AND session_id='.intval($session_id);
1774 1774
         } else {
1775 1775
             $sql_session = '';
1776 1776
         }
1777
-        $sql = 'SELECT document_id FROM ' . $tbl_category . '
1778
-                WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session;
1777
+        $sql = 'SELECT document_id FROM '.$tbl_category.'
1778
+                WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session;
1779 1779
 
1780 1780
         $rs = Database::query($sql);
1781 1781
         $num = Database::num_rows($rs);
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
             $all_user_info = array();
1817 1817
             if (Database::num_rows($rs)) {
1818 1818
                 $row = Database::fetch_array($rs);
1819
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path'];
1819
+                $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
1820 1820
                 if (is_file($filepath)) {
1821 1821
                     $my_content_html = file_get_contents($filepath);
1822 1822
                 }
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
             $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
1900 1900
         }
1901 1901
 
1902
-        $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id'];
1902
+        $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id'];
1903 1903
 
1904 1904
         //replace content
1905 1905
         $info_to_replace_in_content_html = array(
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
             $course_info['name'],
1917 1917
             $info_grade_certificate['grade'],
1918 1918
             $url,
1919
-            '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>',
1919
+            '<a href="'.$url.'" target="_blank">'.get_lang('CertificateOnlineLink').'</a>',
1920 1920
             '((certificate_barcode))',
1921 1921
         );
1922 1922
 
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
         if (!empty($extraFields)) {
1941 1941
             foreach ($extraFields as $extraField) {
1942 1942
                 $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : '';
1943
-                $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))';
1943
+                $info_to_be_replaced_in_content_html[] = '(('.strtolower($extraField['variable']).'))';
1944 1944
                 $info_to_replace_in_content_html[] = $valueExtra;
1945 1945
             }
1946 1946
         }
@@ -1968,17 +1968,17 @@  discard block
 block discarded – undo
1968 1968
             $tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
1969 1969
             $session_id = api_get_session_id();
1970 1970
             if ($session_id == 0 || is_null($session_id)) {
1971
-                $sql_session = 'AND (session_id=' . intval($session_id) . ' OR isnull(session_id)) ';
1971
+                $sql_session = 'AND (session_id='.intval($session_id).' OR isnull(session_id)) ';
1972 1972
             } elseif ($session_id > 0) {
1973
-                $sql_session = 'AND session_id=' . intval($session_id);
1973
+                $sql_session = 'AND session_id='.intval($session_id);
1974 1974
             } else {
1975 1975
                 $sql_session = '';
1976 1976
             }
1977 1977
 
1978
-            $sql = 'UPDATE ' . $tbl_category . ' SET document_id=null
1978
+            $sql = 'UPDATE '.$tbl_category.' SET document_id=null
1979 1979
                     WHERE
1980
-                        course_code = "' . Database::escape_string($course_id) . '" AND
1981
-                        document_id="' . $default_certificate_id . '" ' . $sql_session;
1980
+                        course_code = "' . Database::escape_string($course_id).'" AND
1981
+                        document_id="' . $default_certificate_id.'" '.$sql_session;
1982 1982
             Database::query($sql);
1983 1983
         }
1984 1984
     }
@@ -1994,10 +1994,10 @@  discard block
 block discarded – undo
1994 1994
         if (!empty($courseInfo)) {
1995 1995
             $to_group_id = 0;
1996 1996
             $to_user_id = null;
1997
-            $course_dir = $courseInfo['path'] . "/document/";
1997
+            $course_dir = $courseInfo['path']."/document/";
1998 1998
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
1999
-            $base_work_dir = $sys_course_path . $course_dir;
2000
-            $base_work_dir_test = $base_work_dir . 'certificates';
1999
+            $base_work_dir = $sys_course_path.$course_dir;
2000
+            $base_work_dir_test = $base_work_dir.'certificates';
2001 2001
             $dir_name = '/certificates';
2002 2002
             $post_dir_name = get_lang('CertificatesFiles');
2003 2003
             $visibility_command = 'invisible';
@@ -2224,9 +2224,9 @@  discard block
 block discarded – undo
2224 2224
                                             //$new_abs_path = realpath($dir.'/'.$second_part);
2225 2225
                                             $dir = '';
2226 2226
                                             if (!empty($abs_path)) {
2227
-                                                $dir = dirname($abs_path) . '/';
2227
+                                                $dir = dirname($abs_path).'/';
2228 2228
                                             }
2229
-                                            $new_abs_path = realpath($dir . $second_part);
2229
+                                            $new_abs_path = realpath($dir.$second_part);
2230 2230
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2231 2231
                                             if (count($in_files_list) > 0) {
2232 2232
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2239,9 +2239,9 @@  discard block
 block discarded – undo
2239 2239
                                             $files_list[] = array($second_part, 'local', 'rel');
2240 2240
                                             $dir = '';
2241 2241
                                             if (!empty($abs_path)) {
2242
-                                                $dir = dirname($abs_path) . '/';
2242
+                                                $dir = dirname($abs_path).'/';
2243 2243
                                             }
2244
-                                            $new_abs_path = realpath($dir . $second_part);
2244
+                                            $new_abs_path = realpath($dir.$second_part);
2245 2245
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2246 2246
                                             if (count($in_files_list) > 0) {
2247 2247
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2275,9 +2275,9 @@  discard block
 block discarded – undo
2275 2275
                                             $files_list[] = array($source, 'local', 'rel');
2276 2276
                                             $dir = '';
2277 2277
                                             if (!empty($abs_path)) {
2278
-                                                $dir = dirname($abs_path) . '/';
2278
+                                                $dir = dirname($abs_path).'/';
2279 2279
                                             }
2280
-                                            $new_abs_path = realpath($dir . $source);
2280
+                                            $new_abs_path = realpath($dir.$source);
2281 2281
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2282 2282
                                             if (count($in_files_list) > 0) {
2283 2283
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2290,9 +2290,9 @@  discard block
 block discarded – undo
2290 2290
                                             $files_list[] = array($source, 'local', 'rel');
2291 2291
                                             $dir = '';
2292 2292
                                             if (!empty($abs_path)) {
2293
-                                                $dir = dirname($abs_path) . '/';
2293
+                                                $dir = dirname($abs_path).'/';
2294 2294
                                             }
2295
-                                            $new_abs_path = realpath($dir . $source);
2295
+                                            $new_abs_path = realpath($dir.$source);
2296 2296
                                             $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2297 2297
                                             if (count($in_files_list) > 0) {
2298 2298
                                                 $files_list = array_merge($files_list, $in_files_list);
@@ -2326,9 +2326,9 @@  discard block
 block discarded – undo
2326 2326
                                     $files_list[] = array($source, 'local', 'rel');
2327 2327
                                     $dir = '';
2328 2328
                                     if (!empty($abs_path)) {
2329
-                                        $dir = dirname($abs_path) . '/';
2329
+                                        $dir = dirname($abs_path).'/';
2330 2330
                                     }
2331
-                                    $new_abs_path = realpath($dir . $source);
2331
+                                    $new_abs_path = realpath($dir.$source);
2332 2332
                                     $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2333 2333
                                     if (count($in_files_list) > 0) {
2334 2334
                                         $files_list = array_merge($files_list, $in_files_list);
@@ -2341,9 +2341,9 @@  discard block
 block discarded – undo
2341 2341
                                     $files_list[] = array($source, 'local', 'rel');
2342 2342
                                     $dir = '';
2343 2343
                                     if (!empty($abs_path)) {
2344
-                                        $dir = dirname($abs_path) . '/';
2344
+                                        $dir = dirname($abs_path).'/';
2345 2345
                                     }
2346
-                                    $new_abs_path = realpath($dir . $source);
2346
+                                    $new_abs_path = realpath($dir.$source);
2347 2347
                                     $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1);
2348 2348
                                     if (count($in_files_list) > 0) {
2349 2349
                                         $files_list = array_merge($files_list, $in_files_list);
@@ -2401,24 +2401,24 @@  discard block
 block discarded – undo
2401 2401
             // then possible closing brackets if we were in the opening bracket case
2402 2402
             // OR something like @import()
2403 2403
             $res = preg_match_all(
2404
-                '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' .
2404
+                '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))'.
2405 2405
                 // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much
2406 2406
                 // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name
2407
-                '([ \n\t\r]+)?(' .
2407
+                '([ \n\t\r]+)?('.
2408 2408
                 // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself
2409
-                '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' .
2410
-                '|' .
2409
+                '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))'.
2410
+                '|'.
2411 2411
                 // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself
2412
-                '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' .
2413
-                '))' .
2414
-                '|' .
2412
+                '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))'.
2413
+                '))'.
2414
+                '|'.
2415 2415
                 // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities)
2416 2416
                 '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/',
2417 2417
                 $attrString,
2418 2418
                 $regs
2419 2419
             );
2420 2420
         } catch (Exception $e) {
2421
-            error_log('Caught exception: ' . $e->getMessage(), 0);
2421
+            error_log('Caught exception: '.$e->getMessage(), 0);
2422 2422
         }
2423 2423
         if ($res) {
2424 2424
             for ($i = 0; $i < count($regs[1]); $i++) {
@@ -2496,14 +2496,14 @@  discard block
 block discarded – undo
2496 2496
                 $orig_course_info_path = $origin_course_info_path;
2497 2497
             }
2498 2498
         } else {
2499
-            $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'] . '/';
2499
+            $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'].'/';
2500 2500
             $orig_course_info_path = $orig_course_info['path'];
2501 2501
         }
2502 2502
 
2503 2503
         $destination_course_code = CourseManager::get_course_id_from_path($destination_course_directory);
2504 2504
         $destination_course_info = api_get_course_info($destination_course_code);
2505
-        $dest_course_path = api_get_path(SYS_COURSE_PATH) . $destination_course_directory . '/';
2506
-        $dest_course_path_rel = api_get_path(REL_COURSE_PATH) . $destination_course_directory . '/';
2505
+        $dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/';
2506
+        $dest_course_path_rel = api_get_path(REL_COURSE_PATH).$destination_course_directory.'/';
2507 2507
 
2508 2508
         $user_id = api_get_user_id();
2509 2509
 
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
 
2513 2513
                 // Get information about source url
2514 2514
                 $real_orig_url = $source[0]; // url
2515
-                $scope_url = $source[1];   // scope (local, remote)
2515
+                $scope_url = $source[1]; // scope (local, remote)
2516 2516
                 $type_url = $source[2]; // type (rel, abs, url)
2517 2517
 
2518 2518
                 // Get path and query from origin url
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
                 $dest_url_query = '';
2525 2525
 
2526 2526
                 if (!empty($real_orig_query)) {
2527
-                    $dest_url_query = '?' . $real_orig_query;
2527
+                    $dest_url_query = '?'.$real_orig_query;
2528 2528
                     if (strpos($dest_url_query, $origin_course_code) !== false) {
2529 2529
                         $dest_url_query = str_replace($origin_course_code, $destination_course_code, $dest_url_query);
2530 2530
                     }
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
 
2606 2606
                                 //$destination_url = $url_course_path . $destination_course_directory . '/' . $document_file . $dest_url_query;
2607 2607
                                 // See BT#7780
2608
-                                $destination_url = $dest_course_path_rel . $document_file . $dest_url_query;
2608
+                                $destination_url = $dest_course_path_rel.$document_file.$dest_url_query;
2609 2609
 
2610 2610
                                 // If the course code doesn't exist in the path? what we do? Nothing! see BT#1985
2611 2611
                                 if (strpos($real_orig_path, $origin_course_code) === false) {
@@ -2640,14 +2640,14 @@  discard block
 block discarded – undo
2640 2640
     function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path)
2641 2641
     {
2642 2642
         if (substr($original_path, strlen($original_path) - 1, strlen($original_path)) == '/') {
2643
-            $original = $original_path . $file_name;
2643
+            $original = $original_path.$file_name;
2644 2644
         } else {
2645
-            $original = $original_path . '/' . $file_name;
2645
+            $original = $original_path.'/'.$file_name;
2646 2646
         }
2647 2647
         if (substr($destiny_path, strlen($destiny_path) - 1, strlen($destiny_path)) == '/') {
2648
-            $destination = $destiny_path . $file_name;
2648
+            $destination = $destiny_path.$file_name;
2649 2649
         } else {
2650
-            $destination = $destiny_path . '/' . $file_name;
2650
+            $destination = $destiny_path.'/'.$file_name;
2651 2651
         }
2652 2652
         $original_count = count(explode('/', $original));
2653 2653
         $destination_count = count(explode('/', $destination));
@@ -2661,8 +2661,8 @@  discard block
 block discarded – undo
2661 2661
             $mode = 'inside';
2662 2662
         }
2663 2663
         //We do not select the $original_path becayse the file was already moved
2664
-        $content_html = file_get_contents($destiny_path . '/' . $file_name);
2665
-        $destination_file = $destiny_path . '/' . $file_name;
2664
+        $content_html = file_get_contents($destiny_path.'/'.$file_name);
2665
+        $destination_file = $destiny_path.'/'.$file_name;
2666 2666
 
2667 2667
         $pre_original = strstr($original_path, 'document');
2668 2668
         $pre_destin = strstr($destiny_path, 'document');
@@ -2684,11 +2684,11 @@  discard block
 block discarded – undo
2684 2684
         }
2685 2685
 
2686 2686
         if ($pre_original != '') {
2687
-            $pre_original = '..' . $pre_original . '/';
2687
+            $pre_original = '..'.$pre_original.'/';
2688 2688
         }
2689 2689
 
2690 2690
         if ($pre_destin != '') {
2691
-            $pre_destin = '..' . $pre_destin . '/';
2691
+            $pre_destin = '..'.$pre_destin.'/';
2692 2692
         }
2693 2693
 
2694 2694
         $levels = explode('/', $pre_original);
@@ -2706,7 +2706,7 @@  discard block
 block discarded – undo
2706 2706
         //echo '$count_pre_destination_levels '. $count_pre_destination_levels;
2707 2707
         $pre_remove = '';
2708 2708
         for ($i = 1; $i <= $count_pre_destination_levels; $i++) {
2709
-            $pre_remove .='..\/';
2709
+            $pre_remove .= '..\/';
2710 2710
         }
2711 2711
 
2712 2712
         $orig_source_html = DocumentManager::get_resources_from_source_html($content_html);
@@ -2714,9 +2714,9 @@  discard block
 block discarded – undo
2714 2714
         foreach ($orig_source_html as $source) {
2715 2715
 
2716 2716
             // get information about source url
2717
-            $real_orig_url = $source[0];   // url
2718
-            $scope_url = $source[1];   // scope (local, remote)
2719
-            $type_url = $source[2];   // tyle (rel, abs, url)
2717
+            $real_orig_url = $source[0]; // url
2718
+            $scope_url = $source[1]; // scope (local, remote)
2719
+            $type_url = $source[2]; // tyle (rel, abs, url)
2720 2720
             // Get path and query from origin url
2721 2721
             $orig_parse_url = parse_url($real_orig_url);
2722 2722
             $real_orig_path = $orig_parse_url['path'];
@@ -2743,11 +2743,11 @@  discard block
 block discarded – undo
2743 2743
                         $real_orig_url_temp = '';
2744 2744
                         if ($mode == 'inside') {
2745 2745
                             $real_orig_url_temp = str_replace('../', '', $real_orig_url);
2746
-                            $destination_url = $link_to_add . $real_orig_url_temp;
2746
+                            $destination_url = $link_to_add.$real_orig_url_temp;
2747 2747
                         } else {
2748 2748
                             $real_orig_url_temp = $real_orig_url;
2749 2749
 
2750
-                            $destination_url = preg_replace("/" . $pre_remove . "/", '', $real_orig_url, 1);
2750
+                            $destination_url = preg_replace("/".$pre_remove."/", '', $real_orig_url, 1);
2751 2751
                         }
2752 2752
                         if ($real_orig_url == $destination_url) {
2753 2753
                             //echo 'continue2';
@@ -2773,7 +2773,7 @@  discard block
 block discarded – undo
2773 2773
     {
2774 2774
         $course_data = api_get_course_info($course_code);
2775 2775
         $document_data = self::get_document_data_by_id($document_id, $course_code);
2776
-        $file_path = api_get_path(SYS_COURSE_PATH) . $course_data['path'] . '/document' . $document_data['path'];
2776
+        $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$document_data['path'];
2777 2777
         $pdf = new PDF('A4-L', 'L');
2778 2778
         $pdf->html_to_pdf($file_path, $document_data['title'], $course_code);
2779 2779
     }
@@ -2804,9 +2804,9 @@  discard block
 block discarded – undo
2804 2804
     ) {
2805 2805
         $course_info = api_get_course_info();
2806 2806
         $sessionId = api_get_session_id();
2807
-        $course_dir = $course_info['path'] . '/document';
2807
+        $course_dir = $course_info['path'].'/document';
2808 2808
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
2809
-        $base_work_dir = $sys_course_path . $course_dir;
2809
+        $base_work_dir = $sys_course_path.$course_dir;
2810 2810
 
2811 2811
         if (isset($files[$fileKey])) {
2812 2812
             $upload_ok = process_uploaded_file($files[$fileKey], $show_output);
@@ -2878,7 +2878,7 @@  discard block
 block discarded – undo
2878 2878
                     // Showing message when sending zip files
2879 2879
                     if ($new_path === true && $unzip == 1 && $show_output) {
2880 2880
                         Display::display_confirmation_message(
2881
-                            get_lang('UplUploadSucceeded') . '<br />',
2881
+                            get_lang('UplUploadSucceeded').'<br />',
2882 2882
                             false
2883 2883
                         );
2884 2884
                     }
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
         }
2981 2981
         if (isset($output)) {
2982 2982
             foreach ($output as & $line) {
2983
-                $content .= $line . "\n";
2983
+                $content .= $line."\n";
2984 2984
             }
2985 2985
             return $content;
2986 2986
         } else {
@@ -3012,13 +3012,13 @@  discard block
 block discarded – undo
3012 3012
         $group_condition = null;
3013 3013
         if (isset($group_id)) {
3014 3014
             $group_id = intval($group_id);
3015
-            $group_condition = " AND props.to_group_id='" . $group_id . "' ";
3015
+            $group_condition = " AND props.to_group_id='".$group_id."' ";
3016 3016
         }
3017 3017
 
3018 3018
         $session_condition = null;
3019 3019
         if (isset($session_id)) {
3020 3020
             $session_id = intval($session_id);
3021
-            $session_condition = " AND props.session_id='" . $session_id . "' ";
3021
+            $session_condition = " AND props.session_id='".$session_id."' ";
3022 3022
         }
3023 3023
 
3024 3024
         $sql = "SELECT SUM(size)
@@ -3028,7 +3028,7 @@  discard block
 block discarded – undo
3028 3028
                 WHERE
3029 3029
                     props.c_id 	= $course_id AND
3030 3030
                     docs.c_id 	= $course_id AND
3031
-                    props.tool 	= '" . TOOL_DOCUMENT . "' AND
3031
+                    props.tool 	= '".TOOL_DOCUMENT."' AND
3032 3032
                     props.visibility <> 2
3033 3033
                     $group_condition
3034 3034
                     $session_condition
@@ -3051,8 +3051,8 @@  discard block
 block discarded – undo
3051 3051
         $course_quota_m = round($course_quota / 1048576);
3052 3052
         $already_consumed_space_m = round($already_consumed_space / 1048576);
3053 3053
 
3054
-        $message = get_lang('MaximumAllowedQuota') . ' <strong>' . $course_quota_m . ' megabyte</strong>.<br />';
3055
-        $message .= get_lang('CourseCurrentlyUses') . ' <strong>' . $already_consumed_space_m . ' megabyte</strong>.<br />';
3054
+        $message = get_lang('MaximumAllowedQuota').' <strong>'.$course_quota_m.' megabyte</strong>.<br />';
3055
+        $message .= get_lang('CourseCurrentlyUses').' <strong>'.$already_consumed_space_m.' megabyte</strong>.<br />';
3056 3056
 
3057 3057
         $percentage = round(($already_consumed_space / $course_quota * 100), 1);
3058 3058
 
@@ -3060,33 +3060,33 @@  discard block
 block discarded – undo
3060 3060
 
3061 3061
         // Decide where to place percentage in graph
3062 3062
         if ($percentage >= 50) {
3063
-            $text_in_filled = '&nbsp;' . $other_percentage . '%';
3063
+            $text_in_filled = '&nbsp;'.$other_percentage.'%';
3064 3064
             $text_in_unfilled = '';
3065 3065
         } else {
3066
-            $text_in_unfilled = '&nbsp;' . $other_percentage . '%';
3066
+            $text_in_unfilled = '&nbsp;'.$other_percentage.'%';
3067 3067
             $text_in_filled = '';
3068 3068
         }
3069 3069
 
3070 3070
         // Decide the background colour of the graph
3071 3071
         if ($percentage < 65) {
3072
-            $colour = '#00BB00';        // Safe - green
3072
+            $colour = '#00BB00'; // Safe - green
3073 3073
         } elseif ($percentage < 90) {
3074
-            $colour = '#ffd400';        // Filling up - yelloworange
3074
+            $colour = '#ffd400'; // Filling up - yelloworange
3075 3075
         } else {
3076
-            $colour = '#DD0000';        // Full - red
3076
+            $colour = '#DD0000'; // Full - red
3077 3077
         }
3078 3078
 
3079 3079
         // This is used for the table width: a table of only 100 pixels looks too small
3080 3080
         $visual_percentage = 4 * $percentage;
3081 3081
         $visual_other_percentage = 4 * $other_percentage;
3082 3082
 
3083
-        $message .= get_lang('PercentageQuotaInUse') . ': <strong>' . $percentage . '%</strong>.<br />' .
3084
-            get_lang('PercentageQuotaFree') . ': <strong>' . $other_percentage . '%</strong>.<br />';
3083
+        $message .= get_lang('PercentageQuotaInUse').': <strong>'.$percentage.'%</strong>.<br />'.
3084
+            get_lang('PercentageQuotaFree').': <strong>'.$other_percentage.'%</strong>.<br />';
3085 3085
 
3086
-        $show_percentage = '&nbsp;' . $percentage . '%';
3087
-        $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\'' . api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/bg-header4.png\');" class="document-quota-bar">' .
3088
-            '<div style="width:' . $percentage . '%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>' .
3089
-            '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">' . $show_percentage . '</span></div>';
3086
+        $show_percentage = '&nbsp;'.$percentage.'%';
3087
+        $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\''.api_get_path(WEB_CODE_PATH).'css/'.api_get_visual_theme().'/images/bg-header4.png\');" class="document-quota-bar">'.
3088
+            '<div style="width:'.$percentage.'%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;">&nbsp;</div>'.
3089
+            '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">'.$show_percentage.'</span></div>';
3090 3090
         echo $message;
3091 3091
     }
3092 3092
 
@@ -3102,7 +3102,7 @@  discard block
 block discarded – undo
3102 3102
         $percentage = $already_consumed_space / $course_quota * 100;
3103 3103
         $percentage = round($percentage, 1);
3104 3104
         $message = get_lang('YouAreCurrentlyUsingXOfYourX');
3105
-        $message = sprintf($message, $already_consumed_space_m, $percentage . '%', $course_quota_m . ' ');
3105
+        $message = sprintf($message, $already_consumed_space_m, $percentage.'%', $course_quota_m.' ');
3106 3106
         echo Display::div($message, array('id' => 'document_quota'));
3107 3107
     }
3108 3108
 
@@ -3133,13 +3133,13 @@  discard block
 block discarded – undo
3133 3133
      */
3134 3134
     static function generate_jplayer_jquery($params = array())
3135 3135
     {
3136
-        $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
3136
+        $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
3137 3137
 
3138 3138
         $js = '
3139
-            $("#jquery_jplayer_' . $params['count'] . '").jPlayer({
3139
+            $("#jquery_jplayer_' . $params['count'].'").jPlayer({
3140 3140
                 ready: function() {
3141 3141
                     $(this).jPlayer("setMedia", {
3142
-                        ' . $params['extension'] . ' : "' . $params['url'] . '"
3142
+                        ' . $params['extension'].' : "'.$params['url'].'"
3143 3143
                     });
3144 3144
                 },
3145 3145
                 play: function() { // To avoid both jPlayers playing together.
@@ -3147,12 +3147,12 @@  discard block
 block discarded – undo
3147 3147
                 },
3148 3148
                 //errorAlerts: true,
3149 3149
                 //warningAlerts: true,
3150
-                swfPath: "' . $js_path . 'jquery-jplayer/jplayer/",
3150
+                swfPath: "' . $js_path.'jquery-jplayer/jplayer/",
3151 3151
                 //supplied: "m4a, oga, mp3, ogg, wav",
3152
-                supplied: "' . $params['extension'] . '",
3152
+                supplied: "' . $params['extension'].'",
3153 3153
                 wmode: "window",
3154 3154
                 solution: "flash, html",  // Do not change this setting
3155
-                cssSelectorAncestor: "#jp_container_' . $params['count'] . '",
3155
+                cssSelectorAncestor: "#jp_container_' . $params['count'].'",
3156 3156
             });  	 ' . "\n\n";
3157 3157
 
3158 3158
         return $js;
@@ -3182,16 +3182,16 @@  discard block
 block discarded – undo
3182 3182
         }
3183 3183
 
3184 3184
         //Shows only the play button
3185
-        $html = '<div id="jquery_jplayer_' . $i . '" class="jp-jplayer"></div>
3186
-                <div id="jp_container_' . $i . '" class="jp-audio">
3185
+        $html = '<div id="jquery_jplayer_'.$i.'" class="jp-jplayer"></div>
3186
+                <div id="jp_container_' . $i.'" class="jp-audio">
3187 3187
                     <div class="jp-type-single">
3188 3188
                         <div class="jp-gui jp-interface">
3189 3189
                             <ul class="jp-controls">
3190 3190
                                 <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
3191 3191
                                 <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
3192
-                                ' . $extra_controls . '
3192
+                                ' . $extra_controls.'
3193 3193
                             </ul>
3194
-                            ' . $progress . '
3194
+                            ' . $progress.'
3195 3195
                         </div>
3196 3196
                     </div>
3197 3197
                 </div>';
@@ -3244,8 +3244,8 @@  discard block
 block discarded – undo
3244 3244
                     </div>
3245 3245
                 </div>
3246 3246
                 <div class="jp-no-solution">
3247
-                    <span>' . get_lang('UpdateRequire') . '</span>
3248
-                    ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile") . '
3247
+                    <span>' . get_lang('UpdateRequire').'</span>
3248
+                    ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile").'
3249 3249
                 </div>
3250 3250
             </div>
3251 3251
         </div>';
@@ -3326,7 +3326,7 @@  discard block
 block discarded – undo
3326 3326
 
3327 3327
         $add_folder_filter = null;
3328 3328
         if (!empty($filter_by_folder)) {
3329
-            $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'";
3329
+            $add_folder_filter = " AND docs.path LIKE '".Database::escape_string($filter_by_folder)."%'";
3330 3330
         }
3331 3331
 
3332 3332
         // If we are in LP display hidden folder https://support.chamilo.org/issues/6679
@@ -3361,7 +3361,7 @@  discard block
 block discarded – undo
3361 3361
 
3362 3362
                 $notLikeCondition = null;
3363 3363
                 for ($i = 1; $i <= $num; $i++) {
3364
-                    $repeat = str_repeat('/%', $i+1);
3364
+                    $repeat = str_repeat('/%', $i + 1);
3365 3365
                     $notLikeCondition .= " AND docs.path NOT LIKE '".Database::escape_string($cleanedPath.$repeat)."' ";
3366 3366
                 }
3367 3367
 
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
                 ON (docs.id = last.ref AND docs.c_id = last.c_id)
3387 3387
                 WHERE
3388 3388
                     docs.path NOT LIKE '%_DELETED_%' AND
3389
-                    last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND
3389
+                    last.tool = '".TOOL_DOCUMENT."' $condition_session AND
3390 3390
                     (last.visibility = '1' $lp_visibility_condition) AND
3391 3391
                     last.visibility <> 2 AND
3392 3392
                     docs.c_id = {$course_info['real_id']} AND
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
                 Display::url(
3417 3417
                     Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL),
3418 3418
                     ' javascript:void(0);',
3419
-                    array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div')
3419
+                    array('id' => 'close_div_'.$course_info['real_id'].'_'.$session_id, 'class' => 'close_div')
3420 3420
                 ),
3421 3421
                 array('style' => 'position:absolute;right:10px')
3422 3422
             );
@@ -3520,7 +3520,7 @@  discard block
 block discarded – undo
3520 3520
                     $('#'+tempId).hide();
3521 3521
                 } else {
3522 3522
                     image.addClass('open');
3523
-                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "');
3523
+                    image.attr('src', '" . Display::returnIconPath('nolines_minus.gif')."');
3524 3524
                     $('#'+id).hide();
3525 3525
                     $('#'+tempId).show();
3526 3526
 
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
         $target,
3568 3568
         $overwrite_url
3569 3569
     ) {
3570
-        $img_sys_path = api_get_path(SYS_CODE_PATH) . 'img/';
3570
+        $img_sys_path = api_get_path(SYS_CODE_PATH).'img/';
3571 3571
         $web_code_path = api_get_path(WEB_CODE_PATH);
3572 3572
 
3573 3573
         $documentId = $resource['id'];
@@ -3582,7 +3582,7 @@  discard block
 block discarded – undo
3582 3582
         // It's a file.
3583 3583
         $icon = choose_image($path);
3584 3584
         $position = strrpos($icon, '.');
3585
-        $icon = substr($icon, 0, $position) . '_small.gif';
3585
+        $icon = substr($icon, 0, $position).'_small.gif';
3586 3586
         $my_file_title = $resource['title'];
3587 3587
         $visibility = $resource['visibility'];
3588 3588
 
@@ -3594,25 +3594,25 @@  discard block
 block discarded – undo
3594 3594
         // Show the "image name" not the filename of the image.
3595 3595
         if ($lp_id) {
3596 3596
             // LP URL
3597
-            $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;file=' . $documentId . '&amp;lp_id=' . $lp_id;
3597
+            $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&amp;action=add_item&amp;type='.TOOL_DOCUMENT.'&amp;file='.$documentId.'&amp;lp_id='.$lp_id;
3598 3598
             if (!empty($overwrite_url)) {
3599
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId.'';
3599
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId.'';
3600 3600
             }
3601 3601
         } else {
3602 3602
             // Direct document URL
3603
-            $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId;
3603
+            $url = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId;
3604 3604
             if (!empty($overwrite_url)) {
3605
-                $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId;
3605
+                $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId;
3606 3606
             }
3607 3607
         }
3608 3608
 
3609 3609
         $img = Display::returnIconPath($icon);
3610
-        if (!file_exists($img_sys_path . $icon)) {
3610
+        if (!file_exists($img_sys_path.$icon)) {
3611 3611
             $img = Display::returnIconPath('default_small.gif');
3612 3612
         }
3613 3613
 
3614 3614
         $link = Display::url(
3615
-            '<img alt="" src="' . $img . '" title="" />&nbsp;' . $my_file_title, $url,
3615
+            '<img alt="" src="'.$img.'" title="" />&nbsp;'.$my_file_title, $url,
3616 3616
             array('target' => $target)
3617 3617
         );
3618 3618
 
@@ -3623,12 +3623,12 @@  discard block
 block discarded – undo
3623 3623
         $return = null;
3624 3624
 
3625 3625
         if ($lp_id == false) {
3626
-            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3626
+            $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3627 3627
         } else {
3628
-            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >';
3628
+            $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >';
3629 3629
         }
3630 3630
 
3631
-        $return .= '<div class="item_data" style="margin-left:' . ($num  * 18) . 'px;margin-right:5px;">';
3631
+        $return .= '<div class="item_data" style="margin-left:'.($num * 18).'px;margin-right:5px;">';
3632 3632
 
3633 3633
         if ($add_move_button) {
3634 3634
             $return .= '<a class="moved" href="#">';
@@ -3693,7 +3693,7 @@  discard block
 block discarded – undo
3693 3693
             if (isset($resource['visible']) && $resource['visible'] == 0) {
3694 3694
                 $folder_class_hidden = "doc_folder_hidden"; // in base.css
3695 3695
             }
3696
-            $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
3696
+            $onclick = 'onclick="javascript: testResources(\'res_'.$resource['id'].'\',\'img_'.$resource['id'].'\')"';
3697 3697
         }
3698 3698
         $return = null;
3699 3699
 
@@ -3701,22 +3701,22 @@  discard block
 block discarded – undo
3701 3701
             $return = '<ul class="lp_resource">';
3702 3702
         }
3703 3703
 
3704
-        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_' . $resource['id'] . '"  style="margin-left:' . ($num * 18) . 'px; ">';
3704
+        $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_'.$resource['id'].'"  style="margin-left:'.($num * 18).'px; ">';
3705 3705
 
3706 3706
         $image = Display::returnIconPath('nolines_plus.gif');
3707 3707
         if (empty($path)) {
3708 3708
             $image = Display::returnIconPath('nolines_minus.gif');
3709 3709
         }
3710
-        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'] . '" '.$onclick.'>';
3710
+        $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'].'" '.$onclick.'>';
3711 3711
         $return .= Display::return_icon('lp_folder.gif').'&nbsp;';
3712 3712
         $return .= '<span '.$onclick.' style="cursor: pointer;" >'.$title.'</span>';
3713 3713
         $return .= '</li>';
3714 3714
 
3715 3715
         if (empty($path)) {
3716 3716
             if ($folderId == false) {
3717
-                $return .= '<div id="res_' . $resource['id'] . '" >';
3717
+                $return .= '<div id="res_'.$resource['id'].'" >';
3718 3718
             } else {
3719
-                $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >';
3719
+                $return .= '<div id="res_'.$resource['id'].'" style="display: none;" >';
3720 3720
             }
3721 3721
         }
3722 3722
 
@@ -3878,9 +3878,9 @@  discard block
 block discarded – undo
3878 3878
             $session_id = api_get_session_id();
3879 3879
         }
3880 3880
         $course_info = api_get_course_info($course_code);
3881
-        $course_dir = $course_info['path'] . '/document';
3881
+        $course_dir = $course_info['path'].'/document';
3882 3882
         $sys_course_path = api_get_path(SYS_COURSE_PATH);
3883
-        $base_work_dir = $sys_course_path . $course_dir;
3883
+        $base_work_dir = $sys_course_path.$course_dir;
3884 3884
 
3885 3885
         $course_id = $course_info['real_id'];
3886 3886
         $table_document = Database::get_course_table(TABLE_DOCUMENT);
@@ -3889,7 +3889,7 @@  discard block
 block discarded – undo
3889 3889
         $result = Database::query($qry);
3890 3890
         if (Database::num_rows($result) == 1) {
3891 3891
             $row = Database::fetch_array($result);
3892
-            $doc_path = api_get_path(SYS_COURSE_PATH) . $course_dir . $row['path'];
3892
+            $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
3893 3893
             //TODO: mime_content_type is deprecated, fileinfo php extension is enabled by default as of PHP 5.3.0
3894 3894
             // now versions of PHP on Debian testing(5.2.6-5) and Ubuntu(5.2.6-2ubuntu) are lower, so wait for a while
3895 3895
             $doc_mime = mime_content_type($doc_path);
@@ -3920,8 +3920,8 @@  discard block
 block discarded – undo
3920 3920
                 $file_content = self::get_text_content($doc_path, $doc_mime);
3921 3921
                 $course_code = Database::escape_string($course_code);
3922 3922
 
3923
-                require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
3924
-                require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
3923
+                require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
3924
+                require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
3925 3925
 
3926 3926
                 $ic_slide = new IndexableChunk();
3927 3927
                 $ic_slide->addValue('title', $file_title);
@@ -3938,7 +3938,7 @@  discard block
 block discarded – undo
3938 3938
                 $di = new ChamiloIndexer();
3939 3939
                 $return = $di->connectDb(null, null, $lang);
3940 3940
 
3941
-                require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
3941
+                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
3942 3942
                 $specific_fields = get_specific_field_list();
3943 3943
 
3944 3944
                 // process different depending on what to do if file exists
@@ -3975,7 +3975,7 @@  discard block
 block discarded – undo
3975 3975
                             } else { //if the specific field is not defined, force an empty one
3976 3976
                                 $sterms = '';
3977 3977
                             }
3978
-                            $all_specific_terms .= ' ' . $sterms;
3978
+                            $all_specific_terms .= ' '.$sterms;
3979 3979
                             $sterms = explode(',', $sterms);
3980 3980
                             foreach ($sterms as $sterm) {
3981 3981
                                 $sterm = trim($sterm);
@@ -3989,7 +3989,7 @@  discard block
 block discarded – undo
3989 3989
                             }
3990 3990
                         }
3991 3991
                         // Add terms also to content to make terms findable by probabilistic search
3992
-                        $file_content = $all_specific_terms . ' ' . $file_content;
3992
+                        $file_content = $all_specific_terms.' '.$file_content;
3993 3993
 
3994 3994
                         if (!$simulation) {
3995 3995
                             $ic_slide->addValue('content', $file_content);
@@ -4015,7 +4015,7 @@  discard block
 block discarded – undo
4015 4015
                         } else { //if the specific field is not defined, force an empty one
4016 4016
                             $sterms = '';
4017 4017
                         }
4018
-                        $all_specific_terms .= ' ' . $sterms;
4018
+                        $all_specific_terms .= ' '.$sterms;
4019 4019
                         if (!empty($sterms)) {
4020 4020
                             $sterms = explode(',', $sterms);
4021 4021
                             foreach ($sterms as $sterm) {
@@ -4027,7 +4027,7 @@  discard block
 block discarded – undo
4027 4027
                         }
4028 4028
                     }
4029 4029
                     // Add terms also to content to make terms findable by probabilistic search
4030
-                    $file_content = $all_specific_terms . ' ' . $file_content;
4030
+                    $file_content = $all_specific_terms.' '.$file_content;
4031 4031
                     if (!$simulation) {
4032 4032
                         $ic_slide->addValue('content', $file_content);
4033 4033
                         $di->addChunk($ic_slide);
@@ -4311,7 +4311,7 @@  discard block
 block discarded – undo
4311 4311
         $defaultVisibility = 'visible';
4312 4312
 
4313 4313
         if (isset($settings['documents'])) {
4314
-            $portalDefaultVisibility =  'invisible';
4314
+            $portalDefaultVisibility = 'invisible';
4315 4315
             if ($settings['documents'] == 'true') {
4316 4316
                 $portalDefaultVisibility = 'visible';
4317 4317
             }
@@ -4549,7 +4549,7 @@  discard block
 block discarded – undo
4549 4549
         //make htaccess with allow from all, and file index.html into temp/audio
4550 4550
         $htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess';
4551 4551
         if (!file_exists($htaccess)) {
4552
-            $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
4552
+            $htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes";
4553 4553
             $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w');
4554 4554
             if ($fp) {
4555 4555
                 fwrite($fp, $htaccess_content);
@@ -4558,9 +4558,9 @@  discard block
 block discarded – undo
4558 4558
         }
4559 4559
 
4560 4560
         //encript temp name file
4561
-        $name_crip = sha1(uniqid());//encript
4562
-        $findext= explode(".", $file);
4563
-        $extension = $findext[count($findext)-1];
4561
+        $name_crip = sha1(uniqid()); //encript
4562
+        $findext = explode(".", $file);
4563
+        $extension = $findext[count($findext) - 1];
4564 4564
         $file_crip = $name_crip.'.'.$extension;
4565 4565
 
4566 4566
         //copy file to temp/audio directory
@@ -4664,7 +4664,7 @@  discard block
 block discarded – undo
4664 4664
         $comment = null;
4665 4665
 
4666 4666
         $fileName = api_replace_dangerous_char($title);
4667
-        $filePath = api_get_path(SYS_COURSE_PATH) . "{$courseData['path']}/document{$dir}";
4667
+        $filePath = api_get_path(SYS_COURSE_PATH)."{$courseData['path']}/document{$dir}";
4668 4668
         $fileFullPath = "{$filePath}/{$fileName}.html";
4669 4669
         $fileSize = 0;
4670 4670
         $fileType = 'file';
@@ -4716,7 +4716,7 @@  discard block
 block discarded – undo
4716 4716
             $fileSize,
4717 4717
             $title,
4718 4718
             $comment,
4719
-            0,//$readonly = 0,
4719
+            0, //$readonly = 0,
4720 4720
             true, //$save_visibility = true,
4721 4721
             null, //$group_id = null,
4722 4722
             $sessionId
@@ -5001,8 +5001,8 @@  discard block
 block discarded – undo
5001 5001
             $sessionId,
5002 5002
             $groupId
5003 5003
         )) {
5004
-            $uniqueName = self::addSuffixToFileName($name, '_' . $counter);
5005
-            $filePath = $path . $uniqueName;
5004
+            $uniqueName = self::addSuffixToFileName($name, '_'.$counter);
5005
+            $filePath = $path.$uniqueName;
5006 5006
             $counter++;
5007 5007
         }
5008 5008
 
@@ -5035,7 +5035,7 @@  discard block
 block discarded – undo
5035 5035
             $folder_sql = implode("','", $escaped_folders);
5036 5036
 
5037 5037
             $sql = "SELECT * FROM $doc_table
5038
-                WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('" . $folder_sql . "')";
5038
+                WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('".$folder_sql."')";
5039 5039
             $res = Database::query($sql);
5040 5040
             $folder_titles = array();
5041 5041
             while ($obj = Database::fetch_object($res)) {
@@ -5043,7 +5043,7 @@  discard block
 block discarded – undo
5043 5043
             }
5044 5044
         }
5045 5045
 
5046
-        $form = new FormValidator('selector', 'GET', api_get_self() . '?' . api_get_cidreq());
5046
+        $form = new FormValidator('selector', 'GET', api_get_self().'?'.api_get_cidreq());
5047 5047
         $form->addElement('hidden', 'cidReq', api_get_course_id());
5048 5048
         $parent_select = $form->addSelect('id', get_lang('CurrentDirectory'), '', array('onchange' => 'javascript: document.selector.submit();'));
5049 5049
 
@@ -5063,9 +5063,9 @@  discard block
 block discarded – undo
5063 5063
                     $folder_titles[$folder] = cut($folder_titles[$folder], 80);
5064 5064
                     $counter = count($path_parts) - 2;
5065 5065
                     if ($counter > 0) {
5066
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter) . ' &mdash; ' . $folder_titles[$folder];
5066
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', $counter).' &mdash; '.$folder_titles[$folder];
5067 5067
                     } else {
5068
-                        $label = ' &mdash; ' . $folder_titles[$folder];
5068
+                        $label = ' &mdash; '.$folder_titles[$folder];
5069 5069
                     }
5070 5070
                     $parent_select->addOption($label, $folder_id);
5071 5071
                     if ($selected != '') {
@@ -5083,7 +5083,7 @@  discard block
 block discarded – undo
5083 5083
                     } else {
5084 5084
                         $path_parts = explode('/', str_replace($group_dir, '', $folder));
5085 5085
                         $label = cut($label, 80);
5086
-                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
5086
+                        $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
5087 5087
                     }
5088 5088
                     $parent_select->addOption($label, $folder_id);
5089 5089
                     if ($selected != '') {
@@ -5115,7 +5115,7 @@  discard block
 block discarded – undo
5115 5115
     ) {
5116 5116
         global $dbl_click_id;
5117 5117
         $course_info = api_get_course_info();
5118
-        $www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document';
5118
+        $www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document';
5119 5119
         $webOdflist = DocumentManager::get_web_odf_extension_list();
5120 5120
 
5121 5121
         // Get the title or the basename depending on what we're using
@@ -5139,11 +5139,11 @@  discard block
 block discarded – undo
5139 5139
 
5140 5140
         if (!$show_as_icon) {
5141 5141
             // Build download link (icon)
5142
-            $forcedownload_link = ($filetype == 'folder') ? api_get_self() . '?' . api_get_cidreq() . '&action=downloadfolder&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq() . '&amp;action=download&amp;id=' . $document_data['id'];
5142
+            $forcedownload_link = ($filetype == 'folder') ? api_get_self().'?'.api_get_cidreq().'&action=downloadfolder&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq().'&amp;action=download&amp;id='.$document_data['id'];
5143 5143
             // Folder download or file download?
5144 5144
             $forcedownload_icon = ($filetype == 'folder') ? 'save_pack.png' : 'save.png';
5145 5145
             // Prevent multiple clicks on zipped folder download
5146
-            $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_" . ($dbl_click_id++) . "=false;',10000); } else { return false; }\"" : '';
5146
+            $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_".($dbl_click_id++)."=false;',10000); } else { return false; }\"" : '';
5147 5147
         }
5148 5148
 
5149 5149
         $target = '_self';
@@ -5159,20 +5159,20 @@  discard block
 block discarded – undo
5159 5159
 
5160 5160
             if ($is_browser_viewable_file) {
5161 5161
                 if ($ext == 'pdf' || in_array($ext, $webOdflist)) {
5162
-                    $url = api_get_self() . '?' . api_get_cidreq() . '&amp;action=download&amp;id=' . $document_data['id'];
5162
+                    $url = api_get_self().'?'.api_get_cidreq().'&amp;action=download&amp;id='.$document_data['id'];
5163 5163
                 } else {
5164
-                    $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5164
+                    $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5165 5165
                 }
5166 5166
             } else {
5167 5167
                 // url-encode for problematic characters (we may not call them dangerous characters...)
5168
-                $path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq();
5169
-                $url = $www . $path;
5168
+                $path = str_replace('%2F', '/', $url_path).'?'.api_get_cidreq();
5169
+                $url = $www.$path;
5170 5170
             }
5171 5171
 
5172 5172
             /*$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read
5173 5173
             $url = $www . $path;*/
5174 5174
         } else {
5175
-            $url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id'];
5175
+            $url = api_get_self().'?'.api_get_cidreq().'&id='.$document_data['id'];
5176 5176
         }
5177 5177
 
5178 5178
         // The little download icon
@@ -5182,10 +5182,10 @@  discard block
 block discarded – undo
5182 5182
         if ($path == '/shared_folder') {
5183 5183
             $tooltip_title_alt = get_lang('UserFolders');
5184 5184
         } elseif (strstr($path, 'shared_folder_session_')) {
5185
-            $tooltip_title_alt = get_lang('UserFolders') . ' (' . api_get_session_name(api_get_session_id()) . ')';
5185
+            $tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name(api_get_session_id()).')';
5186 5186
         } elseif (strstr($tooltip_title, 'sf_user_')) {
5187 5187
             $userinfo = api_get_user_info(substr($tooltip_title, 8));
5188
-            $tooltip_title_alt = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5188
+            $tooltip_title_alt = get_lang('UserFolder').' '.$userinfo['complete_name'];
5189 5189
         } elseif ($path == '/chat_files') {
5190 5190
             $tooltip_title_alt = get_lang('ChatFiles');
5191 5191
         } elseif ($path == '/learning_path') {
@@ -5218,24 +5218,24 @@  discard block
 block discarded – undo
5218 5218
                 ) {
5219 5219
                     //filter when I am into shared folder, I can show for donwload only my shared folder
5220 5220
                     if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) {
5221
-                        if (preg_match('/shared_folder\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5222
-                            preg_match('/shared_folder_session_' . $current_session_id . '\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
5221
+                        if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5222
+                            preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) ||
5223 5223
                             api_is_allowed_to_edit() || api_is_platform_admin()
5224 5224
                         ) {
5225
-                            $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5226
-                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5225
+                            $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5226
+                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5227 5227
                         }
5228 5228
                     } elseif (!preg_match('/shared_folder/', urldecode($forcedownload_link)) ||
5229 5229
                         api_is_allowed_to_edit() ||
5230 5230
                         api_is_platform_admin()
5231 5231
                     ) {
5232
-                        $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5233
-                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5232
+                        $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5233
+                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5234 5234
                     }
5235 5235
                 }
5236 5236
             } else {
5237
-                $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5238
-                    Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>';
5237
+                $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5238
+                    Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
5239 5239
             }
5240 5240
 
5241 5241
             // Copy files to users myfiles
@@ -5243,12 +5243,12 @@  discard block
 block discarded – undo
5243 5243
                 api_get_setting('users_copy_files') == 'true' &&
5244 5244
                 !api_is_anonymous()
5245 5245
             ) {
5246
-                $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq();
5246
+                $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq();
5247 5247
 
5248 5248
                 if ($filetype == 'file') {
5249 5249
 
5250
-                    $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' .
5251
-                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5250
+                    $copy_to_myfiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.
5251
+                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5252 5252
 
5253 5253
                     if (api_get_setting('allow_my_files') === 'false') {
5254 5254
                         $copy_to_myfiles = '';
@@ -5267,13 +5267,13 @@  discard block
 block discarded – undo
5267 5267
                 $filetype == 'file' &&
5268 5268
                 in_array($extension, array('html', 'htm'))
5269 5269
             ) {
5270
-                $pdf_icon = ' <a style="float:right".' . $prevent_multiple_click . ' href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $document_data['id'] . '">' .
5271
-                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a> ';
5270
+                $pdf_icon = ' <a style="float:right".'.$prevent_multiple_click.' href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$document_data['id'].'">'.
5271
+                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a> ';
5272 5272
             }
5273 5273
 
5274 5274
             if ($is_browser_viewable_file) {
5275
-                $open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' .
5276
-                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . '&nbsp;&nbsp;</a>';
5275
+                $open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/', $url_path).'?'.api_get_cidreq().'" style="float:right"'.$prevent_multiple_click.' target="_blank">'.
5276
+                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
5277 5277
             }
5278 5278
 
5279 5279
             if ($filetype == 'file') {
@@ -5282,9 +5282,9 @@  discard block
 block discarded – undo
5282 5282
                     (preg_match('/wav$/i', urldecode($checkExtension)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) ||
5283 5283
                     preg_match('/ogg$/i', urldecode($checkExtension))
5284 5284
                 ) {
5285
-                    return '<span style="float:left" ' . $visibility_class . '>' .
5286
-                    $title .
5287
-                    '</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5285
+                    return '<span style="float:left" '.$visibility_class.'>'.
5286
+                    $title.
5287
+                    '</span>'.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5288 5288
                 } elseif (
5289 5289
 
5290 5290
                     // Show preview
@@ -5302,7 +5302,7 @@  discard block
 block discarded – undo
5302 5302
                     )
5303 5303
                 ) {
5304 5304
                     // Simpler version of showinframesmin.php with no headers
5305
-                    $url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5305
+                    $url = 'show_content.php?'.api_get_cidreq().'&id='.$document_data['id'];
5306 5306
                     $class = 'ajax';
5307 5307
                     if ($visibility == false) {
5308 5308
                         $class = "ajax invisible";
@@ -5317,34 +5317,34 @@  discard block
 block discarded – undo
5317 5317
                             'style' => 'float: left;'
5318 5318
                         ]
5319 5319
                     )
5320
-                    . $force_download_html . $send_to . $copy_to_myfiles
5321
-                    . $open_in_new_window_link . $pdf_icon;
5320
+                    . $force_download_html.$send_to.$copy_to_myfiles
5321
+                    . $open_in_new_window_link.$pdf_icon;
5322 5322
                 } else {
5323 5323
                     // For PDF Download the file.
5324 5324
                     $pdfPreview = null;
5325 5325
                     if ($ext != 'pdf' && !in_array($ext, $webOdflist)) {
5326
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5326
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5327 5327
                     } else {
5328 5328
                         $pdfPreview = Display::url(
5329 5329
                             Display::return_icon('preview.gif', get_lang('Preview')),
5330
-                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'],
5330
+                            api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'],
5331 5331
                             array('style' => 'float:right')
5332 5332
                         );
5333 5333
                     }
5334 5334
                     // No plugin just the old and good showinframes.php page
5335
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' .
5336
-                    $pdfPreview.$force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5335
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" style="float:left" '.$visibility_class.' >'.$title.'</a>'.
5336
+                    $pdfPreview.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5337 5337
                 }
5338 5338
             } else {
5339
-                return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . $title . '</a>' .
5340
-                $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon;
5339
+                return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.$title.'</a>'.
5340
+                $force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon;
5341 5341
             }
5342 5342
             // end copy files to users myfiles
5343 5343
         } else {
5344 5344
             // Icon column
5345 5345
             if (preg_match('/shared_folder/', urldecode($checkExtension)) &&
5346 5346
                 preg_match('/shared_folder$/', urldecode($checkExtension)) == false &&
5347
-                preg_match('/shared_folder_session_' . $current_session_id . '$/', urldecode($url)) == false
5347
+                preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url)) == false
5348 5348
             ) {
5349 5349
                 if ($filetype == 'file') {
5350 5350
                     //Sound preview with jplayer
@@ -5369,19 +5369,19 @@  discard block
 block discarded – undo
5369 5369
                             api_get_setting('enable_nanogong') == 'true'
5370 5370
                         )
5371 5371
                     ) {
5372
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'];
5373
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5374
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5375
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5372
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'];
5373
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5374
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5375
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5376 5376
                     } else {
5377
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5378
-                        DocumentManager::build_document_icon_tag($filetype, $path) .
5379
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5377
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5378
+                        DocumentManager::build_document_icon_tag($filetype, $path).
5379
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5380 5380
                     }
5381 5381
                 } else {
5382
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
5383
-                    DocumentManager::build_document_icon_tag($filetype, $path) .
5384
-                    Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
5382
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
5383
+                    DocumentManager::build_document_icon_tag($filetype, $path).
5384
+                    Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>';
5385 5385
                 }
5386 5386
             } else {
5387 5387
                 if ($filetype == 'file') {
@@ -5409,16 +5409,16 @@  discard block
 block discarded – undo
5409 5409
                             api_get_setting('enable_nanogong') == 'true'
5410 5410
                         )
5411 5411
                     ) {
5412
-                        $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; //without preview
5413
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5414
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5412
+                        $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; //without preview
5413
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5414
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5415 5415
                     } else {
5416
-                        return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
5417
-                        DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5416
+                        return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
5417
+                        DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5418 5418
                     }
5419 5419
                 } else {
5420
-                    return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
5421
-                    DocumentManager::build_document_icon_tag($filetype, $path) . '</a>';
5420
+                    return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
5421
+                    DocumentManager::build_document_icon_tag($filetype, $path).'</a>';
5422 5422
                 }
5423 5423
             }
5424 5424
         }
@@ -5442,7 +5442,7 @@  discard block
 block discarded – undo
5442 5442
 
5443 5443
             if (preg_match('/_chnano_.wav$/i', $basename)) {
5444 5444
                 $icon = "jplayer_play.png";
5445
-                $basename = 'wav' . ' ' . '(Nanogong)';
5445
+                $basename = 'wav'.' '.'(Nanogong)';
5446 5446
             } else {
5447 5447
                 $basename = substr(strrchr($basename, '.'), 1);
5448 5448
             }
@@ -5458,13 +5458,13 @@  discard block
 block discarded – undo
5458 5458
                 $userinfo = api_get_user_info(substr($basename, 8));
5459 5459
                 $icon = $userinfo['avatar_small'];
5460 5460
 
5461
-                $basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name'];
5461
+                $basename = get_lang('UserFolder').' '.$userinfo['complete_name'];
5462 5462
                 $user_image = true;
5463 5463
             } elseif (strstr($path, 'shared_folder_session_')) {
5464 5464
                 if ($is_allowed_to_edit) {
5465
-                    $basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder');
5465
+                    $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpUsersFolder');
5466 5466
                 } else {
5467
-                    $basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')';
5467
+                    $basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')';
5468 5468
                 }
5469 5469
                 $icon = 'folder_users.gif';
5470 5470
             } else {
@@ -5558,16 +5558,16 @@  discard block
 block discarded – undo
5558 5558
         // Build URL-parameters for table-sorting
5559 5559
         $sort_params = array();
5560 5560
         if (isset($_GET['column'])) {
5561
-            $sort_params[] = 'column=' . Security::remove_XSS($_GET['column']);
5561
+            $sort_params[] = 'column='.Security::remove_XSS($_GET['column']);
5562 5562
         }
5563 5563
         if (isset($_GET['page_nr'])) {
5564
-            $sort_params[] = 'page_nr=' . Security::remove_XSS($_GET['page_nr']);
5564
+            $sort_params[] = 'page_nr='.Security::remove_XSS($_GET['page_nr']);
5565 5565
         }
5566 5566
         if (isset($_GET['per_page'])) {
5567
-            $sort_params[] = 'per_page=' . Security::remove_XSS($_GET['per_page']);
5567
+            $sort_params[] = 'per_page='.Security::remove_XSS($_GET['per_page']);
5568 5568
         }
5569 5569
         if (isset($_GET['direction'])) {
5570
-            $sort_params[] = 'direction=' . Security::remove_XSS($_GET['direction']);
5570
+            $sort_params[] = 'direction='.Security::remove_XSS($_GET['direction']);
5571 5571
         }
5572 5572
         $sort_params = implode('&amp;', $sort_params);
5573 5573
         $visibility_icon = ($visibility == 0) ? 'invisible' : 'visible';
@@ -5580,89 +5580,89 @@  discard block
 block discarded – undo
5580 5580
         if ($is_read_only /* or ($session_id!=api_get_session_id()) */) {
5581 5581
             if (api_is_course_admin() || api_is_platform_admin()) {
5582 5582
                 if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5583
-                    $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5584
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5585
-                } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5586
-                    $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5587
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5583
+                    $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5584
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5585
+                } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5586
+                    $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5587
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5588 5588
                 } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5589
-                    $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' .
5590
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5589
+                    $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5590
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5591 5591
                 } else {
5592
-                    $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id. '">' .
5593
-                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5592
+                    $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5593
+                        Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5594 5594
                 }
5595 5595
             } else {
5596 5596
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5597 5597
             }
5598
-            $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5598
+            $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
5599 5599
             if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5600
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5600
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL);
5601 5601
             }
5602
-            $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5602
+            $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
5603 5603
         } else {
5604 5604
             //Edit button
5605 5605
             if (in_array($path, DocumentManager::get_system_folders())) {
5606 5606
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
5607
-            } elseif ($is_certificate_mode ) {
5607
+            } elseif ($is_certificate_mode) {
5608 5608
                 // gradebook category doesn't seem to be taken into account
5609
-                $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '&curdirpath=/certificates">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5609
+                $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'&curdirpath=/certificates">'.Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5610 5610
             } else {
5611 5611
                 if (api_get_session_id()) {
5612 5612
                     if ($document_data['session_id'] == api_get_session_id()) {
5613 5613
                         if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5614
-                            $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5615
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5616
-                        } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5617
-                            $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5618
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5614
+                            $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5615
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5616
+                        } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5617
+                            $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5618
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5619 5619
                         } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5620
-                            $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5621
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5620
+                            $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5621
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5622 5622
                         } else {
5623
-                            $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5624
-                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5623
+                            $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5624
+                                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5625 5625
                         }
5626 5626
                     } else {
5627
-                        $modify_icons .= '&nbsp;' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
5627
+                        $modify_icons .= '&nbsp;'.Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
5628 5628
                     }
5629 5629
                 } else {
5630 5630
                     if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') {
5631
-                        $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5632
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5633
-                    } elseif (in_array($extension, $web_odf_extension_list)  && api_get_setting('enabled_support_odf') === true) {
5634
-                        $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id  . '">' .
5635
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5631
+                        $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5632
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5633
+                    } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) {
5634
+                        $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'.
5635
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5636 5636
                     } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') {
5637
-                        $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&amp;id=' . $document_id . '">' .
5638
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5637
+                        $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5638
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5639 5639
                     } else {
5640
-                        $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&amp;id=' . $document_id  . '">' .
5641
-                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
5640
+                        $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&amp;id='.$document_id.'">'.
5641
+                            Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
5642 5642
                     }
5643 5643
                 }
5644 5644
             }
5645 5645
 
5646 5646
             // Move button.
5647 5647
             if ($is_certificate_mode || in_array($path, DocumentManager::get_system_folders())) {
5648
-                $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5648
+                $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5649 5649
             } else {
5650 5650
                 if (api_get_session_id()) {
5651 5651
                     if ($document_data['session_id'] == api_get_session_id()) {
5652
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5653
-                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5652
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5653
+                            Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5654 5654
                     } else {
5655
-                        $modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5655
+                        $modify_icons .= '&nbsp;'.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5656 5656
                     }
5657 5657
                 } else {
5658
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;move=' . $document_id .  '">' .
5659
-                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
5658
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;move='.$document_id.'">'.
5659
+                        Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
5660 5660
                 }
5661 5661
             }
5662 5662
 
5663 5663
             //Visibility button
5664 5664
             if ($is_certificate_mode) {
5665
-                $modify_icons .= '&nbsp;' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL) . '</a>';
5665
+                $modify_icons .= '&nbsp;'.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL).'</a>';
5666 5666
             } else {
5667 5667
                 if (api_is_allowed_to_edit() || api_is_platform_admin()) {
5668 5668
                     if ($visibility_icon == 'invisible') {
@@ -5670,14 +5670,14 @@  discard block
 block discarded – undo
5670 5670
                     } else {
5671 5671
                         $tip_visibility = get_lang('Hide');
5672 5672
                     }
5673
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;id=' . $parent_id . '&amp;' . $visibility_command . '=' . $id . '&amp;' . $sort_params . '">' .
5674
-                        Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>';
5673
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$parent_id.'&amp;'.$visibility_command.'='.$id.'&amp;'.$sort_params.'">'.
5674
+                        Display::return_icon($visibility_icon.'.png', $tip_visibility, '', ICON_SIZE_SMALL).'</a>';
5675 5675
                 }
5676 5676
             }
5677 5677
 
5678 5678
             // Delete button
5679 5679
             if (in_array($path, DocumentManager::get_system_folders())) {
5680
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5680
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5681 5681
             } else {
5682 5682
                 $titleToShow = addslashes(basename($document_data['title']));
5683 5683
 
@@ -5685,23 +5685,23 @@  discard block
 block discarded – undo
5685 5685
                     $_GET['curdirpath'] == '/certificates' &&
5686 5686
                     DocumentManager::get_default_certificate_id(api_get_course_id()) == $id
5687 5687
                 ) {
5688
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
5689
-                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5688
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'delete_certificate_id='.$id.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5689
+                        Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5690 5690
                 } else {
5691 5691
                     if ($is_certificate_mode) {
5692
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid=' . $document_id  . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
5693
-                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5692
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5693
+                            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5694 5694
                     } else {
5695 5695
                         if (api_get_session_id()) {
5696 5696
                             if ($document_data['session_id'] == api_get_session_id()) {
5697
-                                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id  . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">'.
5698
-                                    Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5697
+                                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5698
+                                    Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5699 5699
                             } else {
5700
-                                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5700
+                                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
5701 5701
                             }
5702 5702
                         } else {
5703
-                            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&amp;' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow. '\');">' .
5704
-                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
5703
+                            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'.
5704
+                                Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
5705 5705
                         }
5706 5706
                     }
5707 5707
                 }
@@ -5713,15 +5713,15 @@  discard block
 block discarded – undo
5713 5713
                 // nothing to do
5714 5714
             } else {
5715 5715
                 if ($usePpt2lp && $formatType) {
5716
-                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" ' .
5717
-                        'data-documentId = ' . $document_id .
5718
-                        ' data-formatType = ' . $formatType . '>' .
5716
+                    $modify_icons .= '&nbsp;<a class="convertAction" href="#" '.
5717
+                        'data-documentId = '.$document_id.
5718
+                        ' data-formatType = '.$formatType.'>'.
5719 5719
                         Display::return_icon(
5720 5720
                             'convert.png',
5721 5721
                             get_lang('Convert'),
5722 5722
                             array(),
5723 5723
                             ICON_SIZE_SMALL
5724
-                        ) . '</a>';
5724
+                        ).'</a>';
5725 5725
                 }
5726 5726
             }
5727 5727
         }
@@ -5729,8 +5729,8 @@  discard block
 block discarded – undo
5729 5729
         if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) {
5730 5730
             if ($is_template == 0) {
5731 5731
                 if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) {
5732
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;add_as_template=' . $id .  '&amp;' . $sort_params . '">' .
5733
-                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>';
5732
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;add_as_template='.$id.'&amp;'.$sort_params.'">'.
5733
+                        Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL).'</a>';
5734 5734
                 }
5735 5735
                 if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course
5736 5736
                     $visibility_icon_certificate = 'nocertificate';
@@ -5744,21 +5744,21 @@  discard block
 block discarded – undo
5744 5744
                         $certificate = get_lang('NoDefaultCertificate');
5745 5745
                     }
5746 5746
                     if (isset($_GET['selectcat'])) {
5747
-                        $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;selectcat=' . intval($_GET['selectcat']) . '&amp;set_certificate=' . $id . '&amp;' . $sort_params . '">';
5747
+                        $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;selectcat='.intval($_GET['selectcat']).'&amp;set_certificate='.$id.'&amp;'.$sort_params.'">';
5748 5748
                         $modify_icons .= Display::return_icon($visibility_icon_certificate.'.png', $certificate);
5749 5749
                         $modify_icons .= '</a>';
5750 5750
                         if ($is_preview) {
5751
-                            $modify_icons .= '&nbsp;<a target="_blank"  href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;curdirpath=' . $curdirpath . '&amp;set_preview=' . $id . '&amp;' . $sort_params . '" >' .
5752
-                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>';
5751
+                            $modify_icons .= '&nbsp;<a target="_blank"  href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.$curdirpath.'&amp;set_preview='.$id.'&amp;'.$sort_params.'" >'.
5752
+                                Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL).'</a>';
5753 5753
                         }
5754 5754
                     }
5755 5755
                 }
5756 5756
             } else {
5757
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&amp;remove_as_template=' . $id. '&amp;' . $sort_params . '">' .
5758
-                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>';
5757
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&amp;remove_as_template='.$id.'&amp;'.$sort_params.'">'.
5758
+                    Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL).'</a>';
5759 5759
             }
5760
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' .
5761
-                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a>';
5760
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$id.'">'.
5761
+                Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a>';
5762 5762
         }
5763 5763
         return $modify_icons;
5764 5764
     }
@@ -5827,7 +5827,7 @@  discard block
 block discarded – undo
5827 5827
                     // 3. inside a subfolder of the folder you want to move
5828 5828
                     if (($curdirpath != $folder) &&
5829 5829
                         ($folder != $move_file) &&
5830
-                        (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5830
+                        (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5831 5831
                     ) {
5832 5832
                         $path_displayed = $folder;
5833 5833
                         // If document title is used, we have to display titles instead of real paths...
@@ -5844,7 +5844,7 @@  discard block
 block discarded – undo
5844 5844
             foreach ($folders as $folder) {
5845 5845
                 if (($curdirpath != $folder) &&
5846 5846
                     ($folder != $move_file) &&
5847
-                    (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
5847
+                    (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/')
5848 5848
                 ) {
5849 5849
                     // Cannot copy dir into his own subdir
5850 5850
                     $path_displayed = DocumentManager::get_titles_of_path($folder);
@@ -5886,10 +5886,10 @@  discard block
 block discarded – undo
5886 5886
                 // If this path has soon been stored here we don't need a new query
5887 5887
                 $path_displayed .= $tmp_folders_titles[$tmp_path];
5888 5888
             } else {
5889
-                $sql = 'SELECT title FROM ' . Database::get_course_table(TABLE_DOCUMENT) . '
5890
-                    WHERE c_id = ' . $course_id . ' AND path LIKE BINARY "' . $tmp_path . '"';
5889
+                $sql = 'SELECT title FROM '.Database::get_course_table(TABLE_DOCUMENT).'
5890
+                    WHERE c_id = ' . $course_id.' AND path LIKE BINARY "'.$tmp_path.'"';
5891 5891
                 $rs = Database::query($sql);
5892
-                $tmp_title = '/' . Database::result($rs, 0, 0);
5892
+                $tmp_title = '/'.Database::result($rs, 0, 0);
5893 5893
                 $path_displayed .= $tmp_title;
5894 5894
                 $tmp_folders_titles[$tmp_path] = $tmp_title;
5895 5895
             }
@@ -5925,7 +5925,7 @@  discard block
 block discarded – undo
5925 5925
         $clean_curdirpath = Security::remove_XSS($curdirpath);
5926 5926
         if ($clean_curdirpath == '/shared_folder') {
5927 5927
             return true;
5928
-        } elseif ($clean_curdirpath == '/shared_folder_session_' . $current_session_id) {
5928
+        } elseif ($clean_curdirpath == '/shared_folder_session_'.$current_session_id) {
5929 5929
             return true;
5930 5930
         } else {
5931 5931
             return false;
@@ -5941,7 +5941,7 @@  discard block
 block discarded – undo
5941 5941
         $clean_path = Security::remove_XSS($path);
5942 5942
         if (strpos($clean_path, 'shared_folder/sf_user_')) {
5943 5943
             return true;
5944
-        } elseif (strpos($clean_path, 'shared_folder_session_' . $current_session_id . '/sf_user_')) {
5944
+        } elseif (strpos($clean_path, 'shared_folder_session_'.$current_session_id.'/sf_user_')) {
5945 5945
             return true;
5946 5946
         } else {
5947 5947
             return false;
@@ -5954,11 +5954,11 @@  discard block
 block discarded – undo
5954 5954
      */
5955 5955
     public static function is_my_shared_folder($user_id, $path, $current_session_id)
5956 5956
     {
5957
-        $clean_path = Security::remove_XSS($path) . '/';
5957
+        $clean_path = Security::remove_XSS($path).'/';
5958 5958
         //for security does not remove the last slash
5959
-        $main_user_shared_folder = '/shared_folder\/sf_user_' . $user_id . '\//';
5959
+        $main_user_shared_folder = '/shared_folder\/sf_user_'.$user_id.'\//';
5960 5960
         //for security does not remove the last slash
5961
-        $main_user_shared_folder_session = '/shared_folder_session_' . $current_session_id . '\/sf_user_' . $user_id . '\//';
5961
+        $main_user_shared_folder_session = '/shared_folder_session_'.$current_session_id.'\/sf_user_'.$user_id.'\//';
5962 5962
 
5963 5963
         if (preg_match($main_user_shared_folder, $clean_path)) {
5964 5964
             return true;
@@ -6231,7 +6231,7 @@  discard block
 block discarded – undo
6231 6231
                 ON (i.c_id = d.c_id)
6232 6232
                 WHERE
6233 6233
                     d.id = i.ref AND
6234
-                    i.tool = '" . TOOL_DOCUMENT . "'
6234
+                    i.tool = '".TOOL_DOCUMENT."'
6235 6235
                     $conditionSession AND
6236 6236
                     i.c_id = $courseId AND
6237 6237
                     d.c_id = $courseId ";
@@ -6239,9 +6239,9 @@  discard block
 block discarded – undo
6239 6239
         $result = Database::query($sql);
6240 6240
         $documents = Database::store_result($result, 'ASSOC');
6241 6241
         if ($documents) {
6242
-            $course_dir = $courseInfo['directory'] . '/document';
6242
+            $course_dir = $courseInfo['directory'].'/document';
6243 6243
             $sys_course_path = api_get_path(SYS_COURSE_PATH);
6244
-            $base_work_dir = $sys_course_path . $course_dir;
6244
+            $base_work_dir = $sys_course_path.$course_dir;
6245 6245
 
6246 6246
             foreach ($documents as $document) {
6247 6247
                 $documentId = $document['id'];
Please login to merge, or discard this patch.
main/tracking/lp_results_by_user.php 2 patches
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
17 17
 
18 18
 if (!$is_allowedToTrack) {
19
-	Display :: display_header(null);
20
-	api_not_allowed();
21
-	Display :: display_footer();
19
+    Display :: display_header(null);
20
+    api_not_allowed();
21
+    Display :: display_footer();
22 22
 }
23 23
 
24 24
 $export_to_csv = false;
25 25
 if (isset($_GET['export'])) {
26
-	$export_to_csv = true;
26
+    $export_to_csv = true;
27 27
 }
28 28
 
29 29
 if (api_is_platform_admin() ) {
30
-	$global = true;
30
+    $global = true;
31 31
 } else {
32
-	$global = false;
32
+    $global = false;
33 33
 }
34 34
 
35 35
 if ($global) {
36
-	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
38
-		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
36
+    $temp_course_list = CourseManager :: get_courses_list();
37
+    foreach($temp_course_list  as $temp_course_item) {
38
+        $course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
41 41
             'title' => $course_item['title'],
42 42
         );
43
-	}
43
+    }
44 44
 } else {
45 45
     $current_course['code'] = $_course['id'];
46
-	$course_list = array($current_course);
46
+    $course_list = array($current_course);
47 47
 }
48 48
 
49 49
 $new_course_select = array();
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55 55
 $form->addElement('select','course_code',get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+    $form->addElement('hidden','view','admin');
58 58
 } else {
59
-	//Get exam lists
59
+    //Get exam lists
60 60
     $course_id = api_get_course_int_id();
61
-	$t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
-	$sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
61
+    $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
+    $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
63 63
 	                 WHERE c_id = $course_id AND active='1'
64 64
 	                 ORDER BY quiz.title ASC";
65
-	$resultExercices = Database::query($sqlExercices);
66
-	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
68
-		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
-	}
70
-	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
65
+    $resultExercices = Database::query($sqlExercices);
66
+    $exercise_list[0] = get_lang('All');
67
+    while($a_exercices = Database::fetch_array($resultExercices)) {
68
+        $exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
+    }
70
+    $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
71 71
 }
72 72
 
73 73
 //$form->addElement('submit','submit',get_lang('Filter'));
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 }
82 82
 
83 83
 if (!$export_to_csv) {
84
-	Display :: display_header(get_lang('Reporting'));
85
-	echo '<div class="actions" style ="font-size:10pt;">';
86
-	if ($global) {
84
+    Display :: display_header(get_lang('Reporting'));
85
+    echo '<div class="actions" style ="font-size:10pt;">';
86
+    if ($global) {
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
@@ -93,81 +93,81 @@  discard block
 block discarded – undo
93 93
                 &nbsp;'.get_lang('Print').'</a>
94 94
                 	</div>';
95 95
 
96
-		$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
96
+        $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
97 97
         if (api_is_platform_admin()) {
98
-		  $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
98
+            $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
99 99
         } else {
100 100
             $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>';
101 101
         }
102
-		$menu_items[] = get_lang('ExamTracking');
103
-		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
106
-				echo $item;
107
-				if($key!=$nb_menu_items-1) {
108
-					echo ' | ';
109
-				}
110
-			}
111
-			echo '<br />';
112
-		}
113
-	} else {
114
-	    echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
102
+        $menu_items[] = get_lang('ExamTracking');
103
+        $nb_menu_items = count($menu_items);
104
+        if($nb_menu_items>1) {
105
+            foreach($menu_items as $key=> $item) {
106
+                echo $item;
107
+                if($key!=$nb_menu_items-1) {
108
+                    echo ' | ';
109
+                }
110
+            }
111
+            echo '<br />';
112
+        }
113
+    } else {
114
+        echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
115 115
 		     <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>&nbsp;|&nbsp';
116 116
         echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>';
117
-		echo ' | '.get_lang('ExamTracking').'';
117
+        echo ' | '.get_lang('ExamTracking').'';
118 118
         echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
119 119
             '.Display::return_icon('excel.gif').'
120 120
             &nbsp;'.get_lang('ExportAsXLS').'</a><br /><br />';
121 121
 
122
-	}
122
+    }
123 123
     echo '</div>';
124
-	echo '<br /><br />';
125
-	$form->display();
124
+    echo '<br /><br />';
125
+    $form->display();
126 126
 }
127 127
 $main_result = array();
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131 131
 foreach ($course_list  as $current_course ) {
132
-	$course_info = api_get_course_info($current_course['code']);
133
-	$_course = $course_info;
134
-
135
-	// Getting LP list
136
-	$list = new LearnpathList('', $current_course['code'], $session_id);
137
-	$lp_list = $list->get_flat_list();
138
-
139
-	// Looping LPs
140
-	$lps = array();
141
-	foreach ($lp_list as $lp_id =>$lp) {
142
-		$exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
-		$attempt_result = array();
144
-		// Looping Chamilo Exercises in LP
145
-		foreach ($exercise_list as $exercise) {
146
-			$exercise_stats = Event::get_all_exercise_event_from_lp(
147
-				$exercise['path'],
148
-				$course_info['real_id'],
149
-				$session_id
150
-			);
151
-			// Looping Exercise Attempts
152
-			foreach ($exercise_stats as $stats) {
153
-				$attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
-				$user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
-			}
156
-			$exercise_list_name[$exercise['id']] = $exercise['title'];
157
-		}
158
-		$lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
-		$lp_list_name[$lp_id] = $lp['lp_name'];
160
-	}
161
-	$main_result[$current_course['code']] = $lps;
132
+    $course_info = api_get_course_info($current_course['code']);
133
+    $_course = $course_info;
134
+
135
+    // Getting LP list
136
+    $list = new LearnpathList('', $current_course['code'], $session_id);
137
+    $lp_list = $list->get_flat_list();
138
+
139
+    // Looping LPs
140
+    $lps = array();
141
+    foreach ($lp_list as $lp_id =>$lp) {
142
+        $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
+        $attempt_result = array();
144
+        // Looping Chamilo Exercises in LP
145
+        foreach ($exercise_list as $exercise) {
146
+            $exercise_stats = Event::get_all_exercise_event_from_lp(
147
+                $exercise['path'],
148
+                $course_info['real_id'],
149
+                $session_id
150
+            );
151
+            // Looping Exercise Attempts
152
+            foreach ($exercise_stats as $stats) {
153
+                $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
+                $user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
+            }
156
+            $exercise_list_name[$exercise['id']] = $exercise['title'];
157
+        }
158
+        $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
+        $lp_list_name[$lp_id] = $lp['lp_name'];
160
+    }
161
+    $main_result[$current_course['code']] = $lps;
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165 165
     foreach($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167
-		$user_list_name[$user_id] = api_get_person_name(
168
-			$user_data['firstname'],
169
-			$user_data['lastname']
170
-		);
167
+        $user_list_name[$user_id] = api_get_person_name(
168
+            $user_data['firstname'],
169
+            $user_data['lastname']
170
+        );
171 171
     }
172 172
 }
173 173
 $export_array =  array();
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
                         $html_result .= Display::tag('td', $result);
208 208
 
209 209
                         $html_result .= '</tr>';
210
-						$export_array[] = array(
211
-							$course_code,
212
-							$lp_list_name[$lp_id],
213
-							$exercise_list_name[$exercise_id],
214
-							$user_list_name[$user_id],
215
-							$attempt,
216
-							api_get_local_time($attempt_data['exe_date']),
217
-							$result,
218
-						);
210
+                        $export_array[] = array(
211
+                            $course_code,
212
+                            $lp_list_name[$lp_id],
213
+                            $exercise_list_name[$exercise_id],
214
+                            $user_list_name[$user_id],
215
+                            $attempt,
216
+                            api_get_local_time($attempt_data['exe_date']),
217
+                            $result,
218
+                        );
219 219
                         $attempt++;
220 220
                     }
221 221
                 }
@@ -226,30 +226,30 @@  discard block
 block discarded – undo
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
229
-	echo $html_result;
229
+    echo $html_result;
230 230
 }
231 231
 $filename = 'learning_path_results-'.date('Y-m-d-h:i:s').'.xls';
232 232
 if ($export_to_csv) {
233 233
     export_complete_report_csv($filename, $export_array);
234
-	exit;
234
+    exit;
235 235
 }
236 236
 
237 237
 function export_complete_report_csv($filename, $array)
238 238
 {
239
-	$header[] = array(
240
-		get_lang('Course'),
241
-		get_lang('LearningPath'),
242
-		get_lang('Exercise'),
243
-		get_lang('User'),
244
-		get_lang('Attempt'),
245
-		get_lang('Date'),
246
-		get_lang('Results'),
247
-	);
248
-	if (!empty($array)) {
249
-		$array = array_merge($header, $array);
250
-		Export :: arrayToCsv($array, $filename);
251
-	}
252
-	exit;
239
+    $header[] = array(
240
+        get_lang('Course'),
241
+        get_lang('LearningPath'),
242
+        get_lang('Exercise'),
243
+        get_lang('User'),
244
+        get_lang('Attempt'),
245
+        get_lang('Date'),
246
+        get_lang('Results'),
247
+    );
248
+    if (!empty($array)) {
249
+        $array = array_merge($header, $array);
250
+        Export :: arrayToCsv($array, $filename);
251
+    }
252
+    exit;
253 253
 
254 254
 }
255 255
 Display :: display_footer();
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$export_to_csv = true;
27 27
 }
28 28
 
29
-if (api_is_platform_admin() ) {
29
+if (api_is_platform_admin()) {
30 30
 	$global = true;
31 31
 } else {
32 32
 	$global = false;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 if ($global) {
36 36
 	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
37
+	foreach ($temp_course_list  as $temp_course_item) {
38 38
 		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 $new_course_select = array();
50
-foreach($course_list as $data) {
50
+foreach ($course_list as $data) {
51 51
     $new_course_select[$data['code']] = $data['title'];
52 52
 }
53 53
 
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55
-$form->addElement('select','course_code',get_lang('Course'), $new_course_select);
55
+$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+	$form->addElement('hidden', 'view', 'admin');
58 58
 } else {
59 59
 	//Get exam lists
60 60
     $course_id = api_get_course_int_id();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	                 ORDER BY quiz.title ASC";
65 65
 	$resultExercices = Database::query($sqlExercices);
66 66
 	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
67
+	while ($a_exercices = Database::fetch_array($resultExercices)) {
68 68
 		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69 69
 	}
70 70
 	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
90
-                &nbsp;'.get_lang('ExportAsCSV').'</a>' .
90
+                &nbsp;'.get_lang('ExportAsCSV').'</a>'.
91 91
                 '<a href="javascript: void(0);" onclick="javascript: window.print()">
92 92
                 '.Display::return_icon('printmgr.gif').'
93 93
                 &nbsp;'.get_lang('Print').'</a>
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         }
102 102
 		$menu_items[] = get_lang('ExamTracking');
103 103
 		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
104
+		if ($nb_menu_items > 1) {
105
+			foreach ($menu_items as $key=> $item) {
106 106
 				echo $item;
107
-				if($key!=$nb_menu_items-1) {
107
+				if ($key != $nb_menu_items - 1) {
108 108
 					echo ' | ';
109 109
 				}
110 110
 			}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131
-foreach ($course_list  as $current_course ) {
131
+foreach ($course_list  as $current_course) {
132 132
 	$course_info = api_get_course_info($current_course['code']);
133 133
 	$_course = $course_info;
134 134
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165
-    foreach($user_list as $user_id) {
165
+    foreach ($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167 167
 		$user_list_name[$user_id] = api_get_person_name(
168 168
 			$user_data['firstname'],
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		);
171 171
     }
172 172
 }
173
-$export_array =  array();
173
+$export_array = array();
174 174
 if (!empty($main_result)) {
175 175
 
176 176
     $html_result .= '<table  class="data_table">';
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
             foreach ($exercises as $exercise_id => $exercise_data) {
195 195
                 $users = $exercise_data['users'];
196
-                foreach($users as $user_id => $attempts) {
196
+                foreach ($users as $user_id => $attempts) {
197 197
                     $attempt = 1;
198
-                    foreach($attempts as $exe_id => $attempt_data) {
198
+                    foreach ($attempts as $exe_id => $attempt_data) {
199 199
                         $html_result .= '<tr colspan="">';
200 200
                         $html_result .= Display::tag('td', $course_code);
201 201
                         $html_result .= Display::tag('td', $lp_list_name[$lp_id]);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             }
223 223
         }
224 224
     }
225
-    $html_result .='</table>';
225
+    $html_result .= '</table>';
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
Please login to merge, or discard this patch.
main/exercice/global_multiple_answer.class.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -34,18 +34,18 @@  discard block
 block discarded – undo
34 34
         $html = '<table class="data_table">
35 35
                 <tr>
36 36
                     <th width="10px">
37
-                        ' . get_lang('Number') . '
37
+                        ' . get_lang('Number').'
38 38
                     </th>
39 39
                     <th width="10px">
40
-                        ' . get_lang('True') . '
40
+                        ' . get_lang('True').'
41 41
                     </th>
42 42
                     <th width="50%">
43
-                        ' . get_lang('Answer') . '
43
+                        ' . get_lang('Answer').'
44 44
                     </th>';
45 45
 
46
-        $html .='<th>' . get_lang('Comment') . '</th>';
47
-        $html .='</tr>';
48
-        $form->addElement('label', get_lang('Answers') . '<br /> '.Display::returnIconPath('fill_field.png'), $html);
46
+        $html .= '<th>'.get_lang('Comment').'</th>';
47
+        $html .= '</tr>';
48
+        $form->addElement('label', get_lang('Answers').'<br /> '.Display::returnIconPath('fill_field.png'), $html);
49 49
         $defaults = array();
50 50
         $correct = 0;
51 51
         $answer = false;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
         for ($i = 1; $i <= $nb_answers; ++$i) {
78 78
             /* si la reponse est de type objet */
79 79
             if (is_object($answer)) {
80
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
81
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
82
-                $defaults['correct[' . $i . ']'] = $answer->correct[$i];
80
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
81
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
82
+                $defaults['correct['.$i.']'] = $answer->correct[$i];
83 83
 
84 84
                 // start
85 85
                 $scoreA = $answer->weighting[$i];
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
             $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment['.$i.']');
102 102
             //$renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting['.$i.']');
103 103
 
104
-            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
104
+            $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
105 105
             $answer_number->freeze();
106 106
 
107
-            $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"');
108
-            $boxes_names[] = 'correct[' . $i . ']';
107
+            $form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox"');
108
+            $boxes_names[] = 'correct['.$i.']';
109 109
 
110
-            $form->addElement('html_editor', 'answer[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
111
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
110
+            $form->addElement('html_editor', 'answer['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
111
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
112 112
 
113
-            $form->addElement('html_editor', 'comment[' . $i . ']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
113
+            $form->addElement('html_editor', 'comment['.$i.']', null, array(), array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
114 114
 
115 115
             $form->addElement('html', '</tr>');
116 116
         }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         // Reponses correctes
177 177
         $nbr_corrects = 0;
178 178
         for ($i = 1; $i <= $nb_answers; $i++) {
179
-            $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']'));
179
+            $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
180 180
             if ($goodAnswer) {
181 181
                 $nbr_corrects++;
182 182
             }
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
         $test = $form->getSubmitValue('pts');
196 196
 
197 197
         for ($i = 1; $i <= $nb_answers; $i++) {
198
-            $answer = trim($form->getSubmitValue('answer[' . $i . ']'));
199
-            $comment = trim($form->getSubmitValue('comment[' . $i . ']'));
200
-            $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']'));
198
+            $answer = trim($form->getSubmitValue('answer['.$i.']'));
199
+            $comment = trim($form->getSubmitValue('comment['.$i.']'));
200
+            $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
201 201
 
202 202
             if ($goodAnswer) {
203 203
                 $weighting = abs($answer_score);
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
         $score = null
226 226
     ) {
227 227
         $header = parent::return_header($feedback_type, $counter, $score);
228
-        $header .= '<table class="'.$this->question_table_class .'">
228
+        $header .= '<table class="'.$this->question_table_class.'">
229 229
         <tr>
230
-            <th>' . get_lang("Choice") . '</th>
231
-            <th>' . get_lang("ExpectedChoice") . '</th>
232
-            <th>' . get_lang("Answer") . '</th>';
233
-        $header .= '<th>' . get_lang("Comment") . '</th>';
230
+            <th>' . get_lang("Choice").'</th>
231
+            <th>' . get_lang("ExpectedChoice").'</th>
232
+            <th>' . get_lang("Answer").'</th>';
233
+        $header .= '<th>'.get_lang("Comment").'</th>';
234 234
         $header .= '</tr>';
235 235
 
236 236
         return $header;
Please login to merge, or discard this patch.
main/exercice/hotspot_admin.inc.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 if ($modifyIn) {
27 27
     if ($debug > 0) {
28
-        echo '$modifyIn was set' . "<br />\n";
28
+        echo '$modifyIn was set'."<br />\n";
29 29
     }
30 30
     // if the user has chosen to modify the question only in the current exercise
31 31
     if ($modifyIn == 'thisExercise') {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     unset($buttonBack);
65 65
 }
66 66
 
67
-$hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&exerciseId=' . $exerciseId;
67
+$hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&exerciseId='.$exerciseId;
68 68
 
69 69
 // the answer form has been submitted
70 70
 $submitAnswers = isset($_POST['submitAnswers']) ? true : false;
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 if ($submitAnswers || $buttonBack) {
75 75
     if ($answerType == HOT_SPOT) {
76 76
         if ($debug > 0) {
77
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
77
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
78 78
         }
79 79
 
80 80
         $questionWeighting = $nbrGoodAnswers = 0;
81 81
         for ($i = 1; $i <= $nbrAnswers; $i++) {
82 82
             if ($debug > 0) {
83
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
83
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
84 84
             }
85 85
 
86 86
             $reponse[$i] = trim($reponse[$i]);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if (empty($msgErr)) {
115 115
             for ($i = 1; $i <= $nbrAnswers; $i++) {
116 116
                 if ($debug > 0) {
117
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
117
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
118 118
                 }
119 119
 
120 120
                 $reponse[$i] = trim($reponse[$i]);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 $weighting[$i] = ($weighting[$i]); //it can be float
123 123
 
124 124
                 if ($weighting[$i]) {
125
-                    $questionWeighting+=$weighting[$i];
125
+                    $questionWeighting += $weighting[$i];
126 126
                 }
127 127
 
128 128
                 // creates answer
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 
146 146
             $editQuestion = $questionId;
147 147
             unset($modifyAnswers);
148
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
148
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
149 149
         }
150 150
 
151 151
         if ($debug > 0) {
152
-            echo '$modifyIn was set - end' . "<br />\n";
152
+            echo '$modifyIn was set - end'."<br />\n";
153 153
         }
154 154
     } else {
155 155
         if ($debug > 0) {
156
-            echo '$submitAnswers or $buttonBack was set' . "<br />\n";
156
+            echo '$submitAnswers or $buttonBack was set'."<br />\n";
157 157
         }
158 158
 
159 159
         $questionWeighting = $nbrGoodAnswers = 0;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         for ($i = 1; $i <= $nbrAnswers; $i++) {
170 170
             if ($debug > 0) {
171
-                echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
171
+                echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
172 172
             }
173 173
 
174 174
             $reponse[$i] = trim($reponse[$i]);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                 $threadhold3_str = intval($threadhold3[$i]);
194 194
             }
195 195
 
196
-            $threadhold_total = $threadhold1_str . ';' . $threadhold2_str . ';' . $threadhold3_str;
196
+            $threadhold_total = $threadhold1_str.';'.$threadhold2_str.';'.$threadhold3_str;
197 197
 
198 198
             if (isset($try[$i]) && $try[$i] == 'on') {
199 199
                 $try_str = 1;
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                 $question_str = $select_question[$i];
220 220
             }
221 221
 
222
-            $destination[$i] = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
222
+            $destination[$i] = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
223 223
 
224 224
             // checks if field is empty
225 225
             if (empty($reponse[$i]) && $reponse[$i] != '0') {
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
             $question_str = $selectQuestionNoError;
278 278
         }
279 279
 
280
-        $destination_noerror = $threadhold_total . '@@' . $try_str . '@@' . $lp_str . '@@' . $question_str . '@@' . $url_str;
280
+        $destination_noerror = $threadhold_total.'@@'.$try_str.'@@'.$lp_str.'@@'.$question_str.'@@'.$url_str;
281 281
 
282 282
         if (empty($msgErr)) {
283 283
             for ($i = 1; $i <= $nbrAnswers; $i++) {
284 284
                 if ($debug > 0) {
285
-                    echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
285
+                    echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
286 286
                 }
287 287
 
288 288
                 $reponse[$i] = trim($reponse[$i]);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 $weighting[$i] = ($weighting[$i]); //it can be float
291 291
 
292 292
                 if ($weighting[$i]) {
293
-                    $questionWeighting+=$weighting[$i];
293
+                    $questionWeighting += $weighting[$i];
294 294
                 }
295 295
                 // creates answer
296 296
                 $objAnswer->createAnswer(
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
             $editQuestion = $questionId;
326 326
             unset($modifyAnswers);
327 327
 
328
-            echo '<script type="text/javascript">window.location.href="' . $hotspot_admin_url . '&message=ItemUpdated"</script>';
328
+            echo '<script type="text/javascript">window.location.href="'.$hotspot_admin_url.'&message=ItemUpdated"</script>';
329 329
         }
330 330
     }
331 331
 }
332 332
 
333 333
 if ($modifyAnswers) {
334 334
     if ($debug > 0) {
335
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers is set' . "<br />\n";
335
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers is set'."<br />\n";
336 336
     }
337 337
 
338 338
     // construction of the Answer object
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     Session::write('objAnswer', $objAnswer);
341 341
 
342 342
     if ($debug > 0) {
343
-        echo str_repeat('&nbsp;', 2) . '$answerType is HOT_SPOT' . "<br />\n";
343
+        echo str_repeat('&nbsp;', 2).'$answerType is HOT_SPOT'."<br />\n";
344 344
     }
345 345
 
346 346
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -521,11 +521,11 @@  discard block
 block discarded – undo
521 521
     }
522 522
 
523 523
     if ($debug > 0) {
524
-        echo str_repeat('&nbsp;', 2) . '$usedInSeveralExercises is untrue' . "<br />\n";
524
+        echo str_repeat('&nbsp;', 2).'$usedInSeveralExercises is untrue'."<br />\n";
525 525
     }
526 526
 
527 527
     if ($debug > 0) {
528
-        echo str_repeat('&nbsp;', 4) . '$answerType is HOT_SPOT' . "<br />\n";
528
+        echo str_repeat('&nbsp;', 4).'$answerType is HOT_SPOT'."<br />\n";
529 529
     }
530 530
 
531 531
     if ($answerType == HOT_SPOT_DELINEATION) {
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 
566 566
     Display::tag(
567 567
         'h3',
568
-        get_lang('Question') . ": " . $questionName . Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose')))
568
+        get_lang('Question').": ".$questionName.Display::return_icon('info3.gif', strip_tags(get_lang('HotspotChoose')))
569 569
     );
570 570
 
571 571
     if (!empty($msgErr)) {
572 572
         Display::display_normal_message($msgErr); //main API
573 573
     }
574 574
 
575
-    $hotspot_admin_url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&hotspotadmin=' . $modifyAnswers . '&exerciseId=' . $exerciseId . '&' . api_get_cidreq();
575
+    $hotspot_admin_url = api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&hotspotadmin='.$modifyAnswers.'&exerciseId='.$exerciseId.'&'.api_get_cidreq();
576 576
     ?>
577 577
     <form method="post" action="<?php echo $hotspot_admin_url; ?>" class="form-horizontal" id="frm_exercise" name="frm_exercise">
578 578
         <div class="form-group">
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
                                 <th><?php echo get_lang('Comment'); ?></th>
612 612
                                 <?php
613 613
                                 if ($answerType == HOT_SPOT_DELINEATION) {
614
-                                    echo '<th >' . get_lang('Scenario') . '</th>';
614
+                                    echo '<th >'.get_lang('Scenario').'</th>';
615 615
                                 }
616 616
                                 ?>
617 617
                                 <?php
@@ -643,36 +643,36 @@  discard block
 block discarded – undo
643 643
                                         $isSelected = true;
644 644
                                         $selected = 'selected="selected"';
645 645
                                     }
646
-                                    $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
646
+                                    $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
647 647
                                 }
648 648
 
649 649
                                 if ($isSelected) {
650
-                                    $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
650
+                                    $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
651 651
                                 } else {
652
-                                    $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
652
+                                    $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
653 653
                                 }
654 654
 
655 655
                                 // Feedback SELECT
656 656
                                 $question_list = $objExercise->selectQuestionList();
657 657
                                 $option_feed = '';
658
-                                $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
658
+                                $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
659 659
 
660 660
                                 foreach ($question_list as $key => $questionid) {
661 661
                                     $selected = '';
662 662
                                     $question = Question::read($questionid);
663
-                                    $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
663
+                                    $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
664 664
 
665 665
                                     if (isset($select_question[$i]) && $questionid == $select_question[$i]) {
666 666
                                         $selected = 'selected="selected"';
667 667
                                     }
668 668
 
669
-                                    $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
669
+                                    $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
670 670
                                 }
671 671
 
672 672
                                 if (isset($select_question[$i]) && $select_question[$i] == -1) {
673
-                                    $option_feed .= '<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
673
+                                    $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
674 674
                                 } else {
675
-                                    $option_feed .= '<option value="-1">' . get_lang('ExitTest') . '</option>';
675
+                                    $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
676 676
                                 }
677 677
 
678 678
                                 //-------- IF it is a delineation
@@ -688,9 +688,9 @@  discard block
 block discarded – undo
688 688
                                             $selected2 = 'selected="selected"';
689 689
                                         if ($k == $threadhold3[$i])
690 690
                                             $selected3 = 'selected="selected"';
691
-                                        $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>';
692
-                                        $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>';
693
-                                        $option3.='<option ' . $selected3 . '>' . $k . ' %</option>';
691
+                                        $option1 .= '<option '.$selected1.' >'.$k.' % </option>';
692
+                                        $option2 .= '<option '.$selected2.' >'.$k.' % </option>';
693
+                                        $option3 .= '<option '.$selected3.'>'.$k.' %</option>';
694 694
                                     }
695 695
                                     ?>
696 696
                                     <tr>
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
                                                 <div class="checkbox">
735 735
                                                     <p>
736 736
                                                         <label>
737
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
737
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]"  <?php if ($try[$i] == 1) echo'checked'; ?> />
738 738
                                                             <?php echo get_lang('TryAgain'); ?>
739 739
                                                         </label>
740 740
                                                     </p>
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                                                             <div class="checkbox">
788 788
                                                                 <p>
789 789
                                                                     <label>
790
-                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
790
+                                                                        <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> />
791 791
                                                                         <?php echo get_lang('TryAgain'); ?>
792 792
                                                                     </label>
793 793
                                                                 </p>
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
                                                 <div class="checkbox">
853 853
                                                     <p>
854 854
                                                         <label>
855
-                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
855
+                                                            <input type="checkbox" class="checkbox" name="<?php echo 'try['.$i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> />
856 856
                                                             <?php echo get_lang('TryAgain'); ?>
857 857
                                                         </label>
858 858
                                                     </p>
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
                                         <input class="form-control" type="text" name="reponse[<?php echo $i; ?>]" value="<?php echo Security::remove_XSS($responseValue); ?>" />
893 893
                                     </td>
894 894
                                     <?php
895
-                                    $form = new FormValidator('form_' . $i);
895
+                                    $form = new FormValidator('form_'.$i);
896 896
                                     $config = array(
897 897
                                         'ToolbarSet' => 'TestProposedAnswer',
898 898
                                         'cols-size' => [0, 12, 0]
899 899
                                     );
900
-                                    $form->addHtmlEditor('comment[' . $i . ']', null, false, false, $config);
900
+                                    $form->addHtmlEditor('comment['.$i.']', null, false, false, $config);
901 901
                                     $renderer = $form->defaultRenderer();
902 902
                                     $form_template = '{content}';
903 903
                                     $renderer->setFormTemplate($form_template);
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                                         {element}';
907 907
                                     $renderer->setElementTemplate($element_template);
908 908
 
909
-                                    $form->setDefaults(array('comment[' . $i . ']' => $commentValue));
909
+                                    $form->setDefaults(array('comment['.$i.']' => $commentValue));
910 910
                                     $return = $form->return_form();
911 911
                                     ?>
912 912
                                     <td colspan="2" align="left" ><?php echo $return; ?></td>
@@ -945,36 +945,36 @@  discard block
 block discarded – undo
945 945
                                 $selected = 'selected="selected"';
946 946
                                 $isSelected = true;
947 947
                             }
948
-                            $option_lp.='<option value="' . $id . '" ' . $selected . '>' . $details['lp_name'] . '</option>';
948
+                            $option_lp .= '<option value="'.$id.'" '.$selected.'>'.$details['lp_name'].'</option>';
949 949
                         }
950 950
 
951 951
                         if ($isSelected) {
952
-                            $option_lp = '<option value="0">' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
952
+                            $option_lp = '<option value="0">'.get_lang('SelectTargetLP').'</option>'.$option_lp;
953 953
                         } else {
954
-                            $option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
954
+                            $option_lp = '<option value="0" selected="selected" >'.get_lang('SelectTargetLP').'</option>'.$option_lp;
955 955
                         }
956 956
 
957 957
                         // Feedback SELECT
958 958
                         $question_list = $objExercise->selectQuestionList();
959 959
                         $option_feed = '';
960
-                        $option_feed.='<option value="0">' . get_lang('SelectTargetQuestion') . '</option>';
960
+                        $option_feed .= '<option value="0">'.get_lang('SelectTargetQuestion').'</option>';
961 961
                         $details = isset($details) ? $details : null;
962 962
                         $id = isset($id) ? $id : 0;
963 963
                         $selectQuestionNoError = isset($selectQuestionNoError) ? $selectQuestionNoError : null;
964 964
                         foreach ($question_list as $key => $questionid) {
965 965
                             $selected = '';
966 966
                             $question = Question::read($questionid);
967
-                            $val = 'Q' . $key . ' :' . substrwords($question->selectTitle(), ICON_SIZE_SMALL);
967
+                            $val = 'Q'.$key.' :'.substrwords($question->selectTitle(), ICON_SIZE_SMALL);
968 968
                             $select_lp_id[$id] = $details['lp_name'];
969 969
                             if ($questionid == $selectQuestionNoError) {
970 970
                                 $selected = 'selected="selected"';
971 971
                             }
972
-                            $option_feed.='<option value="' . $questionid . '" ' . $selected . ' >' . $val . '</option>';
972
+                            $option_feed .= '<option value="'.$questionid.'" '.$selected.' >'.$val.'</option>';
973 973
                         }
974 974
                         if ($selectQuestionNoError == -1) {
975
-                            $option_feed.='<option value="-1" selected="selected" >' . get_lang('ExitTest') . '</option>';
975
+                            $option_feed .= '<option value="-1" selected="selected" >'.get_lang('ExitTest').'</option>';
976 976
                         } else {
977
-                            $option_feed.='<option value="-1">' . get_lang('ExitTest') . '</option>';
977
+                            $option_feed .= '<option value="-1">'.get_lang('ExitTest').'</option>';
978 978
                         }
979 979
 
980 980
                         if ($answerType == HOT_SPOT_DELINEATION) {
@@ -1065,6 +1065,6 @@  discard block
 block discarded – undo
1065 1065
     </script>
1066 1066
     <?php
1067 1067
     if ($debug > 0) {
1068
-        echo str_repeat('&nbsp;', 0) . '$modifyAnswers was set - end' . "<br />\n";
1068
+        echo str_repeat('&nbsp;', 0).'$modifyAnswers was set - end'."<br />\n";
1069 1069
     }
1070 1070
 }
Please login to merge, or discard this patch.