From 14488458e2175fead732e9a189a77032556af239 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 9 May 2017 08:13:30 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- main/admin/add_users_to_usergroup.php | 38 +- main/admin/configure_inscription.php | 32 +- main/admin/system_announcements.php | 18 +- main/admin/user_export.php | 34 +- main/auth/courses_controller.php | 37 +- main/exercise/TestCategory.php | 32 +- main/exercise/export/exercise_import.inc.php | 80 +-- main/exercise/tests_category.php | 16 +- main/exercise/unique_answer.class.php | 102 +-- main/forum/viewforum.php | 134 ++-- main/gradebook/lib/GradebookUtils.php | 174 ++--- main/inc/ajax/model.ajax.php | 80 +-- main/inc/lib/TicketManager.php | 96 +-- main/inc/lib/document.lib.php | 662 +++++++++--------- main/inc/lib/image.lib.php | 38 +- main/inc/lib/social.lib.php | 206 +++--- main/inc/lib/system_announcements.lib.php | 28 +- main/inc/lib/template.lib.php | 42 +- main/lp/lp_build.php | 28 +- main/mySpace/access_details.php | 4 +- main/reports/modules/course.php | 14 +- main/reports/multiquery.lib.php | 6 +- main/tracking/courseLogCSV.php | 100 +-- main/tracking/logins_details.php | 50 +- main/webservices/additional_webservices.php | 34 +- main/webservices/api/v2.php | 4 +- main/work/edit.php | 10 +- main/work/upload_from_template.php | 2 +- .../block_daily/block_daily.class.php | 42 +- .../block_global_info.class.php | 10 +- plugin/google_maps/lang/spanish.php | 2 +- .../CoreBundle/Component/Utils/ChamiloApi.php | 22 +- 32 files changed, 1088 insertions(+), 1089 deletions(-) diff --git a/main/admin/add_users_to_usergroup.php b/main/admin/add_users_to_usergroup.php index ddcd56746e..42866f9c4a 100755 --- a/main/admin/add_users_to_usergroup.php +++ b/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) { '; -$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 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 ''; ?> -
+ '.$tool_name.': '.$data['name'].''; 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 '

'.get_lang('FilterByUser').'

'; foreach ($new_field_list as $new_field) { echo $new_field['name']; @@ -354,7 +354,7 @@ if (is_array($extra_field_list)) { echo '  - - - - - @@ -419,7 +419,7 @@ echo Display::input('hidden', 'add_type', null); ?>
diff --git a/main/admin/configure_inscription.php b/main/admin/configure_inscription.php index debc5260ee..d6dc9ccebb 100755 --- a/main/admin/configure_inscription.php +++ b/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('{content}
'); $renderer->setCustomElementTemplate('{element}'); @@ -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)) { diff --git a/main/admin/system_announcements.php b/main/admin/system_announcements.php index bb7fd58353..c05b7332a2 100755 --- a/main/admin/system_announcements.php +++ b/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[] = "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')).""; - $row[] = "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')).""; - $row[] = "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')).""; + $row[] = "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')).""; + $row[] = "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')).""; + $row[] = "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')).""; $row[] = $announcement->lang; $row[] = "id."\">".Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL)." 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).""; $announcement_data[] = $row; diff --git a/main/admin/user_export.php b/main/admin/user_export.php index 726489b4c3..a7b146fa8d 100755 --- a/main/admin/user_export.php +++ b/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) { diff --git a/main/auth/courses_controller.php b/main/auth/courses_controller.php index 3cb802eb1e..f0796143df 100755 --- a/main/auth/courses_controller.php +++ b/main/auth/courses_controller.php @@ -396,13 +396,13 @@ class CoursesController $html .= ''; } else { if (!empty($categoryCourses)) { - $html .= ''; + ).'">'; $html .= "$categoryName ($categoryCourses)"; $html .= ''; } else { @@ -421,13 +421,13 @@ class CoursesController if ($code == $subCategory1Code) { $html .= "$subCategory1Name ($subCategory1Courses)"; } else { - $html .= ''; + ).'">'; $html .= "$subCategory1Name ($subCategory1Courses)"; $html .= ''; } @@ -445,13 +445,13 @@ class CoursesController if ($code == $subCategory2Code) { $html .= "$subCategory2Name ($subCategory2Courses)"; } else { - $html .= ''; + ).'">'; $html .= "$subCategory2Name ($subCategory2Courses)"; $html .= ''; } @@ -469,13 +469,13 @@ class CoursesController if ($code == $subCategory3Code) { $html .= "$subCategory3Name ($subCategory3Courses)"; } else { - $html .= ''; + ).'">'; $html .= "$subCategory3Name ($subCategory3Courses)"; $html .= ''; } @@ -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(), diff --git a/main/exercise/TestCategory.php b/main/exercise/TestCategory.php index 8bbe59ffb1..5f506bd4e2 100644 --- a/main/exercise/TestCategory.php +++ b/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 .= ''; $return .= ''; - $return .= ''; - $return .= ''; + $return .= ''; + $return .= ''; $emptyCategory = array( 'id' => '0', @@ -978,7 +978,7 @@ class TestCategory $return .= ''; $return .= ''; $return .= ''; } @@ -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 = "" . $nb_question_label . ""; + $nb_question_label = $nb_question == 1 ? $nb_question.' '.get_lang('Question') : $nb_question.' '.get_lang('Questions'); + $content = "".$nb_question_label.""; $content .= '
'; $content .= $category['description']; $content .= '
'; - $links = '' . - Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . ''; - $links .= ' '; - $links .= Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . ''; + $links = ''. + Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).''; + $links .= ' '; + $links .= Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; $html .= Display::panel($content, $category['title'].$links); } diff --git a/main/exercise/export/exercise_import.inc.php b/main/exercise/export/exercise_import.inc.php index e788f4981f..1af5f52619 100755 --- a/main/exercise/export/exercise_import.inc.php +++ b/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 .= ""; + $current_question_item_body .= ""; } 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 .= ""; + $current_question_item_body .= ""; } 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; diff --git a/main/exercise/tests_category.php b/main/exercise/tests_category.php index a310fafde5..60bdd4abe3 100755 --- a/main/exercise/tests_category.php +++ b/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 '
'; - echo '' . - Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . ''; + echo ''. + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).''; - echo '' . - Display::return_icon('new_folder.png', get_lang('AddACategory'), null, ICON_SIZE_MEDIUM) . ''; + echo ''. + Display::return_icon('new_folder.png', get_lang('AddACategory'), null, ICON_SIZE_MEDIUM).''; 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 '
'; echo "
"; - echo "
" . get_lang('QuestionCategory') . "
"; + echo "
".get_lang('QuestionCategory')."
"; } diff --git a/main/exercise/unique_answer.class.php b/main/exercise/unique_answer.class.php index 593c4fc6ae..d869637a75 100755 --- a/main/exercise/unique_answer.class.php +++ b/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 = ''; - $feedback_title = ''; + $comment_title = ''; + $feedback_title = ''; } else { - $comment_title = ''; + $comment_title = ''; } $html = '
' . get_lang('Categories') . '' . get_lang('Number') . '
'.get_lang('Categories').''.get_lang('Number').'
'; $value = isset($saved_categories) && isset($saved_categories[$cat_id]) ? $saved_categories[$cat_id]['count_questions'] : -1; - $return .= ''; + $return .= ''; $return .= '
' . get_lang('Comment') . '' . get_lang('Scenario') . ''.get_lang('Comment').''.get_lang('Scenario').'' . get_lang('Comment') . ''.get_lang('Comment').'
- - - - ' . $comment_title . ' - ' . $feedback_title . ' - + + + + ' . $comment_title.' + ' . $feedback_title.' + '; @@ -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( '', - 'counter[' . $i . ']' + 'counter['.$i.']' ); $renderer->setElementTemplate( '', - 'answer[' . $i . ']' + 'answer['.$i.']' ); $renderer->setElementTemplate( '', - 'comment[' . $i . ']' + 'comment['.$i.']' ); $renderer->setElementTemplate( '', - '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(''); } @@ -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 .= '
' . get_lang('Number') . ' ' . get_lang('True') . '' . get_lang('Answer') . '' . get_lang('Weighting') . '' . get_lang('Number').' ' . get_lang('True').'' . get_lang('Answer').'' . get_lang('Weighting').'
{error}
{element}
{error}
{element}
{error}
{element}
{error}
{element}
+ $header .= '
- - - '; - $header .= ''; + + + '; + $header .= ''; $header .= ''; 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); } } diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index ea5f188c64..f281cf0f64 100755 --- a/main/forum/viewforum.php +++ b/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 .= '

