فهرست منبع

Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
Scrutinizer Auto-Fixer 7 سال پیش
والد
کامیت
14488458e2
32فایلهای تغییر یافته به همراه928 افزوده شده و 929 حذف شده
  1. 19 19
      main/admin/add_users_to_usergroup.php
  2. 16 16
      main/admin/configure_inscription.php
  3. 9 9
      main/admin/system_announcements.php
  4. 17 17
      main/admin/user_export.php
  5. 18 19
      main/auth/courses_controller.php
  6. 16 16
      main/exercise/TestCategory.php
  7. 40 40
      main/exercise/export/exercise_import.inc.php
  8. 8 8
      main/exercise/tests_category.php
  9. 51 51
      main/exercise/unique_answer.class.php
  10. 67 67
      main/forum/viewforum.php
  11. 87 87
      main/gradebook/lib/GradebookUtils.php
  12. 40 40
      main/inc/ajax/model.ajax.php
  13. 48 48
      main/inc/lib/TicketManager.php
  14. 171 171
      main/inc/lib/document.lib.php
  15. 19 19
      main/inc/lib/image.lib.php
  16. 103 103
      main/inc/lib/social.lib.php
  17. 14 14
      main/inc/lib/system_announcements.lib.php
  18. 21 21
      main/inc/lib/template.lib.php
  19. 14 14
      main/lp/lp_build.php
  20. 2 2
      main/mySpace/access_details.php
  21. 7 7
      main/reports/modules/course.php
  22. 3 3
      main/reports/multiquery.lib.php
  23. 50 50
      main/tracking/courseLogCSV.php
  24. 25 25
      main/tracking/logins_details.php
  25. 17 17
      main/webservices/additional_webservices.php
  26. 2 2
      main/webservices/api/v2.php
  27. 5 5
      main/work/edit.php
  28. 1 1
      main/work/upload_from_template.php
  29. 21 21
      plugin/dashboard/block_daily/block_daily.class.php
  30. 5 5
      plugin/dashboard/block_global_info/block_global_info.class.php
  31. 1 1
      plugin/google_maps/lang/spanish.php
  32. 11 11
      src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php

+ 19 - 19
main/admin/add_users_to_usergroup.php

@@ -18,8 +18,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[]= array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[]= array('url' => 'usergroups.php','name' => get_lang('Classes'));
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
 
 // Database Table Definitions
 
@@ -90,7 +90,7 @@ function change_select(val) {
 
 </script>';
 
-$form_sent  = 0;
+$form_sent = 0;
 
 $extra_field_list = UserManager::get_extra_fields();
 $new_field_list = array();
@@ -144,7 +144,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'export') {
         foreach ($users as $user) {
             $data[] = array($user['username'], $groupInfo['name']);
         }
-        $filename = 'export_user_class_' . api_get_local_time();
+        $filename = 'export_user_class_'.api_get_local_time();
         Export::arrayToCsv($data, $filename);
         exit;
     }
