diff --git a/main/admin/career_diagram.php b/main/admin/career_diagram.php index 34b2495c44..92888404cd 100644 --- a/main/admin/career_diagram.php +++ b/main/admin/career_diagram.php @@ -1,6 +1,6 @@ getIsAllowedToEdit(); $actions = $agenda->displayActions('calendar'); -if (!$allowToEdit && $event_type === 'course') { +if (!$allowToEdit && 'course' === $event_type) { api_not_allowed(true); } -if ($event_type === 'course') { +if ('course' === $event_type) { $agendaUrl = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?'.api_get_cidreq().'&type=course'; } else { $agendaUrl = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?&type='.$event_type; @@ -287,7 +287,7 @@ if ($allowToEdit) { } $content = $form->returnForm(); break; - case "delete": + case 'delete': if (!(api_is_session_general_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $eventId)) ) { diff --git a/main/calendar/agenda_js.php b/main/calendar/agenda_js.php index 66e34243b7..b71996993c 100755 --- a/main/calendar/agenda_js.php +++ b/main/calendar/agenda_js.php @@ -1,4 +1,5 @@ assign('js_format_date', 'll'); $region_value = api_get_language_isocode(); -if ($region_value == 'en') { +if ('en' == $region_value) { $region_value = 'en-GB'; } $tpl->assign('region_value', $region_value); @@ -221,7 +222,7 @@ if (!empty($userId)) { $agenda_ajax_url = api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?type='.$type; } -if ($type == 'course' && !empty($courseId)) { +if ('course' === $type && !empty($courseId)) { $agenda_ajax_url .= '&'.api_get_cidreq(); } diff --git a/main/extra/create_school_calendar.php b/main/extra/create_school_calendar.php index 50f1fa41cb..ccc2ae652d 100644 --- a/main/extra/create_school_calendar.php +++ b/main/extra/create_school_calendar.php @@ -57,7 +57,7 @@ if (empty($title)) { $nbcol = 2; echo ""; - if ($i % $nbcol == 0) { + if (0 == $i % $nbcol) { for ($i = 0; $i <= $nbjour; $i++) { echo "'; $possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id']; $display_percentage_header = 1; @@ -1203,8 +1203,8 @@ class SurveyUtil $answers_of_user = []; } if (isset($questions[$row['question_id']]) && - $questions[$row['question_id']]['type'] !== 'open' && - $questions[$row['question_id']]['type'] !== 'comment' + 'open' != $questions[$row['question_id']]['type'] && + 'comment' != $questions[$row['question_id']]['type'] ) { $answers_of_user[$row['question_id']][$row['option_id']] = $row; } else { @@ -1214,7 +1214,7 @@ class SurveyUtil } $userParam = $old_user; - if ($survey_data['anonymous'] != 0) { + if (0 != $survey_data['anonymous']) { $userParam = $i; $i++; } @@ -1328,7 +1328,7 @@ class SurveyUtil } else { $content .= '
"; $date1 += 60 * 60 * 24; //On additionne d'un jour (en seconde) diff --git a/main/extra/group_space_tracking.php b/main/extra/group_space_tracking.php index 961e95fcbf..49538c67b8 100644 --- a/main/extra/group_space_tracking.php +++ b/main/extra/group_space_tracking.php @@ -38,19 +38,19 @@ $forums_of_groups = get_forums_of_group($current_group['id']); $forum_state_public = 0; if (is_array($forums_of_groups)) { foreach ($forums_of_groups as $key => $value) { - if ($value['forum_group_public_private'] == 'public') { + if ('public' == $value['forum_group_public_private']) { $forum_state_public = 1; } } } -if ($current_group['doc_state'] != 1 && - $current_group['calendar_state'] != 1 && - $current_group['work_state'] != 1 && - $current_group['announcements_state'] != 1 && - $current_group['wiki_state'] != 1 && - $current_group['chat_state'] != 1 && - $forum_state_public != 1 +if (1 != $current_group['doc_state'] && + 1 != $current_group['calendar_state'] && + 1 != $current_group['work_state'] && + 1 != $current_group['announcements_state'] && + 1 != $current_group['wiki_state'] && + 1 != $current_group['chat_state'] && + 1 != $forum_state_public ) { if (!api_is_allowed_to_edit(null, true) && !GroupManager::is_user_in_group($user_id, $group_id)) { @@ -421,6 +421,6 @@ function user_name_filter($name, $url_params, $row) // Footer $orig = isset($origin) ? $origin : ''; -if ($orig != 'learnpath') { +if ('learnpath' != $orig) { Display::display_footer(); } diff --git a/main/extra/myStudents.php b/main/extra/myStudents.php index 8525d4f342..96446163c2 100644 --- a/main/extra/myStudents.php +++ b/main/extra/myStudents.php @@ -9,7 +9,7 @@ if (empty($allow)) { } api_block_anonymous_users(); -$export_csv = isset($_GET['export']) && $_GET['export'] === 'csv' ? true : false; +$export_csv = isset($_GET['export']) && 'csv' === $_GET['export'] ? true : false; $course_code = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null; $_course = api_get_course_info(); $coment = ''; @@ -57,7 +57,7 @@ if ($export) { $csv_content = []; $from_myspace = false; -if (isset($_GET['from']) && $_GET['from'] == 'myspace') { +if (isset($_GET['from']) && 'myspace' == $_GET['from']) { $from_myspace = true; $this_section = SECTION_TRACKING; } else { @@ -68,7 +68,7 @@ $nameTools = get_lang('StudentDetails'); $em = Database::getManager(); if (isset($_GET['details'])) { - if ($origin === 'user_course') { + if ('user_course' === $origin) { if (empty($cidReq)) { $interbreadcrumb[] = [ "url" => api_get_path(WEB_COURSE_PATH).$courseInfo['directory'], @@ -80,7 +80,7 @@ if (isset($_GET['details'])) { "name" => get_lang('Users'), ]; } else { - if ($origin === 'tracking_course') { + if ('tracking_course' === $origin) { $interbreadcrumb[] = [ "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session='.api_get_session_id(), "name" => get_lang('Tracking'), diff --git a/main/gamification/my_progress.php b/main/gamification/my_progress.php index b7e78b2f5b..556eeb2964 100644 --- a/main/gamification/my_progress.php +++ b/main/gamification/my_progress.php @@ -7,8 +7,6 @@ use Chamilo\CoreBundle\Entity\Repository\TrackECourseAccessRepository; * See the progress for a user when the gamification mode is active. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.gamification */ $cidReset = true; require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/glossary/glossary.js.php b/main/glossary/glossary.js.php index cb3e5d4bfa..53f7dc7068 100644 --- a/main/glossary/glossary.js.php +++ b/main/glossary/glossary.js.php @@ -1,4 +1,5 @@ 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')]; $origin = api_get_origin(); -if ($origin !== 'learnpath') { +if ('learnpath' != $origin) { // So we are not in learnpath tool if (!api_is_allowed_in_course()) { api_not_allowed(true); @@ -155,6 +155,6 @@ Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICO echo Display::toolbarAction('actions', [$actions, GroupManager::getSearchForm()]); echo GroupManager::getOverview($courseId, $keyword); -if ($origin !== 'learnpath') { +if ('learnpath' != $origin) { Display::display_footer(); } diff --git a/main/group/group_space.php b/main/group/group_space.php index 2611b5bf5f..189fcf66b6 100755 --- a/main/group/group_space.php +++ b/main/group/group_space.php @@ -1,12 +1,11 @@ table_data, $this->column, - $this->direction === 'ASC' ? SORT_ASC : SORT_DESC + 'ASC' === $this->direction ? SORT_ASC : SORT_DESC ); } else { $content = $this->table_data; diff --git a/main/inc/lib/SortableTableFromArrayConfig.php b/main/inc/lib/SortableTableFromArrayConfig.php index bba9bf7b54..cd2ee2f061 100644 --- a/main/inc/lib/SortableTableFromArrayConfig.php +++ b/main/inc/lib/SortableTableFromArrayConfig.php @@ -9,8 +9,6 @@ * $column_order is an array that lets us decide the ordering of the columns * i.e: $column_header=array('a','b','c','d','e'); $column_order=array(1,2,5,4,5); * These means that the 3th column (letter "c") will be sort like the order we use in the 5th column - * - * @package chamilo.library */ class SortableTableFromArrayConfig extends SortableTable { @@ -81,7 +79,7 @@ class SortableTableFromArrayConfig extends SortableTable $table = TableSort::sort_table_config( $this->table_data, $this->column, - $this->direction === 'ASC' ? SORT_ASC : SORT_DESC, + 'ASC' === $this->direction ? SORT_ASC : SORT_DESC, $this->column_show, $this->column_order, SORT_REGULAR, diff --git a/main/inc/lib/TeacherTimeReport.php b/main/inc/lib/TeacherTimeReport.php index 0d0645df4a..3827a46e4b 100644 --- a/main/inc/lib/TeacherTimeReport.php +++ b/main/inc/lib/TeacherTimeReport.php @@ -5,8 +5,6 @@ * Library for generate a teacher time report. * * @author Angel Fernando Quiroz Campos - * - * @package chamilo.admin */ class TeacherTimeReport { diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index 087707758a..741e343fc9 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -2705,7 +2705,7 @@ function api_get_session_visibility( // If there is a session duration but there is no previous // access by the user, then the session is still available - if (count($courseAccess) == 0) { + if (0 == count($courseAccess)) { return SESSION_AVAILABLE; } @@ -3614,7 +3614,7 @@ function api_is_allowed_to_session_edit($tutor = false, $coach = false) } else { $sessionId = api_get_session_id(); - if ($sessionId == 0) { + if (0 == $sessionId) { // I'm not in a session so i will return true to not affect the normal behaviour of Chamilo tools. return true; } else { @@ -5553,7 +5553,7 @@ function copy_folder_course_session( $rs1 = Database::query($sql); $num_rows = Database::num_rows($rs1); - if ($num_rows == 0) { + if (0 == $num_rows) { mkdir($new_pathname, api_get_permissions_for_new_directories()); // Insert new folder with destination session_id. diff --git a/main/inc/lib/array.lib.php b/main/inc/lib/array.lib.php index f7ce6b19da..6782a5d45a 100755 --- a/main/inc/lib/array.lib.php +++ b/main/inc/lib/array.lib.php @@ -3,8 +3,6 @@ /** * This is the array library for Chamilo. * Include/require it in your code to use its functionality. - * - * @package chamilo.library */ /** @@ -53,7 +51,7 @@ function msort($array, $id = 'id', $order = 'desc') $lowest_id = 0; $index = 0; foreach ($array as $item) { - if ($order == 'desc') { + if ('desc' == $order) { if ($item[$id] < $array[$lowest_id][$id]) { $lowest_id = $index; } diff --git a/main/inc/lib/attendance.lib.php b/main/inc/lib/attendance.lib.php index 3721ca6b87..863a5e17f3 100755 --- a/main/inc/lib/attendance.lib.php +++ b/main/inc/lib/attendance.lib.php @@ -60,8 +60,8 @@ class Attendance $sql = "SELECT COUNT(att.id) AS total_number_of_items FROM $tbl_attendance att - WHERE - c_id = $course_id AND + WHERE + c_id = $course_id AND active <> 2 $active_plus $condition_session "; /*$active = (int) $active; if ($active === 1 || $active === 0) { @@ -172,8 +172,8 @@ class Attendance while ($attendance = Database::fetch_row($res)) { $session_star = ''; - if (api_get_session_id() == $attendance[6]) { - $session_star = api_get_session_image(api_get_session_id(), $user_info['status']); + if ($session_id == $attendance[6]) { + $session_star = api_get_session_image($session_id, $user_info['status']); } if ($attendance[5] == 1) { diff --git a/main/messages/index.php b/main/messages/index.php index 2223ccdb51..553b395489 100755 --- a/main/messages/index.php +++ b/main/messages/index.php @@ -1,8 +1,7 @@ get_lang('Users'), ]; } else { - if ($origin === 'tracking_course') { + if ('tracking_course' === $origin) { $interbreadcrumb[] = [ 'url' => '../tracking/courseLog.php?cidReq='.$courseCode.'&id_session='.api_get_session_id(), 'name' => get_lang('Tracking'), ]; } else { - if ($origin === 'resume_session') { + if ('resume_session' === $origin) { $interbreadcrumb[] = [ 'url' => "../session/session_list.php", 'name' => get_lang('SessionList'), @@ -1347,7 +1343,7 @@ if (empty($details)) { $timeCourse = Tracking::getCalculateTime($student_id, $courseInfo['real_id'], $sessionId); } - if ($user_info['status'] != INVITEE) { + if (INVITEE != $user_info['status']) { $csv_content[] = []; $csv_content[] = [str_replace(' ', '', strip_tags($userInfo['complete_name']))]; $trackingColumns = api_get_configuration_value('tracking_columns'); diff --git a/main/mySpace/my_career.php b/main/mySpace/my_career.php index 1c0f60c1f7..e00601f852 100644 --- a/main/mySpace/my_career.php +++ b/main/mySpace/my_career.php @@ -5,7 +5,7 @@ use Fhaculty\Graph\Graph; require_once __DIR__.'/../inc/global.inc.php'; -if (api_get_configuration_value('allow_career_diagram') == false) { +if (false == api_get_configuration_value('allow_career_diagram')) { api_not_allowed(true); } diff --git a/main/mySpace/progression.php b/main/mySpace/progression.php index d4b507d66b..64c28f76be 100755 --- a/main/mySpace/progression.php +++ b/main/mySpace/progression.php @@ -1,10 +1,9 @@ , Ghent University, Belgium, * refactoring and tighter integration diff --git a/main/plagiarism/compilatio/download.php b/main/plagiarism/compilatio/download.php index 2c62ba6bda..76f894784c 100644 --- a/main/plagiarism/compilatio/download.php +++ b/main/plagiarism/compilatio/download.php @@ -8,8 +8,6 @@ exit; * 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.work */ session_cache_limiter('public'); require_once '../../inc/global.inc.php'; diff --git a/main/plagiarism/compilatio/upload.php b/main/plagiarism/compilatio/upload.php index 3e5959421c..53c1b32d0f 100644 --- a/main/plagiarism/compilatio/upload.php +++ b/main/plagiarism/compilatio/upload.php @@ -14,7 +14,7 @@ $courseInfo = api_get_course_info(); $compilatio = new Compilatio(); /* if we have to upload severals documents*/ -if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'multi') { +if (isset($_REQUEST['type']) && 'multi' === $_REQUEST['type']) { $docs = explode('a', $_REQUEST['doc']); for ($k = 0; $k < count($docs) - 1; $k++) { $documentId = 0; @@ -41,7 +41,7 @@ if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'multi') { $WrkUrl = $currentCourseRepositoryWeb.$doc->url; $LocalWrkUrl = $courseInfo['course_sys_path'].$doc->url; $mime = DocumentManager::file_get_mime_type($doc->title); - if ($compilatio->getTransportMode() === 'wget') { + if ('wget' === $compilatio->getTransportMode()) { /*Compilatio's server recover tjre file throught wget like this: username:password@http://somedomain.com/reg/remotefilename.tar.gz */ if (strlen($compilatio->getWgetUri()) > 2) { @@ -102,7 +102,7 @@ function sendDocument($documentId, $courseInfo) $mime = DocumentManager::file_get_mime_type($doc->title); $compilatio = new Compilatio(); - if ($compilatio->getTransportMode() === 'wget') { + if ('wget' === $compilatio->getTransportMode()) { if (strlen($compilatio->getWgetUri()) > 2) { $filename = preg_replace('/$', '', $compilatio->getWgetUri()).'/'.$courseInfo['path'].'/'.$doc->title; } else { diff --git a/main/survey/ch_multipleresponse.php b/main/survey/ch_multipleresponse.php index cdde14977d..aad1da5560 100644 --- a/main/survey/ch_multipleresponse.php +++ b/main/survey/ch_multipleresponse.php @@ -55,7 +55,7 @@ class ch_multipleresponse extends survey_question ) { $class = 'checkbox-inline'; $labelClass = 'checkbox-inline'; - if ($questionData['display'] === 'vertical') { + if ('vertical' == $questionData['display']) { $class = 'checkbox-vertical'; } diff --git a/main/survey/ch_yesno.php b/main/survey/ch_yesno.php index 2ba84f3859..c51f169845 100644 --- a/main/survey/ch_yesno.php +++ b/main/survey/ch_yesno.php @@ -62,7 +62,7 @@ class ch_yesno extends survey_question if (is_array($questionData['options'])) { $class = 'radio-inline'; $labelClass = 'radio-inline'; - if ($questionData['display'] === 'vertical') { + if ('vertical' == $questionData['display']) { $class = 'radio-vertical'; } diff --git a/main/survey/copy_survey.php b/main/survey/copy_survey.php index 23d5ba3089..c0a508234b 100644 --- a/main/survey/copy_survey.php +++ b/main/survey/copy_survey.php @@ -1,8 +1,7 @@ addElement('header', $tool_name); // Setting the form elements -if ($action == 'edit' && isset($survey_id) && is_numeric($survey_id)) { +if ('edit' == $action && isset($survey_id) && is_numeric($survey_id)) { $form->addElement('hidden', 'survey_id'); } @@ -133,7 +133,7 @@ $survey_code = $form->addElement( ['size' => '20', 'maxlength' => '20', 'autofocus' => 'autofocus'] ); -if ($action == 'edit') { +if ('edit' == $action) { $survey_code->freeze(); $form->applyFilter('survey_code', 'api_strtoupper'); } diff --git a/main/survey/edit_meeting.php b/main/survey/edit_meeting.php index bf70171ada..700909bd03 100644 --- a/main/survey/edit_meeting.php +++ b/main/survey/edit_meeting.php @@ -169,7 +169,7 @@ if ($form->validate()) { $date = $values[$name]; - if ($date === 'delete' && !empty($id)) { + if ('delete' === $date && !empty($id)) { $deleteItems[] = $id; } diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index 98b416198b..f8cdbe36a1 100755 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -91,7 +91,7 @@ if ((!isset($_GET['course']) || !isset($_GET['invitationcode'])) && !isset($_GET $invitationcode = $_GET['invitationcode']; // Start auto-invitation feature FS#3403 (all-users-can-do-the-survey-URL handling) -if ($invitationcode === 'auto' && isset($_GET['scode'])) { +if ('auto' == $invitationcode && isset($_GET['scode'])) { $userid = api_get_user_id(); // Survey_code of the survey $surveyCode = $_GET['scode']; @@ -131,7 +131,7 @@ if ($invitationcode === 'auto' && isset($_GET['scode'])) { invitation_code = '".Database::escape_string($autoInvitationcode)."'"; $result = Database::query($sql); $now = api_get_utc_datetime(); - if (Database :: num_rows($result) == 0) { + if (0 == Database :: num_rows($result)) { $params = [ 'c_id' => $course_id, 'survey_code' => $surveyCode, @@ -285,7 +285,7 @@ if (count($_POST) > 0) { ); foreach ($value as $answer_key => &$answer_value) { - if ($types[$survey_question_id] === 'score') { + if ('score' == $types[$survey_question_id]) { $option_id = $answer_key; $option_value = $answer_value; } else { @@ -305,7 +305,7 @@ if (count($_POST) > 0) { } else { // All the other question types (open question, multiple choice, percentage, ...) if (isset($types[$survey_question_id]) && - $types[$survey_question_id] === 'percentage') { + 'percentage' == $types[$survey_question_id]) { $sql = "SELECT * FROM $table_survey_question_option WHERE c_id = $course_id AND @@ -316,7 +316,7 @@ if (count($_POST) > 0) { } else { $option_value = 0; if (isset($types[$survey_question_id]) && - $types[$survey_question_id] === 'open' + 'open' == $types[$survey_question_id] ) { $option_value = $value; } @@ -363,7 +363,7 @@ if (count($_POST) > 0) { // Looping through all the post values foreach ($_POST as $key => &$value) { // If the post value key contains the string 'question' then it is an answer to a question - if (strpos($key, 'question') !== false) { + if (false !== strpos($key, 'question')) { // Finding the question id by removing 'question' $survey_question_id = str_replace('question', '', $key); // If not question ID was defined, we're on the start @@ -674,7 +674,7 @@ if (isset($_POST['finish_survey'])) { // Sets the random questions $shuffle = ''; -if ($survey_data['shuffle'] == 1) { +if (1 == $survey_data['shuffle']) { $shuffle = ' BY RAND() '; } @@ -813,13 +813,13 @@ if ((isset($_GET['show']) && $_GET['show'] != '') || $counter++; } } - } elseif ($survey_data['survey_type'] === '1') { + } elseif ('1' === $survey_data['survey_type']) { $my_survey_id = (int) $survey_invitation['survey_id']; $current_user = Database::escape_string($survey_invitation['user']); if (isset($_POST['personality'])) { // Compute the results to get the 3 groups nearest to the user's personality - if ($shuffle == '') { + if ('' == $shuffle) { $order = 'BY sort ASC '; } else { $order = $shuffle; @@ -1079,7 +1079,7 @@ if ((isset($_GET['show']) && $_GET['show'] != '') || $questions = []; while ($row = Database::fetch_array($result, 'ASSOC')) { // If the type is not a pagebreak we store it in the $questions array - if ($row['type'] != 'pagebreak') { + if ('pagebreak' != $row['type']) { $questions[$row['sort']]['question_id'] = $row['question_id']; $questions[$row['sort']]['survey_id'] = $row['survey_id']; $questions[$row['sort']]['survey_question'] = $row['survey_question']; @@ -1193,7 +1193,7 @@ if ((isset($_GET['show']) && $_GET['show'] != '') || $questions = []; while ($row = Database :: fetch_array($result, 'ASSOC')) { // If the type is not a pagebreak we store it in the $questions array - if ($row['type'] !== 'pagebreak') { + if ('pagebreak' != $row['type']) { $questions[$row['sort']]['question_id'] = $row['question_id']; $questions[$row['sort']]['survey_id'] = $row['survey_id']; $questions[$row['sort']]['survey_question'] = $row['survey_question']; @@ -1319,13 +1319,11 @@ if (isset($questions) && is_array($questions)) { $finalAnswer = []; foreach ($userAnswer as $userChoice) { list($choiceId, $choiceValue) = explode('*', $userChoice); - $finalAnswer[$choiceId] = $choiceValue; } break; case 'percentage': list($choiceId, $choiceValue) = explode('*', current($userAnswer)); - $finalAnswer = $choiceId; break; default: diff --git a/main/survey/preview.php b/main/survey/preview.php index 67b528f9d4..77b45acced 100755 --- a/main/survey/preview.php +++ b/main/survey/preview.php @@ -92,14 +92,14 @@ if (isset($_GET['show'])) { $questions_exists = true; if (Database::num_rows($result)) { while ($row = Database::fetch_array($result)) { - if ($survey_data['one_question_per_page'] == 1) { - if ($row['type'] !== 'pagebreak') { + if (1 == $survey_data['one_question_per_page']) { + if ('pagebreak' != $row['type']) { $paged_questions[$counter][] = $row['question_id']; $counter++; continue; } } else { - if ($row['type'] === 'pagebreak') { + if ('pagebreak' == $row['type']) { $counter++; } else { $paged_questions[$counter][] = $row['question_id']; @@ -143,7 +143,7 @@ if (isset($_GET['show'])) { $result = Database::query($sql); while ($row = Database::fetch_array($result)) { // If the type is not a pagebreak we store it in the $questions array - if ($row['type'] !== 'pagebreak') { + if ('pagebreak' != $row['type']) { $sort = $row['sort']; $questions[$sort]['question_id'] = $row['question_id']; $questions[$sort]['survey_id'] = $row['survey_id']; diff --git a/main/survey/question.php b/main/survey/question.php index f4bd1eed11..d01f66ecb4 100755 --- a/main/survey/question.php +++ b/main/survey/question.php @@ -46,13 +46,13 @@ if (api_strlen(strip_tags($surveyData['title'])) > 40) { $urlname .= '...'; } -if ($surveyData['survey_type'] == 1) { +if (1 == $surveyData['survey_type']) { $sql = 'SELECT id FROM '.Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP).' WHERE c_id = '.$course_id.' AND survey_id = '.$surveyId.' LIMIT 1'; $rs = Database::query($sql); - if (Database::num_rows($rs) === 0) { + if (0 === Database::num_rows($rs)) { Display::addFlash( Display::return_message(get_lang('YouNeedToCreateGroups')) ); diff --git a/main/survey/reporting.php b/main/survey/reporting.php index 0292bf74cf..eaa7360609 100755 --- a/main/survey/reporting.php +++ b/main/survey/reporting.php @@ -21,7 +21,7 @@ if (empty($survey_data)) { api_not_allowed(true); } -if ($survey_data['anonymous'] == 0) { +if (0 == $survey_data['anonymous']) { $people_filled_full_data = true; } else { $people_filled_full_data = false; @@ -42,7 +42,7 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ if (!api_is_allowed_to_edit(false, true) || $isDrhOfCourse) { // Show error message if the survey can be seen only by tutors - if ($survey_data['visible_results'] == SURVEY_VISIBLE_TUTOR) { + if (SURVEY_VISIBLE_TUTOR == $survey_data['visible_results']) { api_not_allowed(true); } diff --git a/main/survey/survey.download.inc.php b/main/survey/survey.download.inc.php index 53d561e40a..50c036890b 100755 --- a/main/survey/survey.download.inc.php +++ b/main/survey/survey.download.inc.php @@ -2,8 +2,6 @@ /* For licensing terms, see /license.txt */ /** - * @package chamilo.survey - * * @author Arnaud Ligot * * A small peace of code to enable user to access images included into survey diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index 18c4e6921f..e0fb7d7b43 100755 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -147,7 +147,7 @@ class SurveyManager $survey_id = (int) $survey_id; $table_survey = Database::get_course_table(TABLE_SURVEY); - if ($shared != 0) { + if (0 != $shared) { $table_survey = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); $sql = "SELECT * FROM $table_survey WHERE survey_id='".$survey_id."' "; @@ -581,7 +581,7 @@ class SurveyManager if (!$values['survey_id'] || !is_numeric($values['survey_id']) || - $values['survey_share']['survey_share'] == 'true' + 'true' == $values['survey_share']['survey_share'] ) { $sql = "INSERT INTO $table_survey (code, title, subtitle, author, lang, template, intro, surveythanks, creation_date, course_code) VALUES ( '".Database::escape_string($values['survey_code'])."', @@ -846,7 +846,7 @@ class SurveyManager $datas = self::get_survey($surveyId); $session_where = ''; - if (api_get_session_id() != 0) { + if (0 != api_get_session_id()) { $session_where = ' AND session_id = "'.api_get_session_id().'" '; } @@ -966,9 +966,9 @@ class SurveyManager if (in_array($type, $possible_types)) { return $icon_question[$type]; - } else { - return false; } + + return false; } /** @@ -1034,7 +1034,7 @@ class SurveyManager ? $row['is_required'] : false; - if ($row['survey_group_pri'] != 0) { + if (0 != $row['survey_group_pri']) { $return['assigned'] = $row['survey_group_pri']; $return['choose'] = 1; } else { @@ -1156,7 +1156,7 @@ class SurveyManager } } - if ($form_content['type'] === 'score') { + if ('score' == $form_content['type']) { if (strlen($form_content['maximum_score']) < 1) { $empty_answer = true; } @@ -1246,11 +1246,11 @@ class SurveyManager // Updating an existing question $extraParams = []; if (isset($_POST['choose'])) { - if ($_POST['choose'] == 1) { + if (1 == $_POST['choose']) { $extraParams['survey_group_pri'] = $_POST['assigned']; $extraParams['survey_group_sec1'] = 0; $extraParams['survey_group_sec2'] = 0; - } elseif ($_POST['choose'] == 2) { + } elseif (2 == $_POST['choose']) { $extraParams['survey_group_pri'] = 0; $extraParams['survey_group_sec1'] = $_POST['assigned1']; $extraParams['survey_group_sec2'] = $_POST['assigned2']; @@ -1351,7 +1351,7 @@ class SurveyManager $tbl_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); // Storing a new question - if ($form_content['shared_question_id'] == '' || + if ('' == $form_content['shared_question_id'] || !is_numeric($form_content['shared_question_id']) ) { // Finding the max sort order of the questions in the given survey @@ -1410,10 +1410,10 @@ class SurveyManager $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION); $course_id = api_get_course_int_id(); - if ($direction == 'moveup') { + if ('moveup' == $direction) { $sort = 'DESC'; } - if ($direction == 'movedown') { + if ('movedown' == $direction) { $sort = 'ASC'; } @@ -1580,7 +1580,7 @@ class SurveyManager } } - if (is_numeric($survey_data['survey_share']) && $survey_data['survey_share'] != 0) { + if (is_numeric($survey_data['survey_share']) && 0 != $survey_data['survey_share']) { self::save_shared_question_options($form_content, $survey_data); } @@ -2009,7 +2009,7 @@ class SurveyManager */ public static function protectByMandatory() { - if (strpos($_SERVER['SCRIPT_NAME'], 'fillsurvey.php') !== false) { + if (false !== strpos($_SERVER['SCRIPT_NAME'], 'fillsurvey.php')) { return; } @@ -2354,7 +2354,7 @@ class SurveyManager foreach ($newQuestionList as $question) { $text = $question['question']; - if (strpos($text, $classTag) !== false) { + if (false !== strpos($text, $classTag)) { $replacedText = str_replace($classTag, $className, $text); $values = [ 'c_id' => $courseId, @@ -2375,7 +2375,8 @@ class SurveyManager foreach ($users as $userId) { $userInfo = api_get_user_info($userId); - if (strpos($text, $studentTag) !== false) { + + if (false !== strpos($text, $studentTag)) { $replacedText = str_replace($studentTag, $userInfo['complete_name'], $text); $values = [ 'c_id' => $courseId, diff --git a/main/survey/survey.php b/main/survey/survey.php index d1665d085a..45f8e07a0c 100755 --- a/main/survey/survey.php +++ b/main/survey/survey.php @@ -56,7 +56,7 @@ Session::erase('answer_list'); // Getting the survey information if (!empty($_GET['survey_id'])) { $course_code = api_get_course_id(); - if ($course_code != -1) { + if (-1 != $course_code) { $survey_data = SurveyManager::get_survey($survey_id); } else { api_not_allowed(true); @@ -66,7 +66,7 @@ if (!empty($_GET['survey_id'])) { } $tool_name = strip_tags($survey_data['title'], ''); -$is_survey_type_1 = $survey_data['survey_type'] == 1; +$is_survey_type_1 = 1 == $survey_data['survey_type']; if (api_strlen(strip_tags($survey_data['title'])) > 40) { $tool_name .= '...'; @@ -74,7 +74,7 @@ if (api_strlen(strip_tags($survey_data['title'])) > 40) { if ($is_survey_type_1 && ($action === 'addgroup' || $action === 'deletegroup')) { $_POST['name'] = trim($_POST['name']); - if ($action === 'addgroup') { + if ('addgroup' == $action) { if (!empty($_POST['group_id'])) { Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\' WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\''); @@ -87,7 +87,7 @@ if ($is_survey_type_1 && ($action === 'addgroup' || $action === 'deletegroup')) } } - if ($action === 'deletegroup') { + if ('deletegroup' == $action) { $sql = 'DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' AND survey_id = '.$survey_id; Database::query($sql); @@ -355,7 +355,7 @@ if ($is_survey_type_1) { } echo '
'.get_lang('Name').''.get_lang('Description').'
'; echo '
'; - if ($_GET['action'] == 'editgroup') { + if ('editgroup' == $_GET['action']) { $sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1'; $rs = Database::query($sql); diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index 00101b9b71..c233090100 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -112,7 +112,7 @@ class SurveyUtil $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER); // Make the survey anonymous - if ($survey_data['anonymous'] == 1) { + if (1 == $survey_data['anonymous']) { $surveyUser = Session::read('surveyuser'); if (empty($surveyUser)) { $user = md5($user.time()); @@ -640,7 +640,7 @@ class SurveyUtil echo strip_tags(isset($question['survey_question']) ? $question['survey_question'] : null); echo ''; - if ($question['type'] === 'score') { + if ('score' == $question['type']) { /** @todo This function should return the options as this is needed further in the code */ $options = self::display_question_report_score($survey_data, $question, $offset); } elseif ($question['type'] === 'open' || $question['type'] === 'comment') { @@ -1077,9 +1077,9 @@ class SurveyUtil in_array($row['question_id'], $_POST['questions_filter'])) ) { // We do not show comment and pagebreak question types - if ($row['type'] != 'pagebreak') { + if ('pagebreak' != $row['type']) { $content .= ' 0 && $row['type'] != 'percentage') { + if ($row['number_of_options'] > 0 && 'percentage' != $row['type']) { $content .= ' colspan="'.$row['number_of_options'].'"'; } $content .= '>'; @@ -1146,7 +1146,7 @@ class SurveyUtil (is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter'])) ) { // we do not show comment and pagebreak question types - if ($row['type'] === 'open' || $row['type'] === 'comment') { + if ('open' == $row['type'] || 'comment' == $row['type']) { $content .= '
 - '; if (!empty($answers_of_user[$question_id][$option_id])) { - if ($answers_of_user[$question_id][$option_id]['value'] != 0) { + if (0 != $answers_of_user[$question_id][$option_id]['value']) { $content .= $answers_of_user[$question_id][$option_id]['value']; } else { $content .= 'v'; @@ -1551,8 +1551,8 @@ class SurveyUtil $answers_of_user = []; } - if ($possible_answers_type[$row['question_id']] == 'open' || - $possible_answers_type[$row['question_id']] == 'comment' + if ('open' == $possible_answers_type[$row['question_id']] || + 'comment' == $possible_answers_type[$row['question_id']] ) { $temp_id = 'open'.$open_question_iterator; $answers_of_user[$row['question_id']][$temp_id] = $row; @@ -1601,8 +1601,8 @@ class SurveyUtil $compact = false ) { $return = ''; - if ($survey_data['anonymous'] == 0) { - if (intval($user) !== 0) { + if (0 == $survey_data['anonymous']) { + if (0 !== intval($user)) { $userInfo = api_get_user_info($user); if (!empty($userInfo)) { $user_displayed = $userInfo['complete_name_with_username']; @@ -2413,7 +2413,7 @@ class SurveyUtil // Remind unanswered is a special version of remind all reminder $exclude_users = []; - if ($remindUnAnswered == 1) { + if (1 == $remindUnAnswered) { // Remind only unanswered users $reminder = 1; $exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']); @@ -2423,7 +2423,7 @@ class SurveyUtil $course_id = api_get_course_int_id(); $session_id = api_get_session_id(); - if ($isAdditionalEmail == false) { + if (false == $isAdditionalEmail) { $result = CourseManager::separateUsersGroups($users_array); $groupList = $result['groups']; $users_array = $result['users']; @@ -2454,7 +2454,7 @@ class SurveyUtil $users_array = array_unique($users_array); foreach ($users_array as $key => $value) { - if (!isset($value) || $value == '') { + if (!isset($value) || '' == $value) { continue; } @@ -3062,7 +3062,7 @@ class SurveyUtil if (api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id)) { $editUrl = $codePath.'survey/create_new_survey.php?'. http_build_query($params + ['action' => 'edit', 'survey_id' => $survey_id]); - if ($survey->getSurveyType() == 3) { + if (3 == $survey->getSurveyType()) { $editUrl = $codePath.'survey/edit_meeting.php?'. http_build_query($params + ['action' => 'edit', 'survey_id' => $survey_id]); } @@ -3115,7 +3115,7 @@ class SurveyUtil } } - if ($type != 3) { + if (3 != $type) { $actions[] = Display::url( Display::return_icon('preview_view.png', get_lang('Preview')), $codePath.'survey/preview.php?'.http_build_query($params + ['survey_id' => $survey_id]) @@ -3136,7 +3136,7 @@ class SurveyUtil ); } - if ($type != 3) { + if (3 != $type) { $actions[] = $hideReportingButton ? null : $reportingLink; } @@ -3228,7 +3228,7 @@ class SurveyUtil */ public static function anonymous_filter($anonymous) { - if ($anonymous == 1) { + if (1 == $anonymous) { return get_lang('Yes'); } else { return get_lang('No'); @@ -3391,7 +3391,7 @@ class SurveyUtil $array[1] = $survey[1]; } else { // Doodle - if ($survey['survey_type'] == 3) { + if (3 == $survey['survey_type']) { $array[1] = Display::url( $survey[1], api_get_path(WEB_CODE_PATH).'survey/meeting.php?survey_id='.$survey[0].'&'.api_get_cidreq() @@ -3748,13 +3748,13 @@ class SurveyUtil $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC'); foreach ($extra as $id => $field_details) { - if ($field_details[6] == 0) { + if (0 == $field_details[6]) { continue; } switch ($field_details[2]) { case UserManager::USER_FIELD_TYPE_TEXT: $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; @@ -3762,7 +3762,7 @@ class SurveyUtil break; case UserManager::USER_FIELD_TYPE_TEXTAREA: $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; @@ -3770,7 +3770,7 @@ class SurveyUtil break; case UserManager::USER_FIELD_TYPE_RADIO: $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; @@ -3792,7 +3792,7 @@ class SurveyUtil $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; } - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; @@ -3800,7 +3800,7 @@ class SurveyUtil break; case UserManager::USER_FIELD_TYPE_SELECT_MULTIPLE: $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; @@ -3808,7 +3808,7 @@ class SurveyUtil break; case UserManager::USER_FIELD_TYPE_DATE: $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; @@ -3816,7 +3816,7 @@ class SurveyUtil break; case UserManager::USER_FIELD_TYPE_DATETIME: $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; @@ -3824,7 +3824,7 @@ class SurveyUtil break; case UserManager::USER_FIELD_TYPE_DOUBLE_SELECT: $field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3]; - if ($field_details[7] == 0) { + if (0 == $field_details[7]) { $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; } else { $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; diff --git a/main/survey/survey_invitation.php b/main/survey/survey_invitation.php index faa5f05b66..3717c78f5e 100755 --- a/main/survey/survey_invitation.php +++ b/main/survey/survey_invitation.php @@ -2,8 +2,6 @@ /* For licensing terms, see /license.txt */ /** - * @package chamilo.survey - * * @author Patrick Cool , Ghent University: cleanup, refactoring and rewriting large parts of the code * * @version $Id: survey_invite.php 10680 2007-01-11 21:26:23Z pcool $ diff --git a/main/survey/survey_list.php b/main/survey/survey_list.php index 51ac4dfb86..77bc41a938 100755 --- a/main/survey/survey_list.php +++ b/main/survey/survey_list.php @@ -248,7 +248,7 @@ switch ($action) { break; case 'empty': $mysession = api_get_session_id(); - if ($mysession != 0) { + if (0 != $mysession) { if (!((api_is_session_general_coach() || api_is_platform_admin()) && api_is_element_in_the_session(TOOL_SURVEY, $surveyId))) { // The coach can't empty a survey not belonging to his session @@ -274,7 +274,7 @@ Display::display_header($tool_name, 'Survey'); Display::display_introduction_section('survey', 'left'); // Action handling: searching -if (isset($_GET['search']) && $_GET['search'] === 'advanced') { +if (isset($_GET['search']) && 'advanced' == $_GET['search']) { SurveyUtil::display_survey_search_form(); } diff --git a/main/survey/survey_question.php b/main/survey/survey_question.php index 20201cb94d..bcb2564bb8 100644 --- a/main/survey/survey_question.php +++ b/main/survey/survey_question.php @@ -239,7 +239,7 @@ class survey_question $this->addParentMenu($formData, $form, $surveyData); } - if ($surveyData['survey_type'] == 1) { + if (1 == $surveyData['survey_type']) { $table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP); $sql = 'SELECT id, name FROM '.$table_survey_question_group.' WHERE survey_id = '.$surveyId.' diff --git a/main/template/default/agenda/month.tpl b/main/template/default/agenda/month.tpl index 9dc6e40a71..c9bdb26831 100755 --- a/main/template/default/agenda/month.tpl +++ b/main/template/default/agenda/month.tpl @@ -17,15 +17,11 @@ function checkLength( o, n, min, max ) { function clean_user_select() { //Cleans the selected attr $("#users_to_send").val('').trigger("chosen:updated"); - /*$('#users_to_send') - .find('option') - .removeAttr('selected') - .end();*/ } var region_value = '{{ region_value }}'; -$(document).ready(function() { +$(function() { var cookieData = Cookies.getJSON('agenda_cookies'); var defaultView = (cookieData && cookieData.view) || '{{ default_view }}'; var defaultStartDate = (cookieData && cookieData.start) || moment.now(); @@ -470,7 +466,6 @@ $(document).ready(function() { if (calEvent.editable) { $('#visible_to_input').hide(); $('#add_as_announcement_div').hide(); - {% if type != 'admin' %} $('#visible_to_read_only').show(); $("#visible_to_read_only_users").html(calEvent.sent_to); diff --git a/main/ticket/assign_tickets.php b/main/ticket/assign_tickets.php index 1389f787c9..888c1f7d85 100644 --- a/main/ticket/assign_tickets.php +++ b/main/ticket/assign_tickets.php @@ -1,9 +1,6 @@