' . get_lang("Choice") . '' . get_lang("ExpectedChoice") . '' . get_lang("Answer") . '' . get_lang("Comment") . '' . get_lang("Choice").'' . get_lang("ExpectedChoice").'' . get_lang("Answer").''.get_lang("Comment").'
'; // The column headers (TODO: Make this sortable). $table_list .= ''; - $table_list .= ''; + $table_list .= ''; if ($listType == 'qualify') { - $table_list .= ''; + $table_list .= ''; } if (api_is_allowed_to_edit(null, true)) { - $table_list .= ''; + $table_list .= ''; } $table_list .= ''; $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 .= ''; if ($listType == 'qualify') { - $table_list .= ''; + $table_list .= ''; } if (api_is_allowed_to_edit(null, true)) { $current_qualify_thread = showQualify( @@ -313,20 +313,20 @@ if ( $_GET['id'] ); $table_list .= ''; + . Display::return_icon($icon_qualify, get_lang('Qualify')).''; } $counter_stdlist++; } } else { if ($listType === 'qualify') { - $table_list .= ''; + $table_list .= ''; } else { - $table_list .= ''; + $table_list .= ''; } } @@ -353,13 +353,13 @@ echo '
'; if ($origin != 'learnpath') { if (!empty($groupId)) { - echo '' + echo '' . Display::return_icon('back.png', get_lang('BackTo') - . ' ' . get_lang('Groups'), '', ICON_SIZE_MEDIUM) . ''; + . ' '.get_lang('Groups'), '', ICON_SIZE_MEDIUM).''; } else { echo ''.search_link().''; - echo '' + echo '' . Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM) . ''; } @@ -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 '' . Display::return_icon('new_thread.png', get_lang('NewTopic'), '', ICON_SIZE_MEDIUM) . ''; } else { $my_forum = strval(intval($my_forum)); - echo '' . Display::return_icon('new_thread.png', get_lang('NewTopic'), '', ICON_SIZE_MEDIUM) . ''; @@ -411,7 +411,7 @@ $html .= '
'; 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 = '' - . $row['thread_title'] . ''; + . Security::remove_XSS(urlencode($my_search)).'">' + . $row['thread_title'].''; $html = ''; - $html .= '
'; + $html .= '
'; $html .= '
'; $html .= '
'; $html .= '
'; @@ -496,7 +496,7 @@ if (is_array($threads)) { ); } - $html .= '
' . display_user_image($row['user_id'], $name, $origin) . '
'; + $html .= '
'.display_user_image($row['user_id'], $name, $origin).'
'; $html .= '
'; $html .= '
'; $html .= Display::tag( @@ -506,8 +506,8 @@ if (is_array($threads)) { 'class' => 'title' ) ); - $html .= '

'. get_lang('By') .' ' .$authorName.'

'; - $html .= '

' . api_convert_and_format_date($row['insert_date']) . '

'; + $html .= '

'.get_lang('By').' '.$authorName.'

'; + $html .= '

'.api_convert_and_format_date($row['insert_date']).'

'; 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 .= '
'; $html .= '
' . Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL) - . " {$row['thread_replies']} " . get_lang('Replies') . '
'; - $html .= Display::return_icon( + . " {$row['thread_replies']} ".get_lang('Replies').'
'; + $html .= Display::return_icon( 'post-forum.png', null, null, ICON_SIZE_SMALL - ) . ' ' . $row['thread_views'] . ' ' . get_lang('Views') . '
' . $newPost; + ).' '.$row['thread_views'].' '.get_lang('Views').'
'.$newPost; $html .= '
'; $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 . '
' . get_lang('By') . ' ' . display_user_link( + $last_post = $post_date.'
'.get_lang('By').' '.display_user_link( $last_post_info['poster_id'], $poster_info['complete_name'], '', @@ -561,7 +561,7 @@ if (is_array($threads)) { $html .= '
' . Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) - . ' ' . $last_post; + . ' '.$last_post; $html .= '
'; $html .= '
'; $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 .= '' - . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . ''; + . '&id_attach='.$id_attach.'">' + . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).''; 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.= '" - . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . ''; + . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; } $iconsEdit .= return_visible_invisible_icon( @@ -615,9 +615,9 @@ if (is_array($threads)) { 'gidReq' => api_get_group_id() ) ); - $iconsEdit .= '' + . '&action=move&thread='.$row['thread_id'].'">' . Display::return_icon('move.png', get_lang('MoveThread'), array(), ICON_SIZE_SMALL) . ''; } @@ -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 .= '' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . ''; + . '">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).''; } if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') { - $iconsEdit .= '' . Display::return_icon($icon_liststd, get_lang('StudentList'), array(), ICON_SIZE_SMALL) + . '">'.Display::return_icon($icon_liststd, get_lang('StudentList'), array(), ICON_SIZE_SMALL) . ''; } $html .= $iconsEdit; diff --git a/main/gradebook/lib/GradebookUtils.php b/main/gradebook/lib/GradebookUtils.php index 970ce8f71f..c59525bc2e 100644 --- a/main/gradebook/lib/GradebookUtils.php +++ b/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 .= '' . - Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ''. + Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).''; 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 .= ' ' . - Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).''; } else { - $modify_icons .= ' ' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).''; } - $modify_icons .= ' ' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).''; } else { - $modify_icons .= ' ' . - Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . ''; - $modify_icons .= ' ' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).''; + $modify_icons .= ' '.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).''; } } @@ -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 .= '' . + $modify_icons .= ''. Display::return_icon( 'edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL - ) . ''; + ).''; } } - $modify_icons .= '' . + $modify_icons .= ''. Display::return_icon( 'percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_SMALL - ) . ''; + ).''; - $modify_icons .= '' . + $modify_icons .= ''. Display::return_icon( 'stats.png', get_lang('FlatView'), '', ICON_SIZE_SMALL - ) . ''; - $modify_icons .= ' ' . + ).''; + $modify_icons .= ' '. Display::return_icon( - $visibility_icon . '.png', + $visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL - ) . ''; + ).''; 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 .= ' ' . - Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).''; } } @@ -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 = '' . - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . ''; + $modify_icons = ''. + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).''; } - $modify_icons .= ' ' . - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).''; if (api_is_allowed_to_edit(null, true)) { - $modify_icons .= ' ' . - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).''; } if ($is_locked && !api_is_platform_admin()) { - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); } else { - $modify_icons .= ' ' . - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''; } 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 = '' . - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . ''; + $modify_icons = ''. + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).''; } - $modify_icons .= ' ' . - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . ''; - $modify_icons .= ' ' . - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).''; + $modify_icons .= ' '. + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).''; //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 .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); } else { - $modify_icons .= ' ' . - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . ''; + $modify_icons .= ' '. + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''; } 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')) . '
' . get_lang('Detailed'); + $title = api_strtoupper(get_lang('Average')).'
'.get_lang('Detailed'); } else { - $title = api_strtoupper(get_lang('Average')) . '
' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')'; + $title = api_strtoupper(get_lang('Average')).'
'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')'; } } else { if ($parent_id == 0) { - $title = api_strtoupper(get_lang('Average')) . '
' . get_lang('Detailed'); + $title = api_strtoupper(get_lang('Average')).'
'.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']}" ]; } } diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php index 89dde62009..80f6f3dd49 100755 --- a/main/inc/ajax/model.ajax.php +++ b/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
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++; } } diff --git a/main/inc/lib/TicketManager.php b/main/inc/lib/TicketManager.php index f27e27944b..6316fdf1ff 100644 --- a/main/inc/lib/TicketManager.php +++ b/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 = '
' . get_lang('NamesAndLastNames') . ''.get_lang('NamesAndLastNames').'' . get_lang('Qualification') . ''.get_lang('Qualification').'' . get_lang('Qualify') . ''.get_lang('Qualify').'
'; + $table_list .= '
'; $table_list .= UserManager::getUserProfileLink($userInfo); $table_list .= '' . $row_student_list['qualify'] . '/' . $max_qualify . ''.$row_student_list['qualify'].'/'.$max_qualify.' - ' - . Display::return_icon($icon_qualify, get_lang('Qualify')) . '
' . get_lang('ThereIsNotQualifiedLearners') . '
'.get_lang('ThereIsNotQualifiedLearners').'
' . get_lang('ThereIsNotUnqualifiedLearners') . '
'.get_lang('ThereIsNotUnqualifiedLearners').'
- - + + - - + + - - + + - - + + - - + + - - + + - - + +
' . get_lang('User') . '' . $currentUserInfo['complete_name']. '' . get_lang('User').'' . $currentUserInfo['complete_name'].'
' . get_lang('Username') . '' . $currentUserInfo['username'] . '' . get_lang('Username').'' . $currentUserInfo['username'].'
' . get_lang('Email') . '' . $currentUserInfo['email'] . '' . get_lang('Email').'' . $currentUserInfo['email'].'
' . get_lang('Phone') . '' . $currentUserInfo['phone'] . '' . get_lang('Phone').'' . $currentUserInfo['phone'].'
' . get_lang('Date') . '' . api_convert_and_format_date($now, DATE_TIME_FORMAT_LONG) . '' . get_lang('Date').'' . api_convert_and_format_date($now, DATE_TIME_FORMAT_LONG).'
' . get_lang('Title') . '' . $subject . '' . get_lang('Title').'' . $subject.'
' . get_lang('Description') . '' . $content . '' . get_lang('Description').'' . $content.'
'; @@ -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 = '
-

