From d3e46317aeb83529061b61cd8b0a8f8571d94966 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sat, 28 Nov 2020 17:24:20 +0100 Subject: [PATCH] Minor - fix function name apiBlockInactiveUser, update from master --- main/auth/profile.php | 2 +- main/calendar/agenda_js.php | 2 +- main/dashboard/dashboard_controller.php | 5 ++--- main/exercise/exercise.class.php | 4 ++-- main/exercise/exercise_report.php | 8 ++++---- main/exercise/exercise_result.php | 2 +- main/exercise/export/qti2/qti2_export.php | 7 ++----- main/exercise/export/scorm/ScormQuestion.php | 4 +--- main/exercise/question.class.php | 14 ++++++-------- main/gradebook/my_certificates.php | 2 +- main/inc/lib/api.lib.php | 20 +++++++++----------- whoisonline.php | 2 +- 12 files changed, 31 insertions(+), 41 deletions(-) diff --git a/main/auth/profile.php b/main/auth/profile.php index bb98df4d08..45ca6bd4f0 100755 --- a/main/auth/profile.php +++ b/main/auth/profile.php @@ -13,7 +13,7 @@ use ChamiloSession as Session; */ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; -apiBlockInactiveUser(); +api_block_inactive_user(); $this_section = SECTION_MYPROFILE; $allowSocialTool = api_get_setting('allow_social_tool') === 'true'; diff --git a/main/calendar/agenda_js.php b/main/calendar/agenda_js.php index 0dbc3e423a..63276e7329 100755 --- a/main/calendar/agenda_js.php +++ b/main/calendar/agenda_js.php @@ -13,7 +13,7 @@ if ('personal' == $type || 'admin' == $type) { $cidReset = true; // fixes #5162 } require_once __DIR__.'/../inc/global.inc.php'; -apiBlockInactiveUser(); +api_block_inactive_user(); $current_course_tool = TOOL_CALENDAR_EVENT; $this_section = SECTION_MYAGENDA; diff --git a/main/dashboard/dashboard_controller.php b/main/dashboard/dashboard_controller.php index 29d0c50e24..de9035f666 100755 --- a/main/dashboard/dashboard_controller.php +++ b/main/dashboard/dashboard_controller.php @@ -1,4 +1,5 @@ * * @todo move to main/inc/lib - * - * @package chamilo.dashboard */ class DashboardController { @@ -126,7 +125,7 @@ class DashboardController */ public function store_user_block() { - if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") { + if ("POST" == strtoupper($_SERVER['REQUEST_METHOD'])) { $enabled_blocks = $_POST['enabled_blocks']; $columns = $_POST['columns']; DashboardManager::store_user_blocks($this->user_id, $enabled_blocks, $columns); diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index f588a51201..b5df0c7e01 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -23,7 +23,7 @@ use Doctrine\DBAL\Types\Type; */ class Exercise { - const PAGINATION_ITEMS_PER_PAGE = 20; + public const PAGINATION_ITEMS_PER_PAGE = 20; public $iId; public $id; public $name; @@ -6462,7 +6462,7 @@ class Exercise if (!empty($track_exercise_info)) { $totalScore = 0; - $objExercise = new Exercise(); + $objExercise = new self(); $objExercise->read($track_exercise_info['exe_exo_id']); if (!empty($track_exercise_info['data_tracking'])) { $question_list = explode(',', $track_exercise_info['data_tracking']); diff --git a/main/exercise/exercise_report.php b/main/exercise/exercise_report.php index 599459fb04..c39351af59 100755 --- a/main/exercise/exercise_report.php +++ b/main/exercise/exercise_report.php @@ -313,7 +313,7 @@ if (isset($_REQUEST['comments']) && if ($prereqCheck) { $passed = true; } - if ($passed === false) { + if (false === $passed) { if (!empty($objExerciseTmp->pass_percentage)) { $passed = ExerciseLib::isSuccessExerciseResult( $tot, @@ -334,9 +334,9 @@ if (isset($_REQUEST['comments']) && } $sql = "UPDATE $TBL_LP_ITEM_VIEW - SET score = '".floatval($tot)."' + SET score = '".(float) $tot."' $statusCondition - WHERE c_id = ".$course_id." AND id = ".$lp_item_view_id; + WHERE c_id = $course_id AND id = $lp_item_view_id"; Database::query($sql); header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/exercise_show.php?id='.$id.'&student='.$student_id.'&'.api_get_cidreq()); @@ -675,7 +675,7 @@ if ($is_allowedToEdit || $is_tutor) { ['name' => 'actions', 'index' => 'actions', 'width' => '60', 'align' => 'left', 'search' => 'false', 'sortable' => 'false'], ]; - if ($officialCodeInList === 'true') { + if ('true' === $officialCodeInList) { $officialCodeRow = ['name' => 'official_code', 'index' => 'official_code', 'width' => '50', 'align' => 'left', 'search' => 'true']; $column_model = array_merge([$officialCodeRow], $column_model); } diff --git a/main/exercise/exercise_result.php b/main/exercise/exercise_result.php index a0fed32783..fb058929ea 100755 --- a/main/exercise/exercise_result.php +++ b/main/exercise/exercise_result.php @@ -276,7 +276,7 @@ if (!in_array($origin, ['learnpath', 'embeddable', 'mobileapp'])) { $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id .'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId .'&fb_type='.$objExercise->getFeedbackType().'#atoc_'.$learnpath_item_id; - $href = $lp_mode === 'fullscreen' ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'"'; + $href = 'fullscreen' === $lp_mode ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'"'; if (api_is_allowed_to_session_edit()) { Exercise::cleanSessionVariables(); diff --git a/main/exercise/export/qti2/qti2_export.php b/main/exercise/export/qti2/qti2_export.php index 725b7c6052..4d7b7b07dd 100755 --- a/main/exercise/export/qti2/qti2_export.php +++ b/main/exercise/export/qti2/qti2_export.php @@ -60,7 +60,7 @@ class ImsAssessmentItem } } - $string = ''."\n"; - return $string; } /** @@ -264,7 +263,7 @@ class ImsSection ."\n"; $foot = "\n"; } - $out = $head + return $head .$this->start_section() .$this->export_duration() .$this->export_presentation() @@ -272,8 +271,6 @@ class ImsSection .$this->exportQuestions() .$this->end_section() .$foot; - - return $out; } } diff --git a/main/exercise/export/scorm/ScormQuestion.php b/main/exercise/export/scorm/ScormQuestion.php index 7480ed4853..87bdafa8e6 100644 --- a/main/exercise/export/scorm/ScormQuestion.php +++ b/main/exercise/export/scorm/ScormQuestion.php @@ -171,7 +171,7 @@ class ScormQuestion extends Question $title = $this->selectTitle(); $description = $this->selectDescription(); $cols = 2; - $s = ' + return ' '.$title.' @@ -181,8 +181,6 @@ class ScormQuestion extends Question '.$description.' '; - - return $s; } /** diff --git a/main/exercise/question.class.php b/main/exercise/question.class.php index 7262fd7d71..27ac42845c 100755 --- a/main/exercise/question.class.php +++ b/main/exercise/question.class.php @@ -1917,10 +1917,8 @@ abstract class Question /** * abstract function which creates the form to create / edit the answers of the question. - * - * @param FormValidator $form */ - abstract public function createAnswersForm($form); + abstract public function createAnswersForm(FormValidator $form); /** * abstract function which process the creation of answers. @@ -2236,7 +2234,7 @@ abstract class Question ['class' => 'question_description'] ); } else { - if ($score['pass'] == true) { + if (true == $score['pass']) { $message = Display::div( sprintf( get_lang('ReadingQuestionCongratsSpeedXReachedForYWords'), @@ -2294,10 +2292,10 @@ abstract class Question $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); $tbl_quiz_rel_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); - $quiz_id = intval($quiz_id); + $quiz_id = (int) $quiz_id; $max_score = (float) $max_score; - $type = intval($type); - $level = intval($level); + $type = (int) $type; + $level = (int) $level; // Get the max position $sql = "SELECT max(position) as max_position @@ -2543,7 +2541,7 @@ abstract class Question return in_array($this->type, $this->questionTypeWithFeedback) && - $exercise->getFeedbackType() != EXERCISE_FEEDBACK_TYPE_EXAM; + EXERCISE_FEEDBACK_TYPE_EXAM != $exercise->getFeedbackType(); } /** diff --git a/main/gradebook/my_certificates.php b/main/gradebook/my_certificates.php index bda2d7c868..198cc251b4 100644 --- a/main/gradebook/my_certificates.php +++ b/main/gradebook/my_certificates.php @@ -10,7 +10,7 @@ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; -apiBlockInactiveUser(); +api_block_inactive_user(); $logInfo = [ 'tool' => 'MyCertificates', diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 5052673693..efbc18d5d4 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -1,11 +1,12 @@ 0) { $result_array = Database::fetch_array($result); - $data = (bool) $result_array['active']; } if ($data == false) { diff --git a/whoisonline.php b/whoisonline.php index ada9ecc2b3..7a0fbdc5d7 100755 --- a/whoisonline.php +++ b/whoisonline.php @@ -9,7 +9,7 @@ if (!isset($_GET['cidReq'])) { } require_once './main/inc/global.inc.php'; -apiBlockInactiveUser(); +api_block_inactive_user(); if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { api_protect_course_script(true);