@@ -157,7 +157,7 @@ if (is_array($extra_field_list)) {
         foreach ($new_field_list as $new_field) {
             $varname = 'field_'.$new_field['variable'];
             if (UserManager::is_extra_field_available($new_field['variable'])) {
-                if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
+                if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
                     $use_extra_fields = true;
                     $extra_field_result[] = UserManager::get_extra_user_data_by_value(
                         $new_field['variable'],
@@ -171,10 +171,10 @@ if (is_array($extra_field_list)) {
 
 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 {
@@ -193,7 +193,7 @@ $filters = array(
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
 $searchForm->addHeader(get_lang('AdvancedSearch'));
-$renderer =& $searchForm->defaultRenderer();
+$renderer = & $searchForm->defaultRenderer();
 
 $searchForm->addElement('hidden', 'id', $id);
 foreach ($filters as $param) {
@@ -341,12 +341,12 @@ echo '<div id="advanced_search_options" style="display:none">';
 $searchForm->display();
 echo '</div>';
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;">
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;">
 <?php
 echo '<legend>'.$tool_name.': '.$data['name'].'</legend>';
 
 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('FilterByUser').'</h3>';
         foreach ($new_field_list as $new_field) {
             echo $new_field['name'];
@@ -354,7 +354,7 @@ if (is_array($extra_field_list)) {
             echo '&nbsp;<select name="'.$varname.'">';
             echo '<option value="0">--'.get_lang('Select').'--</option>';
             foreach ($new_field['data'] as $option) {
-                $checked='';
+                $checked = '';
                 if (isset($_POST[$varname])) {
                     if ($_POST[$varname] == $option[1]) {
                         $checked = 'selected="true"';
@@ -380,15 +380,15 @@ echo Display::input('hidden', 'add_type', null);
         <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?>
         <select name="relation" id="relation">
             <option value=""><?php echo get_lang('SelectARelationType')?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN)?'selected=selected':'') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Admin') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER)?'selected=selected':'') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Reader') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION)?'selected=selected':'') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('PendingInvitation') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR)?'selected=selected':'') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Moderator') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM)?'selected=selected':'') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Drh') ?></option>
         </select>
         <?php } ?>
@@ -419,7 +419,7 @@ echo Display::input('hidden', 'add_type', null);
     ?>
     <br />
       <label class="control-label">
-          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
+          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"'; ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
           <?php echo get_lang('UsersRegisteredInAnyGroup'); ?>
       </label>
     </div>

+ 16 - 16
main/admin/configure_inscription.php

@@ -141,9 +141,9 @@ if (!empty($action)) {
                 // This request is only the preparation for the update of the home_top
                 $home_top = '';
                 if (is_file($homep.$topf.'_'.$lang.$ext) && is_readable($homep.$topf.'_'.$lang.$ext)) {
-                    $home_top = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
+                    $home_top = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext);
                 } elseif (is_file($homep.$topf.$lang.$ext) && is_readable($homep.$topf.$lang.$ext)) {
-                    $home_top = @(string)file_get_contents($homep.$topf.$lang.$ext);
+                    $home_top = @(string) file_get_contents($homep.$topf.$lang.$ext);
                 } else {
                     $errorMsg = get_lang('HomePageFilesNotReadable');
                 }
@@ -184,15 +184,15 @@ if ($display_all_form) {
     if (api_is_western_name_order()) {
         //	FIRST NAME and LAST NAME
         $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
-        $form->addElement('text', 'lastname',  get_lang('LastName'),  array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
     } else {
         //	LAST NAME and FIRST NAME
-        $form->addElement('text', 'lastname',  get_lang('LastName'),  array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
         $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
     }
     $form->applyFilter('firstname', 'trim');
     $form->applyFilter('lastname', 'trim');
-    $form->addRule('lastname',  get_lang('ThisFieldIsRequired'), 'required');
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
 
     //	EMAIL
@@ -210,10 +210,10 @@ if ($display_all_form) {
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('username', get_lang('UsernameWrong'), 'username');
     $form->addRule('username', get_lang('UserTaken'), 'username_available');
-    $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
+    $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
 
     //	PASSWORD
-    $form->addElement('password', 'pass1', get_lang('Pass'),         array('size' => 40, 'disabled' => 'disabled'));
+    $form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled'));
     $form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 40, 'disabled' => 'disabled'));
     $form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required');
@@ -244,25 +244,25 @@ if ($display_all_form) {
 
     //	EXTENDED FIELDS
     if (api_get_setting('extended_profile') == 'true' &&
-        api_get_setting('extendedprofile_registration','mycomptetences') == 'true'
+        api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true'
     ) {
         $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
-        api_get_setting('extendedprofile_registration','mydiplomas') == 'true'
+        api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true'
     ) {
         $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
-        api_get_setting('extendedprofile_registration','myteach') == 'true'
+        api_get_setting('extendedprofile_registration', 'myteach') == 'true'
     ) {
         $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
-        api_get_setting('extendedprofile_registration','mypersonalopenarea') == 'true'
+        api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true'
     ) {
         $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
     }
@@ -352,14 +352,14 @@ if (api_get_setting('openid_authentication') == 'true' && !empty($_GET['openid']
 
 $form->setDefaults($defaults);
 
-switch ($action){
+switch ($action) {
     case 'edit_top':
         if ($action == 'edit_top') {
             $name = $topf;
             $open = $home_top;
         } else {
             $name = $newsf;
-            $open = @(string)file_get_contents($homep.$newsf.'_'.$lang.$ext);
+            $open = @(string) file_get_contents($homep.$newsf.'_'.$lang.$ext);
             $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
         }
 
@@ -369,7 +369,7 @@ switch ($action){
 
         $default = array();
         $form = new FormValidator('configure_inscription_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;'));
-        $renderer =& $form->defaultRenderer();
+        $renderer = & $form->defaultRenderer();
         $renderer->setHeaderTemplate('');
         $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
         $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
@@ -388,9 +388,9 @@ switch ($action){
 
         $open = '';
         if (file_exists($homep.$topf.'_'.$lang.$ext)) {
-            $open = @(string)file_get_contents($homep.$topf.'_'.$lang.$ext);
+            $open = @(string) file_get_contents($homep.$topf.'_'.$lang.$ext);
         } else {
-            $open = @(string)file_get_contents($homep.$topf.$ext);
+            $open = @(string) file_get_contents($homep.$topf.$ext);
         }
         $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
         if (!empty($open)) {

+ 9 - 9
main/admin/system_announcements.php

@@ -210,15 +210,15 @@ if ($action_todo) {
 
     $form->addElement('checkbox', 'send_mail', null, get_lang('SendMail'));
 
-    if (isset($_REQUEST['action']) && $_REQUEST['action']=='add') {
+    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
         $form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar'));
-        $text=get_lang('AddNews');
-        $class='add';
+        $text = get_lang('AddNews');
+        $class = 'add';
         $form->addElement('hidden', 'action', 'add');
 
     } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
-        $text=get_lang('EditNews');
-        $class='save';
+        $text = get_lang('EditNews');
+        $class = 'save';
         $form->addElement('hidden', 'action', 'edit');
     }
     $form->addElement('checkbox', 'send_email_test', null, get_lang('SendOnlyAnEmailToMySelfToTest'));
@@ -318,7 +318,7 @@ if ($action_todo) {
 
 if ($show_announcement_list) {
     $announcements = SystemAnnouncementManager :: get_all_announcements();
-    $announcement_data = array ();
+    $announcement_data = array();
     foreach ($announcements as $index => $announcement) {
         $row = array();
         $row[] = $announcement->id;
@@ -326,9 +326,9 @@ if ($show_announcement_list) {
         $row[] = $announcement->title;
         $row[] = api_convert_and_format_date($announcement->date_start);
         $row[] = api_convert_and_format_date($announcement->date_end);
-        $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_TEACHER."&action=". ($announcement->visible_teacher ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_teacher  ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>";
-        $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_STUDENT."&action=". ($announcement->visible_student  ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_student  ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>";
-        $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_GUEST."&action=". ($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest  ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>";
+        $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_TEACHER."&action=".($announcement->visible_teacher ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_teacher ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>";
+        $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_STUDENT."&action=".($announcement->visible_student ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_student ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>";
+        $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_GUEST."&action=".($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>";
         $row[] = $announcement->lang;
         $row[] = "<a href=\"?action=edit&id=".$announcement->id."\">".Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL)."</a> <a href=\"?action=delete&id=".$announcement->id."\"  onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)."</a>";
         $announcement_data[] = $row;

+ 17 - 17
main/admin/user_export.php

@@ -29,16 +29,16 @@ $allCoursesFromSessions = SessionManager::getAllCoursesFromAllSessions();
 
 $coursesSessions = array_merge($coursesSessions, $allCoursesFromSessions);
 
-$courses = array ();
+$courses = array();
 $courses[''] = '--';
 $sql = "SELECT code,visual_code,title FROM $course_table ORDER BY visual_code";
 
 global $_configuration;
 
 if (api_is_multiple_url_enabled()) {
-	$tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
+	$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
 	$access_url_id = api_get_current_access_url_id();
-	if ($access_url_id != -1){
+	if ($access_url_id != -1) {
 	$sql = "SELECT code,visual_code,title
 		FROM $course_table as c
 		INNER JOIN $tbl_course_rel_access_url as course_rel_url
@@ -53,11 +53,11 @@ while ($course = Database::fetch_object($result)) {
 }
 $form = new FormValidator('export_users');
 $form->addElement('header', $tool_name);
-$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'XML','xml');
+$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'XML', 'xml');
 $form->addElement('radio', 'file_type', null, 'CSV', 'csv');
 $form->addElement('radio', 'file_type', null, 'XLS', 'xls');
 
-$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'),'1');
+$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'), '1');
 $form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses);
 $form->addElement('select', 'course_session', get_lang('OnlyUsersFromCourseSession'), $coursesSessions);
 $form->addButtonExport(get_lang('Export'));
@@ -79,7 +79,7 @@ if ($form->validate()) {
 	if (is_array($courseSessionValue) && isset($courseSessionValue[1])) {
         $courseSessionCode = $courseSessionValue[0];
         $sessionId = $courseSessionValue[1];
-        $courseSessionInfo= api_get_course_info($courseSessionCode);
+        $courseSessionInfo = api_get_course_info($courseSessionCode);
         $courseSessionId = $courseSessionInfo['real_id'];
         $sessionInfo = api_get_session_info($sessionId);
     }
@@ -90,7 +90,7 @@ if ($form->validate()) {
 				u.firstname 	AS FirstName,
 				u.email 		AS Email,
 				u.username	AS UserName,
-				".(($_configuration['password_encryption']!='none')?" ":"u.password AS Password, ")."
+				".(($_configuration['password_encryption'] != 'none') ? " " : "u.password AS Password, ")."
 				u.auth_source	AS AuthSource,
 				u.status		AS Status,
 				u.official_code	AS OfficialCode,
@@ -114,10 +114,10 @@ if ($form->validate()) {
         $filename = 'export_users_'.$courseSessionCode.'_'.$sessionInfo['name'].'_'.api_get_local_time();
     } else {
 		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.= " FROM $user_table u
+			$sql .= " FROM $user_table u
 					INNER JOIN $tbl_user_rel_access_url as user_rel_url
 				ON (u.user_id= user_rel_url.user_id)
 				WHERE access_url_id = $access_url_id
@@ -129,8 +129,8 @@ if ($form->validate()) {
 		$filename = 'export_users_'.api_get_local_time();
 	}
 	$data = array();
-	$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC',false);
-	if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') {
+	$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false);
+	if ($export['addcsvheader'] == '1' AND $export['file_type'] == 'csv') {
 		if ($_configuration['password_encryption'] != 'none') {
 			$data[] = array(
 				'UserId',
@@ -160,27 +160,27 @@ if ($form->validate()) {
 			);
 		}
 
-		foreach($extra_fields as $extra) {
-			$data[0][]=$extra[1];
+		foreach ($extra_fields as $extra) {
+			$data[0][] = $extra[1];
 		}
 	}
 
 	$res = Database::query($sql);
-	while($user = Database::fetch_array($res,'ASSOC')) {
+	while ($user = Database::fetch_array($res, 'ASSOC')) {
 		$student_data = UserManager:: get_extra_user_data(
 			$user['UserId'],
 			true,
 			false
 		);
-		foreach($student_data as $key=>$value) {
+		foreach ($student_data as $key=>$value) {
 			$key = substr($key, 6);
 			if (is_array($value)) {
-				$user[$key] = $value['extra_' . $key];
+				$user[$key] = $value['extra_'.$key];
 			} else {
 				$user[$key] = $value;
 			}
 		}
-		$data[] = $user	;
+		$data[] = $user;
 	}
 
 	switch ($file_type) {

+ 18 - 19
main/auth/courses_controller.php

@@ -396,13 +396,13 @@ class CoursesController
                     $html .= '</strong>';
                 } else {
                     if (!empty($categoryCourses)) {
-                        $html .= '<a href="' . CourseCategory::getCourseCategoryUrl(
+                        $html .= '<a href="'.CourseCategory::getCourseCategoryUrl(
                                 1,
                                 $limit['length'],
                                 $categoryCode,
                                 $hiddenLinks,
                                 $action
-                            ) . '">';
+                            ).'">';
                         $html .= "$categoryName ($categoryCourses)";
                         $html .= '</a>';
                     } else {
@@ -421,13 +421,13 @@ class CoursesController
                         if ($code == $subCategory1Code) {
                             $html .= "<strong>$subCategory1Name ($subCategory1Courses)</strong>";
                         } else {
-                            $html .= '<a href="' . CourseCategory::getCourseCategoryUrl(
+                            $html .= '<a href="'.CourseCategory::getCourseCategoryUrl(
                                     1,
                                     $limit['length'],
                                     $categoryCode,
                                     $hiddenLinks,
                                     $action
-                                ) . '">';
+                                ).'">';
                             $html .= "$subCategory1Name ($subCategory1Courses)";
                             $html .= '</a>';
                         }
@@ -445,13 +445,13 @@ class CoursesController
                                 if ($code == $subCategory2Code) {
                                     $html .= "<strong>$subCategory2Name ($subCategory2Courses)</strong>";
                                 } else {
-                                    $html .= '<a href="' . CourseCategory::getCourseCategoryUrl(
+                                    $html .= '<a href="'.CourseCategory::getCourseCategoryUrl(
                                             1,
                                             $limit['length'],
                                             $categoryCode,
                                             $hiddenLinks,
                                             $action
-                                        ) . '">';
+                                        ).'">';
                                     $html .= "$subCategory2Name ($subCategory2Courses)";
                                     $html .= '</a>';
                                 }
@@ -469,13 +469,13 @@ class CoursesController
                                         if ($code == $subCategory3Code) {
                                             $html .= "<strong>$subCategory3Name ($subCategory3Courses)</strong>";
                                         } else {
-                                            $html .= '<a href="' . CourseCategory::getCourseCategoryUrl(
+                                            $html .= '<a href="'.CourseCategory::getCourseCategoryUrl(
                                                     1,
                                                     $limit['length'],
                                                     $categoryCode,
                                                     $hiddenLinks,
                                                     $action
-                                                ) . '">';
+                                                ).'">';
                                             $html .= "$subCategory3Name ($subCategory3Courses)";
                                             $html .= '</a>';
                                         }
@@ -536,7 +536,7 @@ class CoursesController
                 'shield',
                 'default',
                 [
-                    'class' => $btnBing . ' ajax',
+                    'class' => $btnBing.' ajax',
                     'data-title' => get_lang('CheckRequirements'),
                     'data-size' => 'md',
                     'title' => get_lang('CheckRequirements')
@@ -565,7 +565,7 @@ class CoursesController
                 'pencil',
                 'primary',
                 [
-                    'class' => $btnBing .' ajax',
+                    'class' => $btnBing.' ajax',
                     'data-title' => get_lang('AreYouSureToSubscribe'),
                     'data-size' => 'md',
                     'title' => get_lang('Subscribe')
@@ -650,8 +650,7 @@ class CoursesController
         $pageTotal = intval(ceil(intval($countSessions) / $limit['length']));
         // Do NOT show pagination if only one page or less
         $cataloguePagination = $pageTotal > 1 ?
-            CourseCategory::getCatalogPagination($limit['current'], $limit['length'], $pageTotal) :
-            '';
+            CourseCategory::getCatalogPagination($limit['current'], $limit['length'], $pageTotal) : '';
         $sessionsBlocks = $this->getFormattedSessionsBlock($sessions);
 
         // Get session search catalogue URL
@@ -666,13 +665,13 @@ class CoursesController
         $tpl = new Template();
         $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
         $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
-        $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
+        $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
         $tpl->assign('course_url', $courseUrl);
         $tpl->assign('catalog_pagination', $cataloguePagination);
         $tpl->assign('hidden_links', $hiddenLinks);
         $tpl->assign('search_token', Security::get_token());
         $tpl->assign('search_date', $date);
-        $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH) . 'course.ajax.php');
+        $tpl->assign('web_session_courses_ajax_url', api_get_path(WEB_AJAX_PATH).'course.ajax.php');
         $tpl->assign('sessions', $sessionsBlocks);
         $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
 
@@ -699,7 +698,7 @@ class CoursesController
 
         $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
         $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
-        $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
+        $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
         $tpl->assign('course_url', $courseUrl);
         $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
         $tpl->assign('hidden_links', $hiddenLinks);
@@ -730,7 +729,7 @@ class CoursesController
         $tpl = new Template();
         $tpl->assign('show_courses', CoursesAndSessionsCatalog::showCourses());
         $tpl->assign('show_sessions', CoursesAndSessionsCatalog::showSessions());
-        $tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
+        $tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
         $tpl->assign('course_url', $courseUrl);
         $tpl->assign('already_subscribed_label', $this->getAlreadyRegisteredInSessionLabel());
         $tpl->assign('hidden_links', $hiddenLinks);
@@ -829,7 +828,7 @@ class CoursesController
             $coachName = $session->getGeneralCoach()->getCompleteName();
             $actions = null;
             if (api_is_platform_admin()) {
-                $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session->getId();
+                $actions = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session->getId();
             }
 
             $isThisSessionOnSale = $session->getBuyCoursePluginPrice();
@@ -841,13 +840,13 @@ class CoursesController
                 'nbr_courses' => $session->getNbrCourses(),
                 'nbr_users' => $session->getNbrUsers(),
                 'coach_id' => $coachId,
-                'coach_url' => api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId,
+                'coach_url' => api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId,
                 'coach_name' => $coachName,
                 'coach_avatar' => UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL),
                 'is_subscribed' => SessionManager::isUserSubscribedAsStudent($session->getId(), $userId),
                 'icon' => $this->getSessionIcon($session->getName()),
                 'date' => $sessionDates['display'],
-                'price' => (!empty($isThisSessionOnSale['html'])?$isThisSessionOnSale['html']:''),
+                'price' => (!empty($isThisSessionOnSale['html']) ? $isThisSessionOnSale['html'] : ''),
                 'subscribe_button' => isset($isThisSessionOnSale['buy_button']) ? $isThisSessionOnSale['buy_button'] : $this->getRegisteredInSessionButton(
                     $session->getId(),
                     $session->getName(),

+ 16 - 16
main/exercise/TestCategory.php

@@ -42,7 +42,7 @@ class TestCategory
 
             $this->id = $row['id'];
             $this->name = $row['title'];
-            $this->description  = $row['description'];
+            $this->description = $row['description'];
 
             return $this;
         }
@@ -239,7 +239,7 @@ class TestCategory
      */
     public static function getCategoryForQuestion($questionId, $courseId = 0)
     {
-        $courseId = (int)$courseId;
+        $courseId = (int) $courseId;
         if (empty($courseId)) {
             $courseId = api_get_course_int_id();
         }
@@ -401,7 +401,7 @@ class TestCategory
         $categories = self::getListOfCategoriesIDForTestObject($exercise_obj);
         foreach ($categories as $cat_id) {
             $cat = new TestCategory();
-            $cat = (array)$cat->getCategory($cat_id);
+            $cat = (array) $cat->getCategory($cat_id);
             $cat['iid'] = $cat['id'];
             $cat['title'] = $cat['name'];
             $result[$cat['id']] = $cat;
@@ -437,7 +437,7 @@ class TestCategory
         $quiz->read($exerciseId);
         $questionList = $quiz->selectQuestionList();
         // the array given by selectQuestionList start at indice 1 and not at indice 0 !!! ? ? ?
-        for ($i=1; $i <= count($questionList); $i++) {
+        for ($i = 1; $i <= count($questionList); $i++) {
             if (self::getCategoryForQuestion($questionList[$i]) == $categoryId) {
                 $nbCatResult++;
             }
@@ -618,7 +618,7 @@ class TestCategory
      */
     public static function returnCategoryAndTitle($questionId, $in_display_category_name = 1)
     {
-        $is_student = !(api_is_allowed_to_edit(null,true) || api_is_session_admin());
+        $is_student = !(api_is_allowed_to_edit(null, true) || api_is_session_admin());
         // @todo fix $_SESSION['objExercise']
         $objExercise = Session::read('objExercise');
         if (!empty($objExercise)) {
@@ -658,7 +658,7 @@ class TestCategory
     public static function sortTabByBracketLabel($in_tab)
     {
         $tabResult = array();
-        $tabCatName = array();	// tab of category name
+        $tabCatName = array(); // tab of category name
         while (list($cat_id, $tabquestion) = each($in_tab)) {
             $category = new TestCategory();
             $category = $category->getCategory($cat_id);
@@ -956,8 +956,8 @@ class TestCategory
             $return .= $warning;
             $return .= '<table class="data_table">';
             $return .= '<tr>';
-            $return .= '<th height="24">' . get_lang('Categories') . '</th>';
-            $return .= '<th width="70" height="24">' . get_lang('Number') . '</th></tr>';
+            $return .= '<th height="24">'.get_lang('Categories').'</th>';
+            $return .= '<th width="70" height="24">'.get_lang('Number').'</th></tr>';
 
             $emptyCategory = array(
                 'id' => '0',
@@ -978,7 +978,7 @@ class TestCategory
                 $return .= '</td>';
                 $return .= '<td>';
                 $value = isset($saved_categories) && isset($saved_categories[$cat_id]) ? $saved_categories[$cat_id]['count_questions'] : -1;
-                $return .= '<input name="category['.$cat_id.']" value="' .$value.'" />';
+                $return .= '<input name="category['.$cat_id.']" value="'.$value.'" />';
                 $return .= '</td>';
                 $return .= '</tr>';
             }
@@ -1137,16 +1137,16 @@ class TestCategory
             $tmpobj = $tmpobj->getCategory($category['id']);
             $nb_question = $tmpobj->getCategoryQuestionsNumber();
             $rowname = self::protectJSDialogQuote($category['title']);
-            $nb_question_label = $nb_question == 1 ? $nb_question . ' ' . get_lang('Question') : $nb_question . ' ' . get_lang('Questions');
-            $content = "<span style='float:right'>" . $nb_question_label . "</span>";
+            $nb_question_label = $nb_question == 1 ? $nb_question.' '.get_lang('Question') : $nb_question.' '.get_lang('Questions');
+            $content = "<span style='float:right'>".$nb_question_label."</span>";
             $content .= '<div class="sectioncomment">';
             $content .= $category['description'];
             $content .= '</div>';
-            $links = '<a href="' . api_get_self() . '?action=editcategory&category_id=' . $category['id'] . '&'.api_get_cidreq().'">' .
-                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
-            $links .= ' <a href="' . api_get_self() . '?'.api_get_cidreq().'&action=deletecategory&category_id=' . $category['id'] . '" ';
-            $links .= 'onclick="return confirmDelete(\'' . self::protectJSDialogQuote(get_lang('DeleteCategoryAreYouSure') . '[' . $rowname) . '] ?\', \'id_cat' . $category['id'] . '\');">';
-            $links .= Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
+            $links = '<a href="'.api_get_self().'?action=editcategory&category_id='.$category['id'].'&'.api_get_cidreq().'">'.
+                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
+            $links .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=deletecategory&category_id='.$category['id'].'" ';
+            $links .= 'onclick="return confirmDelete(\''.self::protectJSDialogQuote(get_lang('DeleteCategoryAreYouSure').'['.$rowname).'] ?\', \'id_cat'.$category['id'].'\');">';
+            $links .= Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
             $html .= Display::panel($content, $category['title'].$links);
         }
 

+ 40 - 40
main/exercise/export/exercise_import.inc.php

@@ -69,7 +69,7 @@ function import_exercise($file)
     global $questionTempDir;
     global $resourcesLinks;
 
-    $baseWorkDir = api_get_path(SYS_ARCHIVE_PATH) . 'qti2';
+    $baseWorkDir = api_get_path(SYS_ARCHIVE_PATH).'qti2';
 
     if (!is_dir($baseWorkDir)) {
         mkdir($baseWorkDir, api_get_permissions_for_new_directories(), true);
@@ -111,35 +111,35 @@ function import_exercise($file)
     // The assets-related code is a bit fragile as it has to deal with files renamed by Chamilo and it only works if
     // the imsmanifest.xml file is read.
     while (false !== ($file = readdir($exerciseHandle))) {
-        if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") {
+        if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") {
             // Find each manifest for each question repository found
-            $questionHandle = opendir($baseWorkDir . '/' . $file);
+            $questionHandle = opendir($baseWorkDir.'/'.$file);
             // Only analyse one level of subdirectory - no recursivity here
             while (false !== ($questionFile = readdir($questionHandle))) {
                 if (preg_match('/.xml$/i', $questionFile)) {
-                    $isQti = isQtiQuestionBank($baseWorkDir . '/' . $file . '/' . $questionFile);
+                    $isQti = isQtiQuestionBank($baseWorkDir.'/'.$file.'/'.$questionFile);
                     if ($isQti) {
                         $result = qti_parse_file($baseWorkDir, $file, $questionFile);
-                        $filePath = $baseWorkDir . $file;
+                        $filePath = $baseWorkDir.$file;
                         $file_found = true;
                     } else {
-                        $isManifest = isQtiManifest($baseWorkDir . '/' . $file . '/' . $questionFile);
+                        $isManifest = isQtiManifest($baseWorkDir.'/'.$file.'/'.$questionFile);
                         if ($isManifest) {
-                            $resourcesLinks = qtiProcessManifest($baseWorkDir . '/' . $file . '/' . $questionFile);
+                            $resourcesLinks = qtiProcessManifest($baseWorkDir.'/'.$file.'/'.$questionFile);
                         }
                     }
                 }
             }
         } elseif (preg_match('/.xml$/i', $file)) {
-            $isQti = isQtiQuestionBank($baseWorkDir . '/' . $file);
+            $isQti = isQtiQuestionBank($baseWorkDir.'/'.$file);
             if ($isQti) {
                 $result = qti_parse_file($baseWorkDir, '', $file);
-                $filePath = $baseWorkDir . '/' . $file;
+                $filePath = $baseWorkDir.'/'.$file;
                 $file_found = true;
             } else {
-                $isManifest = isQtiManifest($baseWorkDir . '/' . $file);
+                $isManifest = isQtiManifest($baseWorkDir.'/'.$file);
                 if ($isManifest) {
-                    $resourcesLinks = qtiProcessManifest($baseWorkDir . '/' . $file);
+                    $resourcesLinks = qtiProcessManifest($baseWorkDir.'/'.$file);
                 }
             }
 
@@ -179,7 +179,7 @@ function import_exercise($file)
             $question->setAnswer();
             $description = '';
             if (strlen($question_array['title']) < 50) {
-                $question->updateTitle(formatText(strip_tags($question_array['title'])) . '...');
+                $question->updateTitle(formatText(strip_tags($question_array['title'])).'...');
             } else {
                 $question->updateTitle(formatText(substr(strip_tags($question_array['title']), 0, 50)));
                 $description .= $question_array['title'];
@@ -249,7 +249,7 @@ function import_exercise($file)
         }
 
         // delete the temp dir where the exercise was unzipped
-        my_delete($baseWorkDir . $uploadPath);
+        my_delete($baseWorkDir.$uploadPath);
         return $last_exercise_id;
     }
 
@@ -277,8 +277,8 @@ function qti_parse_file($exercisePath, $file, $questionFile)
     global $record_item_body;
     global $questionTempDir;
 
-    $questionTempDir = $exercisePath . '/' . $file . '/';
-    $questionFilePath = $questionTempDir . $questionFile;
+    $questionTempDir = $exercisePath.'/'.$file.'/';
+    $questionFilePath = $questionTempDir.$questionFile;
 
     if (!($fp = fopen($questionFilePath, 'r'))) {
         Display::addFlash(Display::return_message(get_lang('Error opening question\'s XML file'), 'error'));
@@ -333,7 +333,7 @@ function qti_parse_file($exercisePath, $file, $questionFile)
         $error = xml_get_error_code();
         Display::addFlash(
             Display::return_message(
-                get_lang('Error reading XML file') . sprintf('[%d:%d]', xml_get_current_line_number($xml_parser), xml_get_current_column_number($xml_parser)),
+                get_lang('Error reading XML file').sprintf('[%d:%d]', xml_get_current_line_number($xml_parser), xml_get_current_column_number($xml_parser)),
                 'error'
             )
         );
@@ -393,9 +393,9 @@ function startElementQti2($parser, $name, $attributes)
 
     if ($record_item_body) {
         if ((!in_array($current_element, $non_HTML_tag_to_avoid))) {
-            $current_question_item_body .= "<" . $name;
+            $current_question_item_body .= "<".$name;
             foreach ($attributes as $attribute_name => $attribute_value) {
-                $current_question_item_body .= " " . $attribute_name . "=\"" . $attribute_value . "\"";
+                $current_question_item_body .= " ".$attribute_name."=\"".$attribute_value."\"";
             }
             $current_question_item_body .= ">";
         } else {
@@ -403,11 +403,11 @@ function startElementQti2($parser, $name, $attributes)
             //we first save with claroline tags ,then when the answer will be parsed, the claroline tags will be replaced
 
             if ($current_element == 'INLINECHOICEINTERACTION') {
-                $current_question_item_body .= "**claroline_start**" . $attributes['RESPONSEIDENTIFIER'] . "**claroline_end**";
+                $current_question_item_body .= "**claroline_start**".$attributes['RESPONSEIDENTIFIER']."**claroline_end**";
             }
             if ($current_element == 'TEXTENTRYINTERACTION') {
                 $correct_answer_value = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
-                $current_question_item_body .= "[" . $correct_answer_value . "]";
+                $current_question_item_body .= "[".$correct_answer_value."]";
 
             }
             if ($current_element == 'BR') {
@@ -542,7 +542,7 @@ function endElementQti2($parser, $name)
     //treat the record of the full content of itembody tag :
 
     if ($record_item_body && (!in_array($current_element, $non_HTML_tag_to_avoid))) {
-        $current_question_item_body .= "</" . $name . ">";
+        $current_question_item_body .= "</".$name.">";
     }
 
     switch ($name) {
@@ -605,14 +605,14 @@ function elementDataQti2($parser, $data)
             if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'])) {
                 $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] = trim($data);
             } else {
-                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= '' . trim($data);
+                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= ''.trim($data);
             }
             break;
         case 'FEEDBACKINLINE':
             if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'])) {
                 $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] = trim($data);
             } else {
-                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' ' . trim($data);
+                $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' '.trim($data);
             }
             break;
         case 'SIMPLEASSOCIABLECHOICE':
@@ -632,7 +632,7 @@ function elementDataQti2($parser, $data)
             // $resourcesLinks is only defined by qtiProcessManifest()
             if (isset($resourcesLinks) && isset($resourcesLinks['manifest']) && isset($resourcesLinks['web'])) {
                 foreach ($resourcesLinks['manifest'] as $key => $value) {
-                    $data = preg_replace('|' . $value . '|', $resourcesLinks['web'][$key], $data);
+                    $data = preg_replace('|'.$value.'|', $resourcesLinks['web'][$key], $data);
                 }
             }
             $current_question_item_body .= $data;
@@ -642,8 +642,8 @@ function elementDataQti2($parser, $data)
             $answer_identifier = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
             if ($current_inlinechoice_id == $answer_identifier) {
                 $current_question_item_body = str_replace(
-                    "**claroline_start**" . $current_answer_id . "**claroline_end**",
-                    "[" . $data . "]",
+                    "**claroline_start**".$current_answer_id."**claroline_end**",
+                    "[".$data."]",
                     $current_question_item_body
                 );
             } else {
@@ -709,20 +709,20 @@ function startElementQti1($parser, $name, $attributes)
 
     if ($record_item_body) {
         if ((!in_array($current_element, $non_HTML_tag_to_avoid))) {
-            $current_question_item_body .= "<" . $name;
+            $current_question_item_body .= "<".$name;
             foreach ($attributes as $attribute_name => $attribute_value) {
-                $current_question_item_body .= " " . $attribute_name . "=\"" . $attribute_value . "\"";
+                $current_question_item_body .= " ".$attribute_name."=\"".$attribute_value."\"";
             }
             $current_question_item_body .= ">";
         } else {
             //in case of FIB question, we replace the IMS-QTI tag b y the correct answer between "[" "]",
             //we first save with claroline tags ,then when the answer will be parsed, the claroline tags will be replaced
             if ($current_element == 'INLINECHOICEINTERACTION') {
-                $current_question_item_body .= "**claroline_start**" . $attributes['RESPONSEIDENTIFIER'] . "**claroline_end**";
+                $current_question_item_body .= "**claroline_start**".$attributes['RESPONSEIDENTIFIER']."**claroline_end**";
             }
             if ($current_element == 'TEXTENTRYINTERACTION') {
                 $correct_answer_value = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id];
-                $current_question_item_body .= "[" . $correct_answer_value . "]";
+                $current_question_item_body .= "[".$correct_answer_value."]";
 
             }
             if ($current_element == 'BR') {
@@ -842,7 +842,7 @@ function endElementQti1($parser, $name, $attributes)
     //treat the record of the full content of itembody tag :
 
     if ($record_item_body && (!in_array($current_element, $non_HTML_tag_to_avoid))) {
-        $current_question_item_body .= "</" . $name . ">";
+        $current_question_item_body .= "</".$name.">";
     }
 
     switch ($name) {
@@ -961,7 +961,7 @@ function elementDataQti1($parser, $data)
             // $resourcesLinks is only defined by qtiProcessManifest()
             if (isset($resourcesLinks) && isset($resourcesLinks['manifest']) && isset($resourcesLinks['web'])) {
                 foreach ($resourcesLinks['manifest'] as $key => $value) {
-                    $data = preg_replace('|' . $value . '|', $resourcesLinks['web'][$key], $data);
+                    $data = preg_replace('|'.$value.'|', $resourcesLinks['web'][$key], $data);
                 }
             }
             if (!empty($current_question_item_body)) {
@@ -1036,9 +1036,9 @@ function qtiProcessManifest($filePath)
     $sessionId = api_get_session_id();
     $courseDir = $course['path'];
     $sysPath = api_get_path(SYS_COURSE_PATH);
-    $exercisesSysPath = $sysPath . $courseDir . '/document/';
+    $exercisesSysPath = $sysPath.$courseDir.'/document/';
     $webPath = api_get_path(WEB_CODE_PATH);
-    $exercisesWebPath = $webPath . 'document/document.php?' . api_get_cidreq() . '&action=download&id=';
+    $exercisesWebPath = $webPath.'document/document.php?'.api_get_cidreq().'&action=download&id=';
     $links = array(
         'manifest' => array(),
         'system' => array(),
@@ -1046,7 +1046,7 @@ function qtiProcessManifest($filePath)
     );
     $tableDocuments = Database::get_course_table(TABLE_DOCUMENT);
     $countResources = count($xml->resources->resource->file);
-    for ($i=0; $i < $countResources; $i++) {
+    for ($i = 0; $i < $countResources; $i++) {
         $file = $xml->resources->resource->file[$i];
         $href = '';
         foreach ($file->attributes() as $key => $value) {
@@ -1058,21 +1058,21 @@ function qtiProcessManifest($filePath)
         }
         if (!empty($href)) {
             $links['manifest'][] = (string) $href;
-            $links['system'][] = $exercisesSysPath . strtolower($href);
+            $links['system'][] = $exercisesSysPath.strtolower($href);
             $specialHref = Database::escape_string(preg_replace('/_/', '-', strtolower($href)));
             $specialHref = preg_replace('/(-){2,8}/', '-', $specialHref);
 
-            $sql = "SELECT iid FROM " . $tableDocuments . " 
+            $sql = "SELECT iid FROM ".$tableDocuments." 
                     WHERE
-                        c_id = " . $course['real_id'] . " AND 
+                        c_id = " . $course['real_id']." AND 
                         session_id = $sessionId AND 
-                        path = '/" . $specialHref . "'";
+                        path = '/".$specialHref."'";
             $result = Database::query($sql);
             $documentId = 0;
             while ($row = Database::fetch_assoc($result)) {
                 $documentId = $row['iid'];
             }
-            $links['web'][] = $exercisesWebPath . $documentId;
+            $links['web'][] = $exercisesWebPath.$documentId;
         }
     }
     return $links;

+ 8 - 8
main/exercise/tests_category.php

@@ -200,7 +200,7 @@ function add_category_form($action)
 {
     $action = Security::remove_XSS($action);
     // initiate the object
-    $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $action.'&'.api_get_cidreq());
+    $form = new FormValidator('note', 'post', api_get_self().'?action='.$action.'&'.api_get_cidreq());
     // Setting the form elements
     $form->addElement('header', get_lang('AddACategory'));
     $form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95'));
@@ -242,23 +242,23 @@ function add_category_form($action)
 function displayActionBar()
 {
     echo '<div class="actions">';
-    echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?' . api_get_cidreq() . '">' .
-            Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'">'.
+            Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
 
-    echo '<a href="' . api_get_self() . '?action=addcategory&'.api_get_cidreq().'">' .
-        Display::return_icon('new_folder.png', get_lang('AddACategory'), null, ICON_SIZE_MEDIUM) . '</a>';
+    echo '<a href="'.api_get_self().'?action=addcategory&'.api_get_cidreq().'">'.
+        Display::return_icon('new_folder.png', get_lang('AddACategory'), null, ICON_SIZE_MEDIUM).'</a>';
 
     echo Display::url(
         Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM),
-        api_get_self() . '?action=export_category&'.api_get_cidreq()
+        api_get_self().'?action=export_category&'.api_get_cidreq()
     );
 
     echo Display::url(
         Display::return_icon('import_csv.png', get_lang('ImportAsCSV'), [], ICON_SIZE_MEDIUM),
-        api_get_self() . '?action=import_category&'.api_get_cidreq()
+        api_get_self().'?action=import_category&'.api_get_cidreq()
     );
 
     echo '</div>';
     echo "<br/>";
-    echo "<fieldset><legend>" . get_lang('QuestionCategory') . "</legend></fieldset>";
+    echo "<fieldset><legend>".get_lang('QuestionCategory')."</legend></fieldset>";
 }

+ 51 - 51
main/exercise/unique_answer.class.php

@@ -59,21 +59,21 @@ class UniqueAnswer extends Question
 
         if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) {
             //Scenario
-            $comment_title = '<th width="20%">' . get_lang('Comment') . '</th>';
-            $feedback_title = '<th width="20%">' . get_lang('Scenario') . '</th>';
+            $comment_title = '<th width="20%">'.get_lang('Comment').'</th>';
+            $feedback_title = '<th width="20%">'.get_lang('Scenario').'</th>';
         } else {
-            $comment_title = '<th width="40%">' . get_lang('Comment') . '</th>';
+            $comment_title = '<th width="40%">'.get_lang('Comment').'</th>';
         }
 
         $html = '<table class="table table-striped table-hover">
             <thead>
                 <tr style="text-align: center;">
-                    <th width="5%">' . get_lang('Number') . '</th>
-                    <th width="5%"> ' . get_lang('True') . '</th>
-                    <th width="40%">' . get_lang('Answer') . '</th>
-                        ' . $comment_title . '
-                        ' . $feedback_title . '
-                    <th width="10%">' . get_lang('Weighting') . '</th>
+                    <th width="5%">' . get_lang('Number').'</th>
+                    <th width="5%"> ' . get_lang('True').'</th>
+                    <th width="40%">' . get_lang('Answer').'</th>
+                        ' . $comment_title.'
+                        ' . $feedback_title.'
+                    <th width="10%">' . get_lang('Weighting').'</th>
                 </tr>
             </thead>
             <tbody>';
@@ -103,7 +103,7 @@ class UniqueAnswer extends Question
                     continue;
                 }
                 $question = Question::read($questionid);
-                $select_question[$questionid] = 'Q' . $key . ' :' . cut(
+                $select_question[$questionid] = 'Q'.$key.' :'.cut(
                     $question->selectTitle(), 20
                 );
             }
@@ -134,9 +134,9 @@ class UniqueAnswer extends Question
                 if ($answer->correct[$i]) {
                     $correct = $i;
                 }
-                $defaults['answer[' . $i . ']'] = $answer->answer[$i];
-                $defaults['comment[' . $i . ']'] = $answer->comment[$i];
-                $defaults['weighting[' . $i . ']'] = float_format(
+                $defaults['answer['.$i.']'] = $answer->answer[$i];
+                $defaults['comment['.$i.']'] = $answer->comment[$i];
+                $defaults['weighting['.$i.']'] = float_format(
                     $answer->weighting[$i],
                     1
                 );
@@ -159,18 +159,18 @@ class UniqueAnswer extends Question
                     $url_result = $url;
                 }
 
-                $temp_scenario['url' . $i] = $url_result;
-                $temp_scenario['try' . $i] = $try_result;
-                $temp_scenario['lp' . $i] = $lp;
-                $temp_scenario['destination' . $i] = $list_dest;
+                $temp_scenario['url'.$i] = $url_result;
+                $temp_scenario['try'.$i] = $try_result;
+                $temp_scenario['lp'.$i] = $lp;
+                $temp_scenario['destination'.$i] = $list_dest;
             } else {
                 $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1');
                 $defaults['weighting[1]'] = 10;
                 $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2');
                 $defaults['weighting[2]'] = 0;
 
-                $temp_scenario['destination' . $i] = array('0');
-                $temp_scenario['lp' . $i] = array('0');
+                $temp_scenario['destination'.$i] = array('0');
+                $temp_scenario['lp'.$i] = array('0');
             }
             $defaults['scenario'] = $temp_scenario;
 
@@ -182,19 +182,19 @@ class UniqueAnswer extends Question
             );
             $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.']'
             );
             $renderer->setElementTemplate(
                 '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>',
-                'weighting[' . $i . ']'
+                'weighting['.$i.']'
             );
 
             $answer_number = $form->addElement(
@@ -213,7 +213,7 @@ class UniqueAnswer extends Question
                 'class="checkbox"'
             );
 
-            $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editor_config);
+            $form->addHtmlEditor('answer['.$i.']', null, null, true, $editor_config);
 
             $form->addRule(
                 'answer['.$i.']',
@@ -232,28 +232,28 @@ class UniqueAnswer extends Question
                 // Direct feedback
                 //Adding extra feedback fields
                 $group = array();
-                $group['try' . $i] = $form->createElement(
+                $group['try'.$i] = $form->createElement(
                     'checkbox',
-                    'try' . $i,
+                    'try'.$i,
                     null,
                     get_lang('TryAgain')
                 );
-                $group['lp' . $i] = $form->createElement(
+                $group['lp'.$i] = $form->createElement(
                     'select',
-                    'lp' . $i,
-                    get_lang('SeeTheory') . ': ',
+                    'lp'.$i,
+                    get_lang('SeeTheory').': ',
                     $select_lp_id
                 );
-                $group['destination' . $i] = $form->createElement(
+                $group['destination'.$i] = $form->createElement(
                     'select',
-                    'destination' . $i,
-                    get_lang('GoToQuestion') . ': ',
+                    'destination'.$i,
+                    get_lang('GoToQuestion').': ',
                     $select_question
                 );
-                $group['url' . $i] = $form->createElement(
+                $group['url'.$i] = $form->createElement(
                     'text',
-                    'url' . $i,
-                    get_lang('Other') . ': ',
+                    'url'.$i,
+                    get_lang('Other').': ',
                     array(
                         'class' => 'col-md-2',
                         'placeholder' => get_lang('Other')
@@ -266,9 +266,9 @@ class UniqueAnswer extends Question
                     'scenario'
                 );
             } else {
-                $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config);
+                $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config);
             }
-            $form->addText('weighting[' . $i . ']', null, null, array('value' => '0'));
+            $form->addText('weighting['.$i.']', null, null, array('value' => '0'));
             $form->addHtml('</tr>');
         }
 
@@ -328,18 +328,18 @@ class UniqueAnswer extends Question
         $nb_answers = $form->getSubmitValue('nb_answers');
 
         for ($i = 1; $i <= $nb_answers; $i++) {
-            $answer = trim($form->getSubmitValue('answer[' . $i . ']'));
-            $comment = trim($form->getSubmitValue('comment[' . $i . ']'));
-            $weighting = trim($form->getSubmitValue('weighting[' . $i . ']'));
+            $answer = trim($form->getSubmitValue('answer['.$i.']'));
+            $comment = trim($form->getSubmitValue('comment['.$i.']'));
+            $weighting = trim($form->getSubmitValue('weighting['.$i.']'));
             $scenario = $form->getSubmitValue('scenario');
 
             //$list_destination = $form -> getSubmitValue('destination'.$i);
             //$destination_str = $form -> getSubmitValue('destination'.$i);
 
-            $try = $scenario['try' . $i];
-            $lp = $scenario['lp' . $i];
-            $destination = $scenario['destination' . $i];
-            $url = trim($scenario['url' . $i]);
+            $try = $scenario['try'.$i];
+            $lp = $scenario['lp'.$i];
+            $destination = $scenario['destination'.$i];
+            $url = trim($scenario['url'.$i]);
 
             /*
             How we are going to parse the destination value
@@ -387,7 +387,7 @@ class UniqueAnswer extends Question
             }
 
             //1@@1;2;@@2;4;4;@@http://www.chamilo.org
-            $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url;
+            $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url;
             $objAnswer->createAnswer(
                 $answer,
                 $goodAnswer,
@@ -421,12 +421,12 @@ class UniqueAnswer 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;
@@ -497,7 +497,7 @@ class UniqueAnswer extends Question
         if ($correct) {
             $sql = "UPDATE $tbl_quiz_question
                     SET ponderation = (ponderation + $score)
-                    WHERE c_id = $course_id AND id = " . $question_id;
+                    WHERE c_id = $course_id AND id = ".$question_id;
             Database::query($sql);
         }
     }

+ 67 - 67
main/forum/viewforum.php

@@ -25,7 +25,7 @@ use Chamilo\CourseBundle\Entity\CForumPost;
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_FORUM;
+$current_course_tool = TOOL_FORUM;
 
 // Notification for unauthorized people.
 api_protect_course_script(true);
@@ -87,7 +87,7 @@ if (!empty($groupId)) {
 
     // Course
     if (
-        !api_is_allowed_to_edit(false, true) &&  //is a student
+        !api_is_allowed_to_edit(false, true) && //is a student
         (($current_forum_category && $current_forum_category['visibility'] == 0) ||
         $current_forum['visibility'] == 0 || !$user_has_access_in_group)
     ) {
@@ -96,7 +96,7 @@ if (!empty($groupId)) {
 } else {
     //Course
     if (
-        !api_is_allowed_to_edit(false, true) &&  //is a student
+        !api_is_allowed_to_edit(false, true) && //is a student
         (
             ($current_forum_category && $current_forum_category['visibility'] == 0) ||
             $current_forum['visibility'] == 0
@@ -112,12 +112,12 @@ $my_search = isset($_GET['search']) ? $_GET['search'] : '';
 $my_action = isset($_GET['action']) ? $_GET['action'] : '';
 
 $gradebook = null;
-if (isset($_SESSION['gradebook'])){
+if (isset($_SESSION['gradebook'])) {
     $gradebook = $_SESSION['gradebook'];
 }
 
 if (!empty($gradebook) && $gradebook == 'view') {
-    $interbreadcrumb[] = array (
+    $interbreadcrumb[] = array(
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook')
     );
@@ -127,25 +127,25 @@ $forumUrl = api_get_path(WEB_CODE_PATH).'forum/';
 
 if (!empty($groupId)) {
     $interbreadcrumb[] = array(
-        'url' => api_get_path(WEB_CODE_PATH) . 'group/group.php?'.api_get_cidreq(),
+        'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
         'name' => get_lang('Groups')
     );
     $interbreadcrumb[] = array(
-        'url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(),
-        'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']
+        'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
+        'name' => get_lang('GroupSpace').' '.$group_properties['name']
     );
     $interbreadcrumb[] = array(
         'url' => '#',
-        'name' => get_lang('Forum') . ' ' . Security::remove_XSS($current_forum['forum_title'])
+        'name' => get_lang('Forum').' '.Security::remove_XSS($current_forum['forum_title'])
     );
 } else {
     $interbreadcrumb[] = array(
-        'url' => $forumUrl . 'index.php?search=' . Security::remove_XSS($my_search),
+        'url' => $forumUrl.'index.php?search='.Security::remove_XSS($my_search),
         'name' => get_lang('ForumCategories')
     );
     $interbreadcrumb[] = array(
-        'url' => $forumUrl . 'viewforumcategory.php?forumcategory=' . $current_forum_category['cat_id']
-            . '&search=' . Security::remove_XSS(urlencode($my_search)),
+        'url' => $forumUrl.'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id']
+            . '&search='.Security::remove_XSS(urlencode($my_search)),
         'name' => prepare4display($current_forum_category['cat_title'])
     );
     $interbreadcrumb[] = array(
@@ -253,24 +253,24 @@ if (
             break;
     }
 
-    $table_list = Display::page_subheader(get_lang('ThreadUsersList') . ': ' . get_name_thread_by_id($_GET['id']));
+    $table_list = Display::page_subheader(get_lang('ThreadUsersList').': '.get_name_thread_by_id($_GET['id']));
 
     if ($nrorow3 > 0 || $nrorow3 == -2) {
-        $url = api_get_cidreq() .'&forum=' . $my_forum . '&action='
-            . Security::remove_XSS($_GET['action']) . '&content='
-            . Security::remove_XSS($_GET['content'], STUDENT) . '&id=' . intval($_GET['id']);
+        $url = api_get_cidreq().'&forum='.$my_forum.'&action='
+            . Security::remove_XSS($_GET['action']).'&content='
+            . Security::remove_XSS($_GET['content'], STUDENT).'&id='.intval($_GET['id']);
         $tabs = array(
             array(
                 'content' =>  get_lang('AllStudents'),
-                'url' => $forumUrl . 'viewforum.php?' . $url . '&list=all'
+                'url' => $forumUrl.'viewforum.php?'.$url.'&list=all'
             ),
             array(
                 'content' =>  get_lang('StudentsQualified'),
-                'url' => $forumUrl . 'viewforum.php?' . $url . '&list=qualify'
+                'url' => $forumUrl.'viewforum.php?'.$url.'&list=qualify'
             ),
             array(
                 'content' =>  get_lang('StudentsNotQualified'),
-                'url' => $forumUrl . 'viewforum.php?' . $url . '&list=notqualify'
+                'url' => $forumUrl.'viewforum.php?'.$url.'&list=notqualify'
             ),
         );
         $table_list .= Display::tabsOnlyLink($tabs, $active);
@@ -279,32 +279,32 @@ if (
         $table_list .= '<center><br /><table class="data_table" style="width:50%">';
         // The column headers (TODO: Make this sortable).
         $table_list .= '<tr >';
-        $table_list .= '<th height="24">' . get_lang('NamesAndLastNames') . '</th>';
+        $table_list .= '<th height="24">'.get_lang('NamesAndLastNames').'</th>';
 
         if ($listType == 'qualify') {
-            $table_list .= '<th>' . get_lang('Qualification') . '</th>';
+            $table_list .= '<th>'.get_lang('Qualification').'</th>';
         }
         if (api_is_allowed_to_edit(null, true)) {
-            $table_list .= '<th>' . get_lang('Qualify') . '</th>';
+            $table_list .= '<th>'.get_lang('Qualify').'</th>';
         }
         $table_list .= '</tr>';
         $max_qualify = showQualify('2', $userId, $_GET['id']);
         $counter_stdlist = 0;
 
         if (Database::num_rows($student_list) > 0) {
-            while ($row_student_list=Database::fetch_array($student_list)) {
+            while ($row_student_list = Database::fetch_array($student_list)) {
                 $userInfo = api_get_user_info($row_student_list['id']);
                 if ($counter_stdlist % 2 == 0) {
                     $class_stdlist = 'row_odd';
                 } else {
                     $class_stdlist = 'row_even';
                 }
-                $table_list .= '<tr class="' . $class_stdlist . '"><td>';
+                $table_list .= '<tr class="'.$class_stdlist.'"><td>';
                 $table_list .= UserManager::getUserProfileLink($userInfo);
 
                 $table_list .= '</td>';
                 if ($listType == 'qualify') {
-                    $table_list .= '<td>' . $row_student_list['qualify'] . '/' . $max_qualify . '</td>';
+                    $table_list .= '<td>'.$row_student_list['qualify'].'/'.$max_qualify.'</td>';
                 }
                 if (api_is_allowed_to_edit(null, true)) {
                     $current_qualify_thread = showQualify(
@@ -313,20 +313,20 @@ if (
                         $_GET['id']
                     );
                     $table_list .= '<td>
-                        <a href="' . $forumUrl . 'forumqualify.php?' . api_get_cidreq()
-                        . '&forum=' . intval($my_forum) . '&thread='
-                        . intval($_GET['id']) . '&user=' . $row_student_list['id']
-                        . '&user_id=' . $row_student_list['id'] . '&idtextqualify='
+                        <a href="' . $forumUrl.'forumqualify.php?'.api_get_cidreq()
+                        . '&forum='.intval($my_forum).'&thread='
+                        . intval($_GET['id']).'&user='.$row_student_list['id']
+                        . '&user_id='.$row_student_list['id'].'&idtextqualify='
                         . $current_qualify_thread.'">'
-                        . Display::return_icon($icon_qualify, get_lang('Qualify')) . '</a></td></tr>';
+                        . Display::return_icon($icon_qualify, get_lang('Qualify')).'</a></td></tr>';
                 }
                 $counter_stdlist++;
             }
         } else {
             if ($listType === 'qualify') {
-                $table_list .= '<tr><td colspan="2">' . get_lang('ThereIsNotQualifiedLearners') . '</td></tr>';
+                $table_list .= '<tr><td colspan="2">'.get_lang('ThereIsNotQualifiedLearners').'</td></tr>';
             } else {
-                $table_list .= '<tr><td colspan="2">' . get_lang('ThereIsNotUnqualifiedLearners') . '</td></tr>';
+                $table_list .= '<tr><td colspan="2">'.get_lang('ThereIsNotUnqualifiedLearners').'</td></tr>';
             }
         }
 
@@ -353,13 +353,13 @@ echo '<div class="actions">';
 
 if ($origin != 'learnpath') {
     if (!empty($groupId)) {
-        echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'group/group_space.php?'
-            . api_get_cidreq() . '&gradebook=' . $gradebook . '">'
+        echo '<a href="'.api_get_path(WEB_CODE_PATH).'group/group_space.php?'
+            . api_get_cidreq().'&gradebook='.$gradebook.'">'
             . Display::return_icon('back.png', get_lang('BackTo')
-            . ' ' . get_lang('Groups'), '', ICON_SIZE_MEDIUM) . '</a>';
+            . ' '.get_lang('Groups'), '', ICON_SIZE_MEDIUM).'</a>';
     } else {
         echo '<span style="float:right;">'.search_link().'</span>';
-        echo '<a href="' . $forumUrl . 'index.php?' . api_get_cidreq() . '">'
+        echo '<a href="'.$forumUrl.'index.php?'.api_get_cidreq().'">'
             . Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM)
             . '</a>';
     }
@@ -377,13 +377,13 @@ if (
     if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) {
         if (!api_is_anonymous() && !api_is_invitee()) {
             if ($my_forum == strval(intval($my_forum))) {
-                echo '<a href="' . $forumUrl . 'newthread.php?' . api_get_cidreq() . '&forum='
+                echo '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&forum='
                     . Security::remove_XSS($my_forum).'">'
                     . Display::return_icon('new_thread.png', get_lang('NewTopic'), '', ICON_SIZE_MEDIUM)
                     . '</a>';
             } else {
                 $my_forum = strval(intval($my_forum));
-                echo '<a href="' . $forumUrl . 'newthread.php?' . api_get_cidreq()
+                echo '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq()
                     . '&forum='.$my_forum.'">'
                     . Display::return_icon('new_thread.png', get_lang('NewTopic'), '', ICON_SIZE_MEDIUM)
                     . '</a>';
@@ -411,7 +411,7 @@ $html .= '<div class="topic-forum">';
 if ($origin != 'learnpath') {
     $html .= Display::tag(
         'h3',
-        $iconForum .' '. $titleForum,
+        $iconForum.' '.$titleForum,
         array(
             'class' => 'title-forum')
     );
@@ -452,19 +452,19 @@ if (is_array($threads)) {
             }
 
             if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) {
-                $newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
+                $newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
             } else {
                 $newPost = '';
             }
 
             $name = api_get_person_name($row['firstname'], $row['lastname']);
 
-            $linkPostForum = '<a href="viewthread.php?' . api_get_cidreq() . '&forum=' . $my_forum
+            $linkPostForum = '<a href="viewthread.php?'.api_get_cidreq().'&forum='.$my_forum
                 . "&thread={$row['thread_id']}&search="
-                . Security::remove_XSS(urlencode($my_search)) . '">'
-                . $row['thread_title'] . '</a>';
+                . Security::remove_XSS(urlencode($my_search)).'">'
+                . $row['thread_title'].'</a>';
             $html = '';
-            $html .= '<div class="panel panel-default forum '.($row['thread_sticky']?'sticky':'').'">';
+            $html .= '<div class="panel panel-default forum '.($row['thread_sticky'] ? 'sticky' : '').'">';
             $html .= '<div class="panel-body">';
             $html .= '<div class="row">';
             $html .= '<div class="col-md-6">';
@@ -496,7 +496,7 @@ if (is_array($threads)) {
                 );
             }
 
-            $html .= '<div class="thumbnail">' . display_user_image($row['user_id'], $name, $origin) . '</div>';
+            $html .= '<div class="thumbnail">'.display_user_image($row['user_id'], $name, $origin).'</div>';
             $html .= '</div>';
             $html .= '<div class="col-md-10">';
             $html .= Display::tag(
@@ -506,8 +506,8 @@ if (is_array($threads)) {
                     'class' => 'title'
                 )
             );
-            $html .= '<p>'. get_lang('By') .' ' .$authorName.'</p>';
-            $html .= '<p>' . api_convert_and_format_date($row['insert_date']) . '</p>';
+            $html .= '<p>'.get_lang('By').' '.$authorName.'</p>';
+            $html .= '<p>'.api_convert_and_format_date($row['insert_date']).'</p>';
 
             if ($current_forum['moderated'] == 1 && api_is_allowed_to_edit(false, true)) {
                 $waitingCount = getCountPostsWithStatus(
@@ -517,7 +517,7 @@ if (is_array($threads)) {
                 );
                 if (!empty($waitingCount)) {
                     $html .= Display::label(
-                        get_lang('PostsPendingModeration'). ': '.$waitingCount,
+                        get_lang('PostsPendingModeration').': '.$waitingCount,
                         'warning'
                     );
                 }
@@ -531,13 +531,13 @@ if (is_array($threads)) {
             $html .= '<div class="row">';
             $html .= '<div class="col-md-4">'
                 . Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL)
-                . " {$row['thread_replies']} " . get_lang('Replies') . '<br>';
-            $html .=  Display::return_icon(
+                . " {$row['thread_replies']} ".get_lang('Replies').'<br>';
+            $html .= Display::return_icon(
                     'post-forum.png',
                     null,
                     null,
                     ICON_SIZE_SMALL
-                ) . ' ' . $row['thread_views'] . ' ' . get_lang('Views') . '<br>' . $newPost;
+                ).' '.$row['thread_views'].' '.get_lang('Views').'<br>'.$newPost;
             $html .= '</div>';
 
             $last_post_info = get_last_post_by_thread(
@@ -551,7 +551,7 @@ if (is_array($threads)) {
             if ($last_post_info) {
                 $poster_info = api_get_user_info($last_post_info['poster_id']);
                 $post_date = api_convert_and_format_date($last_post_info['post_date']);
-                $last_post = $post_date . '<br>' . get_lang('By') . ' ' . display_user_link(
+                $last_post = $post_date.'<br>'.get_lang('By').' '.display_user_link(
                     $last_post_info['poster_id'],
                     $poster_info['complete_name'],
                     '',
@@ -561,7 +561,7 @@ if (is_array($threads)) {
 
             $html .= '<div class="col-md-5">'
                 . Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY)
-                . ' ' . $last_post;
+                . ' '.$last_post;
             $html .= '</div>';
             $html .= '<div class="col-md-3">';
             $cidreq = api_get_cidreq();
@@ -576,11 +576,11 @@ if (is_array($threads)) {
                 if (api_is_allowed_to_edit(false, true) &&
                     !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)
                 ) {
-                    $iconsEdit .= '<a href="' . $forumUrl . 'editthread.php?' . $cidreq
-                        . '&forum=' . $my_forum . '&thread='
+                    $iconsEdit .= '<a href="'.$forumUrl.'editthread.php?'.$cidreq
+                        . '&forum='.$my_forum.'&thread='
                         . intval($row['thread_id'])
-                        . '&id_attach=' . $id_attach . '">'
-                        . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
+                        . '&id_attach='.$id_attach.'">'
+                        . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
                     if (api_resource_is_locked_by_gradebook($row['thread_id'], LINK_FORUM_THREAD)) {
                         $iconsEdit .= Display::return_icon(
                             'delete_na.png',
@@ -589,12 +589,12 @@ if (is_array($threads)) {
                             ICON_SIZE_SMALL
                         );
                     } else {
-                        $iconsEdit.= '<a href="' . api_get_self() . '?' . $cidreq . '&forum='
-                            . $my_forum . '&action=delete&content=thread&id='
-                            . $row['thread_id'] . "\" onclick=\"javascript:if(!confirm('"
+                        $iconsEdit .= '<a href="'.api_get_self().'?'.$cidreq.'&forum='
+                            . $my_forum.'&action=delete&content=thread&id='
+                            . $row['thread_id']."\" onclick=\"javascript:if(!confirm('"
                             . addslashes(api_htmlentities(get_lang('DeleteCompleteThread'), ENT_QUOTES))
                             . "')) return false;\">"
-                            . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
+                            . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
                     }
 
                     $iconsEdit .= return_visible_invisible_icon(
@@ -615,9 +615,9 @@ if (is_array($threads)) {
                             'gidReq' => api_get_group_id()
                         )
                     );
-                    $iconsEdit .= '<a href="viewforum.php?' . $cidreq . '&forum='
+                    $iconsEdit .= '<a href="viewforum.php?'.$cidreq.'&forum='
                         . $my_forum
-                        . '&action=move&thread=' . $row['thread_id'].'">'
+                        . '&action=move&thread='.$row['thread_id'].'">'
                         . Display::return_icon('move.png', get_lang('MoveThread'), array(), ICON_SIZE_SMALL)
                         . '</a>';
                 }
@@ -634,17 +634,17 @@ if (is_array($threads)) {
             }
             $icon_liststd = 'user.png';
             if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
-                $iconsEdit .= '<a href="' . api_get_self() . '?' . $cidreq . '&forum='
+                $iconsEdit .= '<a href="'.api_get_self().'?'.$cidreq.'&forum='
                     . $my_forum
                     . "&action=notify&content=thread&id={$row['thread_id']}"
-                    . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>';
+                    . '">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).'</a>';
             }
 
             if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
-                $iconsEdit .= '<a href="' . api_get_self() . '?' . $cidreq . '&forum='
+                $iconsEdit .= '<a href="'.api_get_self().'?'.$cidreq.'&forum='
                     . $my_forum
                     . "&action=liststd&content=thread&id={$row['thread_id']}"
-                    . '">' . Display::return_icon($icon_liststd, get_lang('StudentList'), array(), ICON_SIZE_SMALL)
+                    . '">'.Display::return_icon($icon_liststd, get_lang('StudentList'), array(), ICON_SIZE_SMALL)
                     . '</a>';
             }
             $html .= $iconsEdit;

+ 87 - 87
main/gradebook/lib/GradebookUtils.php

@@ -78,9 +78,9 @@ class GradebookUtils
         $course_code = Database::escape_string($course_code);
         if (!empty($link_id)) {
             $link_id = intval($link_id);
-            $sql = 'UPDATE ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK) . '
-                    SET weight = ' . "'" . api_float_val($weight) . "'" . '
-                    WHERE course_code = "' . $course_code . '" AND id = ' . $link_id;
+            $sql = 'UPDATE '.Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK).'
+                    SET weight = ' . "'".api_float_val($weight)."'".'
+                    WHERE course_code = "' . $course_code.'" AND id = '.$link_id;
             Database::query($sql);
         }
 
@@ -100,7 +100,7 @@ class GradebookUtils
 
         // TODO find the corresponding category (the first one for this course, ordered by ID)
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
-        $sql = "DELETE FROM $l WHERE id = ".(int)$link_id;
+        $sql = "DELETE FROM $l WHERE id = ".(int) $link_id;
         Database::query($sql);
 
         return true;
@@ -195,8 +195,8 @@ class GradebookUtils
             $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible';
             $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible';
 
-            $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' .
-                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>';
+            $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'.
+                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>';
 
             if (!api_is_allowed_to_edit(null, true)) {
                 $modify_icons .= Display::url(
@@ -206,9 +206,9 @@ class GradebookUtils
                         '',
                         ICON_SIZE_SMALL
                     ),
-                    'personal_stats.php?' . http_build_query([
+                    'personal_stats.php?'.http_build_query([
                         'selectcat' => $cat->get_id()
-                    ]) . '&' . api_get_cidreq(),
+                    ]).'&'.api_get_cidreq(),
                     [
                         'class' => 'ajax',
                         'data-title' => get_lang('FlatView')
@@ -223,16 +223,16 @@ class GradebookUtils
                 if (api_get_setting('gradebook_locking_enabled') == 'true') {
                     if ($cat->is_locked()) {
                         if (api_is_platform_admin()) {
-                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' .
-                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
+                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'.
+                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
                         } else {
-                            $modify_icons .= '&nbsp;<a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>';
+                            $modify_icons .= '&nbsp;<a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>';
                         }
-                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
+                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
                     } else {
-                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' .
-                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
-                        $modify_icons .= '&nbsp;<a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
+                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'.
+                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
+                        $modify_icons .= '&nbsp;<a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
                     }
                 }
 
@@ -240,44 +240,44 @@ class GradebookUtils
                     if ($cat->is_locked() && !api_is_platform_admin()) {
                         $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
                     } else {
-                        $modify_icons .= '<a href="gradebook_edit_cat.php?editcat=' . $cat->get_id() . '&'.$courseParams.'">' .
+                        $modify_icons .= '<a href="gradebook_edit_cat.php?editcat='.$cat->get_id().'&'.$courseParams.'">'.
                             Display::return_icon(
                                 'edit.png',
                                 get_lang('Modify'),
                                 '',
                                 ICON_SIZE_SMALL
-                            ) . '</a>';
+                            ).'</a>';
                     }
                 }
 
-               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' .
+               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat='.$cat->get_id().'&'.$courseParams.'">'.
                     Display::return_icon(
                         'percentage.png',
                         get_lang('EditAllWeights'),
                         '',
                         ICON_SIZE_SMALL
-                    ) . '</a>';
+                    ).'</a>';
 
-                $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&' . $courseParams. '">' .
+                $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&'.$courseParams.'">'.
                     Display::return_icon(
                         'stats.png',
                         get_lang('FlatView'),
                         '',
                         ICON_SIZE_SMALL
-                    ) . '</a>';
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&' . $courseParams. '">' .
+                    ).'</a>';
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblecat='.$cat->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.'">'.
                     Display::return_icon(
-                        $visibility_icon . '.png',
+                        $visibility_icon.'.png',
                         get_lang('Visible'),
                         '',
                         ICON_SIZE_SMALL
-                    ) . '</a>';
+                    ).'</a>';
 
                 if ($cat->is_locked() && !api_is_platform_admin()) {
                     $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL);
                 } else {
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&' . $courseParams. '" onclick="return confirmation();">' .
-                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>';
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletecat='.$cat->get_id().'&selectcat='.$selectcat.'&'.$courseParams.'" onclick="return confirmation();">'.
+                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>';
                 }
             }
 
@@ -304,22 +304,22 @@ class GradebookUtils
             if ($is_locked && !api_is_platform_admin()) {
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
             } else {
-                $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&' . $courseParams. '">' .
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
+                $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&'.$courseParams.'">'.
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
             }
 
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&'.$courseParams. ' ">' .
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.' ">'.
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
             if (api_is_allowed_to_edit(null, true)) {
-                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '">' .
-                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
+                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'">'.
+                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
             }
 
             if ($is_locked && !api_is_platform_admin()) {
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
             } else {
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '" onclick="return confirmation();">' .
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deleteeval='.$eval->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'" onclick="return confirmation();">'.
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
             }
             return $modify_icons;
         }
@@ -351,21 +351,21 @@ class GradebookUtils
             if ($is_locked && !api_is_platform_admin()) {
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
             } else {
-                $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&' . $courseParams.'">' .
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
+                $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&'.$courseParams.'">'.
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
             }
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&'.$courseParams. ' ">' .
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
-            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&' . $courseParams. '">' .
-                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.' ">'.
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
+            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink='.$link->get_id().'&selectcat='.$selectcat.'&'.$courseParams.'">'.
+                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
 
             //If a work is added in a gradebook you can only delete the link in the work tool
 
             if ($is_locked && !api_is_platform_admin()) {
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
             } else {
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '" onclick="return confirmation();">' .
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletelink='.$link->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'" onclick="return confirmation();">'.
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
             }
 
             return $modify_icons;
@@ -388,8 +388,8 @@ class GradebookUtils
         $sql = "SELECT * FROM $table l
                 WHERE
                     course_code = '$course_code' AND
-                    type = ".(int)$resource_type . " AND
-                    ref_id = " . (int)$resource_id;
+                    type = ".(int) $resource_type." AND
+                    ref_id = " . (int) $resource_id;
         $res = Database::query($sql);
 
         if (Database::num_rows($res) < 1) {
@@ -412,7 +412,7 @@ class GradebookUtils
         }
         // TODO find the corresponding category (the first one for this course, ordered by ID)
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
-        $sql = "SELECT * FROM $l WHERE id = " . (int) $link_id;
+        $sql = "SELECT * FROM $l WHERE id = ".(int) $link_id;
         $res = Database::query($sql);
         $row = array();
         if (Database::num_rows($res) > 0) {
@@ -430,10 +430,10 @@ class GradebookUtils
     {
         $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
         $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
-        $sql = 'SELECT c.id FROM ' . $course_table . ' c
-                INNER JOIN ' . $tbl_grade_links . ' l
+        $sql = 'SELECT c.id FROM '.$course_table.' c
+                INNER JOIN ' . $tbl_grade_links.' l
                 ON c.code = l.course_code
-                WHERE l.id=' . intval($id_link) . ' OR l.category_id=' . intval($id_link);
+                WHERE l.id=' . intval($id_link).' OR l.category_id='.intval($id_link);
         $res = Database::query($sql);
         $array = Database::fetch_array($res, 'ASSOC');
         return $array['id'];
@@ -542,7 +542,7 @@ class GradebookUtils
     {
         $result = Result::load($resid);
         if ($importscore > $eval_max) {
-            header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax=');
+            header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax=');
             exit;
         }
         $result[0]->set_score($importscore);
@@ -588,8 +588,8 @@ class GradebookUtils
     ) {
         $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
         $sql = 'SELECT COUNT(id) as count
-                FROM ' . $table . ' gc
-                WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" ';
+                FROM ' . $table.' gc
+                WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" ';
         $rs_exist = Database::query($sql);
         $row = Database::fetch_array($rs_exist);
         if ($row['count'] == 0) {
@@ -612,8 +612,8 @@ class GradebookUtils
     public static function get_certificate_by_user_id($cat_id, $user_id)
     {
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
-        $sql = 'SELECT * FROM ' . $table_certificate . '
-                WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
+        $sql = 'SELECT * FROM '.$table_certificate.'
+                WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"';
 
         $result = Database::query($sql);
         $row = Database::fetch_array($result, 'ASSOC');
@@ -632,18 +632,18 @@ class GradebookUtils
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
         $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username
-                FROM ' . $table_user . ' u
-                INNER JOIN ' . $table_certificate . ' gc
+                FROM ' . $table_user.' u
+                INNER JOIN ' . $table_certificate.' gc
                 ON u.user_id=gc.user_id ';
         if (!is_null($cat_id) && $cat_id > 0) {
-            $sql.=' WHERE cat_id=' . intval($cat_id);
+            $sql .= ' WHERE cat_id='.intval($cat_id);
         }
         if (!empty($userList)) {
             $userList = array_map('intval', $userList);
             $userListCondition = implode("','", $userList);
             $sql .= " AND u.user_id IN ('$userListCondition')";
         }
-        $sql.=' ORDER BY u.firstname';
+        $sql .= ' ORDER BY u.firstname';
         $rs = Database::query($sql);
 
         $list_users = array();
@@ -664,10 +664,10 @@ class GradebookUtils
     {
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
         $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id
-                FROM  ' . $table_certificate . ' gc
-                WHERE gc.user_id="' . intval($user_id) . '" ';
+                FROM  ' . $table_certificate.' gc
+                WHERE gc.user_id="' . intval($user_id).'" ';
         if (!is_null($cat_id) && $cat_id > 0) {
-            $sql.=' AND cat_id=' . intval($cat_id);
+            $sql .= ' AND cat_id='.intval($cat_id);
         }
 
         $rs = Database::query($sql);
@@ -704,12 +704,12 @@ class GradebookUtils
 
         $new_content_html = isset($content_html['content']) ? $content_html['content'] : null;
         $variables = isset($content_html['variables']) ? $content_html['variables'] : null;
-        $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery';
+        $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery';
         $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html);
 
-        $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document';
+        $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document';
         $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html);
-        $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
+        $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
 
         //add print header
         if (!$hide_print_button) {
@@ -755,9 +755,9 @@ class GradebookUtils
             $session_id = api_get_session_id();
 
             $t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
-            $sql = "SELECT * FROM $t WHERE course_code = '" . Database::escape_string($course_code) . "' ";
+            $sql = "SELECT * FROM $t WHERE course_code = '".Database::escape_string($course_code)."' ";
             if (!empty($session_id)) {
-                $sql .= " AND session_id = " . (int) $session_id;
+                $sql .= " AND session_id = ".(int) $session_id;
             } else {
                 $sql .= " AND (session_id IS NULL OR session_id = 0) ";
             }
@@ -769,7 +769,7 @@ class GradebookUtils
                 if (!empty($session_id)) {
                     $my_session_id = api_get_session_id();
                     $s_name = api_get_session_name($my_session_id);
-                    $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name);
+                    $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name);
                     $cat->set_session_id($session_id);
                 } else {
                     $cat->set_name($course_code);
@@ -897,13 +897,13 @@ class GradebookUtils
 
         if ($use_grade_model) {
             if ($parent_id == 0) {
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
             } else {
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')';
+                $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')';
             }
         } else {
             if ($parent_id == 0) {
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
             } else {
                 $title = api_strtoupper(get_lang('Average'));
             }
@@ -957,11 +957,11 @@ class GradebookUtils
         } else {
             $column = 0;
             $table->setCellContents($row, $column, get_lang('NoResults'));
-            $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"');
+            $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"');
         }
 
         $pdfParams = array(
-            'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(),
+            'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(),
             'pdf_title' => $title,
             'course_code' => $course_code,
             'add_signatures' => ['Drh', 'Teacher', 'Date']
@@ -1046,7 +1046,7 @@ class GradebookUtils
         $a_students = array();
         while ($user = Database::fetch_array($result)) {
             if (!array_key_exists($user['user_id'], $a_students)) {
-                $a_current_student = array ();
+                $a_current_student = array();
                 $a_current_student[] = $user['user_id'];
                 $a_current_student[] = $user['username'];
                 $a_current_student[] = $user['lastname'];
@@ -1103,7 +1103,7 @@ class GradebookUtils
         foreach ($links as $link) {
             // links are always in a course
             $coursecode = $link->get_course_code();
-            if (!array_key_exists($coursecode,$coursecodes)) {
+            if (!array_key_exists($coursecode, $coursecodes)) {
                 $coursecodes[$coursecode] = '1';
                 $users = array_merge($users, self::get_users_in_course($coursecode));
             }
@@ -1116,7 +1116,7 @@ class GradebookUtils
      * Search students matching a given last name and/or first name
      * @author Bert Steppé
      */
-    public static function find_students($mask= '')
+    public static function find_students($mask = '')
     {
         // students shouldn't be here // don't search if mask empty
         if (!api_is_allowed_to_edit() || empty ($mask)) {
@@ -1127,23 +1127,23 @@ class GradebookUtils
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
         $tbl_cru = Database::get_main_table(TABLE_MAIN_COURSE_USER);
         $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code
-                FROM ' . $tbl_user . ' user';
+                FROM ' . $tbl_user.' user';
         if (!api_is_platform_admin()) {
-            $sql .= ', ' . $tbl_cru . ' cru';
+            $sql .= ', '.$tbl_cru.' cru';
         }
 
-        $sql .= ' WHERE user.status = ' . STUDENT;
-        $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'";
-        $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')";
+        $sql .= ' WHERE user.status = '.STUDENT;
+        $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'";
+        $sql .= ' OR user.firstname LIKE '."'%".$mask."%')";
 
         if (!api_is_platform_admin()) {
             $sql .= ' AND user.user_id = cru.user_id AND
                       cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND
                       cru.c_id in (
-                            SELECT c_id FROM '.$tbl_cru . '
+                            SELECT c_id FROM '.$tbl_cru.'
                             WHERE
-                                user_id = ' . api_get_user_id() . ' AND
-                                status = ' . COURSEMANAGER . '
+                                user_id = ' . api_get_user_id().' AND
+                                status = ' . COURSEMANAGER.'
                         )
                     ';
         }
@@ -1185,7 +1185,7 @@ class GradebookUtils
         $sql = 'SELECT ref_id FROM '.$table_link.'
                 WHERE id = '.$linkId.' AND type='.LINK_ATTENDANCE;
 
-        $rs_attendance  = Database::query($sql);
+        $rs_attendance = Database::query($sql);
         if (Database::num_rows($rs_attendance) > 0) {
             $row_attendance = Database::fetch_array($rs_attendance);
             $sql = 'UPDATE '.$tbl_attendance.' SET 
@@ -1282,7 +1282,7 @@ class GradebookUtils
                 'course' => $courseInfo['title'],
                 'score' => $certificateInfo['score_certificate'],
                 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
-                'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
+                'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
             ];
         }
 
@@ -1346,7 +1346,7 @@ class GradebookUtils
                     'course' => $course['title'],
                     'score' => $certificateInfo['score_certificate'],
                     'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
-                    'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
+                    'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
                 ];
             }
         }

+ 40 - 40
main/inc/ajax/model.ajax.php

@@ -11,8 +11,8 @@ $libpath = api_get_path(LIBRARY_PATH);
 $action = $_GET['a'];
 $page = intval($_REQUEST['page']); //page
 $limit = intval($_REQUEST['rows']); //quantity of rows
-$sidx = $_REQUEST['sidx'];         //index (field) to filter
-$sord = $_REQUEST['sord'];         //asc or desc
+$sidx = $_REQUEST['sidx']; //index (field) to filter
+$sord = $_REQUEST['sord']; //asc or desc
 
 if (strpos(strtolower($sidx), 'asc') !== false) {
     $sidx = str_replace(array('asc', ','), '', $sidx);
@@ -24,7 +24,7 @@ if (strpos(strtolower($sidx), 'desc') !== false) {
     $sord = 'desc';
 }
 
-if (!in_array($sord, array('asc','desc'))) {
+if (!in_array($sord, array('asc', 'desc'))) {
     $sord = 'desc';
 }
 
@@ -64,19 +64,19 @@ if (!in_array(
 function getWhereClause($col, $oper, $val)
 {
     $ops = array(
-        'eq' => '=',        //equal
-        'ne' => '<>',       //not equal
-        'lt' => '<',        //less than
-        'le' => '<=',       //less than or equal
-        'gt' => '>',        //greater than
-        'ge' => '>=',       //greater than or equal
-        'bw' => 'LIKE',     //begins with
+        'eq' => '=', //equal
+        'ne' => '<>', //not equal
+        'lt' => '<', //less than
+        'le' => '<=', //less than or equal
+        'gt' => '>', //greater than
+        'ge' => '>=', //greater than or equal
+        'bw' => 'LIKE', //begins with
         'bn' => 'NOT LIKE', //doesn't begin with
-        'in' => 'LIKE',     //is in
+        'in' => 'LIKE', //is in
         'ni' => 'NOT LIKE', //is not in
-        'ew' => 'LIKE',     //ends with
+        'ew' => 'LIKE', //ends with
         'en' => 'NOT LIKE', //doesn't end with
-        'cn' => 'LIKE',     //contains
+        'cn' => 'LIKE', //contains
         'nc' => 'NOT LIKE'  //doesn't contain
     );
 
@@ -100,10 +100,10 @@ function getWhereClause($col, $oper, $val)
 
 // If there is no search request sent by jqgrid, $where should be empty
 $whereCondition = '';
-$operation = isset($_REQUEST['oper'])  ? $_REQUEST['oper']  : false;
-$exportFormat = isset($_REQUEST['export_format'])  ? $_REQUEST['export_format']  : 'csv';
-$searchField = isset($_REQUEST['searchField'])  ? $_REQUEST['searchField']  : false;
-$searchOperator = isset($_REQUEST['searchOper'])   ? $_REQUEST['searchOper']   : false;
+$operation = isset($_REQUEST['oper']) ? $_REQUEST['oper'] : false;
+$exportFormat = isset($_REQUEST['export_format']) ? $_REQUEST['export_format'] : 'csv';
+$searchField = isset($_REQUEST['searchField']) ? $_REQUEST['searchField'] : false;
+$searchOperator = isset($_REQUEST['searchOper']) ? $_REQUEST['searchOper'] : false;
 $searchString = isset($_REQUEST['searchString']) ? $_REQUEST['searchString'] : false;
 $search = isset($_REQUEST['_search']) ? $_REQUEST['_search'] : false;
 $forceSearch = isset($_REQUEST['_force_search']) ? $_REQUEST['_force_search'] : false;
@@ -171,7 +171,7 @@ if (($search || $forceSearch) && ($search !== 'false')) {
             foreach ($filters->rules as $key => $rule) {
                 $whereCondition .= getWhereClause($rule->field, $rule->op, $rule->data);
 
-                if ($counter < count($filters->rules) -1) {
+                if ($counter < count($filters->rules) - 1) {
                     $whereCondition .= $filters->groupOp;
                 }
                 $counter++;
@@ -202,7 +202,7 @@ switch ($action) {
         $userId = api_get_user_id();
         $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
         $courseCodeList = array();
-        $userIdList  = array();
+        $userIdList = array();
         $sessionIdList = [];
         $searchByGroups = false;
         if (api_is_drh()) {
@@ -648,7 +648,7 @@ switch ($action) {
 $total_pages = 0;
 if ($count > 0) {
     if (!empty($limit)) {
-        $total_pages = ceil((float)$count/(float)$limit);
+        $total_pages = ceil((float) $count / (float) $limit);
     }
 }
 if ($page > $total_pages) {
@@ -807,7 +807,7 @@ switch ($action) {
 
         //get sessions
         $arrSessions = array();
-        if(count($sessionIdList) > 0) {
+        if (count($sessionIdList) > 0) {
             $arrSessions = CourseManager::get_user_list_from_course_code(
                 null,
                 null,
@@ -953,10 +953,10 @@ switch ($action) {
     case 'get_work_user_list_others':
         if (isset($_GET['type']) && $_GET['type'] === 'simple') {
             $columns = array(
-                'type', 'firstname', 'lastname',  'title', 'qualification', 'sent_date', 'qualificator_id', 'actions'
+                'type', 'firstname', 'lastname', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions'
             );
         } else {
-            $columns = array('type', 'firstname', 'lastname',  'title', 'sent_date', 'actions');
+            $columns = array('type', 'firstname', 'lastname', 'title', 'sent_date', 'actions');
         }
         $whereCondition .= " AND u.user_id <> ".api_get_user_id();
         $result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $whereCondition);
@@ -990,7 +990,7 @@ switch ($action) {
     case 'get_exercise_results':
         $course = api_get_course_info();
         // Used inside ExerciseLib::get_exam_results_data()
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
         if ($is_allowedToEdit || api_is_student_boss()) {
             $columns = array(
                 'firstname',
@@ -1022,11 +1022,11 @@ switch ($action) {
         break;
     case 'get_hotpotatoes_exercise_results':
         $course = api_get_course_info();
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
         if (api_is_allowed_to_edit()) {
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
         } else {
-            $columns = array('exe_date',  'score', 'actions');
+            $columns = array('exe_date', 'score', 'actions');
         }
         $result = ExerciseLib::get_exam_results_hotpotatoes_data(
             $start,
@@ -1059,12 +1059,12 @@ switch ($action) {
         break;
     case 'get_hotpotatoes_exercise_results':
         $course = api_get_course_info();
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
 
         if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
         } else {
-            $columns = array('exe_date',  'score', 'actions');
+            $columns = array('exe_date', 'score', 'actions');
         }
         $result = ExerciseLib::get_exam_results_hotpotatoes_data(
             $start,
@@ -1136,17 +1136,17 @@ switch ($action) {
                 $detailButtons = [];
                 $detailButtons[] = Display::url(
                     Display::return_icon('works.png', get_lang('WorksReport')),
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/works_in_session_report.php?session=' . $session['id']
+                    api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php?session='.$session['id']
                 );
                 $detailButtons[] = Display::url(
                     Display::return_icon('2rightarrow.png'),
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id']
+                    api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id']
                 );
 
                 $result[] = array(
                     'name' => Display::url(
                         $session['name'],
-                        api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id']
+                        api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id']
                     ),
                     'date' => $session_date_string,
                     'course_per_session' => $count_courses_in_session,
@@ -1459,7 +1459,7 @@ switch ($action) {
         $result = $new_result;
         break;
     case 'get_gradebooks':
-        $columns = array('name', 'certificates','skills', 'actions', 'has_certificates');
+        $columns = array('name', 'certificates', 'skills', 'actions', 'has_certificates');
         if (!in_array($sidx, $columns)) {
             $sidx = 'name';
         }
@@ -1631,7 +1631,7 @@ switch ($action) {
                     if (!empty($exercises[$cnt - 4]['title'])) {
                         $title = ucwords(strtolower(trim($exercises[$cnt - 4]['title'])));
                     }
-                    $columns[] = 'exer' . $i;
+                    $columns[] = 'exer'.$i;
                     $column_names[] = $title;
                     $i++;
                     break;
@@ -1664,7 +1664,7 @@ switch ($action) {
             $sessionInfo = SessionManager::fetch($listUserSess[$user['user_id']]['id_session']);
             $result[$i]['session'] = $sessionInfo['name'];
             $result[$i]['username'] = $user['username'];
-            $result[$i]['name'] = $user['lastname'] . " " . $user['firstname'];
+            $result[$i]['name'] = $user['lastname']." ".$user['firstname'];
             $j = 1;
             $finalScore = 0;
             foreach ($quizIds as $quizID) {
@@ -1672,7 +1672,7 @@ switch ($action) {
                 if (!empty($arrGrade [$user['user_id']][$quizID]) || $arrGrade [$user['user_id']][$quizID] == 0) {
                     $finalScore += $grade = $arrGrade [$user['user_id']][$quizID];
                 }
-                $result[$i]['exer' . $j] = $grade;
+                $result[$i]['exer'.$j] = $grade;
                 $j++;
             }
 
@@ -1840,9 +1840,9 @@ if (in_array($action, $allowed_actions)) {
         foreach ($result as $row) {
             // if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235
             if (!isset($row['id']) || isset($row['id']) && $row['id'] == '') {
-                $response->rows[$i]['id']= $i;
+                $response->rows[$i]['id'] = $i;
             } else {
-                $response->rows[$i]['id']= $row['id'];
+                $response->rows[$i]['id'] = $row['id'];
             }
             $array = array();
             foreach ($columns as $col) {
@@ -1852,7 +1852,7 @@ if (in_array($action, $allowed_actions)) {
                     $array[] = isset($row[$col]) ? Security::remove_XSS($row[$col]) : '';
                 }
             }
-            $response->rows[$i]['cell']=$array;
+            $response->rows[$i]['cell'] = $array;
             $i++;
         }
     }

+ 48 - 48
main/inc/lib/TicketManager.php

@@ -83,7 +83,7 @@ class TicketManager
         $sql = "SELECT id, name, description, total_tickets
                 FROM $table";
 
-        if (!in_array($direction, array('ASC','DESC'))) {
+        if (!in_array($direction, array('ASC', 'DESC'))) {
             $direction = 'ASC';
         }
         $column = intval($column);
@@ -255,7 +255,7 @@ class TicketManager
     public static function get_all_tickets_status()
     {
         $table = Database::get_main_table(TABLE_TICKET_STATUS);
-        $sql = "SELECT * FROM " . $table;
+        $sql = "SELECT * FROM ".$table;
         $result = Database::query($sql);
         $types = array();
         while ($row = Database::fetch_assoc($result)) {
@@ -369,7 +369,7 @@ class TicketManager
         $ticketId = Database::insert($table_support_tickets, $params);
 
         if ($ticketId) {
-            $ticket_code = "A" . str_pad($ticketId, 11, '0', STR_PAD_LEFT);
+            $ticket_code = "A".str_pad($ticketId, 11, '0', STR_PAD_LEFT);
             $titleCreated = sprintf(
                 get_lang('TicketXCreated'),
                 $ticket_code
@@ -431,32 +431,32 @@ class TicketManager
             $helpDeskMessage =
                 '<table>
                         <tr>
-                            <td width="100px"><b>' . get_lang('User') . '</b></td>
-                            <td width="400px">' . $currentUserInfo['complete_name']. '</td>
+                            <td width="100px"><b>' . get_lang('User').'</b></td>
+                            <td width="400px">' . $currentUserInfo['complete_name'].'</td>
                         </tr>
                         <tr>
-                            <td width="100px"><b>' . get_lang('Username') . '</b></td>
-                            <td width="400px">' . $currentUserInfo['username'] . '</td>
+                            <td width="100px"><b>' . get_lang('Username').'</b></td>
+                            <td width="400px">' . $currentUserInfo['username'].'</td>
                         </tr>
                         <tr>
-                            <td width="100px"><b>' . get_lang('Email') . '</b></td>
-                            <td width="400px">' . $currentUserInfo['email'] . '</td>
+                            <td width="100px"><b>' . get_lang('Email').'</b></td>
+                            <td width="400px">' . $currentUserInfo['email'].'</td>
                         </tr>
                         <tr>
-                            <td width="100px"><b>' . get_lang('Phone') . '</b></td>
-                            <td width="400px">' . $currentUserInfo['phone'] . '</td>
+                            <td width="100px"><b>' . get_lang('Phone').'</b></td>
+                            <td width="400px">' . $currentUserInfo['phone'].'</td>
                         </tr>
                         <tr>
-                            <td width="100px"><b>' . get_lang('Date') . '</b></td>
-                            <td width="400px">' . api_convert_and_format_date($now, DATE_TIME_FORMAT_LONG) . '</td>
+                            <td width="100px"><b>' . get_lang('Date').'</b></td>
+                            <td width="400px">' . api_convert_and_format_date($now, DATE_TIME_FORMAT_LONG).'</td>
                         </tr>
                         <tr>
-                            <td width="100px"><b>' . get_lang('Title') . '</b></td>
-                            <td width="400px">' . $subject . '</td>
+                            <td width="100px"><b>' . get_lang('Title').'</b></td>
+                            <td width="400px">' . $subject.'</td>
                         </tr>
                         <tr>
-                            <td width="100px"><b>' . get_lang('Description') . '</b></td>
-                            <td width="400px">' . $content . '</td>
+                            <td width="100px"><b>' . get_lang('Description').'</b></td>
+                            <td width="400px">' . $content.'</td>
                         </tr>
                     </table>';
 
@@ -635,10 +635,10 @@ class TicketManager
         $table_support_messages = Database::get_main_table(TABLE_TICKET_MESSAGE);
         $table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
         if ($sendConfirmation) {
-            $form = '<form action="ticket_details.php?ticket_id=' . $ticketId . '" id="confirmticket" method="POST" >
-                         <p>' . get_lang('TicketWasThisAnswerSatisfying') . '</p>
-                         <button class="btn btn-primary responseyes" name="response" id="responseyes" value="1">' . get_lang('Yes') . '</button>
-                         <button class="btn btn-danger responseno" name="response" id="responseno" value="0">' . get_lang('No') . '</button>
+            $form = '<form action="ticket_details.php?ticket_id='.$ticketId.'" id="confirmticket" method="POST" >
+                         <p>' . get_lang('TicketWasThisAnswerSatisfying').'</p>
+                         <button class="btn btn-primary responseyes" name="response" id="responseyes" value="1">' . get_lang('Yes').'</button>
+                         <button class="btn btn-danger responseno" name="response" id="responseno" value="0">' . get_lang('No').'</button>
                      </form>';
             $content .= $form;
         }
@@ -719,11 +719,11 @@ class TicketManager
         } else {
             $new_file_name = uniqid('');
             $path_attachment = api_get_path(SYS_ARCHIVE_PATH);
-            $path_message_attach = $path_attachment . 'plugin_ticket_messageattch/';
+            $path_message_attach = $path_attachment.'plugin_ticket_messageattch/';
             if (!file_exists($path_message_attach)) {
                 @mkdir($path_message_attach, api_get_permissions_for_new_directories(), true);
             }
-            $new_path = $path_message_attach . $new_file_name;
+            $new_path = $path_message_attach.$new_file_name;
             if (is_uploaded_file($file_attach['tmp_name'])) {
                 @copy($file_attach['tmp_name'], $new_path);
             }
@@ -744,7 +744,7 @@ class TicketManager
                     '$safe_new_file_name',
                     '$ticketId',
                     '$message_id',
-                    '" . $file_attach['size'] . "',
+                    '".$file_attach['size']."',
                     '$userId',
                     '$now',
                     '$userId',
@@ -753,7 +753,7 @@ class TicketManager
             Database::query($sql);
 
             return array(
-                'path' => $path_message_attach . $safe_new_file_name,
+                'path' => $path_message_attach.$safe_new_file_name,
                 'filename' => $safe_file_name,
             );
         }
@@ -944,23 +944,23 @@ class TicketManager
             $unread = Database::fetch_object($result_unread)->unread;*/
 
             $userInfo = api_get_user_info($row['sys_insert_user_id']);
-            $hrefUser = $webPath . 'main/admin/user_information.php?user_id=' . $userInfo['user_id'];
+            $hrefUser = $webPath.'main/admin/user_information.php?user_id='.$userInfo['user_id'];
             $name = "<a href='$hrefUser'> {$userInfo['complete_name_with_username']} </a>";
             $actions = '';
 
             if ($row['assigned_last_user'] != 0) {
                 $assignedUserInfo = api_get_user_info($row['assigned_last_user']);
                 if (!empty($assignedUserInfo)) {
-                    $hrefResp = $webPath . 'main/admin/user_information.php?user_id=' . $assignedUserInfo['user_id'];
+                    $hrefResp = $webPath.'main/admin/user_information.php?user_id='.$assignedUserInfo['user_id'];
                     $row['assigned_last_user'] = "<a href='$hrefResp'> {$assignedUserInfo['complete_name_with_username']} </a>";
                 } else {
                     $row['assigned_last_user'] = get_lang('UnknownUser');
                 }
             } else {
                 if ($row['status_id'] !== self::STATUS_FORWARDED) {
-                    $row['assigned_last_user'] = '<span style="color:#ff0000;">' . get_lang('ToBeAssigned') . '</span>';
+                    $row['assigned_last_user'] = '<span style="color:#ff0000;">'.get_lang('ToBeAssigned').'</span>';
                 } else {
-                    $row['assigned_last_user'] = '<span style="color:#00ff00;">' . get_lang('MessageResent') . '</span>';
+                    $row['assigned_last_user'] = '<span style="color:#00ff00;">'.get_lang('MessageResent').'</span>';
                 }
             }
 
@@ -982,7 +982,7 @@ class TicketManager
             $row['start_date'] = Display::dateToStringAgoAndLongDate($row['start_date']);
             $row['sys_lastedit_datetime'] = Display::dateToStringAgoAndLongDate($row['sys_lastedit_datetime']);
 
-            $icon = Display::return_icon($img_source, get_lang('Info')).'<a href="ticket_details.php?ticket_id=' . $row['id'] . '">' . $row['code'] . '</a>';
+            $icon = Display::return_icon($img_source, get_lang('Info')).'<a href="ticket_details.php?ticket_id='.$row['id'].'">'.$row['code'].'</a>';
 
             if ($isAdmin) {
                 $ticket = array(
@@ -1023,9 +1023,9 @@ class TicketManager
                                 </a>';
             }*/
             if ($isAdmin) {
-                $ticket['0'] .= '&nbsp;&nbsp;<a  href="javascript:void(0)" onclick="load_history_ticket(\'div_' . $row['ticket_id'] . '\',' . $row['ticket_id'] . ')">
-					<img onclick="load_course_list(\'div_' . $row['ticket_id'] . '\',' . $row['ticket_id'] . ')" onmouseover="clear_course_list (\'div_' . $row['ticket_id'] . '\')" src="' . Display::returnIconPath('history.gif') . '" title="' . get_lang('Historial') . '" alt="' . get_lang('Historial') . '"/>
-					<div class="blackboard_hide" id="div_' . $row['ticket_id'] . '">&nbsp;&nbsp;</div>
+                $ticket['0'] .= '&nbsp;&nbsp;<a  href="javascript:void(0)" onclick="load_history_ticket(\'div_'.$row['ticket_id'].'\','.$row['ticket_id'].')">
+					<img onclick="load_course_list(\'div_' . $row['ticket_id'].'\','.$row['ticket_id'].')" onmouseover="clear_course_list (\'div_'.$row['ticket_id'].'\')" src="'.Display::returnIconPath('history.gif').'" title="'.get_lang('Historial').'" alt="'.get_lang('Historial').'"/>
+					<div class="blackboard_hide" id="div_' . $row['ticket_id'].'">&nbsp;&nbsp;</div>
 					</a>&nbsp;&nbsp;';
             }
             $tickets[] = $ticket;
@@ -1227,8 +1227,8 @@ class TicketManager
                 }
 
                 $userInfo = api_get_user_info($row['sys_insert_user_id']);
-                $row['user_url'] = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/user_information.php?user_id=' . $userInfo['user_id'] . '">
-                ' . $userInfo['complete_name']. '</a>';
+                $row['user_url'] = '<a href="'.api_get_path(WEB_PATH).'main/admin/user_information.php?user_id='.$userInfo['user_id'].'">
+                ' . $userInfo['complete_name'].'</a>';
                 $ticket['usuario'] = $userInfo;
                 $ticket['ticket'] = $row;
             }
@@ -1246,19 +1246,19 @@ class TicketManager
             while ($row = Database::fetch_assoc($result)) {
                 $message = $row;
                 $completeName = api_get_person_name($row['firstname'], $row['lastname']);
-                $href = $webPath . 'main/admin/user_information.php?user_id=' . $row['user_id'];
+                $href = $webPath.'main/admin/user_information.php?user_id='.$row['user_id'];
                 $message['admin'] = UserManager::is_admin($message['user_id']);
                 $message['user_created'] = "<a href='$href'> $completeName </a>";
                 $sql = "SELECT *
                         FROM $table_support_message_attachments
                         WHERE
-                            message_id = " . $row['message_id'] . " AND
+                            message_id = ".$row['message_id']." AND
                             ticket_id = $ticketId";
 
                 $result_attach = Database::query($sql);
                 while ($row2 = Database::fetch_assoc($result_attach)) {
-                    $archiveURL = $archiveURL = $webPath . 'ticket/download.php?ticket_id=' . $ticketId . '&file=';
-                    $row2['attachment_link'] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $row2['path'] . '&title=' . $row2['filename'] . '">' . $row2['filename'] . '</a>&nbsp;(' . $row2['size'] . ')';
+                    $archiveURL = $archiveURL = $webPath.'ticket/download.php?ticket_id='.$ticketId.'&file=';
+                    $row2['attachment_link'] = $attach_icon.'&nbsp;<a href="'.$archiveURL.$row2['path'].'&title='.$row2['filename'].'">'.$row2['filename'].'</a>&nbsp;('.$row2['size'].')';
                     $message['attachments'][] = $row2;
                 }
                 $ticket['messages'][] = $message;
@@ -1285,8 +1285,8 @@ class TicketManager
         $sql = "UPDATE $table_support_messages
                 SET
                     status = 'LEI',
-                    sys_lastedit_user_id ='" . api_get_user_id() . "',
-                    sys_lastedit_datetime ='" . $now . "'
+                    sys_lastedit_user_id ='".api_get_user_id()."',
+                    sys_lastedit_datetime ='" . $now."'
                 WHERE ticket_id ='$ticketId' ";
 
         if (api_is_platform_admin()) {
@@ -1424,7 +1424,7 @@ class TicketManager
                 SET
                     status_id = '$status_id',
                     sys_lastedit_user_id ='$userId',
-                    sys_lastedit_datetime ='" . $now . "'
+                    sys_lastedit_datetime ='".$now."'
                 WHERE id ='$ticketId'";
         $result = Database::query($sql);
 
@@ -1509,7 +1509,7 @@ class TicketManager
         $sql = "UPDATE $table_support_tickets SET
                     status_id = '".self::STATUS_CLOSE."',
                     sys_lastedit_user_id ='$userId',
-                    sys_lastedit_datetime ='" . $now . "',
+                    sys_lastedit_datetime ='".$now."',
                     end_date ='$now'
                 WHERE id ='$ticketId'";
         Database::query($sql);
@@ -1561,15 +1561,15 @@ class TicketManager
         while ($row = Database::fetch_assoc($result)) {
             if ($row['user_id'] != 0) {
                 $assignuser = api_get_user_info($row['user_id']);
-                $row['assignuser'] = '<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['user_id'] . '"  target="_blank">' .
-                $assignuser['username'] . '</a>';
+                $row['assignuser'] = '<a href="'.$webpath.'main/admin/user_information.php?user_id='.$row['user_id'].'"  target="_blank">'.
+                $assignuser['username'].'</a>';
             } else {
                 $row['assignuser'] = get_lang('Unassign');
             }
             $row['assigned_date'] = date_to_str_ago($row['assigned_date']);
             $insertuser = api_get_user_info($row['sys_insert_user_id']);
-            $row['insertuser'] = '<a href="' . $webpath . 'main/admin/user_information.php?user_id=' . $row['sys_insert_user_id'] . '"  target="_blank">' .
-                $insertuser['username'] . '</a>';
+            $row['insertuser'] = '<a href="'.$webpath.'main/admin/user_information.php?user_id='.$row['sys_insert_user_id'].'"  target="_blank">'.
+                $insertuser['username'].'</a>';
             $history[] = $row;
         }
         return $history;
@@ -1768,7 +1768,7 @@ class TicketManager
         while ($row = Database::fetch_assoc($result)) {
             if ($row['responsable'] != 0) {
                 $row['responsable'] = api_get_user_info($row['responsable']);
-                $row['responsable'] = $row['responsable']['firstname'] . ' ' . $row['responsable']['lastname'];
+                $row['responsable'] = $row['responsable']['firstname'].' '.$row['responsable']['lastname'];
             }
             $row['sys_insert_datetime'] = api_format_date(
                     $row['sys_insert_datetime'], '%d/%m/%y - %I:%M:%S %p'

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 171 - 171
main/inc/lib/document.lib.php


+ 19 - 19
main/inc/lib/image.lib.php

@@ -114,7 +114,7 @@ abstract class ImageWrapper
             return false;
         }
         $this->path = $path;
-        $this->set_image_wrapper();  //Creates image obj
+        $this->set_image_wrapper(); //Creates image obj
     }
 
     abstract function set_image_wrapper();
@@ -156,7 +156,7 @@ class ImagickWrapper extends ImageWrapper
         if ($this->debug) error_log('Image::set_image_wrapper loaded');
         try {
             if (file_exists($this->path)) {
-                $this->image     = new Imagick($this->path);
+                $this->image = new Imagick($this->path);
 
                 if ($this->image) {
                     $this->fill_image_info(); //Fills height, width and type
@@ -164,7 +164,7 @@ class ImagickWrapper extends ImageWrapper
             } else {
                 if ($this->debug) error_log('Image::image does not exist');
             }
-        } catch(ImagickException $e) {
+        } catch (ImagickException $e) {
             if ($this->debug) error_log($e->getMessage());
         }
     }
@@ -185,7 +185,7 @@ class ImagickWrapper extends ImageWrapper
 
 	public function get_image_size()
     {
-		$imagesize = array('width'=>0,'height'=>0);
+		$imagesize = array('width'=>0, 'height'=>0);
 	    if ($this->image_validated) {
             $imagesize = $this->image->getImageGeometry();
 	    }
@@ -202,8 +202,8 @@ class ImagickWrapper extends ImageWrapper
             $height = $thumbh;
         } else {
             $scale  = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
-            $width  = (int)($this->width * $scale);
-            $height = (int)($this->height * $scale);
+            $width  = (int) ($this->width * $scale);
+            $height = (int) ($this->height * $scale);
         }
 		$result = $this->image->resizeImage($width, $height, $this->filter, 1);
 		$this->width  = $thumbw;
@@ -249,7 +249,7 @@ class ImagickWrapper extends ImageWrapper
 		$result = false;
 		try {
 		    $result = $this->image->writeImage($file);
-		} catch(ImagickException $e) {
+		} catch (ImagickException $e) {
             if ($this->debug) error_log($e->getMessage());
         }
 
@@ -310,9 +310,9 @@ class GDWrapper extends ImageWrapper
 
     public function get_image_size()
     {
-        $return_array = array('width'=>0,'height'=>0);
+        $return_array = array('width'=>0, 'height'=>0);
         if ($this->image_validated) {
-	        $return_array = array('width'=>$this->width,'height'=>$this->height);
+	        $return_array = array('width'=>$this->width, 'height'=>$this->height);
         }
         return $return_array;
 	}
@@ -320,7 +320,7 @@ class GDWrapper extends ImageWrapper
     public function fill_image_info()
     {
     	if (file_exists($this->path)) {
-	        $image_info     = getimagesize($this->path);
+	        $image_info = getimagesize($this->path);
 			$this->width    = $image_info[0];
 			$this->height   = $image_info[1];
 			$this->type     = $image_info[2];
@@ -340,11 +340,11 @@ class GDWrapper extends ImageWrapper
                 $height = $thumbh;
             } else {
                 $scale = min($thumbw / $this->width, $thumbh / $this->height);
-                $width = (int)($this->width * $scale);
-                $height = (int)($this->height * $scale);
+                $width = (int) ($this->width * $scale);
+                $height = (int) ($this->height * $scale);
             }
-			$deltaw = (int)(($thumbw - $width) / 2);
-			$deltah = (int)(($thumbh - $height) / 2);
+			$deltaw = (int) (($thumbw - $width) / 2);
+			$deltah = (int) (($thumbh - $height) / 2);
 			$dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
             		@imagealphablending($dst_img, false);
 		        @imagesavealpha($dst_img, true);
@@ -359,8 +359,8 @@ class GDWrapper extends ImageWrapper
                 $height = $thumbh;
             } else {
                 $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
-                $width  = (int)($this->width * $scale);
-                $height = (int)($this->height * $scale);
+                $width  = (int) ($this->width * $scale);
+                $height = (int) ($this->height * $scale);
             }
 			$deltaw = 0;
 			$deltah = 0;
@@ -419,7 +419,7 @@ class GDWrapper extends ImageWrapper
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
     {
 	    if (!$this->image_validated) return false;
-        $compress = (int)$compress;
+        $compress = (int) $compress;
         $type = $this->type;
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
             $type = $convert_file_to;
@@ -464,11 +464,11 @@ class GDWrapper extends ImageWrapper
          * so that we can use black (0,0,0) as transparent, which is what
          * the image is filled with when created.
          */
-        $transparent = imagecolorallocate($dest_img, 0,0,0);
+        $transparent = imagecolorallocate($dest_img, 0, 0, 0);
         imagealphablending($dest_img, false);
         imagesavealpha($dest_img, true);
         imagecolortransparent($dest_img, $transparent);
-        imagecopy($dest_img, $this->bg, 0,0, 0, 0,imagesx($this->bg), imagesx($this->bg));
+        imagecopy($dest_img, $this->bg, 0, 0, 0, 0, imagesx($this->bg), imagesx($this->bg));
         imagefilter($dest_img, IMG_FILTER_GRAYSCALE);
         $this->bg = $dest_img;
 

+ 103 - 103
main/inc/lib/social.lib.php

@@ -143,12 +143,12 @@ class SocialManager extends UserManager
                     friend_user_id<>'.((int) $user_id).' AND
                     user_id='.((int) $user_id);
         if (isset($id_group) && $id_group > 0) {
-            $sql.=' AND relation_type='.$id_group;
+            $sql .= ' AND relation_type='.$id_group;
         }
         if (isset($search_name)) {
             $search_name = trim($search_name);
             $search_name = str_replace(' ', '', $search_name);
-            $sql.=' AND friend_user_id IN (
+            $sql .= ' AND friend_user_id IN (
                 SELECT user_id FROM '.$tbl_my_user.'
                 WHERE
                     firstName LIKE "%'.Database::escape_string($search_name).'%" OR
@@ -576,7 +576,7 @@ class SocialManager extends UserManager
     {
         $user_info = api_get_user_info($userId);
         $success = get_lang('MessageSentTo');
-        $success.= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
+        $success .= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
 
         if (isset($subject) && isset($content) && isset($userId)) {
             $result = MessageManager::send_message($userId, $subject, $content);
@@ -639,7 +639,7 @@ class SocialManager extends UserManager
             $my_course['course_info']['real_id']
         );
 
-        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory;   // course path
+        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path
         if (api_get_setting('course_images_in_courses_list') === 'true') {
             if (file_exists($course_path.'/course-pic85x85.png')) {
                 $image = $my_course['course_info']['course_image'];
@@ -671,7 +671,7 @@ class SocialManager extends UserManager
         if ($course_visibility != COURSE_VISIBILITY_HIDDEN &&
             ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
         ) {
-            $result .= '<span class="title">' . $course_title . '<span>';
+            $result .= '<span class="title">'.$course_title.'<span>';
         } else {
             $result .= $course_title." ".get_lang('CourseClosed');
         }
@@ -880,57 +880,57 @@ class SocialManager extends UserManager
             $links = '<ul class="nav nav-pills nav-stacked">';
             $active = $show == 'home' ? 'active' : null;
             $links .= '
-                <li class="home-icon ' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
-                        ' . $homeIcon . ' ' . get_lang('Home') . '
+                <li class="home-icon ' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
+                        ' . $homeIcon.' '.get_lang('Home').'
                     </a>
                 </li>';
             $active = $show == 'messages' ? 'active' : null;
             $links .= '
-                <li class="messages-icon ' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
-                        ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
+                <li class="messages-icon ' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
+                        ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
                     </a>
                 </li>';
 
             //Invitations
             $active = $show == 'invitations' ? 'active' : null;
             $links .= '
-                <li class="invitations-icon ' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
-                        ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
+                <li class="invitations-icon ' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
+                        ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
                     </a>
                 </li>';
 
             //Shared profile and groups
             $active = $show == 'shared_profile' ? 'active' : null;
             $links .= '
-                <li class="shared-profile-icon' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
-                        ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
+                <li class="shared-profile-icon' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
+                        ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
                     </a>
                 </li>';
             $active = $show == 'friends' ? 'active' : null;
             $links .= '
-                <li class="friends-icon ' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
-                        ' . $friendsIcon . ' ' . get_lang('Friends') . '
+                <li class="friends-icon ' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
+                        ' . $friendsIcon.' '.get_lang('Friends').'
                     </a>
                 </li>';
             $active = $show == 'browse_groups' ? 'active' : null;
             $links .= '
-                <li class="browse-groups-icon ' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
-                        ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
+                <li class="browse-groups-icon ' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
+                        ' . $groupsIcon.' '.get_lang('SocialGroups').'
                     </a>
                 </li>';
 
             //Search users
             $active = $show == 'search' ? 'active' : null;
             $links .= '
-                <li class="search-icon ' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
-                        ' . $searchIcon . ' ' . get_lang('Search') . '
+                <li class="search-icon ' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
+                        ' . $searchIcon.' '.get_lang('Search').'
                     </a>
                 </li>';
 
@@ -938,9 +938,9 @@ class SocialManager extends UserManager
             $active = $show == 'myfiles' ? 'active' : null;
 
             $myFiles = '
-                <li class="myfiles-icon ' . $active . '">
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
-                        ' . $filesIcon . ' ' . get_lang('MyFiles') . '
+                <li class="myfiles-icon ' . $active.'">
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
+                        ' . $filesIcon.' '.get_lang('MyFiles').'
                     </a>
                 </li>';
 
@@ -948,7 +948,7 @@ class SocialManager extends UserManager
                 $myFiles = '';
             }
             $links .= $myFiles;
-            $links .='</ul>';
+            $links .= '</ul>';
 
             $html .= Display::panelCollapse(
                 get_lang('SocialNetwork'),
@@ -969,57 +969,57 @@ class SocialManager extends UserManager
         }
 
         if ($show == 'shared_profile') {
-            $links =  '<ul class="nav nav-pills nav-stacked">';
+            $links = '<ul class="nav nav-pills nav-stacked">';
             // My own profile
             if ($show_full_profile && $user_id == intval(api_get_user_id())) {
                 $links .= '
-                    <li class="home-icon ' . $active . '">
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
-                            ' . $homeIcon . ' ' . get_lang('Home') . '
+                    <li class="home-icon ' . $active.'">
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
+                            ' . $homeIcon.' '.get_lang('Home').'
                         </a>
                     </li>
-                    <li class="messages-icon ' . $active . '">
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
-                            ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
+                    <li class="messages-icon ' . $active.'">
+                        <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
+                            ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
                         </a>
                     </li>';
                 $active = $show == 'invitations' ? 'active' : null;
                 $links .= '
-                    <li class="invitations-icon' . $active . '">
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
-                            ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
+                    <li class="invitations-icon' . $active.'">
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
+                            ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
                         </a>
                     </li>';
 
                 $links .= '
                     <li class="shared-profile-icon active">
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
-                            ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
+                            ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
                         </a>
                     </li>
                     <li class="friends-icon">
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
-                            ' . $friendsIcon . ' ' . get_lang('Friends') . '
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
+                            ' . $friendsIcon.' '.get_lang('Friends').'
                         </a>
                     </li>
                     <li class="browse-groups-icon">
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
-                            ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
+                            ' . $groupsIcon.' '.get_lang('SocialGroups').'
                         </a>
                     </li>';
                 $active = $show == 'search' ? 'active' : null;
                 $links .= '
-                    <li class="search-icon ' . $active . '">
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
-                            ' . $searchIcon . ' ' . get_lang('Search') . '
+                    <li class="search-icon ' . $active.'">
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
+                            ' . $searchIcon.' '.get_lang('Search').'
                         </a>
                     </li>';
                 $active = $show == 'myfiles' ? 'active' : null;
 
                 $myFiles = '
-                    <li class="myfiles-icon ' . $active . '">
-                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
-                            ' . $filesIcon . ' ' . get_lang('MyFiles') . '
+                    <li class="myfiles-icon ' . $active.'">
+                     <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
+                            ' . $filesIcon.' '.get_lang('MyFiles').'
                         </a>
                     </li>';
 
@@ -1065,7 +1065,7 @@ class SocialManager extends UserManager
                 $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
             } else {
                 if (!$show_full_profile) {
-                    $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="' . $user_id . '" title="'.get_lang('SendInvitation').'">'.Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
+                    $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="'.$user_id.'" title="'.get_lang('SendInvitation').'">'.Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
                 }
             }
 
@@ -1172,7 +1172,7 @@ class SocialManager extends UserManager
         foreach ($user_list as $uid) {
             $user_info = api_get_user_info($uid, $checkIfUserOnline = true);
             $lastname = $user_info['lastname'];
-            $firstname =  $user_info['firstname'];
+            $firstname = $user_info['firstname'];
             $completeName = $firstname.', '.$lastname;
 
             $user_rol = $user_info['status'] == 1 ? Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY) : Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY);
@@ -1190,7 +1190,7 @@ class SocialManager extends UserManager
             }
             $img = '<img class="img-responsive img-circle" title="'.$completeName.'" alt="'.$completeName.'" src="'.$userPicture.'">';
 
-            $url =  null;
+            $url = null;
             // Anonymous users can't have access to the profile
             if (!api_is_anonymous()) {
                 if (api_get_setting('allow_social_tool') === 'true') {
@@ -1345,13 +1345,13 @@ class SocialManager extends UserManager
             case SOCIAL_CENTER_PLUGIN:
                 $social_plugins = array(1, 2);
                 if (is_array($social_plugins) && count($social_plugins) > 0) {
-                    $content.= '<div id="social-plugins">';
+                    $content .= '<div id="social-plugins">';
                     foreach ($social_plugins as $plugin) {
-                        $content.= '<div class="social-plugin-item">';
-                        $content.= $plugin;
-                        $content.= '</div>';
+                        $content .= '<div class="social-plugin-item">';
+                        $content .= $plugin;
+                        $content .= '</div>';
                     }
-                    $content.= '</div>';
+                    $content .= '</div>';
                 }
                 break;
             case SOCIAL_LEFT_PLUGIN:
@@ -1422,12 +1422,12 @@ class SocialManager extends UserManager
         if (!in_array($extension, $allowedTypes)) {
             $flag = false;
         } else {
-            $newFileName = uniqid('') . '.' . $extension;
+            $newFileName = uniqid('').'.'.$extension;
             if (!file_exists($pathMessageAttach)) {
                 @mkdir($pathMessageAttach, api_get_permissions_for_new_directories(), true);
             }
 
-            $newPath = $pathMessageAttach . $newFileName;
+            $newPath = $pathMessageAttach.$newFileName;
             if (is_uploaded_file($fileAttach['tmp_name'])) {
                 @copy($fileAttach['tmp_name'], $newPath);
             }
@@ -1436,9 +1436,9 @@ class SocialManager extends UserManager
             $medium = self::resize_picture($newPath, IMAGE_WALL_MEDIUM_SIZE);
 
             $big = new Image($newPath);
-            $ok = $small && $small->send_image($pathMessageAttach . IMAGE_WALL_SMALL . '_' . $newFileName) &&
-                $medium && $medium->send_image($pathMessageAttach . IMAGE_WALL_MEDIUM .'_' . $newFileName) &&
-                $big && $big->send_image($pathMessageAttach . IMAGE_WALL_BIG . '_' . $newFileName);
+            $ok = $small && $small->send_image($pathMessageAttach.IMAGE_WALL_SMALL.'_'.$newFileName) &&
+                $medium && $medium->send_image($pathMessageAttach.IMAGE_WALL_MEDIUM.'_'.$newFileName) &&
+                $big && $big->send_image($pathMessageAttach.IMAGE_WALL_BIG.'_'.$newFileName);
 
             // Insert
             $newFileName = $social.$newFileName;
@@ -1532,7 +1532,7 @@ class SocialManager extends UserManager
             $start = '0000-00-00';
         }
 
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL, $idMessage, $start, $limit, $offset);
         $formattedList = '<div class="sub-mediapost">';
         $users = array();
@@ -1547,20 +1547,20 @@ class SocialManager extends UserManager
             }
 
             $nameComplete = api_is_western_name_order()
-                ? $users[$userIdLoop]['firstname'] .' ' . $users[$userIdLoop]['lastname']
-                : $users[$userIdLoop]['lastname'] . ' ' . $users[$userIdLoop]['firstname'];
+                ? $users[$userIdLoop]['firstname'].' '.$users[$userIdLoop]['lastname']
+                : $users[$userIdLoop]['lastname'].' '.$users[$userIdLoop]['firstname'];
             $url = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userIdLoop;
             $media = '';
             $media .= '<div class="rep-post">';
             $media .= '<div class="col-md-2 col-xs-2 social-post-answers">';
             $media .= '<div class="user-image pull-right">';
-            $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] .
+            $media .= '<a href="'.$url.'" ><img src="'.$users[$userIdLoop]['avatar'].
                        '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
             $media .= '</div>';
             $media .= '</div>';
             $media .= '<div class="col-md-9 col-xs-9 social-post-answers">';
             $media .= '<div class="user-data">';
-            $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>';
+            $media .= '<div class="username">'.'<a href="'.$url.'">'.$nameComplete.'</a> <span>'.Security::remove_XSS($message['content']).'</span></div>';
             $media .= '<div class="time timeago" title="'.$date.'">'.$date.'</div>';
             $media .= '<br />';
             $media .= '</div>';
@@ -1603,12 +1603,12 @@ class SocialManager extends UserManager
      * @param   int     $offset     Wall messages offset
      * @return  array   $data       return user's starting wall messages along with message extra data
      */
-    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset= 0)
+    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset = 0)
     {
         if (empty($start)) {
             $start = '0000-00-00';
         }
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL_POST, null, $start, $limit, $offset);
         $users = array();
         $data = array();
@@ -1667,7 +1667,7 @@ class SocialManager extends UserManager
 
         $htmlReceiver = '';
         if ($authorId != $receiverId) {
-            $htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> ';
+            $htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
         }
 
         $wallImage = '';
@@ -1702,7 +1702,7 @@ class SocialManager extends UserManager
         $html .= '<div class="img-post">';
         $html .= $wallImage;
         $html .= '</div>';
-        $html .= '<p>'. Security::remove_XSS($message['content']).'</p>';
+        $html .= '<p>'.Security::remove_XSS($message['content']).'</p>';
         $html .= '</div>';
         $html .= '</div>'; // end mediaPost
 
@@ -1877,18 +1877,18 @@ class SocialManager extends UserManager
         if ($number_friends != 0) {
             if ($number_friends > $number_of_images) {
                 if (api_get_user_id() == $user_id) {
-                    $friendHtml.= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
+                    $friendHtml .= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
                 } else {
-                    $friendHtml.= ' <span>'
+                    $friendHtml .= ' <span>'
                         .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
                         .'?view=friends&height=390&width=610&user_id='.$user_id.'"'
                         .'class="ajax" data-title="'.get_lang('SeeAll').'" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>';
                 }
             }
 
-            $friendHtml.= '<ul class="nav nav-list">';
+            $friendHtml .= '<ul class="nav nav-list">';
             $j = 1;
-            for ($k=0; $k < $number_friends; $k++) {
+            for ($k = 0; $k < $number_friends; $k++) {
                 if ($j > $number_of_images) break;
 
                 if (isset($friends[$k])) {
@@ -1902,26 +1902,26 @@ class SocialManager extends UserManager
                         $statusIcon = Display::span('', array('class' => 'offline_user_in_text'));
                     }
 
-                    $friendHtml.= '<li>';
-                    $friendHtml.= '<div>';
+                    $friendHtml .= '<li>';
+                    $friendHtml .= '<div>';
 
                     // the height = 92 must be the same in the image_friend_network span style in default.css
                     $friends_profile = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL);
-                    $friendHtml.= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
+                    $friendHtml .= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
                     $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
-                    $friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>';
-                    $friendHtml.= '</div>';
-                    $friendHtml.= '</li>';
+                    $friendHtml .= $statusIcon.'<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'">'.$name_user.'</a>';
+                    $friendHtml .= '</div>';
+                    $friendHtml .= '</li>';
                 }
                 $j++;
             }
-            $friendHtml.='</ul>';
+            $friendHtml .= '</ul>';
         } else {
-            $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
-                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
+            $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
+                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
         }
 
-        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' (' . $number_friends . ')' );
+        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')');
 
         return $friendHtml;
     }
@@ -1942,9 +1942,9 @@ class SocialManager extends UserManager
 
         if ($number_friends != 0) {
 
-            $friendHtml.= '<div class="list-group">';
+            $friendHtml .= '<div class="list-group">';
             $j = 1;
-            for ($k=0; $k < $number_friends; $k++) {
+            for ($k = 0; $k < $number_friends; $k++) {
                 if ($j > $number_of_images) {
                     break;
                 }
@@ -1954,11 +1954,11 @@ class SocialManager extends UserManager
                     $user_info_friend = api_get_user_info($friend['friend_user_id'], true);
 
                     if (!empty($user_info_friend['user_is_online'])) {
-                        $statusIcon = Display::return_icon('statusonline.png',get_lang('Online'));
-                        $status=1;
+                        $statusIcon = Display::return_icon('statusonline.png', get_lang('Online'));
+                        $status = 1;
                     } else {
-                        $statusIcon = Display::return_icon('statusoffline.png',get_lang('Offline'));
-                        $status=0;
+                        $statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline'));
+                        $status = 0;
                     }
 
                     $friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM);
@@ -1967,24 +1967,24 @@ class SocialManager extends UserManager
                     $showLinkToChat = api_is_global_chat_enabled() &&
                         $friend['friend_user_id'] != api_get_user_id();
 
-                    if ($showLinkToChat){
+                    if ($showLinkToChat) {
                         $friendHtml .= '<a onclick="javascript:chatWith(\''.$friend['friend_user_id'].'\', \''.$name_user.'\', \''.$status.'\',\''.$friendAvatarSmall.'\')" href="javascript:void(0);" class="list-group-item">';
-                        $friendHtml .=  $friend_avatar.' <span class="username">' . $name_user . '</span>';
-                        $friendHtml .= '<span class="status">' . $statusIcon . '</span>';
+                        $friendHtml .= $friend_avatar.' <span class="username">'.$name_user.'</span>';
+                        $friendHtml .= '<span class="status">'.$statusIcon.'</span>';
                     } else {
                         $link_shared = empty($link_shared) ? '' : '&'.$link_shared;
-                        $friendHtml .= '<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">';
-                        $friendHtml .=  $friend_avatar.' <span class="username-all">' . $name_user . '</span>';
+                        $friendHtml .= '<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'" class="list-group-item">';
+                        $friendHtml .= $friend_avatar.' <span class="username-all">'.$name_user.'</span>';
                     }
 
                     $friendHtml .= '</a>';
                 }
                 $j++;
             }
-            $friendHtml.='</div>';
+            $friendHtml .= '</div>';
         } else {
-            $friendHtml.= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
-                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
+            $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
+                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
         }
 
         return $friendHtml;
@@ -2002,7 +2002,7 @@ class SocialManager extends UserManager
                 'post',
                 api_get_path(WEB_CODE_PATH).'social/profile.php'.$userId,
                 null,
-                array('enctype' => 'multipart/form-data') ,
+                array('enctype' => 'multipart/form-data'),
                 FormValidator::LAYOUT_HORIZONTAL
             );
 

+ 14 - 14
main/inc/lib/system_announcements.lib.php

@@ -22,14 +22,14 @@ class SystemAnnouncementManager
         $tbl_announcement_group = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
         $userGroup = new UserGroup();
 
-        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
+        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0);
         $groups = array();
         foreach ($temp_user_groups as $user_group) {
             $groups = array_merge($groups, array($user_group['id']));
             $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
         }
 
-        $groups_string = '('.implode($groups,',').')';
+        $groups_string = '('.implode($groups, ',').')';
         $now = api_get_utc_datetime();
         $sql = "SELECT *, DATE_FORMAT(date_start,'%d-%m-%Y %h:%i:%s') AS display_date
                 FROM  $db_table
@@ -104,13 +104,13 @@ class SystemAnnouncementManager
      * @param string $user_id
      * @return string
      */
-    public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='')
+    public static function display_all_announcements($visible, $id = -1, $start = 0, $user_id = '')
     {
         $user_selected_language = api_get_interface_language();
         $start = intval($start);
         $userGroup = new UserGroup();
         $tbl_announcement_group = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
-        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
+        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0);
         $groups = array();
         foreach ($temp_user_groups as $user_group) {
             $groups = array_merge($groups, array($user_group['id']));
@@ -118,10 +118,10 @@ class SystemAnnouncementManager
         }
 
         // Checks if tables exists to not break platform not updated
-        $groups_string = '('.implode($groups,',').')';
+        $groups_string = '('.implode($groups, ',').')';
 
         $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
-        $now  = api_get_utc_datetime();
+        $now = api_get_utc_datetime();
 
         $sql = "SELECT * FROM ".$db_table."
                 WHERE
@@ -155,7 +155,7 @@ class SystemAnnouncementManager
         if (!isset($_GET['start']) || $_GET['start'] == 0) {
             $sql .= " ORDER BY date_start DESC LIMIT ".$start.",20";
         } else {
-            $sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20";
+            $sql .= " ORDER BY date_start DESC LIMIT ".($start + 1).",20";
         }
         $announcements = Database::query($sql);
         $content = '';
@@ -204,10 +204,10 @@ class SystemAnnouncementManager
      */
     public static function display_arrow($user_id)
     {
-        $start = (int)$_GET['start'];
+        $start = (int) $_GET['start'];
         $nb_announcement = self::count_nb_announcement($start, $user_id);
-        $next = ((int)$_GET['start']+19);
-        $prev = ((int)$_GET['start']-19);
+        $next = ((int) $_GET['start'] + 19);
+        $prev = ((int) $_GET['start'] - 19);
         $content = '';
         if (!isset($_GET['start']) || $_GET['start'] == 0) {
             if ($nb_announcement > 20) {
@@ -567,7 +567,7 @@ class SystemAnnouncementManager
                 $sendEmailTest
             );
         } else {
-            if ($send_mail==1) {
+            if ($send_mail == 1) {
                 self::send_system_announcement_by_email(
                     $title,
                     $content,
@@ -678,7 +678,7 @@ class SystemAnnouncementManager
         $language = null,
         $sendEmailTest = false
     ) {
-        $content = str_replace(array('\r\n', '\n', '\r'),'', $content);
+        $content = str_replace(array('\r\n', '\n', '\r'), '', $content);
         $now = api_get_utc_datetime();
 
         if ($sendEmailTest) {
@@ -704,7 +704,7 @@ class SystemAnnouncementManager
 					WHERE status = '5' ";
 		}
 
-		if ($teacher<> 0 && $student <> 0) {
+		if ($teacher <> 0 && $student <> 0) {
 			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition 
 					WHERE 1 = 1 ";
 		}
@@ -737,7 +737,7 @@ class SystemAnnouncementManager
 
         $message_sent = false;
 
-		while ($row = Database::fetch_array($result,'ASSOC')) {
+		while ($row = Database::fetch_array($result, 'ASSOC')) {
             MessageManager::send_message_simple($row['user_id'], $title, $content);
             $message_sent = true;
 		}

+ 21 - 21
main/inc/lib/template.lib.php

@@ -302,7 +302,7 @@ class Template
                 $content = '<div class="help">';
                 $content .= Display::url(
                     Display::return_icon('help.large.png', get_lang('Help')),
-                    api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help,
+                    api_get_path(WEB_CODE_PATH).'help/help.php?open='.$help,
                     [
                         'class' => 'ajax',
                         'data-title' => get_lang('Help')
@@ -537,7 +537,7 @@ class Template
             'web_course' => api_get_path(WEB_COURSE_PATH),
             'web_main' => api_get_path(WEB_CODE_PATH),
             'web_css' => api_get_path(WEB_CSS_PATH),
-            'web_css_theme' => api_get_path(WEB_CSS_PATH) . $this->themeDir,
+            'web_css_theme' => api_get_path(WEB_CSS_PATH).$this->themeDir,
             'web_ajax' => api_get_path(WEB_AJAX_PATH),
             'web_img' => api_get_path(WEB_IMG_PATH),
             'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
@@ -595,11 +595,11 @@ class Template
             $css[] = api_get_path(WEB_PATH).'web/assets/'.$file;
         }
 
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css';
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css';
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css';
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css';
 
         if (api_is_global_chat_enabled()) {
-            $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css';
+            $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css';
         }
         $css_file_to_string = '';
         foreach ($css as $file) {
@@ -701,10 +701,10 @@ class Template
     {
         global $disable_js_and_css_files, $htmlHeadXtra;
         $isoCode = api_get_language_isocode();
-        $selectLink = 'bootstrap-select/dist/js/i18n/defaults-' . $isoCode . '_' . strtoupper($isoCode) . '.min.js';
+        $selectLink = 'bootstrap-select/dist/js/i18n/defaults-'.$isoCode.'_'.strtoupper($isoCode).'.min.js';
 
         if ($isoCode == 'en') {
-            $selectLink = 'bootstrap-select/dist/js/i18n/defaults-' . $isoCode . '_US.min.js';
+            $selectLink = 'bootstrap-select/dist/js/i18n/defaults-'.$isoCode.'_US.min.js';
         }
         // JS files
         $js_files = array(
@@ -757,8 +757,8 @@ class Template
         }
 
         if ($isoCode != 'en') {
-            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-' . $isoCode . '.js';
-            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-' . $isoCode . '.min.js';
+            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-'.$isoCode.'.js';
+            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-'.$isoCode.'.min.js';
         }
 
         foreach ($bowerJsFiles as $file) {
@@ -1069,13 +1069,13 @@ class Template
         $socialMeta = '';
         $metaTitle = api_get_setting('meta_title');
         if (!empty($metaTitle)) {
-            $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
+            $socialMeta .= '<meta name="twitter:card" content="summary" />'."\n";
             $metaSite = api_get_setting('meta_twitter_site');
             if (!empty($metaSite)) {
-                $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
+                $socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n";
                 $metaCreator = api_get_setting('meta_twitter_creator');
                 if (!empty($metaCreator)) {
-                    $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
+                    $socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n";
                 }
             }
 
@@ -1087,19 +1087,19 @@ class Template
             if (!$userId && !$skillId) {
                 // no combination of user and skill ID has been defined,
                 // so print the normal OpenGraph meta tags
-                $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
-                $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";
+                $socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n";
+                $socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n";
 
                 $metaDescription = api_get_setting('meta_description');
                 if (!empty($metaDescription)) {
-                    $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
+                    $socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n";
                 }
 
                 $metaImage = api_get_setting('meta_image_path');
                 if (!empty($metaImage)) {
-                    if (is_file(api_get_path(SYS_PATH) . $metaImage)) {
-                        $path = api_get_path(WEB_PATH) . $metaImage;
-                        $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n";
+                    if (is_file(api_get_path(SYS_PATH).$metaImage)) {
+                        $path = api_get_path(WEB_PATH).$metaImage;
+                        $socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n";
                     }
                 }
             }
@@ -1149,7 +1149,7 @@ class Template
         // Tutor name
         if (api_get_setting('show_tutor_data') == 'true') {
             // Course manager
-            $courseId  = api_get_course_int_id();
+            $courseId = api_get_course_int_id();
             $id_session = api_get_session_id();
             if (!empty($courseId)) {
                 $tutor_data = '';
@@ -1181,7 +1181,7 @@ class Template
             $courseId = api_get_course_int_id();
             if (!empty($courseId)) {
                 $teacher_data = '';
-                $mail= CourseManager::get_emails_of_tutors_to_course($courseId);
+                $mail = CourseManager::get_emails_of_tutors_to_course($courseId);
                 if (!empty($mail)) {
                     $teachers_parsed = array();
                     foreach ($mail as $value) {
@@ -1449,7 +1449,7 @@ class Template
                     'sessionVar'   => basename(__FILE__, '.php'),
                     'imageOptions' => array(
                         'font_size' => 20,
-                        'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
+                        'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/',
                         'font_file' => 'OpenSans-Regular.ttf',
                         //'output' => 'gif'
                     )

+ 14 - 14
main/lp/lp_build.php

@@ -24,8 +24,8 @@ $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
 $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
 $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
 
-$isStudentView = (int)$_REQUEST['isStudentView'];
-$learnpath_id = (int)$_REQUEST['lp_id'];
+$isStudentView = (int) $_REQUEST['isStudentView'];
+$learnpath_id = (int) $_REQUEST['lp_id'];
 $submit = $_POST['submit_button'];
 
 /* MAIN CODE */
@@ -65,8 +65,8 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
 }
 
 if (!empty($gradebook) && $gradebook == 'view') {
-    $interbreadcrumb[] = array (
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
+    $interbreadcrumb[] = array(
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook')
     );
 }
@@ -74,7 +74,7 @@ $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => g
 $interbreadcrumb[] = array('url' => '#', "name" => $therow['name']);
 
 // Theme calls.
-$lp_theme_css=$_SESSION['oLP']->get_theme();
+$lp_theme_css = $_SESSION['oLP']->get_theme();
 $show_learn_path = true;
 Display::display_header('', 'Path');
 $suredel = trim(get_lang('AreYouSureToDeleteJS'));
@@ -143,15 +143,15 @@ echo '</div>';
 
 function show_block($link, $title, $subtitle, $icon) {
     $html = '<li class="col-md-4">';
-    $html .=  '<div class="thumbnail">';
-    $html .=  '<a href="'.$link.'" title="'.$title.'">';
-    $html .=  Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
-    $html .=  '</a>';
-    $html .=  '<div class="caption">';
-    $html .=  '<strong>'.$title.'</strong></a> '.$subtitle;
-    $html .=  '</div>';
-    $html .=  '</div>';
-    $html .=  '</li>';
+    $html .= '<div class="thumbnail">';
+    $html .= '<a href="'.$link.'" title="'.$title.'">';
+    $html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
+    $html .= '</a>';
+    $html .= '<div class="caption">';
+    $html .= '<strong>'.$title.'</strong></a> '.$subtitle;
+    $html .= '</div>';
+    $html .= '</div>';
+    $html .= '</li>';
     return $html;
 }
 

+ 2 - 2
main/mySpace/access_details.php

@@ -27,7 +27,7 @@ $session_id = intval($_GET['id_session']);
 $type = isset($_REQUEST['type']) ? Security::remove_XSS($_REQUEST['type']) : '';
 $course_code = isset($_REQUEST['course']) ? Security::remove_XSS($_REQUEST['course']) : '';
 $courseInfo = api_get_course_info($course_code);
-$courseId = (!empty($courseInfo['real_id'])?$courseInfo['real_id']:null);
+$courseId = (!empty($courseInfo['real_id']) ? $courseInfo['real_id'] : null);
 $connections = MySpace::get_connections_to_course($user_id, $courseId, $session_id);
 $quote_simple = "'";
 
@@ -126,7 +126,7 @@ $result_to_print = convert_to_string($sql_result);
 
 echo Display::page_header(get_lang('DetailsStudentInCourse'));
 echo Display::page_subheader(
-    get_lang('User').': '.$userInfo['complete_name'].' - '.get_lang('Course').': '.$courseInfo['title'] . ' (' . $course_code . ')'
+    get_lang('User').': '.$userInfo['complete_name'].' - '.get_lang('Course').': '.$courseInfo['title'].' ('.$course_code.')'
 );
 
 $form->setDefaults(array('from' => $from, 'to' => $to));

+ 7 - 7
main/reports/modules/course.php

@@ -16,7 +16,7 @@ function reports_modules_course_init_forEachCourses($course_code, $course_id, $c
     array_push($reports_modules['course'],
         array(
             'keys_query' =>
-                'select ' . $course_id . ' as course_id, "' . $course_code . '" as course_code',
+                'select '.$course_id.' as course_id, "'.$course_code.'" as course_code',
             'values_query_function' => 'reports_modules_course_val'
         ));
 }
@@ -26,12 +26,12 @@ function reports_modules_course_val($course, $key_id)
     return array(
         'type' => 'sql',
         'sql' =>
-            'select ' . $key_id . ', user_id as uid, ' .
-            '-1 as session_id, -1 as attempt, null as score, ' .
-            'NULL as progress, ' .
-            '(sum(logout_course_date) - sum(login_course_date)) as time, null as ts from ' .
-            Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS) .
-            ' where c_id = ' . $course['real_id'] .
+            'select '.$key_id.', user_id as uid, '.
+            '-1 as session_id, -1 as attempt, null as score, '.
+            'NULL as progress, '.
+            '(sum(logout_course_date) - sum(login_course_date)) as time, null as ts from '.
+            Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS).
+            ' where c_id = '.$course['real_id'].
             ' group by user_id'
     );
 }

+ 3 - 3
main/reports/multiquery.lib.php

@@ -10,7 +10,7 @@ function multiquery_query($array)
         $result[$i]['mysql'] = mysql_query($array[$i]);
 
         if (!$result[$i]['mysql']) {
-            die("error in query $i : " . $array[$i]);
+            die("error in query $i : ".$array[$i]);
         }
 
         // fields
@@ -29,8 +29,8 @@ function multiquery_query($array)
     $numberOfResult = mysql_num_rows($result[0]['mysql']);
     for ($i = 1; $i < $result['num_queries']; $i++) {
         if ($numberOfResult != mysql_num_rows($result[$i]['mysql'])) {
-            die("wrong number of row: $numberOfResult vs " .
-                mysql_num_rows($result[$i]['mysql']) . " on query $i");
+            die("wrong number of row: $numberOfResult vs ".
+                mysql_num_rows($result[$i]['mysql'])." on query $i");
         }
     }
 

+ 50 - 50
main/tracking/courseLogCSV.php

@@ -53,13 +53,13 @@ if ($view == "0000100")
 if ($view == "00000010")
     $nameTools = get_lang('ScormAccess');
 
-$interbreadcrumb[] = array("url" => api_get_self() . "?view=0000000", "name" => get_lang('ToolName'));
+$interbreadcrumb[] = array("url" => api_get_self()."?view=0000000", "name" => get_lang('ToolName'));
 
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || api_is_drh();
 
 /* 	MAIN CODE */
 
-$title[0] = get_lang('StatsOfCourse') . " : " . $_course['official_code'];
+$title[0] = get_lang('StatsOfCourse')." : ".$_course['official_code'];
 
 
 $courseInfo = api_get_course_info($_course['official_code']);
@@ -91,40 +91,40 @@ if ($is_allowedToTrack) {
         $sql = "SELECT $TABLECOURSUSER.user_i, $table_user.lastname, $table_user.firstname
                 FROM $TABLECOURSUSER, $table_user
                 WHERE
-                    $TABLECOURSUSER.c_id = '" . api_get_course_int_id() . "' AND
+                    $TABLECOURSUSER.c_id = '".api_get_course_int_id()."' AND
                     $TABLECOURSUSER.user_id = $table_user.user_id AND
-                    $TABLECOURSUSER.relation_type<>" . COURSE_RELATION_TYPE_RRHH . "
+                    $TABLECOURSUSER.relation_type<>".COURSE_RELATION_TYPE_RRHH."
                 ORDER BY $table_user.lastname";
         $results = StatsUtils::getManyResults3Col($sql);
 
         //BUGFIX: get visual code instead of real course code. Scormpaths use the visual code... (should be fixed in future versions)
-        $sql = "SELECT visual_code FROM $TABLECOURSE WHERE code = '" . api_get_course_id() . "'";
+        $sql = "SELECT visual_code FROM $TABLECOURSE WHERE code = '".api_get_course_id()."'";
         $_course['visual_code'] = StatsUtils::getOneResult($sql);
 
         if (is_array($results)) {
             $line = '';
-            $title_line = get_lang('Name') . ";" . get_lang('FirstAccess') . ";" . get_lang('LastAccess') . ";" . get_lang('Visited') . "\n";
+            $title_line = get_lang('Name').";".get_lang('FirstAccess').";".get_lang('LastAccess').";".get_lang('Visited')."\n";
 
             for ($j = 0; $j < count($results); $j++) {
                 // BEGIN % visited
                 // sum of all items (= multiple learningpaths + SCORM imported paths)
-                $sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) FROM $tbl_learnpath_item_view iv " .
+                $sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) FROM $tbl_learnpath_item_view iv ".
                         "INNER JOIN $tbl_learnpath_view v
-                        ON iv.lp_view_id = v.id " .
+                        ON iv.lp_view_id = v.id ".
                         "WHERE
                         	v.c_id = $course_id AND
                         	iv.c_id = $course_id AND
-                		v.user_id = " . $results[$j][0];
+                		v.user_id = ".$results[$j][0];
                 $total_lpath_items = StatsUtils::getOneResult($sql);
 
                 // sum of all completed items (= multiple learningpaths + SCORM imported paths)
-                $sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) " .
-                        "FROM $tbl_learnpath_item_view iv " .
-                        "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id = v.id " .
+                $sql = "SELECT COUNT(DISTINCT(iv.lp_item_id)) ".
+                        "FROM $tbl_learnpath_item_view iv ".
+                        "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id = v.id ".
                         "WHERE
                         	v.c_id = $course_id AND
                         	iv.c_id = $course_id AND
-                        	v.user_id = " . $results[$j][0] . " " .
+                        	v.user_id = ".$results[$j][0]." ".
                         "AND (status = 'completed' OR status='passed')";
                 $total_lpath_items_completed = StatsUtils::getOneResult($sql);
 
@@ -135,23 +135,23 @@ if ($is_allowedToTrack) {
                 // BEGIN first/last access
                 // first access
                 $sql = "SELECT access_date FROM $TABLETRACK_ACCESS_2
-                        WHERE access_user_id = '" . $results[$j][0] . "' AND c_id = '" . $courseId . "' AND access_tool = 'learnpath' AND access_session_id = '" . api_get_session_id() . "'
+                        WHERE access_user_id = '".$results[$j][0]."' AND c_id = '".$courseId."' AND access_tool = 'learnpath' AND access_session_id = '".api_get_session_id()."'
                         ORDER BY access_id ASC LIMIT 1";
                 $first_access = StatsUtils::getOneResult($sql);
                 $first_access = empty($first_access) ? "-" : date('d.m.y', strtotime($first_access));
 
                 // last access
-                $sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = '" . $results[$j][0] . "' AND c_id = '" . $courseId . "' AND access_tool = 'learnpath'";
+                $sql = "SELECT access_date FROM $TABLETRACK_ACCESS WHERE access_user_id = '".$results[$j][0]."' AND c_id = '".$courseId."' AND access_tool = 'learnpath'";
                 $last_access = StatsUtils::getOneResult($sql);
                 $last_access = empty($last_access) ? "-" : date('d.m.y', strtotime($last_access));
                 // END first/last access
                 // BEGIN presentation of data
-                $line .= $results[$j][1] . " " . $results[$j][2] . ";" . $first_access . ";" . $last_access . ";" . $lpath_pct_completed . "\n";
+                $line .= $results[$j][1]." ".$results[$j][2].";".$first_access.";".$last_access.";".$lpath_pct_completed."\n";
 
                 // END presentation of data
             }
         } else {
-            $line = get_lang('NoResult') . "\n";
+            $line = get_lang('NoResult')."\n";
         }
     }
 
@@ -163,9 +163,9 @@ if ($is_allowedToTrack) {
 
         $sql = "SELECT count(*)
                 FROM $TABLECOURSUSER
-                WHERE c_id = '" . api_get_course_int_id() . "' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . "";
+                WHERE c_id = '".api_get_course_int_id()."' AND relation_type<>".COURSE_RELATION_TYPE_RRHH."";
         $count = StatsUtils::getOneResult($sql);
-        $title_line = get_lang('CountUsers') . " ; " . $count . "\n";
+        $title_line = get_lang('CountUsers')." ; ".$count."\n";
     }
 
     /* 	Access to this course */
@@ -183,7 +183,7 @@ if ($is_allowedToTrack) {
                     AND access_tool IS NULL";
         $count = StatsUtils::getOneResult($sql);
 
-        $line .= get_lang('CountToolAccess') . " ; " . $count . "\n";
+        $line .= get_lang('CountToolAccess')." ; ".$count."\n";
 
         // last 31 days
         $sql = "SELECT count(*)
@@ -193,7 +193,7 @@ if ($is_allowedToTrack) {
                     AND access_tool IS NULL";
         $count = StatsUtils::getOneResult($sql);
 
-        $line .= get_lang('Last31days') . " ; " . $count . "\n";
+        $line .= get_lang('Last31days')." ; ".$count."\n";
 
         // last 7 days
         $sql = "SELECT count(*)
@@ -203,7 +203,7 @@ if ($is_allowedToTrack) {
                     AND access_tool IS NULL";
         $count = StatsUtils::getOneResult($sql);
 
-        $line .= get_lang('Last7days') . " ; " . $count . "\n";
+        $line .= get_lang('Last7days')." ; ".$count."\n";
 
         // today
         $sql = "SELECT count(*)
@@ -212,7 +212,7 @@ if ($is_allowedToTrack) {
                     AND ( access_date > CURDATE() )
                     AND access_tool IS NULL";
         $count = StatsUtils::getOneResult($sql);
-        $line .= get_lang('ThisDay') . " ; " . $count . "\n";
+        $line .= get_lang('ThisDay')." ; ".$count."\n";
     }
 
     /* 	Tools */
@@ -221,7 +221,7 @@ if ($is_allowedToTrack) {
         $tempView[2] = '0';
         $title[1] = $nameTools;
         $line = '';
-        $title_line = get_lang('ToolTitleToolnameColumn') . ";" . get_lang('ToolTitleUsersColumn') . ";" . get_lang('ToolTitleCountColumn') . "\n";
+        $title_line = get_lang('ToolTitleToolnameColumn').";".get_lang('ToolTitleUsersColumn').";".get_lang('ToolTitleCountColumn')."\n";
 
         $sql = "SELECT access_tool, COUNT(DISTINCT access_user_id),count( access_tool )
                 FROM $TABLETRACK_ACCESS
@@ -233,10 +233,10 @@ if ($is_allowedToTrack) {
 
         if (is_array($results)) {
             for ($j = 0; $j < count($results); $j++) {
-                $line .= $results[$j][0] . "/" . get_lang($results[$j][0]) . ";" . $results[$j][1] . ";" . $results[$j][2] . "\n";
+                $line .= $results[$j][0]."/".get_lang($results[$j][0]).";".$results[$j][1].";".$results[$j][2]."\n";
             }
         } else {
-            $line = get_lang('NoResult') . "\n";
+            $line = get_lang('NoResult')."\n";
         }
     }
 
@@ -258,14 +258,14 @@ if ($is_allowedToTrack) {
 
         $title[1] = $nameTools;
         $line = '';
-        $title_line = get_lang('LinksTitleLinkColumn') . ";" . get_lang('LinksTitleUsersColumn') . ";" . get_lang('LinksTitleCountColumn') . "\n";
+        $title_line = get_lang('LinksTitleLinkColumn').";".get_lang('LinksTitleUsersColumn').";".get_lang('LinksTitleCountColumn')."\n";
 
         if (is_array($results)) {
             for ($j = 0; $j < count($results); $j++) {
-                $line .= $results[$j][1] . "'>" . $results[$j][0] . ";" . $results[$j][2] . ";" . $results[$j][3] . "\n";
+                $line .= $results[$j][1]."'>".$results[$j][0].";".$results[$j][2].";".$results[$j][3]."\n";
             }
         } else {
-            $line = get_lang('NoResult') . "\n";
+            $line = get_lang('NoResult')."\n";
         }
     }
 
@@ -284,13 +284,13 @@ if ($is_allowedToTrack) {
 
         $title[1] = $nameTools;
         $line = '';
-        $title_line = get_lang('DocumentsTitleDocumentColumn') . ";" . get_lang('DocumentsTitleUsersColumn') . ";" . get_lang('DocumentsTitleCountColumn') . "\n";
+        $title_line = get_lang('DocumentsTitleDocumentColumn').";".get_lang('DocumentsTitleUsersColumn').";".get_lang('DocumentsTitleCountColumn')."\n";
         if (is_array($results)) {
             for ($j = 0; $j < count($results); $j++) {
-                $line .= $results[$j][0] . ";" . $results[$j][1] . ";" . $results[$j][2] . "\n";
+                $line .= $results[$j][0].";".$results[$j][1].";".$results[$j][2]."\n";
             }
         } else {
-            $line = get_lang('NoResult') . "\n";
+            $line = get_lang('NoResult')."\n";
         }
     }
 
@@ -318,10 +318,10 @@ if ($is_allowedToTrack) {
                 //echo "<a href='".api_get_self()."?view=".$view."&scormcontopen=".$ar['id']."' class='specialLink'>$lp_title</a>";
                 if ($ar['id'] == $scormcontopen) { //have to list the students here
                     $contentId = $ar['id'];
-                    $sql2 = "SELECT u.user_id, u.lastname, u.firstname " .
-                            "FROM  $tbl_learnpath_view sd " .
-                            "INNER JOIN $table_user u " .
-                            "ON u.user_id = sd.user_id " .
+                    $sql2 = "SELECT u.user_id, u.lastname, u.firstname ".
+                            "FROM  $tbl_learnpath_view sd ".
+                            "INNER JOIN $table_user u ".
+                            "ON u.user_id = sd.user_id ".
                             "WHERE sd.c_id = $course_id AND sd.lp_id=$contentId group by u.user_id";
                     //error_log($sql2,0);
                     $result2 = Database::query($sql2);
@@ -333,28 +333,28 @@ if ($is_allowedToTrack) {
                         while ($ar2 != '') {
 
                             if (isset($_REQUEST["scormstudentopen"]) && $ar2['user_id'] == $scormstudentopen) {
-                                $line .= $ar['id'] . " " . $ar2['user_id'] . " " . api_get_person_name($ar2['firstname'], $ar2['lastname']);
+                                $line .= $ar['id']." ".$ar2['user_id']." ".api_get_person_name($ar2['firstname'], $ar2['lastname']);
                             } else {
-                                $line .= $ar['id'] . " " . $ar2['user_id'] . " " . api_get_person_name($ar2['firstname'], $ar2['lastname']);
+                                $line .= $ar['id']." ".$ar2['user_id']." ".api_get_person_name($ar2['firstname'], $ar2['lastname']);
                             }
 
                             if ($ar2['user_id'] == $scormstudentopen) { //have to list the student's results
                                 $studentId = $ar2['user_id'];
-                                $sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time " .
-                                        "FROM $tbl_learnpath_item i " .
-                                        "INNER JOIN $tbl_learnpath_item_view iv ON i.id=iv.lp_item_id " .
-                                        "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id=v.id " .
+                                $sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time ".
+                                        "FROM $tbl_learnpath_item i ".
+                                        "INNER JOIN $tbl_learnpath_item_view iv ON i.id=iv.lp_item_id ".
+                                        "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id=v.id ".
                                         "WHERE 	i.c_id = $course_id AND
                                         		iv.c_id = $course_id AND
                                         		v.c_id = $course_id AND
                                 				v.user_id=$studentId and v.lp_id=$contentId ORDER BY v.id, i.id";
                                 $result3 = Database::query($sql3);
                                 $ar3 = Database::fetch_array($result3);
-                                $title_line .= get_lang('ScormTitleColumn') . ";" . get_lang('ScormStatusColumn') . ";" . get_lang('ScormScoreColumn') . ";" . get_lang('ScormTimeColumn');
+                                $title_line .= get_lang('ScormTitleColumn').";".get_lang('ScormStatusColumn').";".get_lang('ScormScoreColumn').";".get_lang('ScormTimeColumn');
                                 while ($ar3['status'] != '') {
                                     require_once '../lp/learnpathItem.class.php';
                                     $time = learnpathItem::getScormTimeFromParameter('php', $ar3['total_time']);
-                                    $line .= $title . ";" . $ar3['status'] . ";" . $ar3['score'] . ";" . $time;
+                                    $line .= $title.";".$ar3['status'].";".$ar3['score'].";".$time;
                                     $ar3 = Database::fetch_array($result3);
                                 }
                             }
@@ -374,23 +374,23 @@ if ($is_allowedToTrack) {
      * Export to a CSV file
      * Force the browser to save the file instead of opening it.
      */
-    $len = strlen($title_line . $line);
+    $len = strlen($title_line.$line);
     header('Content-type: application/octet-stream');
     //header('Content-Type: application/force-download');
-    header('Content-length: ' . $len);
-    $filename = api_html_entity_decode(str_replace(":", "", str_replace(" ", "_", $title[0] . '_' . $title[1] . '.csv')));
+    header('Content-length: '.$len);
+    $filename = api_html_entity_decode(str_replace(":", "", str_replace(" ", "_", $title[0].'_'.$title[1].'.csv')));
     $filename = api_replace_dangerous_char($filename);
     if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
-        header('Content-Disposition: filename= ' . $filename);
+        header('Content-Disposition: filename= '.$filename);
     } else {
-        header('Content-Disposition: attachment; filename= ' . $filename);
+        header('Content-Disposition: attachment; filename= '.$filename);
     }
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
         header('Pragma: ');
         header('Cache-Control: ');
         header('Cache-Control: public'); // IE cannot download from sessions without a cache
     }
-    header('Content-Description: ' . $filename);
+    header('Content-Description: '.$filename);
     header('Content-transfer-encoding: binary');
 
     echo api_html_entity_decode($title_line, ENT_COMPAT);

+ 25 - 25
main/tracking/logins_details.php

@@ -75,13 +75,13 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
     // check if uid is tutor of this group
     $courseId = api_get_course_int_id();
 
-    if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
+    if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
         if ($is_allowedToTrackEverybodyInCourse) {
             $sql = "SELECT u.firstname,u.lastname, u.email
                     FROM $TABLECOURSUSER cu , $TABLEUSER u
                     WHERE
                         cu.user_id = u.user_id AND
-                        cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
+                        cu.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND
                         cu.c_id = '$courseId' AND
                         u.user_id = '$uInfo'";
         } else {
@@ -97,21 +97,21 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
             $res[2] == "" ? $res2 = get_lang('NoEmail') : $res2 = Display::encrypted_mailto_link($res[2]);
 
             echo "<tr><td>";
-            echo $informationsAbout . " : <br>";
+            echo $informationsAbout." : <br>";
             echo "<ul>\n"
-            . "<li>" . get_lang('FirstName') . " : " . $res[0] . "</li>\n"
-            . "<li>" . get_lang('LastName') . " : " . $res[1] . "</li>\n"
-            . "<li>" . get_lang('Email') . " : " . $res2 . "</li>\n"
+            . "<li>".get_lang('FirstName')." : ".$res[0]."</li>\n"
+            . "<li>".get_lang('LastName')." : ".$res[1]."</li>\n"
+            . "<li>".get_lang('Email')." : ".$res2."</li>\n"
             . "</ul>";
             echo "</td></tr>";
             /*             * ***** MENU ******* */
             echo "<tr>
                 <td>
-                [<a href='userLog.php?uInfo=$uInfo&view=$view'>" . get_lang('Back') . "</a>]
+                [<a href='userLog.php?uInfo=$uInfo&view=$view'>".get_lang('Back')."</a>]
         ";
             echo "  &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
-                [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodWeek') . "</a>]
-                [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodMonth') . "</a>]
+                [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodWeek')."</a>]
+                [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodMonth')."</a>]
                 &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
         ";
             switch ($period) {
@@ -120,8 +120,8 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
                     $previousReqDate = $reqdate - 7 * 86400;
                     $nextReqDate = $reqdate + 7 * 86400;
                     echo "
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousWeek') . "</a>]
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextWeek') . "</a>]
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousWeek')."</a>]
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextWeek')."</a>]
                 ";
                     break;
                 default:
@@ -132,8 +132,8 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
                     $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate));
                     $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate));
                     echo "
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousMonth') . "</a>]
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextMonth') . "</a>]
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousMonth')."</a>]
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextMonth')."</a>]
                 ";
                     break;
             }
@@ -153,7 +153,7 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
                         AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
                         GROUP BY DAYOFMONTH(access_date)
                         ORDER BY access_date ASC";
-                $displayedDate = $MonthsLong[date("n", $reqdate) - 1] . date(" Y", $reqdate);
+                $displayedDate = $MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate);
                 break;
             case "week" :
                 $sql = "SELECT access_date
@@ -165,24 +165,24 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
                         GROUP BY DAYOFMONTH(access_date)
                         ORDER BY access_date ASC";
                 $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate)));
-                $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)) ));
-                $displayedDate = get_lang('From') . " " . date("d ", $weeklowreqdate) . $MonthsLong[date("n", $weeklowreqdate) - 1] . date(" Y", $weeklowreqdate)
-                        . " " . get_lang('To') . " " . date("d ", $weekhighreqdate) . $MonthsLong[date("n", $weekhighreqdate) - 1] . date(" Y", $weekhighreqdate);
+                $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate))));
+                $displayedDate = get_lang('From')." ".date("d ", $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate) - 1].date(" Y", $weeklowreqdate)
+                        . " ".get_lang('To')." ".date("d ", $weekhighreqdate).$MonthsLong[date("n", $weekhighreqdate) - 1].date(" Y", $weekhighreqdate);
                 break;
         }
         echo "<tr><td>";
         $results = StatsUtils::getManyResults1Col($sql);
         /*             * * display of the displayed period  ** */
         echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' align=center>";
-        echo "<td bgcolor='#E6E6E6'>" . $displayedDate . "</td>";
+        echo "<td bgcolor='#E6E6E6'>".$displayedDate."</td>";
         if (is_array($results)) {
             for ($j = 0; $j < sizeof($results); $j++) {
                 $beautifulDateTime = api_convert_and_format_date($results[$j], null, date_default_timezone_get());
                 echo "<tr>";
-                echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>";
+                echo "<td style='padding-left : 40px;' valign='top'>".$beautifulDateTime."</td>";
                 echo"</tr>";
                 // $limit is used to select only results between $results[$j] (current login) and next one
-                if ($j == ( sizeof($results) - 1 ))
+                if ($j == (sizeof($results) - 1))
                     $limit = date("Y-m-d H:i:s", $nextReqDate);
                 else
                     $limit = $results[$j + 1];
@@ -192,8 +192,8 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
                         FROM $TABLETRACK_ACCESS
                         WHERE access_user_id = $uInfo
                             AND access_tool IS NOT NULL
-                            AND access_date > '" . $results[$j] . "'
-                            AND access_date < '" . $limit . "'
+                            AND access_date > '".$results[$j]."'
+                            AND access_date < '" . $limit."'
                             AND c_id = $courseId
                         GROUP BY access_tool
                         ORDER BY access_tool ASC";
@@ -204,8 +204,8 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
                     echo "<table width='50%' cellpadding='0' cellspacing='0' border='0'>\n";
                     for ($k = 0; $k < count($results2); $k++) {
                         echo "<tr>\n";
-                        echo "<td width='70%' style='padding-left : 60px;'>" . get_lang($results2[$k][0]) . "</td>\n";
-                        echo "<td width='30%' align='right' style='padding-right : 40px'>" . $results2[$k][1] . " " . get_lang('Visits') . "</td>\n";
+                        echo "<td width='70%' style='padding-left : 60px;'>".get_lang($results2[$k][0])."</td>\n";
+                        echo "<td width='30%' align='right' style='padding-right : 40px'>".$results2[$k][1]." ".get_lang('Visits')."</td>\n";
                         echo "</tr>";
                     }
                     echo "</table>\n";
@@ -215,7 +215,7 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
             }
         } else {
             echo "<tr>";
-            echo "<td colspan='2' bgcolor='#eeeeee'>" . get_lang('NoResult') . "</td>";
+            echo "<td colspan='2' bgcolor='#eeeeee'>".get_lang('NoResult')."</td>";
             echo "</tr>";
         }
         echo "</table>";

+ 17 - 17
main/webservices/additional_webservices.php

@@ -28,7 +28,7 @@ function wsConvertPpt($pptData)
     }
     $fileData = $pptData['file_data'];
     $dataInfo = pathinfo($pptData['file_name']);
-    $fileName =  basename($pptData['file_name'], '.' . $dataInfo['extension']);
+    $fileName = basename($pptData['file_name'], '.'.$dataInfo['extension']);
     $fullFileName = $pptData['file_name'];
     $size = $pptData['service_ppt2lp_size'];
     $w = '800';
@@ -38,8 +38,8 @@ function wsConvertPpt($pptData)
     }
 
     $tempArchivePath = api_get_path(SYS_ARCHIVE_PATH);
-    $tempPath = $tempArchivePath . 'wsConvert/' . $fileName . '/';
-    $tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/';
+    $tempPath = $tempArchivePath.'wsConvert/'.$fileName.'/';
+    $tempPathNewFiles = $tempArchivePath.'wsConvert/'.$fileName.'-n/';
 
     $oldumask = umask(0);
     //$perms = api_get_permissions_for_new_directories();
@@ -49,13 +49,13 @@ function wsConvertPpt($pptData)
     pptConverterDirectoriesCreate($tempPath, $tempPathNewFiles, $fileName, $perms);
 
     $file = base64_decode($fileData);
-    file_put_contents($tempPath . $fullFileName, $file);
+    file_put_contents($tempPath.$fullFileName, $file);
 
     $cmd = pptConverterGetCommandBaseParams();
-    $cmd .= ' -w ' . $w . ' -h ' . $h . ' -d oogie "' . $tempPath . $fullFileName.'"  "' . $tempPathNewFiles . $fileName . '.html"';
+    $cmd .= ' -w '.$w.' -h '.$h.' -d oogie "'.$tempPath.$fullFileName.'"  "'.$tempPathNewFiles.$fileName.'.html"';
 
     //$perms = api_get_permissions_for_new_files();
-    chmod($tempPathNewFiles . $fileName, $perms);
+    chmod($tempPathNewFiles.$fileName, $perms);
 
     $files = array();
     $return = 0;
@@ -67,7 +67,7 @@ function wsConvertPpt($pptData)
         if (is_array($files) && !empty($files)) {
             foreach ($files as $file) {
                 $imageData = explode('||', $file);
-                $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1]));
+                $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles.$fileName.'/'.$imageData[1]));
             }
         }
         $data = array(
@@ -93,7 +93,7 @@ function wsConvertPpt($pptData)
  */
 function deleteDirectory($directoryPath)
 {
-    $files = array_diff(scandir($directoryPath), array('.','..'));
+    $files = array_diff(scandir($directoryPath), array('.', '..'));
     foreach ($files as $file) {
         if (is_dir("$directoryPath/$file")) {
             deleteDirectory("$directoryPath/$file");
@@ -121,8 +121,8 @@ function pptConverterDirectoriesCreate($tempPath, $tempPathNewFiles, $fileName,
     if (!is_dir($tempPathNewFiles)) {
         mkdir($tempPathNewFiles, $perms, true);
     }
-    if (!is_dir($tempPathNewFiles . $fileName)) {
-        mkdir($tempPathNewFiles . $fileName, $perms, true);
+    if (!is_dir($tempPathNewFiles.$fileName)) {
+        mkdir($tempPathNewFiles.$fileName, $perms, true);
     }
 }
 
@@ -133,16 +133,16 @@ function pptConverterDirectoriesCreate($tempPath, $tempPathNewFiles, $fileName,
 function pptConverterGetCommandBaseParams()
 {
     if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
-        $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
-        $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
-        $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter';
+        $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
+        $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar';
+        $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$classPath.'" DokeosConverter';
     } else {
-        $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
+        $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
         $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
-        $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter';
+        $cmd = 'cd '.$converterPath.' && java '.$classPath.' DokeosConverter';
     }
 
-    $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
+    $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
     return $cmd;
 }
 
@@ -151,7 +151,7 @@ $webPath = api_get_path(WEB_PATH);
 $webCodePath = api_get_path(WEB_CODE_PATH);
 $options = array(
     'uri' => $webPath,
-    'location' => $webCodePath . 'webservices/additional_webservices.php'
+    'location' => $webCodePath.'webservices/additional_webservices.php'
 );
 
 $soapServer = new SoapServer(NULL, $options);

+ 2 - 2
main/webservices/api/v2.php

@@ -163,8 +163,8 @@ try {
             $restResponse->setData($data);
             break;
         case Rest::SAVE_COURSE_NOTEBOOK:
-            $title = !empty($_POST['title'])? $_POST['title'] : null;
-            $text = !empty($_POST['text'])? $_POST['text'] : null;
+            $title = !empty($_POST['title']) ? $_POST['title'] : null;
+            $text = !empty($_POST['text']) ? $_POST['text'] : null;
             $data = $restApi->saveCourseNotebook($title, $text);
             $restResponse->setData($data);
             break;

+ 5 - 5
main/work/edit.php

@@ -2,7 +2,7 @@
 /* For licensing terms, see /license.txt */
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
+$current_course_tool = TOOL_STUDENTPUBLICATION;
 
 api_protect_course_script(true);
 
@@ -48,7 +48,7 @@ $check = Security::check_token('post');
 $token = Security::get_token();
 
 $student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
-$has_ended   = false;
+$has_ended = false;
 $is_author = false;
 $work_item = get_work_data_by_id($item_id);
 
@@ -217,7 +217,7 @@ $form->addButtonUpdate($text);
 
 $form->setDefaults($defaults);
 $_course = api_get_course_info();
-$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'] . '/';
+$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH).$_course['path'].'/';
 
 $succeed = false;
 if ($form->validate()) {
@@ -238,7 +238,7 @@ if ($form->validate()) {
             $description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
 
             $add_to_update = null;
-            if ($is_allowed_to_edit && ($_POST['qualification'] !='' )) {
+            if ($is_allowed_to_edit && ($_POST['qualification'] != '')) {
                 /*$add_to_update = ', qualificator_id ='."'".api_get_user_id()."', ";
                 $add_to_update .= ' qualification = '."'".api_float_val($_POST['qualification'])."',";
                 $add_to_update .= ' date_of_qualification = '."'".api_get_utc_datetime()."'";*/
@@ -264,7 +264,7 @@ if ($form->validate()) {
                     'error'
                 ));
             } else {
-                $sql = "UPDATE  " . $work_table . "
+                $sql = "UPDATE  ".$work_table."
                         SET	title = '".Database::escape_string($title)."',
                             description = '".Database::escape_string($description)."'
                             ".$add_to_update."

+ 1 - 1
main/work/upload_from_template.php

@@ -4,7 +4,7 @@
 use ChamiloSession as Session;
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
+$current_course_tool = TOOL_STUDENTPUBLICATION;
 
 api_protect_course_script(true);
 

+ 21 - 21
plugin/dashboard/block_daily/block_daily.class.php

@@ -72,19 +72,19 @@ class BlockDaily extends Block
         $data = array();
         $content = $this->get_content_html();
         $html = '<div class="panel panel-default" id="intro">
-		                <div class="panel-heading">' . get_lang('GradebookAndAttendances') . '
+		                <div class="panel-heading">' . get_lang('GradebookAndAttendances').'
 		                    <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\'' . addslashes(
                 api_htmlentities(
                     get_lang('ConfirmYourChoice'),
                     ENT_QUOTES,
                     $charset
                 )
-            ) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">
+            ).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
                     <em class="fa fa-times"></em>
                         </a></div>
 		                </div>
 		                <div class="panel-body">
-		                   ' . $content . '
+		                   ' . $content.'
 		                </div>
 		            </div>
 				';
@@ -102,17 +102,17 @@ class BlockDaily extends Block
     {
         $course_data = $this->get_course_information_data();
         //$content = '<div style="margin:10px;">';
-        $content = '<h4>' . get_lang(
+        $content = '<h4>'.get_lang(
                 'YourCourseList'
-            ) . '</h4>';
+            ).'</h4>';
         $data_table = null;
         if (!empty($course_data)) {
             $data_table .= '<table class="data_table" width:"95%">';
             $data_table .= '<tr>
-	    						<th>' . get_lang('CourseTitle') . '</th>
-	    						<th width="20%">' . get_lang('NbStudents') . '</th>
-	    						<th width="20%">' . get_lang('Evaluation') . '</th>
-	    						<th width="20%">' . get_lang('ToolAttendance') . '</th>
+	    						<th>' . get_lang('CourseTitle').'</th>
+	    						<th width="20%">' . get_lang('NbStudents').'</th>
+	    						<th width="20%">' . get_lang('Evaluation').'</th>
+	    						<th width="20%">' . get_lang('ToolAttendance').'</th>
 	    					</tr>';
             $i = 1;
             foreach ($course_data as $course) {
@@ -121,12 +121,12 @@ class BlockDaily extends Block
                 } else {
                     $class_tr = 'row_even';
                 }
-                $data_table .= '<tr class="' . $class_tr . '">';
+                $data_table .= '<tr class="'.$class_tr.'">';
                 if (!isset($course[3])) {
                     $course[3] = get_lang('NotAvailable');
                 }
                 foreach ($course as $cell) {
-                    $data_table .= '<td align="right">' . $cell . '</td>';
+                    $data_table .= '<td align="right">'.$cell.'</td>';
                 }
                 $data_table .= '</tr>';
                 $i++;
@@ -138,7 +138,7 @@ class BlockDaily extends Block
         $content .= $data_table;
         if (!empty($course_data)) {
             $content .= '<div style="text-align:right;margin-top:10px;">
-            <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/course.php">' . get_lang('SeeMore') . '</a></div>';
+            <a href="' . api_get_path(WEB_CODE_PATH).'mySpace/course.php">'.get_lang('SeeMore').'</a></div>';
         }
         //$content .= '</div>';
         return $content;
@@ -176,7 +176,7 @@ class BlockDaily extends Block
             $table_course = Database::get_course_table(TABLE_ATTENDANCE);
 
             $sql = "SELECT id, name, attendance_qualify_max FROM $table_course
-                    WHERE c_id = " . $course_info['real_id'] . " AND active = 1 AND session_id = 0";
+                    WHERE c_id = ".$course_info['real_id']." AND active = 1 AND session_id = 0";
             $rs = Database::query($sql);
             $attendance = array();
             $attendances = array();
@@ -188,7 +188,7 @@ class BlockDaily extends Block
                 $attendance['course_code'] = $course_info['code'];
 
                 if ($attendance['done'] != '0') {
-                    $attendances[] = '<a href="' . api_get_path(WEB_PATH).'main/attendance/index.php?cidReq=' . $attendance['course_code'] . '&action=attendance_sheet_print&attendance_id=' . $attendance['id']. '">' . Display::return_icon('printmgr.gif', get_lang('Print')).'</a>';
+                    $attendances[] = '<a href="'.api_get_path(WEB_PATH).'main/attendance/index.php?cidReq='.$attendance['course_code'].'&action=attendance_sheet_print&attendance_id='.$attendance['id'].'">'.Display::return_icon('printmgr.gif', get_lang('Print')).'</a>';
                 } else {
                     $attendances[] = get_lang("NotAvailable");
                 }
@@ -200,7 +200,7 @@ class BlockDaily extends Block
             // Number of students
 
             $sql = "SELECT user_id FROM $tbl_course_user as course_rel_user
-                    WHERE course_rel_user.status=" . STUDENT . " AND course_rel_user.c_id=$courseId";
+                    WHERE course_rel_user.status=".STUDENT." AND course_rel_user.c_id=$courseId";
             $rs = Database::query($sql);
             $users = array();
             while ($row = Database::fetch_array($rs)) {
@@ -211,11 +211,11 @@ class BlockDaily extends Block
             }
 
             if (!empty($tematic_advance)) {
-                $tematic_advance_progress = '<a title="' . get_lang(
+                $tematic_advance_progress = '<a title="'.get_lang(
                         'GoToThematicAdvance'
-                    ) . '" href="' . api_get_path(
+                    ).'" href="'.api_get_path(
                         WEB_CODE_PATH
-                    ) . 'attendance/index.php?cidReq=' . $course_code . '&action=attendance_sheet_print&attendance_id=">' . $tematic_advance . '%</a>';
+                    ).'attendance/index.php?cidReq='.$course_code.'&action=attendance_sheet_print&attendance_id=">'.$tematic_advance.'%</a>';
             } else {
                 $tematic_advance_progress = '0%';
             }
@@ -224,8 +224,8 @@ class BlockDaily extends Block
             $tbl_grade_categories = Database::get_main_table(
                 TABLE_MAIN_GRADEBOOK_CATEGORY
             );
-            $sql = "SELECT id from " . $tbl_grade_categories . "
-                    WHERE course_code ='" . $course_code . "'";
+            $sql = "SELECT id from ".$tbl_grade_categories."
+                    WHERE course_code ='" . $course_code."'";
             $rs = Database::query($sql);
             $category = null;
             while ($row = Database::fetch_array($rs)) {
@@ -238,7 +238,7 @@ class BlockDaily extends Block
                 if (count($eval) > 0) {
                     $i = 0;
                     foreach ($eval as $item) {
-                        $score .= '<a href="' . api_get_path(WEB_PATH).'main/gradebook/gradebook_view_result.php?export=pdf&cat_code=' . $cat[0]->get_id() . '&official_code=' . $cat[0]->get_course_code() . '&selecteval=' . $item->get_id(). '">' . $item->get_name() . '</a>';
+                        $score .= '<a href="'.api_get_path(WEB_PATH).'main/gradebook/gradebook_view_result.php?export=pdf&cat_code='.$cat[0]->get_id().'&official_code='.$cat[0]->get_course_code().'&selecteval='.$item->get_id().'">'.$item->get_name().'</a>';
                         if (count($eval) - 1 != $i) {
                             $score .= ', ';
                         }

+ 5 - 5
plugin/dashboard/block_global_info/block_global_info.class.php

@@ -29,10 +29,10 @@ class BlockGlobalInfo extends Block
     /**
      * Constructor
      */
-    public function __construct ($user_id)
+    public function __construct($user_id)
     {
-        $this->user_id 		= $user_id;
-        $this->path 		= 'block_global_info';
+        $this->user_id = $user_id;
+        $this->path = 'block_global_info';
         if ($this->is_block_visible_for_user($user_id)) {
             //$this->courses = CourseManager::get_courses_followed_by_drh($user_id);
         }
@@ -69,7 +69,7 @@ class BlockGlobalInfo extends Block
     	$html = '
     	            <div class="panel panel-default" id="intro">
     	                <div class="panel-heading">'.get_lang('GlobalPlatformInformation').'
-    	                    <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
+    	                    <div class="pull-right"><a class="btn btn-danger btn-xs" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">
     	                    <em class="fa fa-times"></em>
     	                    </a></div>
     	                </div>
@@ -98,7 +98,7 @@ class BlockGlobalInfo extends Block
              $data_table = '<table class="table table-bordered" width="95%">';
              $i = 1;
              foreach ($global_data as $data) {
-                 if ($i%2 == 0) {
+                 if ($i % 2 == 0) {
                      $class_tr = 'row_odd';
                  } else {
                      $class_tr = 'row_even';

+ 1 - 1
plugin/google_maps/lang/spanish.php

@@ -6,7 +6,7 @@ $strings['extra_field_name_help'] = "Ingrese aquí el nombre del campo o los cam
 <br><br>
 <img src='//maps.google.com/mapfiles/ms/icons/red-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/blue-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/green-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/yellow-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/purple-dot.png'>
 <br><br>
-siga el siguiente link para ver el mapa : <a href='". api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php'>" . api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php</a>";
+siga el siguiente link para ver el mapa : <a href='". api_get_path(WEB_PLUGIN_PATH)."google_maps/src/map_coordinates.php'>".api_get_path(WEB_PLUGIN_PATH)."google_maps/src/map_coordinates.php</a>";
 $strings['enable_api'] = "Activar API";
 $strings['api_key'] = "Api Key";
 $strings['extra_field_name'] = "Nombre del campo extra";

+ 11 - 11
src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php

@@ -74,14 +74,14 @@ class ChamiloApi
         $themeDir = \Template::getThemeDir($theme);
         $customLogoPath = "$themeDir/images/header-logo-custom$accessUrlId.png";
 
-        if (file_exists(api_get_path(SYS_PUBLIC_PATH) . "css/$customLogoPath")) {
-            return api_get_path(WEB_CSS_PATH) . $customLogoPath;
+        if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/$customLogoPath")) {
+            return api_get_path(WEB_CSS_PATH).$customLogoPath;
         }
 
         $originalLogoPath = "$themeDir/images/header-logo.png";
 
-        if (file_exists(api_get_path(SYS_CSS_PATH) . $originalLogoPath)) {
-            return api_get_path(WEB_CSS_PATH) . $originalLogoPath;
+        if (file_exists(api_get_path(SYS_CSS_PATH).$originalLogoPath)) {
+            return api_get_path(WEB_CSS_PATH).$originalLogoPath;
         }
 
         return null;
@@ -101,10 +101,10 @@ class ChamiloApi
         $siteName = api_get_setting('siteName');
 
         if ($logoPath === null) {
-            $headerLogo = \Display::url($siteName, api_get_path(WEB_PATH) . 'index.php');
+            $headerLogo = \Display::url($siteName, api_get_path(WEB_PATH).'index.php');
 
             if (!empty($institutionUrl) && !empty($institution)) {
-                $headerLogo .= ' - ' . \Display::url($institution, $institutionUrl);
+                $headerLogo .= ' - '.\Display::url($institution, $institutionUrl);
             }
 
             $courseInfo = api_get_course_info();
@@ -127,7 +127,7 @@ class ChamiloApi
 
         $image = \Display::img($logoPath, $institution, $imageAttributes);
 
-        return \Display::url($image, api_get_path(WEB_PATH) . 'index.php');
+        return \Display::url($image, api_get_path(WEB_PATH).'index.php');
     }
 
     /**
@@ -139,9 +139,9 @@ class ChamiloApi
     public static function stripGivenTags($string, $tags)
     {
         foreach ($tags as $tag) {
-            $string2 = preg_replace('#</' . $tag . '[^>]*>#i', ' ', $string);
+            $string2 = preg_replace('#</'.$tag.'[^>]*>#i', ' ', $string);
             if ($string2 != $string) {
-                $string = preg_replace('/<' . $tag . '[^>]*>/i', ' ', $string2);
+                $string = preg_replace('/<'.$tag.'[^>]*>/i', ' ', $string2);
             }
         }
 
@@ -162,9 +162,9 @@ class ChamiloApi
         sscanf($time, "%d:%d:%d", $hours, $minutes, $seconds);
         $timeSeconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes;
         if ($operation) {
-            $date->add(new \DateInterval('PT' . $timeSeconds . 'S'));
+            $date->add(new \DateInterval('PT'.$timeSeconds.'S'));
         } else {
-            $date->sub(new \DateInterval('PT' . $timeSeconds . 'S'));
+            $date->sub(new \DateInterval('PT'.$timeSeconds.'S'));
         }
 
         return $date->format('Y-m-d H:i:s');

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است