Browse Source

Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
Scrutinizer Auto-Fixer 7 năm trước cách đây
mục cha
commit
a9a8ec5a55

+ 60 - 60
main/course_info/infocours.php

@@ -15,7 +15,7 @@
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_COURSE_SETTING;
+$current_course_tool = TOOL_COURSE_SETTING;
 $this_section = SECTION_COURSES;
 
 $nameTools = get_lang('ModifInfo');
@@ -106,7 +106,7 @@ $form->addHtml('
             <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-course-settings" aria-expanded="true" aria-controls="collapse-course-settings">
 ');
 $form->addHtml(
-    Display::return_icon('settings.png', get_lang('CourseSettings')) . ' ' . get_lang('CourseSettings')
+    Display::return_icon('settings.png', get_lang('CourseSettings')).' '.get_lang('CourseSettings')
 );
 $form->addHtml('
             </a>
@@ -120,11 +120,11 @@ $form->addHtml('
 
 $image = '';
 // Display course picture
-$course_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository;   // course path
+$course_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository; // course path
 if (file_exists($course_path.'/course-pic85x85.png')) {
-    $course_web_path = api_get_path(WEB_COURSE_PATH).$currentCourseRepository;   // course web path
+    $course_web_path = api_get_path(WEB_COURSE_PATH).$currentCourseRepository; // course web path
     $course_medium_image = $course_web_path.'/course-pic85x85.png?'.rand(1, 1000); // redimensioned image 85x85
-    $image =  '<div class="row"><label class="col-md-2 control-label">'.get_lang('Image').'</label> 
+    $image = '<div class="row"><label class="col-md-2 control-label">'.get_lang('Image').'</label> 
                     <div class="col-md-8"><img src="'.$course_medium_image.'" /></div></div>';
 }
 $form->addHtml($image);
@@ -176,11 +176,11 @@ $form->addRule(
 $form->addElement('checkbox', 'delete_picture', null, get_lang('DeletePicture'));
 
 if (api_get_setting('pdf_export_watermark_by_course') == 'true') {
-    $url =  PDF::get_watermark($course_code);
+    $url = PDF::get_watermark($course_code);
     $form->addText('pdf_export_watermark_text', get_lang('PDFExportWatermarkTextTitle'), false, array('size' => '60'));
     $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
     if ($url != false) {
-        $delete_url = '<a href="?delete_watermark">'.Display::return_icon('delete.png',get_lang('DelImage')).'</a>';
+        $delete_url = '<a href="?delete_watermark">'.Display::return_icon('delete.png', get_lang('DelImage')).'</a>';
         $form->addElement('html', '<div class="row"><div class="formw"><a href="'.$url.'">'.$url.' '.$delete_url.'</a></div></div>');
     }
     $form->addRule('pdf_export_watermark_path', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
@@ -198,7 +198,7 @@ if (api_get_setting('allow_course_theme') == 'true') {
 }
 
 $form->addElement('label', get_lang('DocumentQuota'), format_file_size(DocumentManager::get_course_quota()));
-$form->addButtonSave(get_lang('SaveSettings'),'submit_save');
+$form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 $form->addHtml('
         </div>
     </div>
@@ -214,7 +214,7 @@ $form->addHtml('
 ');
 $form->addElement(
     'html',
-    Display::return_icon('course.png', get_lang('CourseAccess')) . ' ' . get_lang('CourseAccess')
+    Display::return_icon('course.png', get_lang('CourseAccess')).' '.get_lang('CourseAccess')
 );
 $form->addHtml('
             </a>
@@ -228,13 +228,13 @@ $form->addHtml('
 ');
 
 $group = array();
-$group[]= $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
-$group[]= $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
-$group[]= $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
-$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
+$group[] = $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
+$group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
+$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
+$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
 // The "hidden" visibility is only available to portal admins
 if (api_is_platform_admin()) {
-    $group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
+    $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
 }
 $form->addGroup($group, '', array(get_lang("CourseAccess"), get_lang("CourseAccessConfigTip")));
 
@@ -243,13 +243,13 @@ $url = Display::url($url, $url);
 $form->addElement('label', get_lang('DirectLink'), sprintf(get_lang('CourseSettingsRegisterDirectLink'), $url));
 
 $group = array();
-$group[]=$form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
-$group[]=$form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
+$group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
+$group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
 $form->addGroup($group, '', array(get_lang("Subscription")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
-$group[]=$form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
+$group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
+$group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
 $form->addGroup($group, '', array(get_lang("Unsubscription")));
 
 $form->addText('course_registration_password', get_lang('CourseRegistrationPassword'), false, array('size' => '60'));
@@ -272,7 +272,7 @@ $form->addHtml('
             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-documents" aria-expanded="false" aria-controls="collapse-documents">
 ');
 $form->addHtml(
-    Display::return_icon('folder.png', get_lang('Documents')) . ' ' . get_lang('Documents')
+    Display::return_icon('folder.png', get_lang('Documents')).' '.get_lang('Documents')
 );
 $form->addHtml('
                 </a>
@@ -313,7 +313,7 @@ $form->addHtml('
             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-email-notifications" aria-expanded="false" aria-controls="collapse-email-notifications">
 ');
 $form->addHtml(
-    Display::return_icon('mail.png', get_lang('EmailNotifications')) . ' ' . get_lang('EmailNotifications')
+    Display::return_icon('mail.png', get_lang('EmailNotifications')).' '.get_lang('EmailNotifications')
 );
 $form->addHtml('
             </a>
@@ -325,31 +325,31 @@ $form->addHtml('
         <div class="panel-body">
 ');
 $group = array();
-$group[]=$form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1);
-$group[]=$form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertToTeacharAndTutor'), 2);
-$group[]=$form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0);
+$group[] = $form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1);
+$group[] = $form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertToTeacharAndTutor'), 2);
+$group[] = $form->createElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0);
 $form->addGroup($group, '', array(get_lang("NewUserEmailAlert")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'email_alert_students_on_new_homework', get_lang('NewHomeworkEmailAlert'), get_lang('NewHomeworkEmailAlertEnable'), 1);
-$group[]=$form->createElement('radio', 'email_alert_students_on_new_homework', null, get_lang('NewHomeworkEmailAlertDisable'), 0);
+$group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', get_lang('NewHomeworkEmailAlert'), get_lang('NewHomeworkEmailAlertEnable'), 1);
+$group[] = $form->createElement('radio', 'email_alert_students_on_new_homework', null, get_lang('NewHomeworkEmailAlertDisable'), 0);
 $form->addGroup($group, '', array(get_lang("NewHomeworkEmailAlert")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForTeachers'), 3);
-$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForStudents'), 2);
-$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
-$group[]=$form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0);
+$group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForTeachers'), 3);
+$group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertActivateOnlyForStudents'), 2);
+$group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
+$group[] = $form->createElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("WorkEmailAlert")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'email_alert_on_new_doc_dropbox', get_lang('DropboxEmailAlert'), get_lang('DropboxEmailAlertActivate'), 1);
-$group[]=$form->createElement('radio', 'email_alert_on_new_doc_dropbox', null, get_lang('DropboxEmailAlertDeactivate'), 0);
+$group[] = $form->createElement('radio', 'email_alert_on_new_doc_dropbox', get_lang('DropboxEmailAlert'), get_lang('DropboxEmailAlertActivate'), 1);
+$group[] = $form->createElement('radio', 'email_alert_on_new_doc_dropbox', null, get_lang('DropboxEmailAlertDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("DropboxEmailAlert")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'email_alert_manager_on_new_quiz', get_lang('QuizEmailAlert'), get_lang('QuizEmailAlertActivate'), 1);
-$group[]=$form->createElement('radio', 'email_alert_manager_on_new_quiz', null, get_lang('QuizEmailAlertDeactivate'), 0);
+$group[] = $form->createElement('radio', 'email_alert_manager_on_new_quiz', get_lang('QuizEmailAlert'), get_lang('QuizEmailAlertActivate'), 1);
+$group[] = $form->createElement('radio', 'email_alert_manager_on_new_quiz', null, get_lang('QuizEmailAlertDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("QuizEmailAlert")));
 $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 
@@ -367,7 +367,7 @@ $form->addHtml('
             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-user-right" aria-expanded="false" aria-controls="collapse-user-right">
 ');
 $form->addHtml(
-    Display::return_icon('user.png', get_lang('UserRights')) . ' ' . get_lang('UserRights')
+    Display::return_icon('user.png', get_lang('UserRights')).' '.get_lang('UserRights')
 );
 $form->addHtml('
             </a>
@@ -380,23 +380,23 @@ $form->addHtml('
 ');
 
 $group = array();
-$group[]=$form->createElement('radio', 'allow_user_edit_agenda', get_lang('AllowUserEditAgenda'), get_lang('AllowUserEditAgendaActivate'), 1);
-$group[]=$form->createElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0);
+$group[] = $form->createElement('radio', 'allow_user_edit_agenda', get_lang('AllowUserEditAgenda'), get_lang('AllowUserEditAgendaActivate'), 1);
+$group[] = $form->createElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("AllowUserEditAgenda")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'allow_user_edit_announcement', get_lang('AllowUserEditAnnouncement'), get_lang('AllowUserEditAnnouncementActivate'), 1);
-$group[]=$form->createElement('radio', 'allow_user_edit_announcement', null, get_lang('AllowUserEditAnnouncementDeactivate'), 0);
+$group[] = $form->createElement('radio', 'allow_user_edit_announcement', get_lang('AllowUserEditAnnouncement'), get_lang('AllowUserEditAnnouncementActivate'), 1);
+$group[] = $form->createElement('radio', 'allow_user_edit_announcement', null, get_lang('AllowUserEditAnnouncementDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("AllowUserEditAnnouncement")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageForum'), get_lang('AllowUserImageForumActivate'), 1);
-$group[]=$form->createElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0);
+$group[] = $form->createElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageForum'), get_lang('AllowUserImageForumActivate'), 1);
+$group[] = $form->createElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("AllowUserImageForum")));
 
 $group = array();
-$group[]=$form->createElement('radio', 'allow_user_view_user_list', get_lang('AllowUserViewUserList'), get_lang('AllowUserViewUserListActivate'), 1);
-$group[]=$form->createElement('radio', 'allow_user_view_user_list', null, get_lang('AllowUserViewUserListDeactivate'), 0);
+$group[] = $form->createElement('radio', 'allow_user_view_user_list', get_lang('AllowUserViewUserList'), get_lang('AllowUserViewUserListActivate'), 1);
+$group[] = $form->createElement('radio', 'allow_user_view_user_list', null, get_lang('AllowUserViewUserListDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("AllowUserViewUserList")));
 $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 $form->addHtml('
@@ -413,7 +413,7 @@ $form->addHtml('
             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-chat-settings" aria-expanded="false" aria-controls="collapse-chat-settings">
 ');
 $form->addHtml(
-    Display::return_icon('chat.png', get_lang('ConfigChat'),'',ICON_SIZE_SMALL).' '.get_lang('ConfigChat')
+    Display::return_icon('chat.png', get_lang('ConfigChat'), '', ICON_SIZE_SMALL).' '.get_lang('ConfigChat')
 );
 $form->addHtml('
             </a>
@@ -426,8 +426,8 @@ $form->addHtml('
 ');
 
 $group = array();
-$group[]=$form->createElement('radio', 'allow_open_chat_window', get_lang('AllowOpenchatWindow'), get_lang('AllowOpenChatWindowActivate'), 1);
-$group[]=$form->createElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0);
+$group[] = $form->createElement('radio', 'allow_open_chat_window', get_lang('AllowOpenchatWindow'), get_lang('AllowOpenChatWindowActivate'), 1);
+$group[] = $form->createElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0);
 $form->addGroup($group, '', array(get_lang("AllowOpenchatWindow")));
 $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 
@@ -459,16 +459,16 @@ $form->addHtml('
 
 // Auto launch LP
 $group = array();
-$group[]=$form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToALearningPath'), 1);
-$group[]=$form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToTheLearningPathList'), 2);
-$group[]=$form->createElement('radio', 'enable_lp_auto_launch', null, get_lang('Deactivate'), 0);
+$group[] = $form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToALearningPath'), 1);
+$group[] = $form->createElement('radio', 'enable_lp_auto_launch', get_lang('LPAutoLaunch'), get_lang('RedirectToTheLearningPathList'), 2);
+$group[] = $form->createElement('radio', 'enable_lp_auto_launch', null, get_lang('Deactivate'), 0);
 $form->addGroup($group, '', array(get_lang("LPAutoLaunch")));
 
 if (api_get_setting('allow_course_theme') == 'true') {
     // Allow theme into Learning path
     $group = array();
-    $group[]=$form->createElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1);
-    $group[]=$form->createElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
+    $group[] = $form->createElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1);
+    $group[] = $form->createElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
     $form->addGroup($group, '', array(get_lang("AllowLearningPathTheme")));
 }
 
@@ -544,7 +544,7 @@ $form->addHtml(
     Display::return_icon(
         'course_progress.png',
         get_lang('ThematicAdvanceConfiguration')
-    ) . ' ' . get_lang('ThematicAdvanceConfiguration')
+    ).' '.get_lang('ThematicAdvanceConfiguration')
 );
 $form->addHtml('
             </a>
@@ -557,10 +557,10 @@ $form->addHtml('
 ');
 
 $group = array();
-$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', get_lang('InfoAboutAdvanceInsideHomeCourse'), get_lang('DisplayAboutLastDoneAdvance'), 1);
-$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 2);
-$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDoneAndLastDoneAdvance'), 3);
-$group[]=$form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DoNotDisplayAnyAdvance'), 0);
+$group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', get_lang('InfoAboutAdvanceInsideHomeCourse'), get_lang('DisplayAboutLastDoneAdvance'), 1);
+$group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 2);
+$group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDoneAndLastDoneAdvance'), 3);
+$group[] = $form->createElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DoNotDisplayAnyAdvance'), 0);
 $form->addGroup($group, '', array(get_lang("InfoAboutAdvanceInsideHomeCourse")));
 $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
 $form->addHtml('
@@ -570,7 +570,7 @@ $form->addHtml('
 $form->addHtml('</div>');
 
 // Certificate settings
-if (api_get_setting('allow_public_certificates')=='true') {
+if (api_get_setting('allow_public_certificates') == 'true') {
     $form->addHtml('<div class="panel panel-default">');
     $form->addHtml('
         <div class="panel-heading" role="tab" id="heading-certificate-settings">
@@ -578,7 +578,7 @@ if (api_get_setting('allow_public_certificates')=='true') {
                 <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-certificate-settings" aria-expanded="false" aria-controls="collapse-certificate-settings">
     ');
     $form->addHtml(
-        Display::return_icon('certificate.png', get_lang('Certificates')) . ' ' . get_lang('Certificates')
+        Display::return_icon('certificate.png', get_lang('Certificates')).' '.get_lang('Certificates')
     );
     $form->addHtml('
                 </a>
@@ -591,8 +591,8 @@ if (api_get_setting('allow_public_certificates')=='true') {
     ');
 
     $group = array();
-    $group[]=$form->createElement('radio', 'allow_public_certificates', get_lang('AllowPublicCertificates'), get_lang('Yes'), 1);
-    $group[]=$form->createElement('radio', 'allow_public_certificates', null, get_lang('No'), 0);
+    $group[] = $form->createElement('radio', 'allow_public_certificates', get_lang('AllowPublicCertificates'), get_lang('Yes'), 1);
+    $group[] = $form->createElement('radio', 'allow_public_certificates', null, get_lang('No'), 0);
     $form->addGroup($group, '', array(get_lang('AllowPublicCertificates')));
     $form->addButtonSave(get_lang('SaveSettings'), 'submit_save');
     $form->addHtml('
@@ -610,7 +610,7 @@ $form->addHtml('
             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-forum-settings" aria-expanded="false" aria-controls="collapse-forum-settings">
 ');
 $form->addHtml(
-    Display::return_icon('forum.png', get_lang('Forum')) . ' ' . get_lang('Forum')
+    Display::return_icon('forum.png', get_lang('Forum')).' '.get_lang('Forum')
 );
 $form->addHtml('
             </a>

+ 4 - 4
main/dashboard/dashboard.php

@@ -13,7 +13,7 @@ api_block_anonymous_users();
 // menu actions for dashboard views
 $views = array('blocks', 'list');
 
-if(isset($_GET['view']) && in_array($_GET['view'], $views)){
+if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
     $dashboard_view = $_GET['view'];
 }
 
@@ -21,16 +21,16 @@ $link_blocks_view = $link_list_view = null;
 
 if (isset($dashboard_view) && $dashboard_view == 'list') {
     $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'.
-        Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>';
+        Display::return_icon('blocks.png', get_lang('DashboardBlocks'), '', ICON_SIZE_MEDIUM).'</a>';
 } else {
     $link_list_view = '<a href="'.api_get_self().'?view=list">'.
-        Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>';
+        Display::return_icon('edit.png', get_lang('EditBlocks'), '', ICON_SIZE_MEDIUM).'</a>';
 }
 
 $configuration_link = null;
 if (api_is_platform_admin()) {
     $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'
-    .Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>';
+    .Display::return_icon('settings.png', get_lang('ConfigureDashboardPlugin'), '', ICON_SIZE_MEDIUM).'</a>';
 }
 
 echo '<div class="actions">';

+ 7 - 7
main/document/record_audio.php

@@ -80,7 +80,7 @@ if (!is_dir($filepath)) {
 
 //groups //TODO: clean
 if (!empty($groupId)) {
-    $interbreadcrumb[] = array ("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
+    $interbreadcrumb[] = array("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
     $noPHP_SELF = true;
     $group = GroupManager :: get_group_properties($groupId);
     $path = explode('/', $dir);
@@ -138,14 +138,14 @@ if (isset($document_data['parents'])) {
 //make some vars
 $wamiuserid = api_get_user_id();
 
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'rtc/RecordRTC.js"></script>';
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/recorder.js"></script>';
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/gui.js"></script>';
-$htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>';
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
+$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'swfobject/swfobject.js"></script>';
 
 $actions = Display::toolbarButton(
-    get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'),
-    'document.php?' . api_get_cidreq() . "&id=$document_id",
+    get_lang('BackTo').' '.get_lang('DocumentsOverview'),
+    'document.php?'.api_get_cidreq()."&id=$document_id",
     'arrow-left',
     'default',
     [],

+ 24 - 24
main/exercise/fill_blanks.class.php

@@ -372,7 +372,7 @@ class FillBlanks extends Question
         // remove spaces at the beginning and the end of text in square brackets
         $answer = preg_replace_callback(
             "/".$blankStartSeparatorRegexp."[^]]+".$blankEndSeparatorRegexp."/",
-            function ($matches) use ($blankStartSeparator, $blankEndSeparator) {
+            function($matches) use ($blankStartSeparator, $blankEndSeparator) {
                 $matchingResult = $matches[0];
                 $matchingResult = trim($matchingResult, $blankStartSeparator);
                 $matchingResult = trim($matchingResult, $blankEndSeparator);
@@ -417,7 +417,7 @@ class FillBlanks extends Question
         if ($nb > 0) {
             $answer .= '::';
             // weighting
-            for ($i=0; $i < $nb; ++$i) {
+            for ($i = 0; $i < $nb; ++$i) {
                 // enter the weighting of word $i
                 $answer .= $form->getSubmitValue('weighting['.$i.']');
                 // not the last word, add ","
@@ -455,7 +455,7 @@ class FillBlanks extends Question
 
         // Allow answers order switches
         $is_multiple = $form -> getSubmitValue('multiple_answer');
-        $answer.= '@'.$is_multiple;
+        $answer .= '@'.$is_multiple;
 
         $this->save();
         $objAnswer = new Answer($this->id);
@@ -472,7 +472,7 @@ class FillBlanks extends Question
     public function return_header($feedback_type = null, $counter = null, $score = null)
     {
         $header = parent::return_header($feedback_type, $counter, $score);
-        $header .= '<table class="'.$this->question_table_class .'">
+        $header .= '<table class="'.$this->question_table_class.'">
             <tr>
                 <th>'.get_lang("Answer").'</th>
             </tr>';
@@ -513,13 +513,13 @@ class FillBlanks extends Question
                 // if display for student, shuffle the correct answer menu
                 $listMenu = self::getFillTheBlankMenuAnswers($inTeacherSolution, $displayForStudent);
                 $result .= '<select id="choice_id_'.$currentQuestion.'_'.$inBlankNumber.'" name="choice['.$questionId.'][]">';
-                for ($k=0; $k < count($listMenu); $k++) {
+                for ($k = 0; $k < count($listMenu); $k++) {
                     $selected = '';
                     if ($correctItem == $listMenu[$k]) {
                         $selected = " selected=selected ";
                     }
                     // if in teacher view, display the first item by default, which is the right answer
-                    if ($k==0 && !$displayForStudent) {
+                    if ($k == 0 && !$displayForStudent) {
                         $selected = " selected=selected ";
                     }
                     $optionMenu .= '<option '.$selected.' value="'.$listMenu[$k].'">'.$listMenu[$k].'</option>';
@@ -696,10 +696,10 @@ class FillBlanks extends Question
         if (count($listDetails) < 3) {
             $listWeightings = explode(',', $listDetails[0]);
             $listSizeOfInput = array();
-            for ($i=0; $i < count($listWeightings); $i++) {
+            for ($i = 0; $i < count($listWeightings); $i++) {
                 $listSizeOfInput[] = 200;
             }
-            $blankSeparatorNumber = 0;    // 0 is [...]
+            $blankSeparatorNumber = 0; // 0 is [...]
         } else {
             $listWeightings = explode(',', $listDetails[0]);
             $listSizeOfInput = explode(',', $listDetails[1]);
@@ -731,9 +731,9 @@ class FillBlanks extends Question
             // remove [ and ] in string
             array_walk(
                 $listWords[0],
-                function (&$value, $key, $tabBlankChar) {
+                function(&$value, $key, $tabBlankChar) {
                     $trimChars = '';
-                    for ($i=0; $i < count($tabBlankChar); $i++) {
+                    for ($i = 0; $i < count($tabBlankChar); $i++) {
                         $trimChars .= $tabBlankChar[$i];
                     }
                     $value = trim($value, $trimChars);
@@ -753,18 +753,18 @@ class FillBlanks extends Question
         // if student answer, the second [] is the student answer,
         // the third is if student scored or not
         $listBrackets = array();
-        $listWords =  array();
+        $listWords = array();
 
         if ($isStudentAnswer) {
-            for ($i=0; $i < count($listAnswerResults['tabwords']); $i++) {
+            for ($i = 0; $i < count($listAnswerResults['tabwords']); $i++) {
                 $listBrackets[] = $listAnswerResults['tabwordsbracket'][$i];
                 $listWords[] = $listAnswerResults['tabwords'][$i];
-                if ($i+1 < count($listAnswerResults['tabwords'])) {
+                if ($i + 1 < count($listAnswerResults['tabwords'])) {
                     // should always be
                     $i++;
                 }
                 $listAnswerResults['studentanswer'][] = $listAnswerResults['tabwords'][$i];
-                if ($i+1 < count($listAnswerResults['tabwords'])) {
+                if ($i + 1 < count($listAnswerResults['tabwords'])) {
                     // should always be
                     $i++;
                 }
@@ -866,9 +866,9 @@ class FillBlanks extends Question
                                 $tabAnswer['tabwords'][$bracketNumber]
                             )
                             ) {
-                                $tabUserResult[$data['user_id']][$bracketNumber] = 0;   //  right answer
+                                $tabUserResult[$data['user_id']][$bracketNumber] = 0; //  right answer
                             } else {
-                                $tabUserResult[$data['user_id']][$bracketNumber] = -1;  // wrong answer
+                                $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer
                             }
                     }
                 } else {
@@ -876,11 +876,11 @@ class FillBlanks extends Question
                     if ($useLastAnsweredAttempt) {
                         // if we take into account the last answered attempt
                         if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) {
-                            $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
+                            $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered
                         }
                     } else {
                         // we take the last attempt, even if the student answer the question before
-                        $tabUserResult[$data['user_id']][$bracketNumber] = -2;      // not answered
+                        $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered
                     }
                 }
             }
@@ -924,7 +924,7 @@ class FillBlanks extends Question
         $separatorEnd = $listWithStudentAnswer['blankseparatorend'];
         // lets rebuild the sentence with [correct answer][student answer][answer is correct]
         $result = '';
-        for ($i=0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) {
+        for ($i = 0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) {
             $result .= $listWithStudentAnswer['commonwords'][$i];
             $result .= $listWithStudentAnswer['tabwordsbracket'][$i];
             $result .= $separatorStart.$listWithStudentAnswer['studentanswer'][$i].$separatorEnd;
@@ -1006,7 +1006,7 @@ class FillBlanks extends Question
             ")",
         ];
         $result = $text;
-        for ($i=0; $i < count($listRegexpCharacters); $i++) {
+        for ($i = 0; $i < count($listRegexpCharacters); $i++) {
             $result = str_replace($listRegexpCharacters[$i], "\\".$listRegexpCharacters[$i], $result);
         }
 
@@ -1067,7 +1067,7 @@ class FillBlanks extends Question
     {
         $listResults = array();
         $fillBlanksAllowedSeparator = self::getAllowedSeparator();
-        for ($i=0; $i < count($fillBlanksAllowedSeparator); $i++) {
+        for ($i = 0; $i < count($fillBlanksAllowedSeparator); $i++) {
             $listResults[] = $fillBlanksAllowedSeparator[$i][0]."...".$fillBlanksAllowedSeparator[$i][1];
         }
 
@@ -1085,7 +1085,7 @@ class FillBlanks extends Question
     {
         $listSeparators = self::getAllowedSeparator();
         $result = 0;
-        for ($i=0; $i < count($listSeparators); $i++) {
+        for ($i = 0; $i < count($listSeparators); $i++) {
             if ($listSeparators[$i][0] == $startSeparator &&
                 $listSeparators[$i][1] == $endSeparator
             ) {
@@ -1123,7 +1123,7 @@ class FillBlanks extends Question
 
         // rebuild the answer with good HTML style
         // this is the student answer, right or wrong
-        for ($i=0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) {
+        for ($i = 0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) {
             if ($listStudentAnswerInfo['studentscore'][$i] == 1) {
                 $listStudentAnswerInfo['studentanswer'][$i] = self::getHtmlRightAnswer(
                     $listStudentAnswerInfo['studentanswer'][$i],
@@ -1144,7 +1144,7 @@ class FillBlanks extends Question
         }
 
         // rebuild the sentence with student answer inserted
-        for ($i=0; $i < count($listStudentAnswerInfo['commonwords']); $i++) {
+        for ($i = 0; $i < count($listStudentAnswerInfo['commonwords']); $i++) {
             $result .= isset($listStudentAnswerInfo['commonwords'][$i]) ? $listStudentAnswerInfo['commonwords'][$i] : '';
             $result .= isset($listStudentAnswerInfo['studentanswer'][$i]) ? $listStudentAnswerInfo['studentanswer'][$i] : '';
         }

+ 21 - 21
main/exercise/global_multiple_answer.class.php

@@ -35,20 +35,20 @@ class GlobalMultipleAnswer extends Question
         $html = '<table class="data_table">
                 <tr>
                     <th width="10px">
-                        ' . get_lang('Number') . '
+                        ' . get_lang('Number').'
                     </th>
                     <th width="10px">
-                        ' . get_lang('True') . '
+                        ' . get_lang('True').'
                     </th>
                     <th width="50%">
-                        ' . get_lang('Answer') . '
+                        ' . get_lang('Answer').'
                     </th>';
 
-        $html .='<th>' . get_lang('Comment') . '</th>';
-        $html .='</tr>';
+        $html .= '<th>'.get_lang('Comment').'</th>';
+        $html .= '</tr>';
         $form->addElement(
             'label',
-            get_lang('Answers') .
+            get_lang('Answers').
             '<br /> '.Display::return_icon('fill_field.png'),
             $html
         );
@@ -83,9 +83,9 @@ class GlobalMultipleAnswer extends Question
         for ($i = 1; $i <= $nb_answers; ++$i) {
             /* si la reponse est de type objet */
             if (is_object($answer)) {
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
-                $defaults['correct[' . $i . ']'] = $answer->correct[$i];
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
+                $defaults['correct['.$i.']'] = $answer->correct[$i];
 
                 // start
                 $scoreA = $answer->weighting[$i];
@@ -126,8 +126,8 @@ class GlobalMultipleAnswer extends Question
             );
             $answer_number->freeze();
 
-            $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"');
-            $boxes_names[] = 'correct[' . $i . ']';
+            $form->addElement('checkbox', 'correct['.$i.']', null, null, 'class="checkbox"');
+            $boxes_names[] = 'correct['.$i.']';
 
             $form->addElement(
                 'html_editor',
@@ -140,7 +140,7 @@ class GlobalMultipleAnswer extends Question
                     'Height' => '100',
                 )
             );
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
             $form->addElement(
                 'html_editor',
                 'comment['.$i.']',
@@ -217,7 +217,7 @@ class GlobalMultipleAnswer extends Question
         // Reponses correctes
         $nbr_corrects = 0;
         for ($i = 1; $i <= $nb_answers; $i++) {
-            $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']'));
+            $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
             if ($goodAnswer) {
                 $nbr_corrects++;
             }
@@ -236,9 +236,9 @@ class GlobalMultipleAnswer extends Question
         $test = $form->getSubmitValue('pts');
 
         for ($i = 1; $i <= $nb_answers; $i++) {
-            $answer = trim($form->getSubmitValue('answer[' . $i . ']'));
-            $comment = trim($form->getSubmitValue('comment[' . $i . ']'));
-            $goodAnswer = trim($form->getSubmitValue('correct[' . $i . ']'));
+            $answer = trim($form->getSubmitValue('answer['.$i.']'));
+            $comment = trim($form->getSubmitValue('comment['.$i.']'));
+            $goodAnswer = trim($form->getSubmitValue('correct['.$i.']'));
 
             if ($goodAnswer) {
                 $weighting = abs($answer_score);
@@ -266,12 +266,12 @@ class GlobalMultipleAnswer extends Question
         $score = null
     ) {
         $header = parent::return_header($feedback_type, $counter, $score);
-        $header .= '<table class="'.$this->question_table_class .'">
+        $header .= '<table class="'.$this->question_table_class.'">
         <tr>
-            <th>' . get_lang("Choice") . '</th>
-            <th>' . get_lang("ExpectedChoice") . '</th>
-            <th>' . get_lang("Answer") . '</th>';
-        $header .= '<th>' . get_lang("Comment") . '</th>';
+            <th>' . get_lang("Choice").'</th>
+            <th>' . get_lang("ExpectedChoice").'</th>
+            <th>' . get_lang("Answer").'</th>';
+        $header .= '<th>'.get_lang("Comment").'</th>';
         $header .= '</tr>';
 
         return $header;

+ 18 - 18
main/exercise/multiple_answer_combination.class.php

@@ -40,10 +40,10 @@ class MultipleAnswerCombination extends Question
         $html = '<table class="table table-striped table-hover">';
         $html .= '<thead>';
         $html .= '<tr>';
-        $html .= '<th width="10">' . get_lang('Number') . '</th>';
-        $html .= '<th width="10">' . get_lang('True') . '</th>';
-        $html .= '<th width="50%">' . get_lang('Answer') . '</th>';
-        $html .= '<th width="50%">' . get_lang('Comment') . '</th>';
+        $html .= '<th width="10">'.get_lang('Number').'</th>';
+        $html .= '<th width="10">'.get_lang('True').'</th>';
+        $html .= '<th width="50%">'.get_lang('Answer').'</th>';
+        $html .= '<th width="50%">'.get_lang('Comment').'</th>';
         $html .= '</tr>';
         $html .= '</thead>';
         $html .= '<tbody>';
@@ -75,10 +75,10 @@ class MultipleAnswerCombination extends Question
             $form->addHtml('<tr>');
 
             if (is_object($answer)) {
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
-                $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1);
-                $defaults['correct[' . $i . ']'] = $answer->correct[$i];
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
+                $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1);
+                $defaults['correct['.$i.']'] = $answer->correct[$i];
             } else {
                 $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2');
                 $defaults['comment[1]'] = get_lang('DefaultMultipleComment2');
@@ -94,22 +94,22 @@ class MultipleAnswerCombination extends Question
 
             $renderer->setElementTemplate(
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
-                'correct[' . $i . ']'
+                'correct['.$i.']'
             );
             $renderer->setElementTemplate(
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
-                'counter[' . $i . ']'
+                'counter['.$i.']'
             );
             $renderer->setElementTemplate(
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
-                'answer[' . $i . ']'
+                'answer['.$i.']'
             );
             $renderer->setElementTemplate(
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
-                'comment[' . $i . ']'
+                'comment['.$i.']'
             );
 
-            $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
+            $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"');
             $answer_number->freeze();
 
             $form->addElement(
@@ -119,20 +119,20 @@ class MultipleAnswerCombination extends Question
                 null,
                 'class="checkbox" style="margin-left: 0em;"'
             );
-            $boxes_names[] = 'correct[' . $i . ']';
+            $boxes_names[] = 'correct['.$i.']';
 
             $form->addElement(
                 'html_editor',
-                'answer[' . $i . ']',
+                'answer['.$i.']',
                 null,
                 array(),
                 array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')
             );
-            $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
+            $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required');
 
             $form->addElement(
                 'html_editor',
-                'comment[' . $i . ']',
+                'comment['.$i.']',
                 null,
                 array(),
                 array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100')
@@ -225,7 +225,7 @@ class MultipleAnswerCombination extends Question
     function return_header($feedback_type = null, $counter = null, $score = null)
     {
         $header = parent::return_header($feedback_type, $counter, $score);
-        $header .= '<table class="'.$this->question_table_class .'">
+        $header .= '<table class="'.$this->question_table_class.'">
             <tr>
                 <th>'.get_lang("Choice").'</th>
                 <th>'. get_lang("ExpectedChoice").'</th>

+ 9 - 9
main/gradebook/gradebook_display_certificate.php

@@ -6,7 +6,7 @@
  * @package chamilo.gradebook
  */
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_GRADEBOOK;
+$current_course_tool = TOOL_GRADEBOOK;
 
 if (!api_is_student_boss()) {
     api_protect_course_script(true);
@@ -16,9 +16,9 @@ set_time_limit(0);
 ini_set('max_execution_time', 0);
 
 //extra javascript functions for in html head:
-$htmlHeadXtra[] ="<script>
+$htmlHeadXtra[] = "<script>
 function confirmation() {
-	if (confirm(\" " . trim(get_lang('AreYouSureToDelete')) . " ?\")) {
+	if (confirm(\" " . trim(get_lang('AreYouSureToDelete'))." ?\")) {
 	    return true;
 	} else {
 	    return false;
@@ -31,7 +31,7 @@ if (!api_is_allowed_to_edit() && !api_is_student_boss()) {
     api_not_allowed(true);
 }
 
-$cat_id = isset($_GET['cat_id']) ? (int)$_GET['cat_id'] : null;
+$cat_id = isset($_GET['cat_id']) ? (int) $_GET['cat_id'] : null;
 $action = isset($_GET['action']) && $_GET['action'] ? $_GET['action'] : null;
 $filterOfficialCode = isset($_POST['filter']) ? Security::remove_XSS($_POST['filter']) : null;
 $filterOfficialCodeGet = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null;
@@ -76,7 +76,7 @@ $interbreadcrumb[] = array(
     'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?',
     'name' => get_lang('Gradebook'),
 );
-$interbreadcrumb[] = array('url' => '#','name' => get_lang('GradebookListOfStudentsCertificates'));
+$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradebookListOfStudentsCertificates'));
 
 $this_section = SECTION_COURSES;
 Display::display_header('');
@@ -104,9 +104,9 @@ $cats = Category:: load($cat_id, null, null, null, null, null, false);
 if (!empty($cats)) {
     //with this fix the teacher only can view 1 gradebook
     if (api_is_platform_admin()) {
-        $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
+        $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
     } else {
-        $stud_id= api_get_user_id();
+        $stud_id = api_get_user_id();
     }
 
     $total_weight = $cats[0]->get_weight();
@@ -153,7 +153,7 @@ $certificate_list = array();
 if ($filter === 'true') {
     echo '<br />';
     $options = UserManager::getOfficialCodeGrouped();
-    $options =array_merge(array('all' => get_lang('All')), $options);
+    $options = array_merge(array('all' => get_lang('All')), $options);
     $form = new FormValidator(
         'official_code_filter',
         'POST',
@@ -220,7 +220,7 @@ if (count($certificate_list) == 0) {
             $certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn btn-default'));
             echo $certificates;
             echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&'.api_get_cidreq().'&action=delete&cat_id='.$cat_id.'&certificate_id='.$value_certificate['id'].'">
-                    '.Display::return_icon('delete.png',get_lang('Delete')).'
+                    '.Display::return_icon('delete.png', get_lang('Delete')).'
                   </a>';
             echo '</td></tr>';
         }

+ 36 - 36
main/gradebook/lib/flatview_data_generator.class.php

@@ -115,10 +115,10 @@ class FlatViewDataGenerator
             isset($this->params['only_subcat']) &&
             $this->params['only_subcat'] == $this->category->get_id()
         ) {
-            $main_weight  = $this->category->get_weight();
+            $main_weight = $this->category->get_weight();
             $grade_model_id = $this->category->get_grade_model_id();
         } else {
-            $main_cat  = Category::load($parent_id, null, null);
+            $main_cat = Category::load($parent_id, null, null);
             $main_weight = $main_cat[0]->get_weight();
             $grade_model_id = $main_cat[0]->get_grade_model_id();
         }
@@ -198,7 +198,7 @@ class FlatViewDataGenerator
                     $list = [];
                     $list['items'] = $finalList;
                     $list['header'] = '<center>'.$mainHeader.'</center>';
-                    $headers[]= $list;
+                    $headers[] = $list;
                 } else {
                     $headers[] = '<center>'.$mainHeader.'</center>';
                 }
@@ -226,7 +226,7 @@ class FlatViewDataGenerator
                     !in_array($item->get_id(), $evaluationsAdded)
                 ) {
                     $weight = round(100 * $item->get_weight() / $main_weight, 1);
-                    $headers[] = $item->get_name() . ' ' . $weight . ' % ';
+                    $headers[] = $item->get_name().' '.$weight.' % ';
                 }
             }
         }
@@ -265,7 +265,7 @@ class FlatViewDataGenerator
         if (!isset($items_count)) {
             $items_count = count($this->evals_links) - $items_start;
         }
-        for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) {
+        for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
             $item = $this->evals_links [$count + $items_start];
             $headers[] = $item->get_name();
         }
@@ -294,13 +294,13 @@ class FlatViewDataGenerator
     ) {
         // Do some checks on users/items counts, redefine if invalid values
         if (!isset($users_count)) {
-            $users_count = count ($this->users) - $users_start;
+            $users_count = count($this->users) - $users_start;
         }
         if ($users_count < 0) {
             $users_count = 0;
         }
         if (!isset($items_count)) {
-            $items_count = count ($this->evals) + count ($this->links) - $items_start;
+            $items_count = count($this->evals) + count($this->links) - $items_start;
         }
         if ($items_count < 0) {
             $items_count = 0;
@@ -313,10 +313,10 @@ class FlatViewDataGenerator
 
         // sort users array
         if ($users_sorting & self::FVDG_SORT_LASTNAME) {
-            usort($userTable, array('FlatViewDataGenerator','sort_by_last_name'));
+            usort($userTable, array('FlatViewDataGenerator', 'sort_by_last_name'));
 
         } elseif ($users_sorting & self::FVDG_SORT_FIRSTNAME) {
-            usort($userTable, array('FlatViewDataGenerator','sort_by_first_name'));
+            usort($userTable, array('FlatViewDataGenerator', 'sort_by_first_name'));
         }
 
         if ($users_sorting & self::FVDG_SORT_DESC) {
@@ -360,10 +360,10 @@ class FlatViewDataGenerator
             $parent_id == 0 ||
             (isset($this->params['only_subcat']) && $this->params['only_subcat'] == $this->category->get_id())
         ) {
-            $main_weight  = $this->category->get_weight();
+            $main_weight = $this->category->get_weight();
             $grade_model_id = $this->category->get_grade_model_id();
         } else {
-            $main_cat  = Category::load($parent_id, null, null);
+            $main_cat = Category::load($parent_id, null, null);
             $main_weight = $main_cat[0]->get_weight();
             $grade_model_id = $main_cat[0]->get_grade_model_id();
         }
@@ -477,11 +477,11 @@ class FlatViewDataGenerator
                     $divide = $score[1] == 0 ? 1 : $score[1];
 
                     $sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
-                    $item_value  = $score[0]/$divide*$main_weight;
+                    $item_value = $score[0] / $divide * $main_weight;
 
                     // Fixing total when using one or multiple gradebooks
-                    $percentage = $sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight();
-                    $item_value = $percentage*$item_value;
+                    $percentage = $sub_cat->get_weight() / ($sub_cat_percentage) * $sub_cat_percentage / $this->category->get_weight();
+                    $item_value = $percentage * $item_value;
                     $item_total += $sub_cat->get_weight();
                     /*
                         if ($convert_using_the_global_weight) {
@@ -635,7 +635,7 @@ class FlatViewDataGenerator
             // Sub cat weight
             //$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
 
-            $item_value = isset($score[0]) ? $score[0]/$divide : 0;
+            $item_value = isset($score[0]) ? $score[0] / $divide : 0;
 
             // Fixing total when using one or multiple gradebooks.
             if (empty($parentCategoryIdFilter)) {
@@ -724,11 +724,11 @@ class FlatViewDataGenerator
         $data = array();
 
         foreach ($selected_users as $user) {
-            $row = array ();
+            $row = array();
             for ($count = 0; $count < count($this->evals_links); $count++) {
                 $item = $this->evals_links [$count];
                 $score = $item->calc_score($user[0]);
-                $porcent_score = isset($score[1]) &&  $score[1] > 0 ? ($score[0]*100)/$score[1] :0;
+                $porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0] * 100) / $score[1] : 0;
                 $row[$item->get_name()] = $porcent_score;
             }
             $data[$user[0]] = $row;
@@ -751,7 +751,7 @@ class FlatViewDataGenerator
         */
         $result = array();
         foreach ($data_by_item as $k => $v) {
-            $average = round(array_sum($v)/count($v));
+            $average = round(array_sum($v) / count($v));
             arsort($v);
             $maximum = array_shift($v);
             $minimum = array_pop($v);
@@ -760,7 +760,7 @@ class FlatViewDataGenerator
                 $minimum = 0;
             }
 
-            $summary= array(
+            $summary = array(
                 'max' => $maximum,
                 'min' => $minimum,
                 'avg' => $average
@@ -777,19 +777,19 @@ class FlatViewDataGenerator
     public function get_data_to_graph()
     {
         // do some checks on users/items counts, redefine if invalid values
-        $usertable = array ();
+        $usertable = array();
         foreach ($this->users as $user) {
             $usertable[] = $user;
         }
         // sort users array
-        usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
+        usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
 
-        $data = array ();
+        $data = array();
 
         $selected_users = $usertable;
         foreach ($selected_users as $user) {
-            $row = array ();
-            $row[] = $user[0];    // user id
+            $row = array();
+            $row[] = $user[0]; // user id
             $item_value = 0;
             $item_total = 0;
 
@@ -797,12 +797,12 @@ class FlatViewDataGenerator
                 $item = $this->evals_links[$count];
                 $score = $item->calc_score($user[0]);
 
-                $divide =( ($score[1])==0 ) ? 1 : $score[1];
-                $item_value += $score[0]/$divide*$item->get_weight();
+                $divide = (($score[1]) == 0) ? 1 : $score[1];
+                $item_value += $score[0] / $divide * $item->get_weight();
                 $item_total += $item->get_weight();
 
 
-                $score_denom = ($score[1]==0) ? 1 : $score[1];
+                $score_denom = ($score[1] == 0) ? 1 : $score[1];
                 $score_final = ($score[0] / $score_denom) * 100;
                 $row[] = $score_final;
             }
@@ -829,15 +829,15 @@ class FlatViewDataGenerator
             $usertable[] = $user;
         }
         // sort users array
-        usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
+        usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
 
         // generate actual data array
         $scoredisplay = ScoreDisplay::instance();
         $data = array();
         $selected_users = $usertable;
         foreach ($selected_users as $user) {
-            $row = array ();
-            $row[] = $user[0];    // user id
+            $row = array();
+            $row[] = $user[0]; // user id
             $item_value = 0;
             $item_total = 0;
             $final_score = 0;
@@ -857,8 +857,8 @@ class FlatViewDataGenerator
                     $divide = $score[1] == 0 ? 1 : $score[1];
 
                     //$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
-                    $item_value     = $score[0]/$divide*$main_weight;
-                    $item_total        += $sub_cat->get_weight();
+                    $item_value = $score[0] / $divide * $main_weight;
+                    $item_total += $sub_cat->get_weight();
 
                     $row[] = array(
                         $item_value,
@@ -880,13 +880,13 @@ class FlatViewDataGenerator
                     $score = $item->calc_score($user[0]);
                     $divide = ($score[1]) == 0 ? 1 : $score[1];
                     $item_value += $score[0] / $divide * $item->get_weight();
-                    $item_total+=$item->get_weight();
-                    $score_denom=($score[1]==0) ? 1 : $score[1];
+                    $item_total += $item->get_weight();
+                    $score_denom = ($score[1] == 0) ? 1 : $score[1];
                     $score_final = ($score[0] / $score_denom) * 100;
-                    $row[] = array ($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM,null, true)));
+                    $row[] = array($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM, null, true)));
 
                 }
-                $total_score=array($item_value,$item_total);
+                $total_score = array($item_value, $item_total);
                 $score_final = ($item_value / $item_total) * 100;
                 if ($displayWarning) {
                     Display::display_warning_message($total_score[1]);

+ 7 - 7
main/inc/ajax/course.ajax.php

@@ -90,7 +90,7 @@ switch ($action) {
                         0, //howMany
                         1, //$orderby = 1
                         'ASC',
-                        -1,  //visibility
+                        -1, //visibility
                         $_GET['q'],
                         null, //$urlId
                         true //AlsoSearchCode
@@ -112,7 +112,7 @@ switch ($action) {
 
                 if (!empty($course['category_code'])) {
                     $parents = CourseCategory::getParentsToString($course['category_code']);
-                    $title = $parents . $course['title'];
+                    $title = $parents.$course['title'];
                 }
 
                 $results['items'][] = array(
@@ -192,7 +192,7 @@ switch ($action) {
                     ON u.user_id = r.user_id
                     WHERE session_id = %d AND c_id =  '%s'
                     AND (u.firstname LIKE '%s' OR u.username LIKE '%s' OR u.lastname LIKE '%s')";
-            $needle = '%' . $_GET['q'] . '%';
+            $needle = '%'.$_GET['q'].'%';
             $sql_query = sprintf($sql, $_GET['session_id'], $course['real_id'], $needle, $needle, $needle);
 
             $result = Database::query($sql_query);
@@ -211,7 +211,7 @@ switch ($action) {
     case 'search_exercise_by_course':
         if (api_is_platform_admin()) {
             $course = api_get_course_info_by_id($_GET['course_id']);
-            $session_id = (!empty($_GET['session_id'])) ?  intval($_GET['session_id']) : 0 ;
+            $session_id = (!empty($_GET['session_id'])) ? intval($_GET['session_id']) : 0;
             $exercises = ExerciseLib::get_all_exercises(
                 $course,
                 $session_id,
@@ -222,7 +222,7 @@ switch ($action) {
             );
 
             foreach ($exercises as $exercise) {
-                $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']) );
+                $data[] = array('id' => $exercise['id'], 'text' => html_entity_decode($exercise['title']));
             }
             if (!empty($data)) {
                 $data[] = array('id' => 'T', 'text' => 'TODOS');
@@ -247,11 +247,11 @@ switch ($action) {
                 $sql,
                 intval($_GET['course_id']),
                 intval($_GET['session_id']),
-                '%' . Database::escape_string($_GET['q']).'%'
+                '%'.Database::escape_string($_GET['q']).'%'
             );
             $result = Database::query($sql_query);
             while ($survey = Database::fetch_assoc($result)) {
-                $survey['title'] .= ($survey['anonymous'] == 1) ? ' (' . get_lang('Anonymous') . ')' : '';
+                $survey['title'] .= ($survey['anonymous'] == 1) ? ' ('.get_lang('Anonymous').')' : '';
                 $data[] = array(
                     'id' => $survey['id'],
                     'text' => strip_tags(html_entity_decode($survey['title']))

+ 43 - 43
main/inc/ajax/course_home.ajax.php

@@ -48,19 +48,19 @@ switch ($action) {
                 $na_image = CourseHome::getCustomWebIconPath().CourseHome::getDisableIcon($tool_info['custom_icon']);
             }
 
-            $requested_image = ($tool_visibility == 0 ) ? $tool_image : $na_image;
-            $requested_class = ($tool_visibility == 0 ) ? '' : 'text-muted';
-            $requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive';
-            $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png';
-            $requested_visible = ($tool_visibility == 0 ) ? 1 : 0;
-            $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png';
-            $requested_visible = ($tool_visibility == 0 ) ? 1 : 0;
+            $requested_image = ($tool_visibility == 0) ? $tool_image : $na_image;
+            $requested_class = ($tool_visibility == 0) ? '' : 'text-muted';
+            $requested_message = ($tool_visibility == 0) ? 'is_active' : 'is_inactive';
+            $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png';
+            $requested_visible = ($tool_visibility == 0) ? 1 : 0;
+            $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png';
+            $requested_visible = ($tool_visibility == 0) ? 1 : 0;
 
             // HIDE AND REACTIVATE TOOL
             if ($_GET["id"] == strval(intval($_GET["id"]))) {
                 $sql = "UPDATE $tool_table SET
                         visibility = $requested_visible
-                        WHERE c_id = $course_id AND id='" . intval($_GET['id']) . "'";
+                        WHERE c_id = $course_id AND id='".intval($_GET['id'])."'";
                 Database::query($sql);
             }
             $response_data = array(
@@ -112,12 +112,12 @@ switch ($action) {
          */
         require_once __DIR__.'/../global.inc.php';
         $now = time();
-        $page  = intval($_REQUEST['page']);     //page
-        $limit = intval($_REQUEST['rows']);     // quantity of rows
+        $page  = intval($_REQUEST['page']); //page
+        $limit = intval($_REQUEST['rows']); // quantity of rows
         //index to filter
         $sidx  = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
-        $sord  = $_REQUEST['sord'];    //asc or desc
-        if (!in_array($sord, array('asc','desc'))) {
+        $sord  = $_REQUEST['sord']; //asc or desc
+        if (!in_array($sord, array('asc', 'desc'))) {
             $sord = 'desc';
         }
         $session_id  = intval($_REQUEST['session_id']);
@@ -137,7 +137,7 @@ switch ($action) {
             }
         }
 
-        $start = $limit*$page - $limit;
+        $start = $limit * $page - $limit;
         $course_list = SessionManager::get_course_list_by_session_id($session_id);
         $count = 0;
         $temp = array();
@@ -149,14 +149,14 @@ switch ($action) {
             $item['title'] = Display::url($item['title'], $course_url, array('target' => SESSION_LINK_TARGET));
 
             foreach ($flat_list as $lp_id => $lp_item) {
-                $temp[$count]['id']= $lp_id;
+                $temp[$count]['id'] = $lp_id;
 
                 $lp = new learnpath($item['code'], $lp_id, api_get_user_id());
                 if ($lp->progress_db == 100) {
                     continue;
                 }
 
-                $lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
+                $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
 
                 $last_date = Tracking::get_last_connection_date_on_the_course(
                     api_get_user_id(),
@@ -212,25 +212,25 @@ switch ($action) {
         }
         $temp = msort($temp, $sidx, $sord);
 
-        $i =0;
+        $i = 0;
         $response = new stdClass();
         foreach ($temp as $key => $row) {
             $row = $row['cell'];
             if (!empty($row)) {
-                if ($key >= $start  && $key < ($start + $limit)) {
-                    $response->rows[$i]['id']= $key;
-                    $response->rows[$i]['cell']=array($row[0], $row[1], $row[2]);
+                if ($key >= $start && $key < ($start + $limit)) {
+                    $response->rows[$i]['id'] = $key;
+                    $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]);
                     $i++;
                 }
             }
         }
         $total_pages = 0;
         if ($count > 0 && $limit > 0) {
-            $total_pages = ceil($count/$limit);
+            $total_pages = ceil($count / $limit);
         }
         $response->total = $total_pages;
         if ($page > $total_pages) {
-            $response->page= $total_pages;
+            $response->page = $total_pages;
         } else {
             $response->page = $page;
         }
@@ -240,12 +240,12 @@ switch ($action) {
     case 'session_courses_lp_by_week':
         require_once __DIR__.'/../global.inc.php';
         $now = time();
-        $page = intval($_REQUEST['page']);     //page
-        $limit = intval($_REQUEST['rows']);     // quantity of rows
+        $page = intval($_REQUEST['page']); //page
+        $limit = intval($_REQUEST['rows']); // quantity of rows
         $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'course';
         $sidx = str_replace(array('week desc,', ' '), '', $sidx);
-        $sord = $_REQUEST['sord'];    //asc or desc
-        if (!in_array($sord, array('asc','desc'))) {
+        $sord = $_REQUEST['sord']; //asc or desc
+        if (!in_array($sord, array('asc', 'desc'))) {
             $sord = 'desc';
         }
 
@@ -293,8 +293,8 @@ switch ($action) {
             );
 
             foreach ($flat_list as $lp_id => $lp_item) {
-                $temp[$count]['id']= $lp_id;
-                $lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
+                $temp[$count]['id'] = $lp_id;
+                $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
 
                 $last_date = Tracking::get_last_connection_date_on_the_course(
                     api_get_user_id(),
@@ -356,20 +356,20 @@ switch ($action) {
         }
 
         $response = new stdClass();
-        $i =0;
+        $i = 0;
         foreach ($temp as $key => $row) {
             $row = $row['cell'];
             if (!empty($row)) {
-                if ($key >= $start  && $key < ($start + $limit)) {
-                    $response->rows[$i]['id']= $key;
-                    $response->rows[$i]['cell']=array($row[0], $row[1], $row[2],$row[3]);
+                if ($key >= $start && $key < ($start + $limit)) {
+                    $response->rows[$i]['id'] = $key;
+                    $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2], $row[3]);
                     $i++;
                 }
             }
         }
         $total_pages = 0;
         if ($count > 0 && $limit > 0) {
-            $total_pages = ceil($count/$limit);
+            $total_pages = ceil($count / $limit);
         }
         $response->total = $total_pages;
         if ($page > $total_pages) {
@@ -383,12 +383,12 @@ switch ($action) {
     case 'session_courses_lp_by_course':
         require_once __DIR__.'/../global.inc.php';
         $now = time();
-        $page  = intval($_REQUEST['page']);     //page
-        $limit = intval($_REQUEST['rows']);     // quantity of rows
+        $page  = intval($_REQUEST['page']); //page
+        $limit = intval($_REQUEST['rows']); // quantity of rows
         $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
         $sidx = str_replace(array('course asc,', ' '), '', $sidx);
 
-        $sord = $_REQUEST['sord'];    //asc or desc
+        $sord = $_REQUEST['sord']; //asc or desc
         if (!in_array($sord, array('asc', 'desc'))) {
             $sord = 'desc';
         }
@@ -409,7 +409,7 @@ switch ($action) {
             }
         }
 
-        $start = $limit*$page - $limit;
+        $start = $limit * $page - $limit;
         $course_list = SessionManager::get_course_list_by_session_id($session_id);
         $count = 0;
 
@@ -431,9 +431,9 @@ switch ($action) {
                 $item['title'],
                 api_get_path(WEB_COURSE_PATH).$item['directory'].'/?id_session='.$session_id, array('target'=>SESSION_LINK_TARGET)
             );
-            foreach($flat_list as $lp_id => $lp_item) {
-                $temp[$count]['id']= $lp_id;
-                $lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
+            foreach ($flat_list as $lp_id => $lp_item) {
+                $temp[$count]['id'] = $lp_id;
+                $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
                 $last_date = Tracking::get_last_connection_date_on_the_course(
                     api_get_user_id(),
                     $item,
@@ -485,13 +485,13 @@ switch ($action) {
 
         $temp = msort($temp, $sidx, $sord);
         $response = new stdClass();
-        $i =0;
+        $i = 0;
         foreach ($temp as $key => $row) {
             $row = $row['cell'];
             if (!empty($row)) {
-                if ($key >= $start  && $key < ($start + $limit)) {
-                    $response->rows[$i]['id']= $key;
-                    $response->rows[$i]['cell']=array($row[0], $row[1], $row[2]);
+                if ($key >= $start && $key < ($start + $limit)) {
+                    $response->rows[$i]['id'] = $key;
+                    $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]);
                     $i++;
                 }
             }

+ 6 - 6
main/inc/ajax/user_manager.ajax.php

@@ -71,7 +71,7 @@ switch ($action) {
                 <div class="row">
                     <div class="col-sm-10 col-sm-offset-2">
                         <a class="btn btn-primary" id="send_message_link">
-                            <em class="fa fa-envelope"></em> ' . get_lang('Send') . '
+                            <em class="fa fa-envelope"></em> ' . get_lang('Send').'
                         </a>
                     </div>
                 </div>
@@ -136,13 +136,13 @@ switch ($action) {
                     $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
                     $email_admin = api_get_setting('emailAdministrator');
                     $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
-                    $emailbody=get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
+                    $emailbody = get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
 
-                    $emailbody.=sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n";
-                    $emailbody.=sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n";
-                    $emailbody.=get_lang('HaveFun')."\n\n";
+                    $emailbody .= sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n";
+                    $emailbody .= sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n";
+                    $emailbody .= get_lang('HaveFun')."\n\n";
                     //$emailbody.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula');
-                    $emailbody.=api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
+                    $emailbody .= api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator');
 
                     $additionalParameters = array(
                         'smsType' => SmsPlugin::ACCOUNT_APPROVED_CONNECT,

+ 24 - 24
main/inc/lib/notebook.lib.php

@@ -29,7 +29,7 @@ class NotebookManager
         return "<script>
 				function confirmation (name)
 				{
-					if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\"))
+					if (confirm(\" " . get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
 						{return true;}
 					else
 						{return false;}
@@ -114,7 +114,7 @@ class NotebookManager
                 description 		AS note_comment,
                 session_id			AS session_id
                FROM $t_notebook
-               WHERE c_id = $course_id AND notebook_id = '" . intval($notebook_id) . "' ";
+               WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' ";
         $result = Database::query($sql);
         if (Database::num_rows($result) != 1) {
             return array();
@@ -193,8 +193,8 @@ class NotebookManager
         $sql = "DELETE FROM $t_notebook
                 WHERE
                     c_id = $course_id AND
-                    notebook_id='" . intval($notebook_id) . "' AND
-                    user_id = '" . api_get_user_id() . "'";
+                    notebook_id='".intval($notebook_id)."' AND
+                    user_id = '" . api_get_user_id()."'";
         $result = Database::query($sql);
         $affected_rows = Database::affected_rows($result);
         if ($affected_rows != 1) {
@@ -241,20 +241,20 @@ class NotebookManager
                         '32'
                     ).'</a>';
             } elseif (api_is_allowed_to_session_edit(false, true)) {
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
             }
         } else {
-            echo '<a href="javascript:void(0)">' .
-                Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
+            echo '<a href="javascript:void(0)">'.
+                Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
         }
 
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' .
-            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' .
-            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' .
-            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.
+            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.
+            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.
+            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
         echo '</div>';
 
         if (!isset($_SESSION['notebook_view']) ||
@@ -266,9 +266,9 @@ class NotebookManager
         // Database table definition
         $t_notebook = Database::get_course_table(TABLE_NOTEBOOK);
         if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
         } else {
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
         }
 
         //condition for the session
@@ -281,7 +281,7 @@ class NotebookManager
         $sql = "SELECT * FROM $t_notebook
                 WHERE
                     c_id = $course_id AND
-                    user_id = '" . api_get_user_id() . "'
+                    user_id = '".api_get_user_id()."'
                     $condition_session
                     $cond_extra $order_by
                 ";
@@ -291,18 +291,18 @@ class NotebookManager
             $session_img = api_get_session_image($row['session_id'], $_user['status']);
             $updateValue = '';
             if ($row['update_date'] <> $row['creation_date']) {
-                $updateValue = ', ' . get_lang('UpdateDate') . ': ' . Display::dateToStringAgoAndLongDate($row['update_date']);
+                $updateValue = ', '.get_lang('UpdateDate').': '.Display::dateToStringAgoAndLongDate($row['update_date']);
             }
 
-            $actions = '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' .
-                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
-            $actions .= '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' .
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
+            $actions = '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.
+                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
+            $actions .= '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
 
             echo Display::panel(
                 $row['description'],
-                $row['title'] . $session_img.' <div class="pull-right">'.$actions.'</div>',
-                get_lang('CreationDate') . ': ' . Display::dateToStringAgoAndLongDate($row['creation_date']). $updateValue
+                $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',
+                get_lang('CreationDate').': '.Display::dateToStringAgoAndLongDate($row['creation_date']).$updateValue
             );
         }
     }

+ 25 - 25
main/inc/lib/urlmanager.lib.php

@@ -23,7 +23,7 @@ class UrlManager
     public static function add($url, $description, $active)
     {
         $tms = time();
-        $table= Database::get_main_table(TABLE_MAIN_ACCESS_URL);
+        $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
         $sql = "INSERT INTO $table
                 SET url 	= '".Database::escape_string($url)."',
                 description = '".Database::escape_string($description)."',
@@ -92,7 +92,7 @@ class UrlManager
         $sql = "DELETE FROM $tableUser WHERE access_url_id = ".$id;
         Database::query($sql);
 
-        $sql= "DELETE FROM $table WHERE id = ".$id;
+        $sql = "DELETE FROM $table WHERE id = ".$id;
         Database::query($sql);
 
         return true;
@@ -105,7 +105,7 @@ class UrlManager
      */
     public static function url_exist($url)
     {
-        $table= Database::get_main_table(TABLE_MAIN_ACCESS_URL);
+        $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
         $sql = "SELECT id FROM $table
                 WHERE url = '".Database::escape_string($url)."' ";
         $res = Database::query($sql);
@@ -139,10 +139,10 @@ class UrlManager
      * */
     public static function url_count()
     {
-        $table_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL);
+        $table_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
         $sql = "SELECT count(id) as count_result FROM $table_access_url";
         $res = Database::query($sql);
-        $url = Database::fetch_array($res,'ASSOC');
+        $url = Database::fetch_array($res, 'ASSOC');
         $result = $url['count_result'];
 
         return $result;
@@ -160,7 +160,7 @@ class UrlManager
                 FROM $table
                 ORDER BY id";
         $res = Database::query($sql);
-        $urls = array ();
+        $urls = array();
         while ($url = Database::fetch_array($res)) {
             $urls[] = $url;
         }
@@ -277,7 +277,7 @@ class UrlManager
      **/
     public static function get_url_rel_session_data($access_url_id = null)
     {
-        $where ='';
+        $where = '';
         $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
 
@@ -391,7 +391,7 @@ class UrlManager
     public static function relation_url_user_exist($user_id, $url_id)
     {
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-        $sql= "SELECT user_id FROM $table
+        $sql = "SELECT user_id FROM $table
                WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." ";
         $result = Database::query($sql);
         $num = Database::num_rows($result);
@@ -409,7 +409,7 @@ class UrlManager
     public static function relation_url_course_exist($courseId, $urlId)
     {
         $table_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
-        $sql= "SELECT c_id FROM $table_url_rel_course
+        $sql = "SELECT c_id FROM $table_url_rel_course
                WHERE
                     access_url_id = ".intval($urlId)." AND
                     c_id = '".intval($courseId)."'";
@@ -430,7 +430,7 @@ class UrlManager
     public static function relationUrlUsergroupExist($userGroupId, $urlId)
     {
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
-        $sql= "SELECT usergroup_id FROM $table
+        $sql = "SELECT usergroup_id FROM $table
                WHERE 
                     access_url_id = ".intval($urlId)." AND
                     usergroup_id = ".intval($userGroupId);
@@ -449,7 +449,7 @@ class UrlManager
     * */
     public static function relation_url_session_exist($session_id, $url_id)
     {
-        $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
+        $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
         $session_id = intval($session_id);
         $url_id = intval($url_id);
         $sql = "SELECT session_id FROM $table_url_rel_session
@@ -517,7 +517,7 @@ class UrlManager
                     $courseId = $courseInfo['real_id'];
 
                     $count = self::relation_url_course_exist($courseId, $url_id);
-                    if ($count==0) {
+                    if ($count == 0) {
                         $sql = "INSERT INTO $table_url_rel_course
                                 SET c_id = '".$courseId."', access_url_id = ".intval($url_id);
                         $result = Database::query($sql);
@@ -603,7 +603,7 @@ class UrlManager
     public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId)
     {
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
-        $sql= "SELECT course_category_id FROM $table
+        $sql = "SELECT course_category_id FROM $table
                WHERE access_url_id = ".intval($urlId)." AND
                      course_category_id = ".intval($categoryCourseId);
         $result = Database::query($sql);
@@ -774,7 +774,7 @@ class UrlManager
         $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $result = true;
         if (!empty($user_id) && !empty($url_id)) {
-            $sql= "DELETE FROM $table_url_rel_user
+            $sql = "DELETE FROM $table_url_rel_user
                    WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id);
             $result = Database::query($sql);
         }
@@ -794,7 +794,7 @@ class UrlManager
         $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $result = true;
         if (!empty($userId)) {
-            $sql= "DELETE FROM $table_url_rel_user
+            $sql = "DELETE FROM $table_url_rel_user
                    WHERE user_id = ".intval($userId);
             Database::query($sql);
         }
@@ -813,7 +813,7 @@ class UrlManager
     public static function delete_url_rel_course($courseId, $urlId)
     {
         $table_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
-        $sql= "DELETE FROM $table_url_rel_course
+        $sql = "DELETE FROM $table_url_rel_course
                WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)."  ";
         $result = Database::query($sql);
 
@@ -831,7 +831,7 @@ class UrlManager
     public static function delete_url_rel_usergroup($userGroupId, $urlId)
     {
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
-        $sql= "DELETE FROM $table
+        $sql = "DELETE FROM $table
                WHERE usergroup_id = '".intval($userGroupId)."' AND
                      access_url_id = ".intval($urlId);
         $result = Database::query($sql);
@@ -850,7 +850,7 @@ class UrlManager
     public static function deleteUrlRelCourseCategory($userGroupId, $urlId)
     {
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
-        $sql= "DELETE FROM $table
+        $sql = "DELETE FROM $table
                WHERE course_category_id = '".intval($userGroupId)."' AND
                      access_url_id=".intval($urlId)."  ";
         $result = Database::query($sql);
@@ -869,7 +869,7 @@ class UrlManager
     public static function delete_url_rel_session($session_id, $url_id)
     {
         $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-        $sql= "DELETE FROM $table_url_rel_session
+        $sql = "DELETE FROM $table_url_rel_session
                WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)."  ";
         $result = Database::query($sql, 'ASSOC');
 
@@ -884,7 +884,7 @@ class UrlManager
      * */
     public static function update_urls_rel_user($user_list, $access_url_id)
     {
-        $table_url_rel_user	= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+        $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $sql = "SELECT user_id 
                 FROM $table_url_rel_user 
                 WHERE access_url_id = ".intval($access_url_id);
@@ -1053,7 +1053,7 @@ class UrlManager
         $result = Database::query($sql);
         $existing_sessions = array();
 
-        while ($row = Database::fetch_array($result)){
+        while ($row = Database::fetch_array($result)) {
             $existing_sessions[] = $row['session_id'];
         }
 
@@ -1083,8 +1083,8 @@ class UrlManager
      */
     public static function get_access_url_from_user($user_id)
     {
-        $table_url_rel_user	= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-        $table_url	= Database::get_main_table(TABLE_MAIN_ACCESS_URL);
+        $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+        $table_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
         $sql = "SELECT url, access_url_id 
                 FROM $table_url_rel_user url_rel_user 
                 INNER JOIN $table_url u
@@ -1122,7 +1122,7 @@ class UrlManager
     public static function get_access_url_from_session($session_id)
     {
         $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-        $table_url  = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
+        $table_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
         $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session 
                 INNER JOIN $table_url u
                 ON (url_rel_session.access_url_id = u.id)
@@ -1139,7 +1139,7 @@ class UrlManager
      */
     public static function get_url_id($url)
     {
-        $table_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL);
+        $table_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
         $sql = "SELECT id FROM $table_access_url 
                 WHERE url = '".Database::escape_string($url)."'";
         $result = Database::query($sql);

+ 34 - 34
main/session/add_users_to_session.php

@@ -102,13 +102,13 @@ function search_users($needle, $type)
         if (api_is_session_admin() &&
             api_get_setting('prevent_session_admins_to_manage_all_users') === 'true'
         ) {
-            $order_clause = " AND user.creator_id = " . api_get_user_id() . $order_clause;
+            $order_clause = " AND user.creator_id = ".api_get_user_id().$order_clause;
         }
 
         $cond_user_id = '';
 
         // Only for single & multiple
-        if (in_array($type, array('single','multiple')))
+        if (in_array($type, array('single', 'multiple')))
         if (!empty($id_session)) {
             $id_session = intval($id_session);
             // check id_user from session_rel_user table
@@ -118,11 +118,11 @@ function search_users($needle, $type)
             $user_ids = array();
             if (Database::num_rows($res) > 0) {
                 while ($row = Database::fetch_row($res)) {
-                    $user_ids[] = (int)$row[0];
+                    $user_ids[] = (int) $row[0];
                 }
             }
             if (count($user_ids) > 0) {
-                $cond_user_id = ' AND user.id NOT IN('.implode(",",$user_ids).')';
+                $cond_user_id = ' AND user.id NOT IN('.implode(",", $user_ids).')';
             }
         }
 
@@ -164,7 +164,7 @@ function search_users($needle, $type)
         }
 
         if (api_is_multiple_url_enabled()) {
-            $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+            $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
             $access_url_id = api_get_current_access_url_id();
             if ($access_url_id != -1) {
                 switch ($type) {
@@ -215,10 +215,10 @@ function search_users($needle, $type)
 
         $rs = Database::query($sql);
         $i = 0;
-        if ($type=='single') {
+        if ($type == 'single') {
             while ($user = Database :: fetch_array($rs)) {
                 $i++;
-                if ($i<=10) {
+                if ($i <= 10) {
                     $person_name = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].') '.$user['official_code'];
                     if ($showOfficialCode) {
                         $officialCode = !empty($user['official_code']) ? $user['official_code'].' - ' : '? - ';
@@ -231,7 +231,7 @@ function search_users($needle, $type)
                 }
             }
 
-            $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
+            $xajax_response -> addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return));
         } else {
             global $nosessionUsersList;
             $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
@@ -244,7 +244,7 @@ function search_users($needle, $type)
                 $return .= '<option value="'.$user['id'].'">'.$person_name.' </option>';
             }
             $return .= '</select>';
-            $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
+            $xajax_response -> addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
         }
     }
     return $xajax_response;
@@ -360,10 +360,10 @@ if ($ajax_search) {
             $order_clause";
 
     if (api_is_multiple_url_enabled()) {
-        $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+        $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
-            $sql="SELECT u.id, lastname, firstname, username, session_id, official_code
+            $sql = "SELECT u.id, lastname, firstname, username, session_id, official_code
             FROM $tbl_user u
             INNER JOIN $tbl_session_rel_user
                 ON $tbl_session_rel_user.user_id = u.id AND
@@ -377,7 +377,7 @@ if ($ajax_search) {
     $result = Database::query($sql);
     $users = Database::store_result($result);
     foreach ($users as $user) {
-        $sessionUsersList[$user['id']] = $user ;
+        $sessionUsersList[$user['id']] = $user;
     }
 
     $sessionUserInfo = SessionManager::getTotalUserCoursesInSession($id_session);
@@ -413,12 +413,12 @@ if ($ajax_search) {
                     if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
                         $use_extra_fields = true;
                         if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
-                            $extra_field_result[]= UserManager::get_extra_user_data_by_tags(
+                            $extra_field_result[] = UserManager::get_extra_user_data_by_tags(
                                 intval($_POST['field_id']),
                                 $_POST[$varname]
                             );
                         } else {
-                            $extra_field_result[]= UserManager::get_extra_user_data_by_value(
+                            $extra_field_result[] = UserManager::get_extra_user_data_by_value(
                                 $new_field['variable'],
                                 $_POST[$varname]
                             );
@@ -431,10 +431,10 @@ if ($ajax_search) {
 
     if ($use_extra_fields) {
         $final_result = array();
-       	if (count($extra_field_result)>1) {
-	    for($i=0;$i<count($extra_field_result)-1;$i++) {
-                if (is_array($extra_field_result[$i+1])) {
-                    $final_result  = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]);
+       	if (count($extra_field_result) > 1) {
+	    for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
+                if (is_array($extra_field_result[$i + 1])) {
+                    $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
                 }
             }
         } else {
@@ -442,14 +442,14 @@ if ($ajax_search) {
         }
 
         if (api_is_multiple_url_enabled()) {
-            if (is_array($final_result) && count($final_result)>0) {
-                $where_filter = " AND u.id IN  ('".implode("','",$final_result)."') ";
+            if (is_array($final_result) && count($final_result) > 0) {
+                $where_filter = " AND u.id IN  ('".implode("','", $final_result)."') ";
             } else {
                 //no results
                 $where_filter = " AND u.id  = -1";
             }
         } else {
-            if (is_array($final_result) && count($final_result)>0) {
+            if (is_array($final_result) && count($final_result) > 0) {
                 $where_filter = " WHERE u.id IN  ('".implode("','", $final_result)."') ";
             } else {
                 //no results
@@ -458,7 +458,7 @@ if ($ajax_search) {
         }
     }
     if (api_is_session_admin() && api_get_setting('prevent_session_admins_to_manage_all_users') === 'true') {
-        $order_clause = " AND u.creator_id = " . api_get_user_id() . $order_clause;
+        $order_clause = " AND u.creator_id = ".api_get_user_id().$order_clause;
     }
     if ($use_extra_fields) {
         $sql = "SELECT  u.id, lastname, firstname, username, session_id, official_code
@@ -480,7 +480,7 @@ if ($ajax_search) {
                 $order_clause";
     }
     if (api_is_multiple_url_enabled()) {
-        $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+        $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             $sql = "SELECT  u.id, lastname, firstname, username, session_id, official_code
@@ -506,7 +506,7 @@ if ($ajax_search) {
                 'ln' => $user['lastname'],
                 'un' => $user['username'],
                 'official_code' => $user['official_code']
-            ) ;
+            );
             unset($users[$uid]);
         }
     }
@@ -522,7 +522,7 @@ if ($ajax_search) {
           WHERE u.status<>".DRH." AND u.status<>6 $order_clause";
 
     if (api_is_multiple_url_enabled()) {
-        $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+        $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             $sql = "SELECT  u.id, lastname, firstname, username, session_id, official_code
@@ -560,7 +560,7 @@ if ($add_type == 'multiple') {
 	$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&amp;add='.$addProcess.'&amp;add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
 }
 $link_add_group = Display::url(
-    Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'),
+    Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'),
     api_get_path(WEB_CODE_PATH).'admin/usergroups.php'
 );
 
@@ -581,12 +581,12 @@ $newLinks .= Display::url(
     echo $newLinks;
     ?>
 </div>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($addProcess)) echo '&add=true' ; ?>"  <?php if ($ajax_search) { echo ' onsubmit="valide();"';}?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($addProcess)) echo '&add=true'; ?>"  <?php if ($ajax_search) { echo ' onsubmit="valide();"'; }?>>
 <?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?>
 <?php
-if ($add_type=='multiple') {
+if ($add_type == 'multiple') {
 	if (is_array($extra_field_list)) {
-		if (is_array($new_field_list) && count($new_field_list)>0 ) {
+		if (is_array($new_field_list) && count($new_field_list) > 0) {
 			echo '<h3>'.get_lang('FilterUsers').'</h3>';
 			foreach ($new_field_list as $new_field) {
 				echo $new_field['name'];
@@ -594,8 +594,8 @@ if ($add_type=='multiple') {
                 $fieldtype = $new_field['type'];
 				echo '&nbsp;<select name="'.$varname.'">';
 				echo '<option value="0">--'.get_lang('Select').'--</option>';
-				foreach	($new_field['data'] as $option) {
-					$checked='';
+				foreach ($new_field['data'] as $option) {
+					$checked = '';
                     if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
                         if (isset($_POST[$varname])) {
                             if ($_POST[$varname] == $option['tag']) {
@@ -636,7 +636,7 @@ if (!empty($errorMsg)) {
         <div class="form-group">
             <label><?php echo get_lang('UserListInPlatform') ?> </label>
             <?php
-            if (!($add_type=='multiple')) {
+            if (!($add_type == 'multiple')) {
               ?>
               <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" class="form-control" />
               <div id="ajax_list_users_single" class="select-list-ajax"></div>
@@ -648,7 +648,7 @@ if (!empty($errorMsg)) {
               <?php
               foreach ($nosessionUsersList as $uid => $enreg) {
               ?>
-                  <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>>
+                  <option value="<?php echo $uid; ?>" <?php if (in_array($uid, $UserList)) echo 'selected="selected"'; ?>>
                       <?php
                       $personName = $enreg['ln'].' '.$enreg['fn'].' ('.$enreg['un'].') '.$enreg['official_code'];
                       if ($showOfficialCode) {
@@ -673,7 +673,7 @@ if (!empty($errorMsg)) {
     </div>
 
     <div class="col-md-4">
-        <?php if ($add_type=='multiple') { ?>
+        <?php if ($add_type == 'multiple') { ?>
             <?php echo get_lang('FirstLetterUser'); ?> :
 
             <select id="first_letter_user" name="firstLetterUser" onchange = "change_select(this.value);" >

+ 16 - 16
main/social/invitations.php

@@ -16,8 +16,8 @@ if (api_get_setting('allow_social_tool') !== 'true') {
 
 $this_section = SECTION_SOCIAL;
 
-$interbreadcrumb[] = array ('url' =>'profile.php','name' => get_lang('SocialNetwork'));
-$interbreadcrumb[] = array ('url' =>'#','name' => get_lang('Invitations'));
+$interbreadcrumb[] = array('url' =>'profile.php', 'name' => get_lang('SocialNetwork'));
+$interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('Invitations'));
 
 $userGroupModel = new UserGroup();
 
@@ -64,7 +64,7 @@ if (is_array($_GET) && count($_GET) > 0) {
                     Display::return_message(get_lang('UserIsNotSubscribedToThisGroup'), 'warning')
                 );
 
-                header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
+                header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
                 exit;
                 break;
             case 'deny':
@@ -74,7 +74,7 @@ if (is_array($_GET) && count($_GET) > 0) {
                     Display::return_message(get_lang('GroupInvitationWasDeny'))
                 );
 
-                header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
+                header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
                 exit;
         }
     }
@@ -130,24 +130,24 @@ if ($number_loop != 0) {
         $invitationHtml .= '<div class="btn-group btn-group-sm" role="group">';
         $invitationHtml .= Display::toolbarButton(
             null,
-            api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?' . http_build_query([
+            api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([
                 'a' => 'add_friend',
                 'friend_id' => $sender_user_id,
                 'is_my_friend' => 'friend'
             ]),
             'check',
             'default',
-            ['id' => 'btn-accept-' . $sender_user_id]
+            ['id' => 'btn-accept-'.$sender_user_id]
         );
         $invitationHtml .= Display::toolbarButton(
             null,
-            api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?' . http_build_query([
+            api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([
                 'a' => 'deny_friend',
                 'denied_friend_id' => $sender_user_id,
             ]),
             'times',
             'default',
-            ['id' => 'btn-deny-' . $sender_user_id]
+            ['id' => 'btn-deny-'.$sender_user_id]
         );
         $invitationHtml .= '</div>';
         $invitationHtml .= '</div>';
@@ -184,7 +184,7 @@ if (count($list_get_invitation_sent) > 0) {
         $invitationSentHtml .= '<div class="col-md-9">';
         $invitationSentHtml .= '<h4 class="title-profile"><a class="profile_link" href="profile.php?u='.$sender_user_id.'">'.$user_info['complete_name'].'</a></h4>';
         $invitationSentHtml .= '<div class="content-invitation">'.$title.' : '.$content.'</div>';
-        $invitationSentHtml .= '<div class="date-invitation">'. get_lang('DateSend').' : '.$date.'</div>';
+        $invitationSentHtml .= '<div class="date-invitation">'.get_lang('DateSend').' : '.$date.'</div>';
         $invitationSentHtml .= '</div>';
         $invitationSentHtml .= '</div></div>';
     }
@@ -203,9 +203,9 @@ if (count($pending_invitations) > 0) {
         );
         $img = '<img class="img-responsive" src="'.$picture['file'].'" />';
         $invitation['picture_uri'] = '<a href="group_view.php?id='.$invitation['id'].'">'.$img.'</a>';
-        $invitation['name'] = '<a href="group_view.php?id='.$invitation['id'].'">'.cut($invitation['name'],120,true).'</a>';
+        $invitation['name'] = '<a href="group_view.php?id='.$invitation['id'].'">'.cut($invitation['name'], 120, true).'</a>';
         $invitation['description'] = cut($invitation['description'], 220, true);
-        $new_invitation[]=$invitation;
+        $new_invitation[] = $invitation;
         $waitingInvitation .= '<div class="panel-invitations"><div class="row">';
         $waitingInvitation .= '<div class="col-md-3">'.$invitation['picture_uri'].'</div>';
         $waitingInvitation .= '<div class="col-md-9">';
@@ -214,19 +214,19 @@ if (count($pending_invitations) > 0) {
         $waitingInvitation .= '<div class="btn-group" role="group">';
         $waitingInvitation .= Display::toolbarButton(
             get_lang('AcceptInvitation'),
-            api_get_path(WEB_CODE_PATH) . 'social/invitations.php?' . http_build_query(['accept' => $invitation['id']]),
+            api_get_path(WEB_CODE_PATH).'social/invitations.php?'.http_build_query(['accept' => $invitation['id']]),
             'check',
             'success',
-            ['id' => 'accept-invitation-' . $invitation['id']]
+            ['id' => 'accept-invitation-'.$invitation['id']]
         );
         $waitingInvitation .= Display::toolbarButton(
             get_lang('DenyInvitation'),
-            api_get_path(WEB_CODE_PATH) . 'social/invitations.php?' . http_build_query(['deny' => $invitation['id']]),
+            api_get_path(WEB_CODE_PATH).'social/invitations.php?'.http_build_query(['deny' => $invitation['id']]),
             'times',
             'danger',
-            ['id' => 'deny-invitation-' . $invitation['id']]
+            ['id' => 'deny-invitation-'.$invitation['id']]
         );
-        $waitingInvitation .='</div>';
+        $waitingInvitation .= '</div>';
         $waitingInvitation .= '</div></div>';
     }
     $socialInvitationsBlock .= Display::panel($waitingInvitation, get_lang('GroupsWaitingApproval'));

+ 13 - 13
main/ticket/new_ticket.php

@@ -8,7 +8,7 @@
 require_once __DIR__.'/../inc/global.inc.php';
 
 if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') != 'true') {
-    header('location:' . api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
+    header('location:'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
     exit;
 }
 
@@ -91,7 +91,7 @@ function add_image_form() {
     });
 
     img_remove = $("<img/>", {
-        src: "' . Display::returnIconPath('delete.png') . '"
+        src: "' . Display::returnIconPath('delete.png').'"
     });
 
     new_filepath_id = $("#filepath_" + counter_image);
@@ -110,10 +110,10 @@ $projectId = isset($_GET['project_id']) ? (int) $_GET['project_id'] : '';
 
 $types = TicketManager::get_all_tickets_categories($projectId, 'category.name ASC');
 $htmlHeadXtra[] = '<script language="javascript">
-    var projects = ' . js_array($types, 'projects', 'project_id') . '
-    var course_required = ' . js_array($types, 'course_required', 'course_required') . '
-    var other_area = ' . js_array($types, 'other_area', 'other_area') . '
-    var email = ' . js_array($types, 'email', 'email') .
+    var projects = ' . js_array($types, 'projects', 'project_id').'
+    var course_required = ' . js_array($types, 'course_required', 'course_required').'
+    var other_area = ' . js_array($types, 'other_area', 'other_area').'
+    var email = ' . js_array($types, 'email', 'email').
 '</script>';
 
 /**
@@ -122,7 +122,7 @@ $htmlHeadXtra[] = '<script language="javascript">
  */
 function js_str($s)
 {
-    return '"' . addcslashes($s, "\0..\37\"\\") . '"';
+    return '"'.addcslashes($s, "\0..\37\"\\").'"';
 }
 
 /**
@@ -135,7 +135,7 @@ function js_array($array, $name, $key)
 {
     $return = "new Array(); ";
     foreach ($array as $value) {
-        $return .= $name . "['" . $value['category_id'] . "'] ='" . $value[$key] . "'; ";
+        $return .= $name."['".$value['category_id']."'] ='".$value[$key]."'; ";
     }
 
     return $return;
@@ -148,7 +148,7 @@ function save_ticket()
 {
     $content = $_POST['content'];
     if ($_POST['phone'] != '') {
-        $content .= '<p style="color:red">&nbsp;' . get_lang('Phone') . ': ' . $_POST['phone']. '</p>';
+        $content .= '<p style="color:red">&nbsp;'.get_lang('Phone').': '.$_POST['phone'].'</p>';
     }
     $course_id = isset($_POST['course_id']) ? $_POST['course_id'] : '';
     $sessionId = isset($_POST['session_id']) ? $_POST['session_id'] : '';
@@ -179,7 +179,7 @@ function save_ticket()
         $status,
         $user_id
     )) {
-        header('Location:' . api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
+        header('Location:'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
         exit;
     } else {
         Display::addFlash(Display::return_message(get_lang('ThereWasAnErrorRegisteringTheTicket')));
@@ -363,7 +363,7 @@ $form->addElement(
 $form->addElement(
     'text',
     'phone',
-    get_lang('Phone') . ' (' . get_lang('Optional') . ')',
+    get_lang('Phone').' ('.get_lang('Optional').')',
     array(
         'id' => 'phone'
     )
@@ -401,7 +401,7 @@ $form->addLabel('', '<span id="filepaths"><div id="filepath_1"></div></span>');
 $form->addLabel(
     '',
     '<span id="link-more-attach">
-         <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</span>
+         <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile').'</span>
          </span>
          ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')
     '
@@ -434,7 +434,7 @@ Display::display_header(get_lang('ComposeMessage'));
 echo '<div class="actions">';
 echo Display::url(
     Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM),
-    api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php'
+    api_get_path(WEB_CODE_PATH).'ticket/tickets.php'
 );
 echo '</div>';
 

+ 3 - 3
main/work/upload_corrections.php

@@ -5,7 +5,7 @@ use ChamiloSession as Session;
 use Symfony\Component\Finder\Finder;
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
+$current_course_tool = TOOL_STUDENTPUBLICATION;
 
 api_protect_course_script(true);
 
@@ -81,7 +81,7 @@ if ($form->validate()) {
     if ($upload) {
         $zip = new PclZip($_FILES['file']['tmp_name']);
         // Check the zip content (real size and file extension)
-        $zipFileList = (array)$zip->listContent();
+        $zipFileList = (array) $zip->listContent();
 
         $realSize = 0;
         foreach ($zipFileList as & $this_content) {
@@ -128,7 +128,7 @@ if ($form->validate()) {
         foreach ($result as $item) {
             $title = $item['title_clean'];
             $insert_date = str_replace(array(':', '-', ' '), '_', api_get_local_time($item['sent_date_from_db']));
-            $title =  api_replace_dangerous_char($insert_date.'_'.$item['username'].'_'.$title);
+            $title = api_replace_dangerous_char($insert_date.'_'.$item['username'].'_'.$title);
             $finalResult[$title] = $item['id'];
         }
 

+ 10 - 10
plugin/vchamilo/lib/Virtual.php

@@ -28,7 +28,7 @@ class Virtual
         self::getHostName($_configuration);
 
         // We are on physical chamilo. Let original config play
-        $virtualChamiloWebRoot = rtrim($_configuration['vchamilo_web_root'], '/') . '/';
+        $virtualChamiloWebRoot = rtrim($_configuration['vchamilo_web_root'], '/').'/';
 
         $virtualChamilo = [];
         if ($_configuration['root_web'] == $virtualChamiloWebRoot) {
@@ -234,7 +234,7 @@ class Virtual
         if (preg_match('#https?://#', $url)) {
             header('location: '.$url);
         } else {
-            header('location: ' . api_get_path(WEB_PATH).$url);
+            header('location: '.api_get_path(WEB_PATH).$url);
         }
         exit;
     }
@@ -417,7 +417,7 @@ class Virtual
         }
 
         // Making the command line (see 'vconfig.php' file for defining the right paths).
-        $sqlcmd = $pgm.' -h'.$vchamilodata->db_host.(isset($vchamilodata->db_port) ? ' -P'.$vchamilodata->db_port.' ' : ' ' );
+        $sqlcmd = $pgm.' -h'.$vchamilodata->db_host.(isset($vchamilodata->db_port) ? ' -P'.$vchamilodata->db_port.' ' : ' ');
         $sqlcmd .= '-u'.$vchamilodata->db_user.' '.$databasePassword;
         $sqlcmd .= '%DATABASE% < ';
 
@@ -500,7 +500,7 @@ class Virtual
         //    $cmds[] = $cmd_main . ' > ' . $outputfilerad;
         //} else {
         $cmd_main = "-h{$host} -P{$port} -u{$vchamilo->db_user} {$pass} {$vchamilo->main_database}";
-        $cmds[] = $cmd_main . ' > ' . escapeshellarg($outputfilerad);
+        $cmds[] = $cmd_main.' > '.escapeshellarg($outputfilerad);
         //}
 
         $mysqldumpcmd = self::getConfig('vchamilo', 'cmd_mysqldump', true);
@@ -949,7 +949,7 @@ class Virtual
                 Display::return_message('You cannot use the same database as the chamilo master', 'error')
             );
 
-            return ;
+            return;
         }
 
         $databaseName = $data->main_database;
@@ -963,7 +963,7 @@ class Virtual
                     'error'
                 )
             );
-            return ;
+            return;
         }
 
         $data->root_web = api_add_trailing_slash($data->root_web);
@@ -993,7 +993,7 @@ class Virtual
                 Display::addFlash(
                     Display::return_message('Cannot create slug from url: '.$data->root_web, 'error')
                 );
-                return ;
+                return;
             }
             Database::insert($tablename, (array) $data);
         }
@@ -1135,14 +1135,14 @@ class Virtual
                 $newDatabase->sitename = $siteName;
                 $newDatabase->institution = $institution;
                 $slug = $newDatabase->slug = $data->slug = self::getSlugFromUrl($data->root_web);
-                $id = Database::insert($table, (array)$newDatabase);
+                $id = Database::insert($table, (array) $newDatabase);
             }
         }
 
         if (!$id) {
             // Show data detail to help debug
             //var_dump($data);
-            throw new Exception('New/Imported instance was not registered - edit ' . __FILE__ . ' on line ' . __LINE__ . 'to var_dump');
+            throw new Exception('New/Imported instance was not registered - edit '.__FILE__.' on line '.__LINE__.'to var_dump');
         }
 
         if (empty($slug)) {
@@ -1313,7 +1313,7 @@ class Virtual
             $id = (int) $id;
             $sql = "SELECT * FROM vchamilo WHERE id = $id";
             $result = Database::query($sql);
-            $vhost =  (object) Database::fetch_array($result, 'ASSOC');
+            $vhost = (object) Database::fetch_array($result, 'ASSOC');
         }
 
         return $vhost;

+ 5 - 5
plugin/vchamilo/views/manage.controller.php

@@ -112,9 +112,9 @@ switch ($action) {
         $vid = isset($_REQUEST['vid']) ? $_REQUEST['vid'] : '';
         if ($vid) {
             $vhosts = Database::select('*', 'vchamilo', array('where' => array('id = ?' => $vid)));
-            $vhost = (object)array_pop($vhosts);
+            $vhost = (object) array_pop($vhosts);
         } else {
-            $vhost = (object)$_configuration;
+            $vhost = (object) $_configuration;
             $vhost->slug = Virtual::getSlugFromUrl($vhost->root_web);
             $vhost->id = 0;
         }
@@ -305,10 +305,10 @@ switch ($action) {
                 $vid = isset($_REQUEST['vid']) ? $_REQUEST['vid'] : 0;
                 if ($vid) {
                     $vhosts = Database::select('*', 'vchamilo', array('where' => array('id = ?' => $vid)));
-                    $vhost = (object)array_pop($vhosts);
+                    $vhost = (object) array_pop($vhosts);
                     $toclear[$vhost->id] = $vhost;
                 } else {
-                    $toclear[0] = (object)$_configuration;
+                    $toclear[0] = (object) $_configuration;
                 }
             }
         } else {
@@ -331,7 +331,7 @@ switch ($action) {
                 //$uploadPath = Virtual::getConfig('vchamilo', 'upload_real_root');
 
                 // Get instance archive
-                $archivepath = api_get_path(SYS_ARCHIVE_PATH, (array)$instance);
+                $archivepath = api_get_path(SYS_ARCHIVE_PATH, (array) $instance);
                 $templatepath = $archivePath.'/'.$instance['slug'].'/twig';
                 Display::addFlash(Display::return_message("Deleting cache $templatepath \n"));
                 removeDir($templatepath);

+ 1 - 1
src/Chamilo/CoreBundle/Component/Editor/Editor.php

@@ -131,7 +131,7 @@ class Editor
             case 'integer':
                 //no break
             case 'double':
-                return (string)$var;
+                return (string) $var;
                 //no break
             case 'resource':
                 //no break