";
- if ($i % $nbcol == 0) {
+ if (0 == $i % $nbcol) {
for ($i = 0; $i <= $nbjour; $i++) {
echo " ";
$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 ' |