diff --git a/main/admin/access_url_add_courses_to_url.php b/main/admin/access_url_add_courses_to_url.php index 32cfb3fd95..c8ab1f50e7 100755 --- a/main/admin/access_url_add_courses_to_url.php +++ b/main/admin/access_url_add_courses_to_url.php @@ -5,8 +5,6 @@ * It displays a list of users and a list of courses; * you can select multiple users and courses and then click on. * - * @package chamilo.admin - * * @author Julio Montoya */ $cidReset = true; diff --git a/main/admin/access_url_add_usergroup_to_url.php b/main/admin/access_url_add_usergroup_to_url.php index c992901d7d..3209289160 100755 --- a/main/admin/access_url_add_usergroup_to_url.php +++ b/main/admin/access_url_add_usergroup_to_url.php @@ -5,8 +5,6 @@ * It displays a list of users and a list of courses; * you can select multiple users and courses and then click on. * - * @package chamilo.admin - * * @author Julio Montoya */ $cidReset = true; diff --git a/main/admin/access_url_add_users_to_url.php b/main/admin/access_url_add_users_to_url.php index aee42f6f95..45bf76c714 100755 --- a/main/admin/access_url_add_users_to_url.php +++ b/main/admin/access_url_add_users_to_url.php @@ -5,8 +5,6 @@ * It displays a list of users and a list of courses; * you can select multiple users and courses and then click on. * - * @package chamilo.admin - * * @author Julio Montoya */ $cidReset = true; diff --git a/main/admin/access_url_check_user_session.php b/main/admin/access_url_check_user_session.php index a2027a4c1b..f03aaba3cd 100755 --- a/main/admin/access_url_check_user_session.php +++ b/main/admin/access_url_check_user_session.php @@ -1,9 +1,8 @@ */ $cidReset = true; @@ -31,7 +30,7 @@ if ($form->validate()) { $url_to_go = 'access_urls.php'; if (!empty($url_id)) { //we can't change the status of the url with id=1 - if ($url_id == 1) { + if (1 == $url_id) { $active = 1; } diff --git a/main/admin/access_url_edit_course_category_to_url.php b/main/admin/access_url_edit_course_category_to_url.php index e971f20457..16622b53c0 100755 --- a/main/admin/access_url_edit_course_category_to_url.php +++ b/main/admin/access_url_edit_course_category_to_url.php @@ -2,8 +2,6 @@ /* For licensing terms, see /license.txt */ /** - * @package chamilo.admin - * * @author Julio Montoya */ diff --git a/main/admin/access_url_edit_courses_to_url.php b/main/admin/access_url_edit_courses_to_url.php index d564b6f253..9fb8b2b25f 100755 --- a/main/admin/access_url_edit_courses_to_url.php +++ b/main/admin/access_url_edit_courses_to_url.php @@ -2,8 +2,6 @@ /* For licensing terms, see /license.txt */ /** - * @package chamilo.admin - * * @author Julio Montoya */ // resetting the course id diff --git a/main/admin/access_url_edit_usergroup_to_url.php b/main/admin/access_url_edit_usergroup_to_url.php index 02c2da9e3b..9dc550a248 100755 --- a/main/admin/access_url_edit_usergroup_to_url.php +++ b/main/admin/access_url_edit_usergroup_to_url.php @@ -2,8 +2,6 @@ /* For licensing terms, see /license.txt */ /** - * @package chamilo.admin - * * @author Julio Montoya */ // resetting the course id diff --git a/main/admin/access_url_edit_users_to_url.php b/main/admin/access_url_edit_users_to_url.php index ab551619d5..6b41f3fb18 100755 --- a/main/admin/access_url_edit_users_to_url.php +++ b/main/admin/access_url_edit_users_to_url.php @@ -1,8 +1,6 @@ */ // resetting the course id diff --git a/main/admin/access_urls.php b/main/admin/access_urls.php index 7a5b87e4e7..dfe0cd52ec 100755 --- a/main/admin/access_urls.php +++ b/main/admin/access_urls.php @@ -1,10 +1,9 @@ * @author Yannick Warnier */ diff --git a/main/admin/add_courses_to_usergroup.php b/main/admin/add_courses_to_usergroup.php index 6c4ece17f7..69908b0e33 100755 --- a/main/admin/add_courses_to_usergroup.php +++ b/main/admin/add_courses_to_usergroup.php @@ -1,8 +1,5 @@ . - * - * @package chamilo.admin */ /** @@ -13,7 +11,7 @@ * * @param array $courses * - * @return array $errors + * @return array */ function validate_courses_data($courses) { @@ -159,9 +157,7 @@ function save_courses_data($courses) */ function parse_csv_courses_data($file) { - $courses = Import::csv_reader($file); - - return $courses; + return Import::csv_reader($file); } $cidReset = true; diff --git a/main/admin/course_information.php b/main/admin/course_information.php index d820f008fb..dfdf9f4c6c 100755 --- a/main/admin/course_information.php +++ b/main/admin/course_information.php @@ -4,8 +4,6 @@ * This script gives information about a course. * * @author Bart Mollet - * - * @package chamilo.admin */ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/admin/course_request_accepted.php b/main/admin/course_request_accepted.php index 20cdce7d59..26416bcaf0 100755 --- a/main/admin/course_request_accepted.php +++ b/main/admin/course_request_accepted.php @@ -1,11 +1,10 @@ , 2010 * @author Bruno Rubio Gayo , 2010 * Centro de Supercomputacion de Galicia (CESGA) diff --git a/main/admin/course_request_edit.php b/main/admin/course_request_edit.php index a0dddcaca3..ad5f31ab85 100755 --- a/main/admin/course_request_edit.php +++ b/main/admin/course_request_edit.php @@ -1,11 +1,10 @@ , 2010 */ $cidReset = true; diff --git a/main/admin/course_request_rejected.php b/main/admin/course_request_rejected.php index 2baf6a1af9..9c51db9580 100755 --- a/main/admin/course_request_rejected.php +++ b/main/admin/course_request_rejected.php @@ -1,11 +1,10 @@ , 2010 * @author Bruno Rubio Gayo , 2010 * Centro de Supercomputacion de Galicia (CESGA) @@ -114,9 +113,9 @@ function get_request_data($from, $number_of_items, $column, $direction) $keyword = isset($_GET['keyword']) ? Database::escape_string(trim($_GET['keyword'])) : ''; $course_request_table = Database::get_main_table(TABLE_MAIN_COURSE_REQUEST); - $from = intval($from); - $number_of_items = intval($number_of_items); - $column = intval($column); + $from = (int) $from; + $number_of_items = (int) $number_of_items; + $column = (int) $column; $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction; $sql = "SELECT diff --git a/main/admin/course_request_review.php b/main/admin/course_request_review.php index 47d8d58a6b..6be31c1616 100755 --- a/main/admin/course_request_review.php +++ b/main/admin/course_request_review.php @@ -1,11 +1,10 @@ , 2010 * Centro de Supercomputacion de Galicia (CESGA) * @author Ivan Tcholakov (technical adaptation for Chamilo 1.8.8), 2010 diff --git a/main/admin/course_user_import.php b/main/admin/course_user_import.php index b1e0edbceb..4b216a7550 100755 --- a/main/admin/course_user_import.php +++ b/main/admin/course_user_import.php @@ -4,8 +4,6 @@ /** * This tool allows platform admins to update course-user relations by uploading * a CSV file. - * - * @package chamilo.admin */ /** @@ -142,9 +140,7 @@ function save_data($users_courses) */ function parse_csv_data($file) { - $courses = Import::csvToArray($file); - - return $courses; + return Import::csvToArray($file); } $cidReset = true; diff --git a/main/admin/course_user_import_by_email.php b/main/admin/course_user_import_by_email.php index 9522c315d4..9f3ab7c5ac 100755 --- a/main/admin/course_user_import_by_email.php +++ b/main/admin/course_user_import_by_email.php @@ -4,8 +4,6 @@ exit; /** * This tool allows platform admins to update course-user relations by uploading * a CSV file. - * - * @package chamilo.admin */ /** * Validates the imported data. @@ -140,9 +138,7 @@ function save_data($users_courses) */ function parse_csv_data($file) { - $courses = Import::csv_reader($file); - - return $courses; + return Import::csv_reader($file); } $cidReset = true; diff --git a/main/admin/dashboard_add_courses_to_user.php b/main/admin/dashboard_add_courses_to_user.php index 8986b73a70..91cdbddafd 100755 --- a/main/admin/dashboard_add_courses_to_user.php +++ b/main/admin/dashboard_add_courses_to_user.php @@ -3,8 +3,6 @@ /** * Interface for assigning courses to Human Resources Manager. - * - * @package chamilo.admin */ // resetting the course id $cidReset = true; @@ -30,7 +28,7 @@ $tbl_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); // initializing variables -$user_id = intval($_GET['user']); +$user_id = (int) ($_GET['user']); $user_info = api_get_user_info($user_id); $user_anonymous = api_get_anonymous_id(); $current_user_id = api_get_user_id(); diff --git a/main/admin/dashboard_add_sessions_to_user.php b/main/admin/dashboard_add_sessions_to_user.php index 2c593fc3e6..7eb0ceaa5a 100755 --- a/main/admin/dashboard_add_sessions_to_user.php +++ b/main/admin/dashboard_add_sessions_to_user.php @@ -3,8 +3,6 @@ /** * Interface for assigning sessions to Human Resources Manager. - * - * @package chamilo.admin */ // resetting the course id $cidReset = true; diff --git a/main/admin/dashboard_add_users_to_user.php b/main/admin/dashboard_add_users_to_user.php index 5a4fc2291b..79365efdfc 100755 --- a/main/admin/dashboard_add_users_to_user.php +++ b/main/admin/dashboard_add_users_to_user.php @@ -3,8 +3,6 @@ /** * Interface for assigning users to Human Resources Manager. - * - * @package chamilo.admin */ // resetting the course id diff --git a/main/admin/email_tester.php b/main/admin/email_tester.php index 4ef85b562f..8a94f3f4a5 100644 --- a/main/admin/email_tester.php +++ b/main/admin/email_tester.php @@ -2,8 +2,6 @@ /* For licensing terms, see /license.txt */ /** * Index page of the admin tools. - * - * @package chamilo.admin */ // Resetting the course id. $cidReset = true; diff --git a/main/admin/export_certificates.php b/main/admin/export_certificates.php index 34aeeba24d..6d37fdb605 100644 --- a/main/admin/export_certificates.php +++ b/main/admin/export_certificates.php @@ -1,9 +1,6 @@ validate()) { $default['content'] = $content; if (isset($values['language'])) { - if ($submit == 'back') { + if ('back' == $submit) { header('Location: legal_add.php'); exit; - } elseif ($submit === 'save') { + } elseif ('save' === $submit) { $id = LegalManager::add($lang, $content, $type, $changes, $values); if (!empty($id)) { Display::addFlash(Display::return_message(get_lang('TermAndConditionSaved'), 'success')); diff --git a/main/admin/promotions.php b/main/admin/promotions.php index fb7f84544f..0db2e9317f 100755 --- a/main/admin/promotions.php +++ b/main/admin/promotions.php @@ -1,9 +1,6 @@ * * @since Chamilo 1.8.7 - * - * @package chamilo.admin */ define('CSS_UPLOAD_PATH', api_get_path(SYS_APP_PATH).'Resources/public/css/themes/'); diff --git a/main/admin/settings.php b/main/admin/settings.php index 098051c2e0..5e564e81cd 100755 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -9,8 +9,6 @@ use ChamiloSession as Session; * * @author Patrick Cool * @author Julio Montoya - Multiple URL site - * - * @package chamilo.admin */ // Resetting the course id. diff --git a/main/admin/skill.php b/main/admin/skill.php index eaaca79c54..dfb4fd5b8a 100644 --- a/main/admin/skill.php +++ b/main/admin/skill.php @@ -5,8 +5,6 @@ use Chamilo\CoreBundle\Entity\Skill; /** * This script manages the skills, levels and profiles assignments. - * - * @package chamilo.skill */ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/admin/skill_badge.php b/main/admin/skill_badge.php index 3e73e4b696..e12f337f8b 100644 --- a/main/admin/skill_badge.php +++ b/main/admin/skill_badge.php @@ -4,8 +4,6 @@ * Show information about Mozilla OpenBadges. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.admin.openbadges */ $cidReset = true; diff --git a/main/admin/skill_badge_create.php b/main/admin/skill_badge_create.php index 2aef0dafef..aab0c76766 100644 --- a/main/admin/skill_badge_create.php +++ b/main/admin/skill_badge_create.php @@ -5,8 +5,6 @@ * Show information about Mozilla OpenBadges. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.admin.openbadges */ $cidReset = true; diff --git a/main/admin/skill_level.php b/main/admin/skill_level.php index 8bfad072db..e7b06c3640 100644 --- a/main/admin/skill_level.php +++ b/main/admin/skill_level.php @@ -5,8 +5,6 @@ use Chamilo\SkillBundle\Entity\Level; /** * Add a skill Level. - * - * @package chamilo.skill */ $cidReset = true; diff --git a/main/admin/skill_list.php b/main/admin/skill_list.php index 0569e05ce8..1f9a0de9af 100644 --- a/main/admin/skill_list.php +++ b/main/admin/skill_list.php @@ -5,8 +5,6 @@ * Skill list for management. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.admin */ $cidReset = true; diff --git a/main/admin/skills.php b/main/admin/skills.php index 0d8db2379a..e1e0c945d3 100755 --- a/main/admin/skills.php +++ b/main/admin/skills.php @@ -1,9 +1,6 @@ */ diff --git a/main/admin/user_export.php b/main/admin/user_export.php index 015c173dfa..281673a360 100755 --- a/main/admin/user_export.php +++ b/main/admin/user_export.php @@ -1,9 +1,6 @@ '; } -if ($user['status'] == DRH) { +if (DRH == $user['status']) { $usersAssigned = UserManager::get_users_followed_by_drh($userId); if ($usersAssigned) { @@ -700,7 +700,6 @@ echo Tracking::displayUserSkills( ); if (api_get_configuration_value('allow_career_users')) { $careers = UserManager::getUserCareers($userId); - if (!empty($careers)) { echo Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']); $table = new HTML_Table(['class' => 'data_table']); diff --git a/main/admin/user_list.php b/main/admin/user_list.php index 1d112fe462..c3ee566711 100755 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -485,7 +485,7 @@ function get_user_data($from, $number_of_items, $column, $direction) alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; - if ($user[7] == 1 && !empty($user['exp'])) { + if (1 == $user[7] && !empty($user['exp'])) { // check expiration date $expiration_time = convert_sql_date($user['exp']); // if expiration date is passed, store a special value for active field @@ -820,20 +820,20 @@ function active_filter($active, $params, $row) { $_user = api_get_user_info(); - if ($active == '1') { + if ('1' == $active) { $action = 'Lock'; $image = 'accept'; - } elseif ($active == '-1') { + } elseif ('-1' == $active) { $action = 'edit'; $image = 'warning'; - } elseif ($active == '0') { + } elseif ('0' == $active) { $action = 'Unlock'; $image = 'error'; } $result = ''; - if ($action === 'edit') { + if ('edit' === $action) { $result = Display::return_icon( $image.'.png', get_lang('AccountExpired'), @@ -1170,7 +1170,7 @@ $table_result = $table->return_table(); $extra_search_options = ''; // Try to search the user everywhere -if ($table->get_total_number_of_items() == 0) { +if (0 == $table->get_total_number_of_items()) { if (api_get_multiple_access_url() && isset($_REQUEST['keyword'])) { $keyword = Database::escape_string($_REQUEST['keyword']); $conditions = ['username' => $keyword]; diff --git a/main/admin/user_list_consent.php b/main/admin/user_list_consent.php index 9fbcf3ae92..5fb7bf441b 100644 --- a/main/admin/user_list_consent.php +++ b/main/admin/user_list_consent.php @@ -6,8 +6,6 @@ use ChamiloSession as Session; /** * @author Bart Mollet * @author Julio Montoya BeezNest 2011 - * - * @package chamilo.admin */ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; @@ -100,7 +98,7 @@ function prepare_user_sql_query($getCount) } } - if ($atLeastOne == false) { + if (false == $atLeastOne) { $keywordListValues = []; } @@ -225,7 +223,7 @@ function get_user_data($from, $number_of_items, $column, $direction) alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; - if ($user[7] == 1 && !empty($user[10])) { + if (1 == $user[7] && !empty($user[10])) { // check expiration date $expiration_time = convert_sql_date($user[10]); // if expiration date is passed, store a special value for active field diff --git a/main/admin/user_move_stats.php b/main/admin/user_move_stats.php index c2ad282728..4bf6ba8ed1 100755 --- a/main/admin/user_move_stats.php +++ b/main/admin/user_move_stats.php @@ -3,8 +3,6 @@ /** * User move script (to move between courses and sessions). - * - * @package chamilo.admin */ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/admin/user_update_import.php b/main/admin/user_update_import.php index d6952a33b0..f75bfb7736 100644 --- a/main/admin/user_update_import.php +++ b/main/admin/user_update_import.php @@ -3,8 +3,6 @@ /** * This tool allows platform admins to add users by uploading a CSV or XML file. - * - * @package chamilo.admin */ use Ddeboer\DataImport\Reader\CsvReader; diff --git a/main/admin/usergroup_export.php b/main/admin/usergroup_export.php index 8cdc7ed534..09b149469e 100755 --- a/main/admin/usergroup_export.php +++ b/main/admin/usergroup_export.php @@ -1,9 +1,6 @@ addCheckBox( 'send_to_hrm_users', null, diff --git a/main/announcements/download.php b/main/announcements/download.php index bf9db69bd5..a4a222ebec 100755 --- a/main/announcements/download.php +++ b/main/announcements/download.php @@ -41,7 +41,7 @@ if (is_dir($full_file_name)) { //remove last slash if present //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url; //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René) - while ($doc_url[$dul = strlen($doc_url) - 1] == '/') { + while ('/' == $doc_url[$dul = strlen($doc_url) - 1]) { $doc_url = substr($doc_url, 0, $dul); } //create the path @@ -71,7 +71,7 @@ if (Database::num_rows($result) > 0) { ) ) { $result = DocumentManager::file_send_for_download($full_file_name, true, $title); - if ($result === false) { + if (false === $result) { api_not_allowed(true); } } diff --git a/main/badge/assertion.php b/main/badge/assertion.php index 132e0f4464..7fe0786fdb 100644 --- a/main/badge/assertion.php +++ b/main/badge/assertion.php @@ -5,8 +5,6 @@ * Show information about a new assertion. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.badge */ require_once __DIR__.'/../inc/global.inc.php'; @@ -15,7 +13,7 @@ $skillId = isset($_GET['skill']) ? (int) $_GET['skill'] : 0; $courseId = isset($_GET['course']) ? (int) $_GET['course'] : 0; $sessionId = isset($_GET['session']) ? (int) $_GET['session'] : 0; -if ($userId === 0 || $skillId === 0) { +if (0 === $userId || 0 === $skillId) { exit; } @@ -32,7 +30,7 @@ $userSkill = $objSkillRelUser->getByUserAndSkill( $sessionId ); -if ($userSkill == false) { +if (false == $userSkill) { exit; } diff --git a/main/badge/assign.php b/main/badge/assign.php index eabac0c27b..c2da385c29 100644 --- a/main/badge/assign.php +++ b/main/badge/assign.php @@ -8,8 +8,6 @@ use Skill as SkillManager; * Page for assign skills to a user. * * @author: Jose Loguercio - * - * @package chamilo.badge */ require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/badge/class.php b/main/badge/class.php index a880b85e92..2c23e93ff3 100644 --- a/main/badge/class.php +++ b/main/badge/class.php @@ -5,8 +5,6 @@ * Show information about the OpenBadge class. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.badge */ require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/badge/criteria.php b/main/badge/criteria.php index 13e9ceb28c..def38c499f 100644 --- a/main/badge/criteria.php +++ b/main/badge/criteria.php @@ -5,8 +5,6 @@ * Show information about OpenBadge criteria. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.badge */ require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/badge/issued.php b/main/badge/issued.php index 211c8fd7ce..112abd2903 100644 --- a/main/badge/issued.php +++ b/main/badge/issued.php @@ -10,8 +10,6 @@ use SkillRelUser as SkillRelUserManager; * * @author Angel Fernando Quiroz Campos * @author José Loguercio Silva - * - * @package chamilo.badge */ require_once __DIR__.'/../inc/global.inc.php'; @@ -233,7 +231,7 @@ if ($allowExport) { $backpack = 'https://backpack.openbadges.org/'; $configBackpack = api_get_setting('openbadges_backpack'); - if (strcmp($backpack, $configBackpack) !== 0) { + if (0 !== strcmp($backpack, $configBackpack)) { $backpack = $configBackpack; if (substr($backpack, -1) !== '/') { $backpack .= '/'; diff --git a/main/badge/issued_all.php b/main/badge/issued_all.php index 409859921e..2f59d99c0e 100644 --- a/main/badge/issued_all.php +++ b/main/badge/issued_all.php @@ -9,8 +9,6 @@ use SkillRelUser as SkillRelUserManager; * Show information about all issued badges with same skill by user. * * @author José Loguercio Silva - * - * @package chamilo.badge */ require_once __DIR__.'/../inc/global.inc.php'; @@ -220,7 +218,7 @@ foreach ($userSkills as $index => $skillIssue) { $backpack = 'https://backpack.openbadges.org/'; $configBackpack = api_get_setting('openbadges_backpack'); - if (strcmp($backpack, $configBackpack) !== 0) { + if (0 !== strcmp($backpack, $configBackpack)) { $backpack = $configBackpack; if (substr($backpack, -1) !== '/') { $backpack .= '/'; diff --git a/main/badge/issuer.php b/main/badge/issuer.php index 1bfb97e834..9302200dd6 100644 --- a/main/badge/issuer.php +++ b/main/badge/issuer.php @@ -5,8 +5,6 @@ * Show information about the OpenBadge issuer. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.badge */ require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/blog/blog.php b/main/blog/blog.php index 8b275ae983..2364b1faf6 100755 --- a/main/blog/blog.php +++ b/main/blog/blog.php @@ -3,8 +3,6 @@ /** * BLOG HOMEPAGE * This file takes care of all blog navigation and displaying. - * - * @package chamilo.blogs */ require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/blog/blog_admin.php b/main/blog/blog_admin.php index 5fa076f16c..069433821a 100755 --- a/main/blog/blog_admin.php +++ b/main/blog/blog_admin.php @@ -4,8 +4,6 @@ /** * BLOG HOMEPAGE * This file takes care of all blog navigation and displaying. - * - * @package chamilo.blogs */ require_once __DIR__.'/../inc/global.inc.php'; $current_course_tool = TOOL_BLOGS; diff --git a/main/blog/download.php b/main/blog/download.php index 62e7beb114..d5b5c53fa7 100755 --- a/main/blog/download.php +++ b/main/blog/download.php @@ -5,8 +5,6 @@ * Html files are parsed to fix a few problems with URLs, * but this code will hopefully be replaced soon by an Apache URL * rewrite mechanism. - * - * @package chamilo.blogs */ session_cache_limiter('public'); @@ -36,7 +34,7 @@ $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/b //if the rewrite rule asks for a directory, we redirect to the course view if (is_dir($full_file_name)) { //remove last slash if present - while ($doc_url[$dul = strlen($doc_url) - 1] == '/') { + while ('/' == $doc_url[$dul = strlen($doc_url) - 1]) { $doc_url = substr($doc_url, 0, $dul); } //create the path diff --git a/main/calendar/agenda.php b/main/calendar/agenda.php index 307c01ff47..76e796fcae 100755 --- a/main/calendar/agenda.php +++ b/main/calendar/agenda.php @@ -1,10 +1,6 @@ TOOL_CALENDAR_EVENT, - 'tool_id' => 0, - 'tool_id_detail' => 0, 'action' => $action, - 'info' => '', ]; Event::registerLog($logInfo); diff --git a/main/calendar/agenda_js.php b/main/calendar/agenda_js.php index 118ea248e2..ef1580d466 100755 --- a/main/calendar/agenda_js.php +++ b/main/calendar/agenda_js.php @@ -1,9 +1,6 @@ addHtmlEditor( ] ); -if ($agenda->type === 'course') { +if ('course' === $agenda->type) { $form->addHtml(''); diff --git a/main/calendar/agenda_list.php b/main/calendar/agenda_list.php index cad5594c9a..9ff9479ee7 100755 --- a/main/calendar/agenda_list.php +++ b/main/calendar/agenda_list.php @@ -1,17 +1,13 @@ TOOL_CALENDAR_EVENT, - 'tool_id' => 0, - 'tool_id_detail' => 0, 'action' => $action, ]; Event::registerLog($logInfo); diff --git a/main/course_description/add.php b/main/course_description/add.php index 122733b0dc..fa05437217 100755 --- a/main/course_description/add.php +++ b/main/course_description/add.php @@ -5,8 +5,6 @@ * View (MVC patter) for adding a course description. * * @author Christian Fasanando - * - * @package chamilo.course_description */ // protect a course script diff --git a/main/course_description/course_description_controller.php b/main/course_description/course_description_controller.php index 597e0239a5..ed0e242868 100644 --- a/main/course_description/course_description_controller.php +++ b/main/course_description/course_description_controller.php @@ -7,8 +7,6 @@ * it should be included inside a dispatcher file (e.g: index.php). * * @author Christian Fasanando - * - * @package chamilo.course_description */ class CourseDescriptionController { diff --git a/main/course_description/edit.php b/main/course_description/edit.php index 82e16b7f75..eafcb26f5d 100755 --- a/main/course_description/edit.php +++ b/main/course_description/edit.php @@ -5,8 +5,6 @@ * View (MVC patter) for editing a course description. * * @author Christian Fasanando - * - * @package chamilo.course_description */ // protect a course script diff --git a/main/course_description/layout.php b/main/course_description/layout.php index 997b971d6c..acd6b76898 100755 --- a/main/course_description/layout.php +++ b/main/course_description/layout.php @@ -5,8 +5,6 @@ * Layout (principal view) used for structuring other views. * * @author Christian Fasanando - * - * @package chamilo.course_description */ // protect a course script diff --git a/main/course_info/download.php b/main/course_info/download.php index 737d07ac0e..fa6f5a7c58 100755 --- a/main/course_info/download.php +++ b/main/course_info/download.php @@ -5,8 +5,6 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver; /** * Download script for course info. - * - * @package chamilo.course_info */ require_once __DIR__.'/../inc/global.inc.php'; $this_section = SECTION_COURSES; @@ -32,7 +30,7 @@ if (in_array($extension, ['xml', 'csv']) && (api_is_platform_admin(true) || api_is_drh()) ) { $content_type = 'application/force-download'; -} elseif ($extension === 'zip' && $_cid && (api_is_platform_admin(true) || api_is_course_admin())) { +} elseif ('zip' === $extension && $_cid && (api_is_platform_admin(true) || api_is_course_admin())) { $content_type = 'application/force-download'; } diff --git a/main/course_info/legal.php b/main/course_info/legal.php index 70473776e6..7de0f0465d 100755 --- a/main/course_info/legal.php +++ b/main/course_info/legal.php @@ -23,7 +23,7 @@ $enabled = api_get_plugin_setting('courselegal', 'tool_enable'); $pluginExtra = null; $pluginLegal = false; -if ($enabled == 'true') { +if ('true' == $enabled) { $pluginLegal = true; require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php'; $plugin = CourseLegalPlugin::create(); diff --git a/main/dropbox/dropbox_init.inc.php b/main/dropbox/dropbox_init.inc.php index befd6b75b5..cbd3ce963b 100755 --- a/main/dropbox/dropbox_init.inc.php +++ b/main/dropbox/dropbox_init.inc.php @@ -15,8 +15,6 @@ use ChamiloSession as Session; * @author Roan Embrechts, virtual course support * @author Patrick Cool , Ghent University (see history version 1.3) * - * @package chamilo.dropbox - * * @todo complete refactoring. Currently there are about at least 3 sql queries needed for every individual dropbox document. * first we find all the documents that were sent (resp. received) by the user * then for every individual document the user(s)information who received (resp. sent) the document is searched @@ -108,8 +106,6 @@ Version 1.1 * download file / folder (download icon) * same action on multiple documents * extended feedback - * - * @package chamilo.dropbox */ require_once __DIR__.'/../inc/global.inc.php'; $is_allowed_in_course = api_is_allowed_in_course(); @@ -156,7 +152,7 @@ if (empty($session_id)) { // off all the documents that have already been sent. // @todo consider moving the javascripts in a function that displays the javascripts // only when it is needed. -if ($action == 'add') { +if ('add' == $action) { $dropbox_person = new Dropbox_Person( $user_id, $is_courseAdmin, diff --git a/main/dropbox/update.php b/main/dropbox/update.php index 532e632fd7..c9db38c65d 100644 --- a/main/dropbox/update.php +++ b/main/dropbox/update.php @@ -6,7 +6,7 @@ require_once 'dropbox_init.inc.php'; api_protect_course_script(); -if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { +if (0 != api_get_session_id() && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(true); } diff --git a/main/exercise/Draggable.php b/main/exercise/Draggable.php index 94e1792295..af901aa9b6 100644 --- a/main/exercise/Draggable.php +++ b/main/exercise/Draggable.php @@ -1,4 +1,5 @@ setDefaults(['orientation' => 'h']); - if ($this->isContent == 1) { + if (1 == $this->isContent) { $form->setDefaults($defaults); } } diff --git a/main/exercise/HotSpotDelineation.php b/main/exercise/HotSpotDelineation.php index dea533c926..8d327ba11b 100644 --- a/main/exercise/HotSpotDelineation.php +++ b/main/exercise/HotSpotDelineation.php @@ -1,4 +1,5 @@ id)) { $form->setDefaults($defaults); } else { - if ($this->isContent == 1) { + if (1 == $this->isContent) { // Default sample content. $form->setDefaults($defaults); } else { diff --git a/main/exercise/admin.php b/main/exercise/admin.php index 14c8a93b5a..86a5e2b89f 100755 --- a/main/exercise/admin.php +++ b/main/exercise/admin.php @@ -1,4 +1,5 @@ * @author César Perales Updated function names and import files for Aiken format support */ diff --git a/main/exercise/answer.class.php b/main/exercise/answer.class.php index e31c6772ba..0b58e29e0c 100755 --- a/main/exercise/answer.class.php +++ b/main/exercise/answer.class.php @@ -1,4 +1,5 @@ autoId as $key => $autoId) { if ($autoId == $id) { - $result = [ + return [ 'answer' => $this->answer[$key], 'correct' => $this->correct[$key], 'comment' => $this->comment[$key], ]; - - return $result; } } @@ -247,7 +244,7 @@ class Answer $field = 'position'; } - if ($order != 'ASC' && $order != 'DESC') { + if ('ASC' != $order && 'DESC' != $order) { $order = 'ASC'; } @@ -260,7 +257,7 @@ class Answer $result_question = Database::query($sql); $questionType = Database::fetch_array($result_question); - if ($questionType['type'] == DRAGGABLE) { + if (DRAGGABLE == $questionType['type']) { // Random is done by submit.js.tpl $this->read(); @@ -404,9 +401,7 @@ class Answer $rs = Database::query($sql); if (Database::num_rows($rs) > 0) { - $row = Database::fetch_array($rs, 'ASSOC'); - - return $row; + return Database::fetch_array($rs, 'ASSOC'); } return false; @@ -417,7 +412,7 @@ class Answer * * @author Yannick Warnier * - * @param - integer $id - answer ID + * @param - integer $pos - answer ID * * @return bool - answer title */ @@ -1070,7 +1065,7 @@ class Answer /** * Check if a answer is correct by an answer auto id. * - * @param $needle int The answer auto id + * @param int $needle The answer auto id * * @return bool */ diff --git a/main/exercise/calculated_answer.class.php b/main/exercise/calculated_answer.class.php index f7ef9f8e72..72629dc7c7 100644 --- a/main/exercise/calculated_answer.class.php +++ b/main/exercise/calculated_answer.class.php @@ -1,4 +1,5 @@ getRepository('ChamiloCoreBundle:CQuizCategory'); foreach ($questions_by_category as $categoryId => $questionList) { $cat = new TestCategory(); @@ -991,7 +991,6 @@ class Exercise } else { $categoryEntity = $parentsLoaded[$cat['parent_id']]; } - $repo = $em->getRepository('ChamiloCoreBundle:CQuizCategory'); $path = $repo->getPath($categoryEntity); $index = 0; @@ -1002,7 +1001,7 @@ class Exercise /** @var \Chamilo\CourseBundle\Entity\CQuizCategory $categoryParent */ foreach ($path as $categoryParent) { $visibility = $categoryParent->getVisibility(); - if ($visibility == 0) { + if (0 == $visibility) { $categoryParentId = $categoryId; $categoryTitle = $cat['title']; if (count($path) > 1) { @@ -1131,12 +1130,12 @@ class Exercise $randomLimit = " ORDER BY RAND() LIMIT $random"; // Random with no limit - if ($random == -1) { + if (-1 == $random) { $randomLimit = ' ORDER BY RAND() '; } // Admin see the list in default order - if ($adminView === true) { + if (true === $adminView) { // If viewing it as admin for edition, don't show it randomly, use title + id $randomLimit = 'ORDER BY e.question_order'; } @@ -1269,7 +1268,7 @@ class Exercise } /** - * @param $value int + * @param int $value */ public function updateSaveCorrectAnswers($value) { @@ -1681,7 +1680,7 @@ class Exercise ]; $allow = api_get_configuration_value('allow_exercise_categories'); - if ($allow === true) { + if (true === $allow) { if (!empty($this->getExerciseCategoryId())) { $params['exercise_category_id'] = $this->getExerciseCategoryId(); } @@ -1692,12 +1691,12 @@ class Exercise } $allow = api_get_configuration_value('allow_quiz_show_previous_button_setting'); - if ($allow === true) { + if (true === $allow) { $params['show_previous_button'] = $this->showPreviousButton(); } $allow = api_get_configuration_value('allow_notification_setting_per_exercise'); - if ($allow === true) { + if (true === $allow) { $notifications = $this->getNotifications(); $params['notifications'] = ''; if (!empty($notifications)) { @@ -1828,12 +1827,12 @@ class Exercise // searches the position of the question ID in the list $pos = array_search($questionId, $this->questionList); // question not found - if ($pos === false) { + if (false === $pos) { return false; } else { // dont reduce the number of random question if we use random by category option, or if // random all questions - if ($this->isRandom() && $this->isRandomByCat() == 0) { + if ($this->isRandom() && 0 == $this->isRandomByCat()) { if (count($this->questionList) >= $this->random && $this->random > 0) { $this->random--; $this->save(); @@ -2820,7 +2819,7 @@ class Exercise ]; $ic_slide->xapian_data = serialize($xapian_data); $exercise_description = $all_specific_terms.' '.$this->description; - $ic_slide->addValue("content", $exercise_description); + $ic_slide->addValue('content', $exercise_description); $di = new ChamiloIndexer(); isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; @@ -2849,7 +2848,7 @@ class Exercise public function search_engine_delete() { // remove from search engine if enabled - if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { + if ('true' == api_get_setting('search_enabled') && extension_loaded('xapian')) { $course_id = api_get_course_id(); $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); $sql = 'SELECT * FROM %s @@ -3130,9 +3129,7 @@ class Exercise 'questions_to_check' => '', ]; - $id = Database::insert($track_exercises, $params); - - return $id; + return Database::insert($track_exercises, $params); } /** @@ -3381,7 +3378,7 @@ class Exercise { $timeLeft = (int) $timeLeft; $script = 'redirectExerciseToResult();'; - if ($this->type == ALL_ON_ONE_PAGE) { + if (ALL_ON_ONE_PAGE == $this->type) { $script = "save_now_all('validate');"; } @@ -3532,7 +3529,7 @@ class Exercise $course_id = $this->course_id; $objQuestionTmp = Question::read($questionId, $this->course); - if ($objQuestionTmp === false) { + if (false === $objQuestionTmp) { return false; } @@ -3673,7 +3670,7 @@ class Exercise $result = Database::query($sql); $choice = Database::result($result, 0, 'answer'); - if ($userAnsweredQuestion === false) { + if (false === $userAnsweredQuestion) { $userAnsweredQuestion = !empty($choice); } $studentChoice = $choice == $answerAutoId ? 1 : 0; @@ -3871,7 +3868,7 @@ class Exercise } $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; - if ($answerCorrect == 1) { + if (1 == $answerCorrect) { $real_answers[$answerId] = false; if ($studentChoice) { $real_answers[$answerId] = true; @@ -3884,7 +3881,7 @@ class Exercise } } else { $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; - if ($answerCorrect == 1) { + if (1 == $answerCorrect) { $real_answers[$answerId] = false; if ($studentChoice) { $real_answers[$answerId] = true; @@ -3924,7 +3921,7 @@ class Exercise $last = count($pre_array) - 1; $is_set_switchable = explode('@', $pre_array[$last]); $switchable_answer_set = false; - if (isset($is_set_switchable[1]) && $is_set_switchable[1] == 1) { + if (isset($is_set_switchable[1]) && 1 == $is_set_switchable[1]) { $switchable_answer_set = true; } $answer = ''; @@ -3991,7 +3988,7 @@ class Exercise $chosen_list = []; for ($i = 0; $i < count($real_correct_tags); $i++) { - if ($i == 0) { + if (0 == $i) { $answer .= $real_text[0]; } if (!$switchable_answer_set) { @@ -4077,7 +4074,7 @@ class Exercise if (!$from_database) { $studentAnswer = FillBlanks::clearStudentAnswer($studentAnswer); if ($debug) { - error_log("Student answer cleaned:"); + error_log('Student answer cleaned:'); error_log($studentAnswer); } } @@ -4209,7 +4206,7 @@ class Exercise // take the string remaining (after the last "[" we found) $temp = api_substr($temp, $pos + 1); // quit the loop if there are no more blanks, and update $pos to the position of next ']' - if (($pos = api_strpos($temp, ']')) === false) { + if (false === ($pos = api_strpos($temp, ']'))) { // adds the end of the text $answer .= $temp; break; @@ -4256,7 +4253,7 @@ class Exercise $calculatedChoice = ''; for ($i = 0; $i < count($realCorrectTags); $i++) { - if ($i == 0) { + if (0 == $i) { $answer .= $realText[0]; } // Needed to parse ' and " characters @@ -4280,7 +4277,7 @@ class Exercise $answer .= ''; // remove   that causes issue } // adds the correct word, followed by ] to close the blank - if ($this->results_disabled != EXERCISE_FEEDBACK_TYPE_EXAM) { + if (EXERCISE_FEEDBACK_TYPE_EXAM != $this->results_disabled) { $answer .= ' / '.$realCorrectTags[$i].''; $calculatedStatus = Display::label(get_lang('Correct'), 'success'); $expectedAnswer = $realCorrectTags[$i]; @@ -4318,12 +4315,12 @@ class Exercise $choice = stripslashes($choice); $questionScore = $data['marks']; - if ($questionScore == -1) { + if (-1 == $questionScore) { $totalScore += 0; } else { $totalScore += $questionScore; } - if ($questionScore == '') { + if ('' == $questionScore) { $questionScore = 0; } $arrques = $questionName; @@ -4422,7 +4419,7 @@ class Exercise $status = Display::label(get_lang('Incorrect'), 'danger'); if (!empty($s_user_answer)) { - if ($answerType == DRAGGABLE) { + if (DRAGGABLE == $answerType) { if ($s_user_answer == $i_answer_correct_answer) { $questionScore += $i_answerWeighting; $totalScore += $i_answerWeighting; @@ -4480,7 +4477,7 @@ class Exercise } } } - } elseif ($answerType == DRAGGABLE) { + } elseif (DRAGGABLE == $answerType) { $user_answer = Display::label(get_lang('Incorrect'), 'danger'); if ($this->showExpectedChoice()) { $user_answer = ''; @@ -4496,8 +4493,8 @@ class Exercise } if ($show_result) { - if ($this->showExpectedChoice() === false && - $showTotalScoreAndUserChoicesInLastAttempt === false + if (false === $this->showExpectedChoice() && + false === $showTotalScoreAndUserChoicesInLastAttempt ) { $user_answer = ''; } @@ -4553,7 +4550,7 @@ class Exercise echo ''; break; case DRAGGABLE: - if ($showTotalScoreAndUserChoicesInLastAttempt == false) { + if (false == $showTotalScoreAndUserChoicesInLastAttempt) { $s_answer_label = ''; } echo ''; @@ -4770,7 +4767,7 @@ class Exercise $newquestionList[] = $questionId; } - if ($answerId === 1) { + if (1 === $answerId) { $studentChoice = $choice[$answerId]; $questionScore += $answerWeighting; } @@ -4803,7 +4800,7 @@ class Exercise } if ($show_result) { - if ($from === 'exercise_result') { + if ('exercise_result' === $from) { // Display answers (if not matching type, or if the answer is correct) if (!in_array($answerType, [MATCHING, DRAGGABLE, MATCHING_DRAGGABLE]) || $answerCorrect @@ -6188,9 +6185,8 @@ class Exercise $tpl = new Template(null, false, false, false, false, false, false); $tpl->assign('data', $data); $layoutTemplate = $tpl->get_template('exercise/partials/result_exercise.tpl'); - $content = $tpl->fetch($layoutTemplate); - return $content; + return $tpl->fetch($layoutTemplate); } /** @@ -7607,7 +7603,7 @@ class Exercise $questionList = $this->selectQuestionList(true); // test is randomQuestions - see field random of test - if ($this->random > 0 && $this->randomByCat == 0) { + if ($this->random > 0 && 0 == $this->randomByCat) { $numberRandomQuestions = $this->random; $questionScoreList = []; foreach ($questionList as $questionId) { @@ -7745,7 +7741,7 @@ class Exercise $ids = array_map('intval', $ids); $ids = implode(',', $ids); $track_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); - if ($sessionId != 0) { + if (0 != $sessionId) { $sql = "SELECT * FROM $track_exercises te INNER JOIN c_quiz cq ON cq.id = te.exe_exo_id AND te.c_id = cq.c_id WHERE @@ -7803,7 +7799,7 @@ class Exercise return null; } - $currentQuestion = $currentQuestion - 1; + $currentQuestion--; if (!empty($result['question_list'])) { $answeredQuestions = []; @@ -7941,7 +7937,7 @@ class Exercise } } - if ($onlyCorrect === false) { + if (false === $onlyCorrect) { // Only take latest attempt break; } @@ -7969,7 +7965,7 @@ class Exercise public function showPreviousButton() { $allow = api_get_configuration_value('allow_quiz_show_previous_button_setting'); - if ($allow === false) { + if (false === $allow) { return true; } @@ -7979,7 +7975,7 @@ class Exercise public function getPreventBackwards() { $allow = api_get_configuration_value('quiz_prevent_backwards_move'); - if ($allow === false) { + if (false === $allow) { return 0; } @@ -8053,9 +8049,8 @@ class Exercise ];*/ $type = Type::getType('array'); $platform = Database::getManager()->getConnection()->getDatabasePlatform(); - $result = $type->convertToPHPValue($this->pageResultConfiguration, $platform); - return $result; + return $type->convertToPHPValue($this->pageResultConfiguration, $platform); } return []; @@ -8071,9 +8066,7 @@ class Exercise $result = $this->getPageResultConfiguration(); if (!empty($result)) { - $value = isset($result[$attribute]) ? $result[$attribute] : null; - - return $value; + return isset($result[$attribute]) ? $result[$attribute] : null; } return null; @@ -8125,7 +8118,7 @@ class Exercise ]) ) { $hide = (int) $this->getPageConfigurationAttribute('hide_expected_answer'); - if ($hide === 1) { + if (1 === $hide) { return false; } @@ -8146,7 +8139,7 @@ class Exercise public function getQuestionRibbon($class, $scoreLabel, $result, $array) { $hide = (int) $this->getPageConfigurationAttribute('hide_question_score'); - if ($hide === 1) { + if (1 === $hide) { return ''; } @@ -8159,7 +8152,7 @@ class Exercise if (!empty($result)) { $label .= '

'.get_lang('Score').': '.$result.'

'; } - if ($hideLabel === true) { + if (true === $hideLabel) { $answerUsed = (int) $array['used']; $answerMissing = (int) $array['missing'] - $answerUsed; for ($i = 1; $i <= $answerUsed; $i++) { @@ -8326,7 +8319,7 @@ class Exercise $studentIdList = array_column($studentList, 'user_id'); } - if ($this->exercise_was_added_in_lp == false) { + if (false == $this->exercise_was_added_in_lp) { $sql = "SELECT * FROM $tblStats WHERE exe_exo_id = $exerciseId AND @@ -9574,7 +9567,7 @@ class Exercise public function hasResultsAccess($exerciseResultInfo) { $diff = $this->getResultAccessTimeDiff($exerciseResultInfo); - if ($diff === 0) { + if (0 === $diff) { return false; } @@ -10094,7 +10087,7 @@ class Exercise $count = $category_info['count_questions']; // -1 means all questions $categoryCountArray[$category_id] = $count; - if ($count == -1) { + if (-1 == $count) { $categoryCountArray[$category_id] = 999; } } @@ -10282,7 +10275,7 @@ class Exercise $question = $item['question']; $file = $item['generated_oral_file']; $answer = $item['answer']; - if ($answer == 0) { + if (0 == $answer) { $answer = ''; } $answer_type = $item['answer_type']; diff --git a/main/exercise/exercise.php b/main/exercise/exercise.php index ef83262e3d..8b21b3837e 100644 --- a/main/exercise/exercise.php +++ b/main/exercise/exercise.php @@ -388,7 +388,7 @@ if ($is_allowedToEdit) { } // Clean student results - if ($exercise_action_locked == false) { + if (false == $exercise_action_locked) { $quantity_results_deleted = $objExerciseTmp->cleanResults(true); $title = $objExerciseTmp->selectTitle(); @@ -639,7 +639,7 @@ if (api_get_configuration_value('allow_exercise_categories') === false) { $down = ''; if ($is_allowedToEdit) { $up = Display::url($upIcon, $modifyUrl.'&action=up_category&category_id_edit='.$categoryIdItem); - if ($counter === 0) { + if (0 === $counter) { $up = Display::url(Display::return_icon('up_na.png'), '#'); } $down = Display::url($downIcon, $modifyUrl.'&action=down_category&category_id_edit='.$categoryIdItem); @@ -660,7 +660,7 @@ if (api_get_configuration_value('allow_exercise_categories') === false) { } } -if ($origin !== 'learnpath') { +if ('learnpath' !== $origin) { // We are not in learnpath tool Display::display_footer(); } diff --git a/main/exercise/exercise_admin.php b/main/exercise/exercise_admin.php index 3538bce6db..9d729172ea 100755 --- a/main/exercise/exercise_admin.php +++ b/main/exercise/exercise_admin.php @@ -49,8 +49,7 @@ $htmlHeadXtra[] = ''; $htmlHeadXtra[] = $js; @@ -939,7 +937,7 @@ if ($show_results) { echo $totalScoreText; } -if ($action === 'export') { +if ('export' === $action) { $content = ob_get_clean(); // needed in order to mpdf to work ob_clean(); diff --git a/main/exercise/exercise_submit.php b/main/exercise/exercise_submit.php index 9aecba820f..cfd73603a6 100755 --- a/main/exercise/exercise_submit.php +++ b/main/exercise/exercise_submit.php @@ -42,7 +42,7 @@ $sessionId = api_get_session_id(); $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools'); $showGlossary = in_array($glossaryExtraTools, ['true', 'exercise', 'exercise_and_lp']); -if ($origin === 'learnpath') { +if ('learnpath' == $origin) { $showGlossary = in_array($glossaryExtraTools, ['true', 'lp', 'exercise_and_lp']); } if ($showGlossary) { @@ -70,7 +70,7 @@ if (api_get_configuration_value('quiz_prevent_copy_paste')) { $htmlHeadXtra[] = ''; } -if (api_get_setting('enable_record_audio') === 'true') { +if ('true' === api_get_setting('enable_record_audio')) { $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; @@ -174,7 +174,7 @@ $exercise_sound = $objExercise->selectSound(); // If reminder ends we jump to the exercise_reminder if ($objExercise->review_answers) { - if ($remind_question_id == -1) { + if (-1 == $remind_question_id) { header('Location: '.api_get_path(WEB_CODE_PATH). 'exercise/exercise_reminder.php?exerciseId='.$exerciseId.'&'.api_get_cidreq()); exit; @@ -189,7 +189,7 @@ $current_timestamp = time(); $myRemindList = []; $time_control = false; -if ($objExercise->expired_time != 0) { +if (0 != $objExercise->expired_time) { $time_control = true; } @@ -419,7 +419,7 @@ if (empty($exercise_stat_info)) { // Remember last question id position. $isFirstTime = Session::read('firstTime'); - if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) { + if ($isFirstTime && ONE_PER_PAGE == $objExercise->type) { $resolvedQuestions = Event::getAllExerciseEventByExeId($exe_id); if (!empty($resolvedQuestions) && !empty($exercise_stat_info['data_tracking']) @@ -493,9 +493,9 @@ if ($debug) { error_log("6.1 params: -> $params"); } -if ($reminder == 2 && empty($myRemindList)) { +if (2 == $reminder && empty($myRemindList)) { if ($debug) { - error_log("6.2 calling the exercise_reminder.php "); + error_log('6.2 calling the exercise_reminder.php '); } header('Location: exercise_reminder.php?'.$params); exit; @@ -610,7 +610,7 @@ if (!empty($questionList)) { if ($current_question > $question_count) { // If time control then don't change the current question, otherwise there will be a loop. // @todo - if ($time_control == false) { + if (false == $time_control) { $current_question = 0; } } @@ -644,7 +644,7 @@ if ($formSent && isset($_POST)) { error_log('9.2. $_POST[hotspot] data '.print_r($exerciseResultCoordinates, 1)); } } - if ($objExercise->type == ALL_ON_ONE_PAGE) { + if (ALL_ON_ONE_PAGE == $objExercise->type) { // $exerciseResult receives the content of the form. // Each choice of the student is stored into the array $choice $exerciseResult = $choice; @@ -1387,7 +1387,7 @@ if (!empty($error)) { foreach ($questionList as $questionId) { // for sequential exercises - if ($objExercise->type == ONE_PER_PAGE) { + if (ONE_PER_PAGE == $objExercise->type) { // if it is not the right question, goes to the next loop iteration if ($current_question != $i) { $i++; diff --git a/main/exercise/exercise_submit_modal.php b/main/exercise/exercise_submit_modal.php index ea34ed49d9..c64b2d65e2 100755 --- a/main/exercise/exercise_submit_modal.php +++ b/main/exercise/exercise_submit_modal.php @@ -93,7 +93,7 @@ if (empty($choiceValue) && empty($hotSpot) && $loaded) { $links = ''.get_lang('TryAgain').' '.$icon.' '; // the link to finish the test - if ($destinationId == -1) { + if (-1 == $destinationId) { $links .= Display::return_icon( 'finish.gif', '', @@ -195,7 +195,7 @@ $answerType = $objQuestionTmp->selectType(); $showResult = false; $objAnswerTmp = new Answer($questionId, api_get_course_int_id()); -if ($objExercise->getFeedbackType() === EXERCISE_FEEDBACK_TYPE_DIRECT) { +if (EXERCISE_FEEDBACK_TYPE_DIRECT === $objExercise->getFeedbackType()) { $showResult = true; } @@ -334,9 +334,9 @@ if ($answerType === HOT_SPOT_DELINEATION) { $contents = $manageAnswerHtmlContent; } $links = ''; -if ($objExercise->getFeedbackType() === EXERCISE_FEEDBACK_TYPE_DIRECT) { - if (isset($choiceValue) && $choiceValue == -1) { - if ($answerType != HOT_SPOT_DELINEATION) { +if (EXERCISE_FEEDBACK_TYPE_DIRECT === $objExercise->getFeedbackType()) { + if (isset($choiceValue) && -1 == $choiceValue) { + if (HOT_SPOT_DELINEATION != $answerType) { $links .= ''.get_lang('ChooseAnAnswer').'
'; } } @@ -352,7 +352,7 @@ if (isset($result['answer_destination'])) { } // the link to retry the question -if (isset($try) && $try == 1) { +if (isset($try) && 1 == $try) { $num_value_array = array_keys($questionList, $questionId); $links .= Display:: return_icon( 'reload.gif', @@ -386,7 +386,7 @@ $nextQuestion = $questionNum + 1; $destinationId = isset($questionList[$nextQuestion]) ? $questionList[$nextQuestion] : -1; // the link to finish the test -if ($destinationId == -1) { +if (-1 == $destinationId) { $links .= Display:: return_icon( 'finish.gif', '', diff --git a/main/exercise/export/aiken/aiken_classes.php b/main/exercise/export/aiken/aiken_classes.php index 8d8447eb49..4070ce5387 100755 --- a/main/exercise/export/aiken/aiken_classes.php +++ b/main/exercise/export/aiken/aiken_classes.php @@ -1,12 +1,11 @@ * @author Yannick Warnier - updated ImsAnswerHotspot to match QTI norms * @author César Perales Updated function names and import files for Aiken format support - * - * @package chamilo.exercise */ /** @@ -37,9 +36,6 @@ class Aiken2Question extends Question return true; } - /** - * {@inheritdoc} - */ public function processAnswersCreation($form, $exercise) { return true; @@ -48,8 +44,6 @@ class Aiken2Question extends Question /** * Class. - * - * @package chamilo.exercise */ class AikenAnswerMultipleChoice extends Answer { diff --git a/main/exercise/export/aiken/aiken_import.inc.php b/main/exercise/export/aiken/aiken_import.inc.php index db783ddf49..303adb3d7b 100755 --- a/main/exercise/export/aiken/aiken_import.inc.php +++ b/main/exercise/export/aiken/aiken_import.inc.php @@ -1,4 +1,5 @@ * @author Guillaume Lederer * @author César Perales Parse function for Aiken format - * - * @package chamilo.exercise */ /** @@ -170,7 +169,7 @@ function aiken_import_exercise($file) $result = 'NoTxtFileFoundInTheZip'; } - if ($result !== true) { + if (true !== $result) { return $result; } @@ -371,7 +370,7 @@ function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile) } } $total_questions = count($exercise_info['question']); - $total_weight = (!empty($_POST['total_weight'])) ? intval($_POST['total_weight']) : 20; + $total_weight = !empty($_POST['total_weight']) ? (int) ($_POST['total_weight']) : 20; foreach ($exercise_info['question'] as $key => $question) { $exercise_info['question'][$key]['weighting'][current(array_keys($exercise_info['question'][$key]['weighting']))] = $total_weight / $total_questions; } diff --git a/main/exercise/export/exercise_import.inc.php b/main/exercise/export/exercise_import.inc.php index 8dbed79599..95bea987c5 100755 --- a/main/exercise/export/exercise_import.inc.php +++ b/main/exercise/export/exercise_import.inc.php @@ -1,4 +1,5 @@ * @author Guillaume Lederer * @author Yannick Warnier @@ -34,7 +32,7 @@ function get_and_unzip_uploaded_exercise($baseWorkDir, $uploadPath) } if (preg_match('/.zip$/i', $_FILES['userFile']['name'])) { - $result = handle_uploaded_document( + return handle_uploaded_document( $_course, $_FILES['userFile'], $baseWorkDir, @@ -50,8 +48,6 @@ function get_and_unzip_uploaded_exercise($baseWorkDir, $uploadPath) null, false ); - - return $result; } return false; @@ -683,7 +679,6 @@ function isQtiManifest($filePath) * to be able to transform them into the questions text. * * @param string $filePath The absolute filepath - * @param array $links List of filepaths changes * * @return bool */ @@ -708,8 +703,8 @@ function qtiProcessManifest($filePath) $file = $xml->resources->resource->file[$i]; $href = ''; foreach ($file->attributes() as $key => $value) { - if ($key == 'href') { - if (substr($value, -3, 3) != 'xml') { + if ('href' == $key) { + if ('xml' != substr($value, -3, 3)) { $href = $value; } } diff --git a/main/exercise/export/index.php b/main/exercise/export/index.php index a83bbe0669..248be214c4 100755 --- a/main/exercise/export/index.php +++ b/main/exercise/export/index.php @@ -1,12 +1,11 @@ */ /** * Redirection. */ -header("Location: ../../../"); +header('Location: ../../../'); exit(); diff --git a/main/exercise/export/qti2/qti2_classes.php b/main/exercise/export/qti2/qti2_classes.php index 0b03a0505c..7f7e180d42 100755 --- a/main/exercise/export/qti2/qti2_classes.php +++ b/main/exercise/export/qti2/qti2_classes.php @@ -28,8 +28,6 @@ interface ImsAnswerInterface * @author Claro Team * @author Yannick Warnier - * updated ImsAnswerHotspot to match QTI norms - * - * @package chamilo.exercise */ class Ims2Question extends Question { @@ -83,9 +81,6 @@ class Ims2Question extends Question return true; } - /** - * {@inheritdoc} - */ public function processAnswersCreation($form, $exercise) { return true; @@ -94,8 +89,6 @@ class Ims2Question extends Question /** * Class. - * - * @package chamilo.exercise */ class ImsAnswerMultipleChoice extends Answer implements ImsAnswerInterface { diff --git a/main/exercise/export/qti2/qti2_export.php b/main/exercise/export/qti2/qti2_export.php index 79597e279d..e7559a1dd9 100755 --- a/main/exercise/export/qti2/qti2_export.php +++ b/main/exercise/export/qti2/qti2_export.php @@ -1,11 +1,10 @@ * @author Yannick Warnier - * - * @package chamilo.exercise */ require __DIR__.'/qti2_classes.php'; @@ -17,8 +16,6 @@ require __DIR__.'/qti2_classes.php'; * Every start_*() and corresponding end_*(), as well as export_*() methods return a string. * * note: Attached files are NOT exported. - * - * @package chamilo.exercise */ class ImsAssessmentItem { @@ -44,7 +41,7 @@ class ImsAssessmentItem { $this->question = $question; $this->answer = $this->question->setAnswer(); - $this->questionIdent = "QST_".$question->id; + $this->questionIdent = 'QST_'.$question->id; } /** @@ -111,8 +108,6 @@ class ImsAssessmentItem * * This is a default behaviour, some classes may want to override this. * - * @param $standalone: Boolean stating if it should be exported as a stand-alone question - * * @return string string, the XML flow for an Item */ public function export($standalone = false) @@ -127,7 +122,7 @@ class ImsAssessmentItem return $head; } - $res = $head + return $head .$this->start_item() .$this->answer->imsExportResponsesDeclaration($this->questionIdent, $this->question) .$this->start_item_body() @@ -141,8 +136,6 @@ class ImsAssessmentItem .$this->add_response_processing() .$this->end_item() .$foot; - - return $res; } } @@ -158,8 +151,6 @@ class ImsAssessmentItem * - anonymous_attempts * * @author Amand Tihon - * - * @package chamilo.exercise */ class ImsSection { @@ -179,12 +170,10 @@ class ImsSection public function start_section() { - $out = '
'."\n"; - - return $out; } public function end_section() @@ -212,11 +201,9 @@ class ImsSection */ public function export_presentation() { - $out = "\n" - ." exercise->selectDescription())."]]>\n" + return "\n" + .' exercise->selectDescription())."]]>\n" ."\n"; - - return $out; } /** @@ -315,8 +302,6 @@ class ImsSection * warning: Attached files are NOT exported. * * @author Amand Tihon - * - * @package chamilo.exercise */ class ImsItem { @@ -335,7 +320,7 @@ class ImsItem { $this->question = $question; $this->answer = $question->answer; - $this->questionIdent = "QST_".$question->selectId(); + $this->questionIdent = 'QST_'.$question->selectId(); } /** @@ -418,7 +403,7 @@ class ImsItem public function export($standalone = false) { global $charset; - $head = $foot = ""; + $head = $foot = ''; if ($standalone) { $head = ''."\n" @@ -456,9 +441,8 @@ function export_exercise_to_qti($exerciseId, $standalone = true) return ''; } $ims = new ImsSection($exercise); - $xml = $ims->export($standalone); - return $xml; + return $ims->export($standalone); } /** diff --git a/main/exercise/export/scorm/ScormAnswerFillInBlanks.php b/main/exercise/export/scorm/ScormAnswerFillInBlanks.php index 7cb9a04d26..616e1860ce 100644 --- a/main/exercise/export/scorm/ScormAnswerFillInBlanks.php +++ b/main/exercise/export/scorm/ScormAnswerFillInBlanks.php @@ -1,10 +1,9 @@ '; - $html[] = ' '.$answer.""; + $html[] = ' '.$answer.''; $html[] = '  '; $html[] = '