' . get_lang('TicketWasThisAnswerSatisfying') . '

- - + $form = ' +

' . get_lang('TicketWasThisAnswerSatisfying').'

+ +
'; $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 = " {$userInfo['complete_name_with_username']} "; $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'] = " {$assignedUserInfo['complete_name_with_username']} "; } else { $row['assigned_last_user'] = get_lang('UnknownUser'); } } else { if ($row['status_id'] !== self::STATUS_FORWARDED) { - $row['assigned_last_user'] = '' . get_lang('ToBeAssigned') . ''; + $row['assigned_last_user'] = ''.get_lang('ToBeAssigned').''; } else { - $row['assigned_last_user'] = '' . get_lang('MessageResent') . ''; + $row['assigned_last_user'] = ''.get_lang('MessageResent').''; } } @@ -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')).'' . $row['code'] . ''; + $icon = Display::return_icon($img_source, get_lang('Info')).''.$row['code'].''; if ($isAdmin) { $ticket = array( @@ -1023,9 +1023,9 @@ class TicketManager '; }*/ if ($isAdmin) { - $ticket['0'] .= '   - ' . get_lang('Historial') . ' -
  
+ $ticket['0'] .= '  
+ '.get_lang('Historial').' +
  
  '; } $tickets[] = $ticket; @@ -1227,8 +1227,8 @@ class TicketManager } $userInfo = api_get_user_info($row['sys_insert_user_id']); - $row['user_url'] = ' - ' . $userInfo['complete_name']. ''; + $row['user_url'] = ' + ' . $userInfo['complete_name'].''; $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'] = " $completeName "; $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 . ' ' . $row2['filename'] . ' (' . $row2['size'] . ')'; + $archiveURL = $archiveURL = $webPath.'ticket/download.php?ticket_id='.$ticketId.'&file='; + $row2['attachment_link'] = $attach_icon.' '.$row2['filename'].' ('.$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'] = '' . - $assignuser['username'] . ''; + $row['assignuser'] = ''. + $assignuser['username'].''; } 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'] = '' . - $insertuser['username'] . ''; + $row['insertuser'] = ''. + $insertuser['username'].''; $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' diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index c974917910..6b17702d2e 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -288,7 +288,7 @@ class DocumentManager return true; } else { $tbl_document = Database::get_course_table(TABLE_DOCUMENT); - $tbl_item_property = $this_course . 'item_property'; + $tbl_item_property = $this_course.'item_property'; $doc_url = Database::escape_string($doc_url); $query = "SELECT 1 FROM $tbl_document AS docs,$tbl_item_property AS props WHERE @@ -337,18 +337,18 @@ class DocumentManager } header('Content-type: application/octet-stream'); - header('Content-length: ' . $len); + header('Content-length: '.$len); 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'); $res = fopen($full_file_name, 'r'); @@ -375,7 +375,7 @@ class DocumentManager } else { $encoding = @api_detect_encoding_html(file_get_contents($full_file_name)); if (!empty($encoding)) { - $content_type .= '; charset=' . $encoding; + $content_type .= '; charset='.$encoding; } } break; @@ -385,7 +385,7 @@ class DocumentManager } else { $encoding = @api_detect_encoding(strip_tags(file_get_contents($full_file_name))); if (!empty($encoding)) { - $content_type .= '; charset=' . $encoding; + $content_type .= '; charset='.$encoding; } } break; @@ -394,13 +394,13 @@ class DocumentManager header('Content-type: application/octet-stream'); break; } - header('Content-type: ' . $content_type); - header('Content-Length: ' . $len); + header('Content-type: '.$content_type); + header('Content-Length: '.$len); $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); if (strpos($user_agent, 'msie')) { - header('Content-Disposition: ; filename= ' . $filename); + header('Content-Disposition: ; filename= '.$filename); } else { - header('Content-Disposition: inline; filename= ' . $filename); + header('Content-Disposition: inline; filename= '.$filename); } if ($fixLinksHttpToHttps) { @@ -441,18 +441,18 @@ class DocumentManager header('Content-type: application/octet-stream'); //header('Content-Type: application/force-download'); - header('Content-length: ' . $len); + header('Content-length: '.$len); 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 $full_string; @@ -465,30 +465,30 @@ class DocumentManager $content_type = self::file_get_mime_type($filename); header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); switch ($content_type) { case 'text/html': $encoding = @api_detect_encoding_html($full_string); if (!empty($encoding)) { - $content_type .= '; charset=' . $encoding; + $content_type .= '; charset='.$encoding; } break; case 'text/plain': $encoding = @api_detect_encoding(strip_tags($full_string)); if (!empty($encoding)) { - $content_type .= '; charset=' . $encoding; + $content_type .= '; charset='.$encoding; } break; } - header('Content-type: ' . $content_type); - header('Content-Length: ' . $len); + header('Content-type: '.$content_type); + header('Content-Length: '.$len); $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); if (strpos($user_agent, 'msie')) { - header('Content-Disposition: ; filename= ' . $filename); + header('Content-Disposition: ; filename= '.$filename); } else { - header('Content-Disposition: inline; filename= ' . $filename); + header('Content-Disposition: inline; filename= '.$filename); } echo($full_string); //You have to ensure that the calling script then stops processing (exit();) @@ -583,9 +583,9 @@ class DocumentManager if (!empty($students)) { $conditionList = array(); foreach ($students as $studentId => $studentInfo) { - $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id']; + $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id']; } - $sharedCondition .= ' AND docs.path IN ("' . implode('","', $conditionList) . '")'; + $sharedCondition .= ' AND docs.path IN ("'.implode('","', $conditionList).'")'; } } @@ -612,8 +612,8 @@ class DocumentManager last.tool = '".TOOL_DOCUMENT."' AND docs.c_id = {$_course['real_id']} AND last.c_id = {$_course['real_id']} AND - docs.path LIKE '" . Database::escape_string($path . $added_slash.'%'). "' AND - docs.path NOT LIKE '" . Database::escape_string($path . $added_slash.'%/%')."' AND + docs.path LIKE '".Database::escape_string($path.$added_slash.'%')."' AND + docs.path NOT LIKE '" . Database::escape_string($path.$added_slash.'%/%')."' AND docs.path NOT LIKE '%_DELETED_%' AND $userGroupFilter AND last.visibility $visibility_bit @@ -654,7 +654,7 @@ class DocumentManager $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES); $sql = "SELECT id FROM $table_template WHERE - course_code = '" . $_course['code'] . "' AND + course_code = '".$_course['code']."' AND user_id = '".api_get_user_id()."' AND ref_doc = '".$row['id']."'"; $template_result = Database::query($sql); @@ -767,7 +767,7 @@ class DocumentManager $conditionList = array(); if (!empty($students)) { foreach ($students as $studentId => $studentInfo) { - $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id']; + $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id']; } } @@ -799,7 +799,7 @@ class DocumentManager docs.c_id = last.c_id ) WHERE - last.tool = '" . TOOL_DOCUMENT . "' AND + last.tool = '".TOOL_DOCUMENT."' AND last.c_id = {$_course['real_id']} AND docs.c_id = {$_course['real_id']} AND docs.filetype = 'folder' AND @@ -817,7 +817,7 @@ class DocumentManager docs.c_id = last.c_id ) WHERE - last.tool = '" . TOOL_DOCUMENT . "' AND + last.tool = '".TOOL_DOCUMENT."' AND last.c_id = {$_course['real_id']} AND docs.c_id = {$_course['real_id']} AND docs.filetype = 'folder' AND @@ -878,7 +878,7 @@ class DocumentManager ON (docs.id = last.ref AND last.c_id = docs.c_id) WHERE $fileType - last.tool = '" . TOOL_DOCUMENT . "' AND + last.tool = '".TOOL_DOCUMENT."' AND $groupCondition AND $visibilityCondition $show_users_condition @@ -904,7 +904,7 @@ class DocumentManager ON (docs.id = last.ref AND last.c_id = docs.c_id) WHERE docs.filetype = 'folder' AND - last.tool = '" . TOOL_DOCUMENT . "' AND + last.tool = '".TOOL_DOCUMENT."' AND $groupCondition AND last.visibility = 0 $condition_session AND last.c_id = {$_course['real_id']} AND @@ -918,9 +918,9 @@ class DocumentManager INNER JOIN $TABLE_DOCUMENT AS docs ON (docs.id = last.ref AND docs.c_id = last.c_id) WHERE - docs.path LIKE '" . Database::escape_string($row['path'].'/%') . "' AND + docs.path LIKE '".Database::escape_string($row['path'].'/%')."' AND docs.filetype = 'folder' AND - last.tool = '" . TOOL_DOCUMENT . "' AND + last.tool = '" . TOOL_DOCUMENT."' AND $groupCondition AND last.visibility = 1 $condition_session AND last.c_id = {$_course['real_id']} AND @@ -998,7 +998,7 @@ class DocumentManager td.c_id = $course_id AND tp.c_id = $course_id AND td.session_id = $sessionId AND - (path='" . $path . "' OR path LIKE BINARY '" . $path . "/%' ) "; + (path='".$path."' OR path LIKE BINARY '".$path."/%' ) "; // Get all id's of documents that are deleted $what_to_check_result = Database::query($sql); @@ -1348,7 +1348,7 @@ class DocumentManager $res = Database::query($sql); if (Database::num_rows($res) > 0) { $row2 = Database::fetch_array($res); - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; $di = new ChamiloIndexer(); $di->remove_document((int) $row2['search_did']); } @@ -1357,7 +1357,7 @@ class DocumentManager Database::query($sql); // remove terms from db - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; delete_all_values_for_item($course_id, TOOL_DOCUMENT, $document_id); } } @@ -1443,12 +1443,12 @@ class DocumentManager $path = str_replace('%2F', '/', $url_path); $pathinfo = pathinfo($row['path']); - $row['url'] = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?cidReq=' . $course_code . '&id=' . $id; - $row['document_url'] = api_get_path(WEB_CODE_PATH) . 'document/document.php?cidReq=' . $course_code . '&id=' . $id; - $row['absolute_path'] = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path']; - $row['absolute_path_from_document'] = '/document' . $row['path']; - $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'] . '/'; - $row['direct_url'] = $www . $path; + $row['url'] = api_get_path(WEB_CODE_PATH).'document/showinframes.php?cidReq='.$course_code.'&id='.$id; + $row['document_url'] = api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.$course_code.'&id='.$id; + $row['absolute_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path']; + $row['absolute_path_from_document'] = '/document'.$row['path']; + $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'].'/'; + $row['direct_url'] = $www.$path; $row['basename'] = basename($row['path']); if (dirname($row['path']) == '.') { @@ -1468,7 +1468,7 @@ class DocumentManager $real_dir = ''; for ($i = 1; $i < $array_len; $i++) { - $real_dir .= '/' . (isset($dir_array[$i]) ? $dir_array[$i] : ''); + $real_dir .= '/'.(isset($dir_array[$i]) ? $dir_array[$i] : ''); $parent_id = self::get_document_id($course_info, $real_dir); if ($session_id != 0 && empty($parent_id)) { $parent_id = self::get_document_id($course_info, $real_dir, 0); @@ -1542,21 +1542,21 @@ class DocumentManager $user_id = intval($user_id); $document_id = intval($document_id); - $sql = 'SELECT id FROM ' . $table_template . ' + $sql = 'SELECT id FROM '.$table_template.' WHERE - course_code="' . $course_code . '" AND - user_id="' . $user_id . '" AND - ref_doc="' . $document_id . '"'; + course_code="' . $course_code.'" AND + user_id="' . $user_id.'" AND + ref_doc="' . $document_id.'"'; $result = Database::query($sql); $template_id = Database::result($result, 0, 0); - my_delete(api_get_path(SYS_CODE_PATH) . 'upload/template_thumbnails/' . $template_id . '.jpg'); + my_delete(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/'.$template_id.'.jpg'); - $sql = 'DELETE FROM ' . $table_template . ' + $sql = 'DELETE FROM '.$table_template.' WHERE - course_code="' . $course_code . '" AND - user_id="' . $user_id . '" AND - ref_doc="' . $document_id . '"'; + course_code="' . $course_code.'" AND + user_id="' . $user_id.'" AND + ref_doc="' . $document_id.'"'; Database::query($sql); } @@ -1619,7 +1619,7 @@ class DocumentManager WHERE d.c_id = $course_id AND ip.c_id = $course_id AND - ip.tool = '" . TOOL_DOCUMENT . "' $condition AND + ip.tool = '".TOOL_DOCUMENT."' $condition AND filetype = '$file_type' AND locate(concat(path,'/'), '$doc_path')=1 "; @@ -1793,12 +1793,12 @@ class DocumentManager if (empty($session_id)) { $sql_session = 'AND (session_id = 0 OR isnull(session_id)) '; } elseif ($session_id > 0) { - $sql_session = 'AND session_id=' . intval($session_id); + $sql_session = 'AND session_id='.intval($session_id); } else { $sql_session = ''; } - $sql = 'UPDATE ' . $tbl_category . ' SET document_id="' . intval($document_id) . '" - WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session; + $sql = 'UPDATE '.$tbl_category.' SET document_id="'.intval($document_id).'" + WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session; Database::query($sql); } @@ -1820,12 +1820,12 @@ class DocumentManager if (empty($session_id)) { $sql_session = 'AND (session_id = 0 OR isnull(session_id)) '; } elseif ($session_id > 0) { - $sql_session = 'AND session_id=' . intval($session_id); + $sql_session = 'AND session_id='.intval($session_id); } else { $sql_session = ''; } - $sql = 'SELECT document_id FROM ' . $tbl_category . ' - WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session; + $sql = 'SELECT document_id FROM '.$tbl_category.' + WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session; $rs = Database::query($sql); $num = Database::num_rows($rs); @@ -1870,7 +1870,7 @@ class DocumentManager $all_user_info = array(); if (Database::num_rows($rs)) { $row = Database::fetch_array($rs); - $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path']; + $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path']; if (is_file($filepath)) { $my_content_html = file_get_contents($filepath); } @@ -1956,8 +1956,8 @@ class DocumentManager $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY); } - $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id']; - $externalStyleFile = api_get_path(SYS_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/certificate.css'; + $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id']; + $externalStyleFile = api_get_path(SYS_CSS_PATH).'themes/'.api_get_visual_theme().'/certificate.css'; $externalStyle = ''; if (is_file($externalStyleFile)) { @@ -1979,7 +1979,7 @@ class DocumentManager $course_info['name'], $info_grade_certificate['grade'], $url, - '' . get_lang('CertificateOnlineLink') . '', + ''.get_lang('CertificateOnlineLink').'', '((certificate_barcode))', $externalStyle ); @@ -2006,7 +2006,7 @@ class DocumentManager if (!empty($extraFields)) { foreach ($extraFields as $extraField) { $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : ''; - $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))'; + $info_to_be_replaced_in_content_html[] = '(('.strtolower($extraField['variable']).'))'; $info_to_replace_in_content_html[] = $valueExtra; } } @@ -2034,17 +2034,17 @@ class DocumentManager $tbl_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $session_id = api_get_session_id(); if ($session_id == 0 || is_null($session_id)) { - $sql_session = 'AND (session_id=' . intval($session_id) . ' OR isnull(session_id)) '; + $sql_session = 'AND (session_id='.intval($session_id).' OR isnull(session_id)) '; } elseif ($session_id > 0) { - $sql_session = 'AND session_id=' . intval($session_id); + $sql_session = 'AND session_id='.intval($session_id); } else { $sql_session = ''; } - $sql = 'UPDATE ' . $tbl_category . ' SET document_id = null + $sql = 'UPDATE '.$tbl_category.' SET document_id = null WHERE - course_code = "' . Database::escape_string($course_id) . '" AND - document_id="' . $default_certificate_id . '" ' . $sql_session; + course_code = "' . Database::escape_string($course_id).'" AND + document_id="' . $default_certificate_id.'" '.$sql_session; Database::query($sql); } } @@ -2059,10 +2059,10 @@ class DocumentManager if (!empty($courseInfo)) { $to_group_id = 0; $to_user_id = null; - $course_dir = $courseInfo['path'] . "/document/"; + $course_dir = $courseInfo['path']."/document/"; $sys_course_path = api_get_path(SYS_COURSE_PATH); - $base_work_dir = $sys_course_path . $course_dir; - $base_work_dir_test = $base_work_dir . 'certificates'; + $base_work_dir = $sys_course_path.$course_dir; + $base_work_dir_test = $base_work_dir.'certificates'; $dir_name = '/certificates'; $post_dir_name = get_lang('CertificatesFiles'); $visibility_command = 'invisible'; @@ -2288,9 +2288,9 @@ class DocumentManager //$new_abs_path = realpath($dir.'/'.$second_part); $dir = ''; if (!empty($abs_path)) { - $dir = dirname($abs_path) . '/'; + $dir = dirname($abs_path).'/'; } - $new_abs_path = realpath($dir . $second_part); + $new_abs_path = realpath($dir.$second_part); $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); if (count($in_files_list) > 0) { $files_list = array_merge($files_list, $in_files_list); @@ -2303,9 +2303,9 @@ class DocumentManager $files_list[] = array($second_part, 'local', 'rel'); $dir = ''; if (!empty($abs_path)) { - $dir = dirname($abs_path) . '/'; + $dir = dirname($abs_path).'/'; } - $new_abs_path = realpath($dir . $second_part); + $new_abs_path = realpath($dir.$second_part); $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); if (count($in_files_list) > 0) { $files_list = array_merge($files_list, $in_files_list); @@ -2339,9 +2339,9 @@ class DocumentManager $files_list[] = array($source, 'local', 'rel'); $dir = ''; if (!empty($abs_path)) { - $dir = dirname($abs_path) . '/'; + $dir = dirname($abs_path).'/'; } - $new_abs_path = realpath($dir . $source); + $new_abs_path = realpath($dir.$source); $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); if (count($in_files_list) > 0) { $files_list = array_merge($files_list, $in_files_list); @@ -2354,9 +2354,9 @@ class DocumentManager $files_list[] = array($source, 'local', 'rel'); $dir = ''; if (!empty($abs_path)) { - $dir = dirname($abs_path) . '/'; + $dir = dirname($abs_path).'/'; } - $new_abs_path = realpath($dir . $source); + $new_abs_path = realpath($dir.$source); $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); if (count($in_files_list) > 0) { $files_list = array_merge($files_list, $in_files_list); @@ -2390,9 +2390,9 @@ class DocumentManager $files_list[] = array($source, 'local', 'rel'); $dir = ''; if (!empty($abs_path)) { - $dir = dirname($abs_path) . '/'; + $dir = dirname($abs_path).'/'; } - $new_abs_path = realpath($dir . $source); + $new_abs_path = realpath($dir.$source); $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); if (count($in_files_list) > 0) { $files_list = array_merge($files_list, $in_files_list); @@ -2405,9 +2405,9 @@ class DocumentManager $files_list[] = array($source, 'local', 'rel'); $dir = ''; if (!empty($abs_path)) { - $dir = dirname($abs_path) . '/'; + $dir = dirname($abs_path).'/'; } - $new_abs_path = realpath($dir . $source); + $new_abs_path = realpath($dir.$source); $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); if (count($in_files_list) > 0) { $files_list = array_merge($files_list, $in_files_list); @@ -2466,24 +2466,24 @@ class DocumentManager // then possible closing brackets if we were in the opening bracket case // OR something like @import() $res = preg_match_all( - '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' . + '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))'. // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name - '([ \n\t\r]+)?(' . + '([ \n\t\r]+)?('. // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself - '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' . - '|' . + '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))'. + '|'. // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself - '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' . - '))' . - '|' . + '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))'. + '))'. + '|'. // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities) '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/', $attrString, $regs ); } catch (Exception $e) { - error_log('Caught exception: ' . $e->getMessage(), 0); + error_log('Caught exception: '.$e->getMessage(), 0); } if ($res) { for ($i = 0; $i < count($regs[1]); $i++) { @@ -2561,14 +2561,14 @@ class DocumentManager $orig_course_info_path = $origin_course_info_path; } } else { - $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'] . '/'; + $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'].'/'; $orig_course_info_path = $orig_course_info['path']; } $destination_course_code = CourseManager::get_course_id_from_path($destination_course_directory); $destination_course_info = api_get_course_info($destination_course_code); - $dest_course_path = api_get_path(SYS_COURSE_PATH) . $destination_course_directory . '/'; - $dest_course_path_rel = api_get_path(REL_COURSE_PATH) . $destination_course_directory . '/'; + $dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/'; + $dest_course_path_rel = api_get_path(REL_COURSE_PATH).$destination_course_directory.'/'; $user_id = api_get_user_id(); @@ -2577,7 +2577,7 @@ class DocumentManager // Get information about source url $real_orig_url = $source[0]; // url - $scope_url = $source[1]; // scope (local, remote) + $scope_url = $source[1]; // scope (local, remote) $type_url = $source[2]; // type (rel, abs, url) // Get path and query from origin url @@ -2589,7 +2589,7 @@ class DocumentManager $dest_url_query = ''; if (!empty($real_orig_query)) { - $dest_url_query = '?' . $real_orig_query; + $dest_url_query = '?'.$real_orig_query; if (strpos($dest_url_query, $origin_course_code) !== false) { $dest_url_query = str_replace($origin_course_code, $destination_course_code, $dest_url_query); } @@ -2670,7 +2670,7 @@ class DocumentManager //$destination_url = $url_course_path . $destination_course_directory . '/' . $document_file . $dest_url_query; // See BT#7780 - $destination_url = $dest_course_path_rel . $document_file . $dest_url_query; + $destination_url = $dest_course_path_rel.$document_file.$dest_url_query; // If the course code doesn't exist in the path? what we do? Nothing! see BT#1985 if (strpos($real_orig_path, $origin_course_code) === false) { @@ -2705,14 +2705,14 @@ class DocumentManager public function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path) { if (substr($original_path, strlen($original_path) - 1, strlen($original_path)) == '/') { - $original = $original_path . $file_name; + $original = $original_path.$file_name; } else { - $original = $original_path . '/' . $file_name; + $original = $original_path.'/'.$file_name; } if (substr($destiny_path, strlen($destiny_path) - 1, strlen($destiny_path)) == '/') { - $destination = $destiny_path . $file_name; + $destination = $destiny_path.$file_name; } else { - $destination = $destiny_path . '/' . $file_name; + $destination = $destiny_path.'/'.$file_name; } $original_count = count(explode('/', $original)); $destination_count = count(explode('/', $destination)); @@ -2726,8 +2726,8 @@ class DocumentManager $mode = 'inside'; } //We do not select the $original_path becayse the file was already moved - $content_html = file_get_contents($destiny_path . '/' . $file_name); - $destination_file = $destiny_path . '/' . $file_name; + $content_html = file_get_contents($destiny_path.'/'.$file_name); + $destination_file = $destiny_path.'/'.$file_name; $pre_original = strstr($original_path, 'document'); $pre_destin = strstr($destiny_path, 'document'); @@ -2749,11 +2749,11 @@ class DocumentManager } if ($pre_original != '') { - $pre_original = '..' . $pre_original . '/'; + $pre_original = '..'.$pre_original.'/'; } if ($pre_destin != '') { - $pre_destin = '..' . $pre_destin . '/'; + $pre_destin = '..'.$pre_destin.'/'; } $levels = explode('/', $pre_original); @@ -2771,7 +2771,7 @@ class DocumentManager //echo '$count_pre_destination_levels '. $count_pre_destination_levels; $pre_remove = ''; for ($i = 1; $i <= $count_pre_destination_levels; $i++) { - $pre_remove .='..\/'; + $pre_remove .= '..\/'; } $orig_source_html = self::get_resources_from_source_html($content_html); @@ -2779,9 +2779,9 @@ class DocumentManager foreach ($orig_source_html as $source) { // get information about source url - $real_orig_url = $source[0]; // url - $scope_url = $source[1]; // scope (local, remote) - $type_url = $source[2]; // tyle (rel, abs, url) + $real_orig_url = $source[0]; // url + $scope_url = $source[1]; // scope (local, remote) + $type_url = $source[2]; // tyle (rel, abs, url) // Get path and query from origin url $orig_parse_url = parse_url($real_orig_url); $real_orig_path = $orig_parse_url['path']; @@ -2808,11 +2808,11 @@ class DocumentManager $real_orig_url_temp = ''; if ($mode == 'inside') { $real_orig_url_temp = str_replace('../', '', $real_orig_url); - $destination_url = $link_to_add . $real_orig_url_temp; + $destination_url = $link_to_add.$real_orig_url_temp; } else { $real_orig_url_temp = $real_orig_url; - $destination_url = preg_replace("/" . $pre_remove . "/", '', $real_orig_url, 1); + $destination_url = preg_replace("/".$pre_remove."/", '', $real_orig_url, 1); } if ($real_orig_url == $destination_url) { //echo 'continue2'; @@ -2846,7 +2846,7 @@ class DocumentManager ) { $course_data = api_get_course_info($courseCode); $document_data = self::get_document_data_by_id($document_id, $courseCode); - $file_path = api_get_path(SYS_COURSE_PATH) . $course_data['path'] . '/document' . $document_data['path']; + $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$document_data['path']; if ($orientation == 'landscape') { $pageFormat = 'A4-L'; $pdfOrientation = 'L'; @@ -2894,9 +2894,9 @@ class DocumentManager ) { $course_info = api_get_course_info(); $sessionId = api_get_session_id(); - $course_dir = $course_info['path'] . '/document'; + $course_dir = $course_info['path'].'/document'; $sys_course_path = api_get_path(SYS_COURSE_PATH); - $base_work_dir = $sys_course_path . $course_dir; + $base_work_dir = $sys_course_path.$course_dir; $group_properties = GroupManager::get_group_properties(api_get_group_id()); $groupIid = isset($group_properties['iid']) ? $group_properties['iid'] : 0; @@ -3084,7 +3084,7 @@ class DocumentManager } if (isset($output)) { foreach ($output as & $line) { - $content .= $line . "\n"; + $content .= $line."\n"; } return $content; } else { @@ -3116,13 +3116,13 @@ class DocumentManager $group_condition = null; if (isset($group_id)) { $group_id = intval($group_id); - $group_condition = " AND props.to_group_id='" . $group_id . "' "; + $group_condition = " AND props.to_group_id='".$group_id."' "; } $session_condition = null; if (isset($session_id)) { $session_id = intval($session_id); - $session_condition = " AND props.session_id='" . $session_id . "' "; + $session_condition = " AND props.session_id='".$session_id."' "; } $sql = "SELECT SUM(size) @@ -3132,7 +3132,7 @@ class DocumentManager WHERE props.c_id = $course_id AND docs.c_id = $course_id AND - props.tool = '" . TOOL_DOCUMENT . "' AND + props.tool = '".TOOL_DOCUMENT."' AND props.visibility <> 2 $group_condition $session_condition @@ -3155,8 +3155,8 @@ class DocumentManager $course_quota_m = round($course_quota / 1048576); $already_consumed_space_m = round($already_consumed_space / 1048576); - $message = get_lang('MaximumAllowedQuota') . ' ' . $course_quota_m . ' megabyte.
'; - $message .= get_lang('CourseCurrentlyUses') . ' ' . $already_consumed_space_m . ' megabyte.
'; + $message = get_lang('MaximumAllowedQuota').' '.$course_quota_m.' megabyte.
'; + $message .= get_lang('CourseCurrentlyUses').' '.$already_consumed_space_m.' megabyte.
'; $percentage = round(($already_consumed_space / $course_quota * 100), 1); @@ -3164,33 +3164,33 @@ class DocumentManager // Decide where to place percentage in graph if ($percentage >= 50) { - $text_in_filled = ' ' . $other_percentage . '%'; + $text_in_filled = ' '.$other_percentage.'%'; $text_in_unfilled = ''; } else { - $text_in_unfilled = ' ' . $other_percentage . '%'; + $text_in_unfilled = ' '.$other_percentage.'%'; $text_in_filled = ''; } // Decide the background colour of the graph if ($percentage < 65) { - $colour = '#00BB00'; // Safe - green + $colour = '#00BB00'; // Safe - green } elseif ($percentage < 90) { - $colour = '#ffd400'; // Filling up - yelloworange + $colour = '#ffd400'; // Filling up - yelloworange } else { - $colour = '#DD0000'; // Full - red + $colour = '#DD0000'; // Full - red } // This is used for the table width: a table of only 100 pixels looks too small $visual_percentage = 4 * $percentage; $visual_other_percentage = 4 * $other_percentage; - $message .= get_lang('PercentageQuotaInUse') . ': ' . $percentage . '%.
' . - get_lang('PercentageQuotaFree') . ': ' . $other_percentage . '%.
'; + $message .= get_lang('PercentageQuotaInUse').': '.$percentage.'%.
'. + get_lang('PercentageQuotaFree').': '.$other_percentage.'%.
'; - $show_percentage = ' ' . $percentage . '%'; - $message .= '
' . - '
 
' . - '' . $show_percentage . '
'; + $show_percentage = ' '.$percentage.'%'; + $message .= '
'. + '
 
'. + ''.$show_percentage.'
'; echo $message; } @@ -3206,7 +3206,7 @@ class DocumentManager $percentage = $already_consumed_space / $course_quota * 100; $percentage = round($percentage, 1); $message = get_lang('YouAreCurrentlyUsingXOfYourX'); - $message = sprintf($message, $already_consumed_space_m, $percentage . '%', $course_quota_m . ' '); + $message = sprintf($message, $already_consumed_space_m, $percentage.'%', $course_quota_m.' '); return Display::div($message, array('id' => 'document_quota')); } @@ -3239,13 +3239,13 @@ class DocumentManager */ public static function generate_jplayer_jquery($params = array()) { - $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/'; + $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; $js = ' - $("#jquery_jplayer_' . $params['count'] . '").jPlayer({ + $("#jquery_jplayer_' . $params['count'].'").jPlayer({ ready: function() { $(this).jPlayer("setMedia", { - ' . $params['extension'] . ' : "' . $params['url'] . '" + ' . $params['extension'].' : "'.$params['url'].'" }); }, play: function() { // To avoid both jPlayers playing together. @@ -3253,12 +3253,12 @@ class DocumentManager }, //errorAlerts: true, //warningAlerts: true, - swfPath: "' . $js_path . 'jquery-jplayer/jplayer/", + swfPath: "' . $js_path.'jquery-jplayer/jplayer/", //supplied: "m4a, oga, mp3, ogg, wav", - supplied: "' . $params['extension'] . '", + supplied: "' . $params['extension'].'", wmode: "window", solution: "flash, html", // Do not change this setting - cssSelectorAncestor: "#jp_container_' . $params['count'] . '", + cssSelectorAncestor: "#jp_container_' . $params['count'].'", }); ' . "\n\n"; return $js; @@ -3287,16 +3287,16 @@ class DocumentManager } //Shows only the play button - $html = ' - '; @@ -3433,7 +3433,7 @@ class DocumentManager $add_folder_filter = null; if (!empty($filter_by_folder)) { - $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'"; + $add_folder_filter = " AND docs.path LIKE '".Database::escape_string($filter_by_folder)."%'"; } // If we are in LP display hidden folder https://support.chamilo.org/issues/6679 @@ -3468,7 +3468,7 @@ class DocumentManager $notLikeCondition = null; for ($i = 1; $i <= $num; $i++) { - $repeat = str_repeat('/%', $i+1); + $repeat = str_repeat('/%', $i + 1); $notLikeCondition .= " AND docs.path NOT LIKE '".Database::escape_string($cleanedPath.$repeat)."' "; } @@ -3493,7 +3493,7 @@ class DocumentManager ON (docs.id = last.ref AND docs.c_id = last.c_id) WHERE docs.path NOT LIKE '%_DELETED_%' AND - last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND + last.tool = '".TOOL_DOCUMENT."' $condition_session AND (last.visibility = '1' $lp_visibility_condition) AND last.visibility <> 2 AND docs.c_id = {$course_info['real_id']} AND @@ -3523,7 +3523,7 @@ class DocumentManager Display::url( Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL), ' javascript:void(0);', - array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div') + array('id' => 'close_div_'.$course_info['real_id'].'_'.$session_id, 'class' => 'close_div') ), array('style' => 'position:absolute;right:10px') ); @@ -3631,7 +3631,7 @@ class DocumentManager $('#'+tempId).hide(); } else { image.addClass('open'); - image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "'); + image.attr('src', '" . Display::returnIconPath('nolines_minus.gif')."'); $('#'+id).hide(); $('#'+tempId).show(); @@ -3682,7 +3682,7 @@ class DocumentManager $target, $overwrite_url ) { - $img_sys_path = api_get_path(SYS_CODE_PATH) . 'img/'; + $img_sys_path = api_get_path(SYS_CODE_PATH).'img/'; $web_code_path = api_get_path(WEB_CODE_PATH); $documentId = $resource['id']; @@ -3697,7 +3697,7 @@ class DocumentManager // It's a file. $icon = choose_image($path); $position = strrpos($icon, '.'); - $icon = substr($icon, 0, $position) . '_small.gif'; + $icon = substr($icon, 0, $position).'_small.gif'; $my_file_title = $resource['title']; $visibility = $resource['visibility']; @@ -3709,29 +3709,29 @@ class DocumentManager // Show the "image name" not the filename of the image. if ($lp_id) { // LP URL - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=add_item&type=' . TOOL_DOCUMENT . '&file=' . $documentId . '&lp_id=' . $lp_id; + $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=add_item&type='.TOOL_DOCUMENT.'&file='.$documentId.'&lp_id='.$lp_id; if (!empty($overwrite_url)) { - $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId.''; + $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId.''; } } else { // Direct document URL - $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId; + $url = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId; if (!empty($overwrite_url)) { - $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId; + $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId; } } $img = Display::returnIconPath($icon); - if (!file_exists($img_sys_path . $icon)) { + if (!file_exists($img_sys_path.$icon)) { $img = Display::returnIconPath('default_small.gif'); } $link = Display::url( - ' ' . $my_file_title, $url, + ' '.$my_file_title, $url, array('target' => $target, 'class' => 'moved') ); - $directUrl = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId; + $directUrl = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId; $link .= Display::url( Display::return_icon('preview_view.png', get_lang('Preview')), @@ -3746,12 +3746,12 @@ class DocumentManager $return = null; if ($lp_id == false) { - $return .= '
  • '; + $return .= '
  • '; } else { - $return .= '
  • '; + $return .= '
  • '; } - $return .= '
    '; + $return .= '
    '; if ($add_move_button) { $return .= ''; @@ -3819,7 +3819,7 @@ class DocumentManager if (isset($resource['visible']) && $resource['visible'] == 0) { $folder_class_hidden = "doc_folder_hidden"; // in base.css } - $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"'; + $onclick = 'onclick="javascript: testResources(\'res_'.$resource['id'].'\',\'img_'.$resource['id'].'\')"'; } $return = null; @@ -3827,22 +3827,22 @@ class DocumentManager $return = ''; $html .= Display::panelCollapse( get_lang('SocialNetwork'), @@ -969,57 +969,57 @@ class SocialManager extends UserManager } if ($show == 'shared_profile') { - $links = ''; } else { - $friendHtml.= '
    '.get_lang('NoFriendsInYourContactList').'
    ' - .' '. get_lang('TryAndFindSomeFriends').'
    '; + $friendHtml .= '
    '.get_lang('NoFriendsInYourContactList').'
    ' + .' '.get_lang('TryAndFindSomeFriends').'
    '; } - $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.= '
    '; + $friendHtml .= '
    '; $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 .= ''; - $friendHtml .= $friend_avatar.' ' . $name_user . ''; - $friendHtml .= '' . $statusIcon . ''; + $friendHtml .= $friend_avatar.' '.$name_user.''; + $friendHtml .= ''.$statusIcon.''; } else { $link_shared = empty($link_shared) ? '' : '&'.$link_shared; - $friendHtml .= ''; - $friendHtml .= $friend_avatar.' ' . $name_user . ''; + $friendHtml .= ''; + $friendHtml .= $friend_avatar.' '.$name_user.''; } $friendHtml .= ''; } $j++; } - $friendHtml.='
    '; + $friendHtml .= '
    '; } else { - $friendHtml.= '
    '.get_lang('NoFriendsInYourContactList').' ' - .' '. get_lang('TryAndFindSomeFriends').'
    '; + $friendHtml .= '
    '.get_lang('NoFriendsInYourContactList').' ' + .' '.get_lang('TryAndFindSomeFriends').'
    '; } 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 ); diff --git a/main/inc/lib/system_announcements.lib.php b/main/inc/lib/system_announcements.lib.php index 5963bbc039..e2821204c7 100755 --- a/main/inc/lib/system_announcements.lib.php +++ b/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; } diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index e21c37799e..213a65460d 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -302,7 +302,7 @@ class Template $content = '
    '; $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 .= '' . "\n"; + $socialMeta .= ''."\n"; $metaSite = api_get_setting('meta_twitter_site'); if (!empty($metaSite)) { - $socialMeta .= '' . "\n"; + $socialMeta .= ''."\n"; $metaCreator = api_get_setting('meta_twitter_creator'); if (!empty($metaCreator)) { - $socialMeta .= '' . "\n"; + $socialMeta .= ''."\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 .= '' . "\n"; - $socialMeta .= '' . "\n"; + $socialMeta .= ''."\n"; + $socialMeta .= ''."\n"; $metaDescription = api_get_setting('meta_description'); if (!empty($metaDescription)) { - $socialMeta .= '' . "\n"; + $socialMeta .= ''."\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 .= '' . "\n"; + if (is_file(api_get_path(SYS_PATH).$metaImage)) { + $path = api_get_path(WEB_PATH).$metaImage; + $socialMeta .= ''."\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' ) diff --git a/main/lp/lp_build.php b/main/lp/lp_build.php index 419ed9a1af..422d86693f 100755 --- a/main/lp/lp_build.php +++ b/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 '
    '; function show_block($link, $title, $subtitle, $icon) { $html = '
  • '; - $html .= '
    '; - $html .= ''; - $html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG); - $html .= ''; - $html .= '
    '; - $html .= ''.$title.' '.$subtitle; - $html .= '
    '; - $html .= '
    '; - $html .= '
  • '; + $html .= '
    '; + $html .= ''; + $html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG); + $html .= ''; + $html .= '
    '; + $html .= ''.$title.' '.$subtitle; + $html .= '
    '; + $html .= '
    '; + $html .= ''; return $html; } diff --git a/main/mySpace/access_details.php b/main/mySpace/access_details.php index 5608478c63..f2f51a103f 100755 --- a/main/mySpace/access_details.php +++ b/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)); diff --git a/main/reports/modules/course.php b/main/reports/modules/course.php index c8b44e3b95..a07e1d2d92 100755 --- a/main/reports/modules/course.php +++ b/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' ); } diff --git a/main/reports/multiquery.lib.php b/main/reports/multiquery.lib.php index d66c7ecb3b..7763048652 100755 --- a/main/reports/multiquery.lib.php +++ b/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"); } } diff --git a/main/tracking/courseLogCSV.php b/main/tracking/courseLogCSV.php index 0ab01a47e1..3c4b61a65a 100755 --- a/main/tracking/courseLogCSV.php +++ b/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 "$lp_title"; 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); diff --git a/main/tracking/logins_details.php b/main/tracking/logins_details.php index eef7f875dc..6c60ee7fd5 100755 --- a/main/tracking/logins_details.php +++ b/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 ""; - echo $informationsAbout . " :
    "; + echo $informationsAbout." :
    "; echo "
      \n" - . "
    • " . get_lang('FirstName') . " : " . $res[0] . "
    • \n" - . "
    • " . get_lang('LastName') . " : " . $res[1] . "
    • \n" - . "
    • " . get_lang('Email') . " : " . $res2 . "
    • \n" + . "
    • ".get_lang('FirstName')." : ".$res[0]."
    • \n" + . "
    • ".get_lang('LastName')." : ".$res[1]."
    • \n" + . "
    • ".get_lang('Email')." : ".$res2."
    • \n" . "
    "; echo ""; /* * ***** MENU ******* */ echo " - [" . get_lang('Back') . "] + [".get_lang('Back')."] "; echo "    ||    - [" . get_lang('PeriodWeek') . "] - [" . get_lang('PeriodMonth') . "] + [".get_lang('PeriodWeek')."] + [".get_lang('PeriodMonth')."]    ||    "; switch ($period) { @@ -120,8 +120,8 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s $previousReqDate = $reqdate - 7 * 86400; $nextReqDate = $reqdate + 7 * 86400; echo " - [" . get_lang('PreviousWeek') . "] - [" . get_lang('NextWeek') . "] + [".get_lang('PreviousWeek')."] + [".get_lang('NextWeek')."] "; 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 " - [" . get_lang('PreviousMonth') . "] - [" . get_lang('NextMonth') . "] + [".get_lang('PreviousMonth')."] + [".get_lang('NextMonth')."] "; 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 ""; $results = StatsUtils::getManyResults1Col($sql); /* * * display of the displayed period ** */ echo ""; - echo ""; + echo ""; 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 ""; - echo ""; + echo ""; echo""; // $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 "
    " . $displayedDate . "".$displayedDate."
    " . $beautifulDateTime . "".$beautifulDateTime."
    \n"; for ($k = 0; $k < count($results2); $k++) { echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; echo ""; } echo "
    " . get_lang($results2[$k][0]) . "" . $results2[$k][1] . " " . get_lang('Visits') . "".get_lang($results2[$k][0])."".$results2[$k][1]." ".get_lang('Visits')."
    \n"; @@ -215,7 +215,7 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s } } else { echo ""; - echo "" . get_lang('NoResult') . ""; + echo "".get_lang('NoResult').""; echo ""; } echo ""; diff --git a/main/webservices/additional_webservices.php b/main/webservices/additional_webservices.php index 87f901b60f..9c5964b63b 100755 --- a/main/webservices/additional_webservices.php +++ b/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); diff --git a/main/webservices/api/v2.php b/main/webservices/api/v2.php index 16b9d4399c..5c8f13e681 100644 --- a/main/webservices/api/v2.php +++ b/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; diff --git a/main/work/edit.php b/main/work/edit.php index 1e549e3fbe..ef2aa633df 100755 --- a/main/work/edit.php +++ b/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." diff --git a/main/work/upload_from_template.php b/main/work/upload_from_template.php index 01ffc1f9cf..e2641919d9 100755 --- a/main/work/upload_from_template.php +++ b/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); diff --git a/plugin/dashboard/block_daily/block_daily.class.php b/plugin/dashboard/block_daily/block_daily.class.php index 4413aec3b3..3804ed8042 100755 --- a/plugin/dashboard/block_daily/block_daily.class.php +++ b/plugin/dashboard/block_daily/block_daily.class.php @@ -72,19 +72,19 @@ class BlockDaily extends Block $data = array(); $content = $this->get_content_html(); $html = '
    -
    ' . get_lang('GradebookAndAttendances') . ' +
    - ' . $content . ' + ' . $content.'
    '; @@ -102,17 +102,17 @@ class BlockDaily extends Block { $course_data = $this->get_course_information_data(); //$content = '
    '; - $content = '

    ' . get_lang( + $content = '

    '.get_lang( 'YourCourseList' - ) . '

    '; + ).''; $data_table = null; if (!empty($course_data)) { $data_table .= ''; $data_table .= ' - - - - + + + + '; $i = 1; foreach ($course_data as $course) { @@ -121,12 +121,12 @@ class BlockDaily extends Block } else { $class_tr = 'row_even'; } - $data_table .= ''; + $data_table .= ''; if (!isset($course[3])) { $course[3] = get_lang('NotAvailable'); } foreach ($course as $cell) { - $data_table .= ''; + $data_table .= ''; } $data_table .= ''; $i++; @@ -138,7 +138,7 @@ class BlockDaily extends Block $content .= $data_table; if (!empty($course_data)) { $content .= ''; + '.get_lang('SeeMore').''; } //$content .= ''; 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[] = '' . Display::return_icon('printmgr.gif', get_lang('Print')).''; + $attendances[] = ''.Display::return_icon('printmgr.gif', get_lang('Print')).''; } 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 = '' . $tematic_advance . '%'; + ).'attendance/index.php?cidReq='.$course_code.'&action=attendance_sheet_print&attendance_id=">'.$tematic_advance.'%'; } 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 .= '' . $item->get_name() . ''; + $score .= ''.$item->get_name().''; if (count($eval) - 1 != $i) { $score .= ', '; } diff --git a/plugin/dashboard/block_global_info/block_global_info.class.php b/plugin/dashboard/block_global_info/block_global_info.class.php index 8306fe17e3..32f80b5848 100755 --- a/plugin/dashboard/block_global_info/block_global_info.class.php +++ b/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 = '
    '.get_lang('GlobalPlatformInformation').' - @@ -98,7 +98,7 @@ class BlockGlobalInfo extends Block $data_table = '
    ' . get_lang('CourseTitle') . '' . get_lang('NbStudents') . '' . get_lang('Evaluation') . '' . get_lang('ToolAttendance') . '' . get_lang('CourseTitle').'' . get_lang('NbStudents').'' . get_lang('Evaluation').'' . get_lang('ToolAttendance').'
    ' . $cell . ''.$cell.'
    '; $i = 1; foreach ($global_data as $data) { - if ($i%2 == 0) { + if ($i % 2 == 0) { $class_tr = 'row_odd'; } else { $class_tr = 'row_even'; diff --git a/plugin/google_maps/lang/spanish.php b/plugin/google_maps/lang/spanish.php index 6cde766b42..9310fbb4a4 100644 --- a/plugin/google_maps/lang/spanish.php +++ b/plugin/google_maps/lang/spanish.php @@ -6,7 +6,7 @@ $strings['extra_field_name_help'] = "Ingrese aquĆ­ el nombre del campo o los cam



    -siga el siguiente link para ver el mapa : " . api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php"; +siga el siguiente link para ver el mapa : ".api_get_path(WEB_PLUGIN_PATH)."google_maps/src/map_coordinates.php"; $strings['enable_api'] = "Activar API"; $strings['api_key'] = "Api Key"; $strings['extra_field_name'] = "Nombre del campo extra"; diff --git a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php index bd60be62e6..0b3718e7a0 100644 --- a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php +++ b/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('#]*>#i', ' ', $string); + $string2 = preg_replace('#]*>#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');