Minor - format code, add minor fixes from master

pull/3683/head
Julio Montoya 5 years ago
parent 314aac7111
commit bfaa71e3f7
  1. 4
      main/mySpace/calendar_plan.php
  2. 4
      main/mySpace/index.php
  3. 6
      main/mySpace/lp_tracking.php
  4. 12
      main/mySpace/progression.php
  5. 4
      main/mySpace/session.php
  6. 12
      main/mySpace/session_admin_teachers.php
  7. 4
      main/mySpace/session_filter.php
  8. 6
      main/mySpace/tc_report.php
  9. 6
      main/mySpace/teachers.php
  10. 2
      main/mySpace/ti_report.php
  11. 4
      main/survey/ch_multiplechoiceother.php
  12. 2
      main/survey/ch_selectivedisplay.php
  13. 14
      main/survey/survey.lib.php
  14. 2
      main/survey/survey.php
  15. 6
      main/survey/surveyUtil.class.php
  16. 5
      main/tracking/course_log_resources.php
  17. 3
      main/tracking/course_log_tools.php
  18. 5
      main/tracking/course_session_report.php
  19. 6
      main/tracking/exams.php
  20. 6
      main/tracking/question_course_report.php
  21. 5
      main/tracking/total_time.php
  22. 2
      main/user/classes.php
  23. 2
      main/user/resume_session.php
  24. 2
      main/user/session_list.php
  25. 6
      main/user/subscribe_user.php
  26. 4
      main/work/upload_from_template.php
  27. 36
      src/Chamilo/CoreBundle/Entity/ExtraField.php

@ -20,7 +20,7 @@ $now = new DateTime('now', $timezone);
$currentYear = (int) $now->format('Y');
$searchYear = isset($_GET['year']) ? (int) $_GET['year'] : $currentYear;
$currentOrder = isset($_GET['order']) && $_GET['order'] === 'desc' ? 'desc' : 'asc';
$currentOrder = isset($_GET['order']) && 'desc' === $_GET['order'] ? 'desc' : 'asc';
if (api_is_western_name_order()) {
$orderBy = " firstname ";
@ -43,7 +43,7 @@ $students = UserManager::getUsersFollowedByUser(
api_is_student_boss() ? STUDENT_BOSS : COURSEMANAGER
);
if ($currentOrder === 'desc') {
if ('desc' === $currentOrder) {
$order = 'asc';
} else {
$order = 'desc';

@ -3,8 +3,6 @@
/**
* Homepage for the MySpace directory.
*
* @package chamilo.reporting
*/
// resetting the course id
@ -22,7 +20,7 @@ $this_section = SECTION_TRACKING;
ob_start();
$nameTools = get_lang('MySpace');
$export_csv = isset($_GET['export']) && $_GET['export'] === 'csv' ? true : false;
$export_csv = isset($_GET['export']) && 'csv' === $_GET['export'] ? true : false;
$display = isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null;
$csv_content = [];
$user_id = api_get_user_id();

@ -21,7 +21,7 @@ if (isset($_GET['from']) && 'myspace' == $_GET['from']) {
}
$session_id = isset($_REQUEST['id_session']) ? (int) $_REQUEST['id_session'] : api_get_session_id();
$export_csv = isset($_GET['export']) && $_GET['export'] === 'csv';
$export_csv = isset($_GET['export']) && 'csv' == $_GET['export'];
$user_id = isset($_GET['student_id']) ? (int) $_GET['student_id'] : api_get_user_id();
$courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : api_get_course_id();
$origin = api_get_origin();
@ -30,7 +30,7 @@ $csv_content = [];
$courseInfo = api_get_course_info($courseCode);
if (empty($courseInfo) || empty($lp_id)) {
api_not_allowed(api_get_origin() !== 'learnpath');
api_not_allowed('learnpath' !== api_get_origin());
}
$userInfo = api_get_user_info($user_id);
$name = $userInfo['complete_name'];
@ -46,7 +46,7 @@ if (!$isBoss &&
api_not_allowed(api_get_origin() !== 'learnpath');
}
if ($origin === 'user_course') {
if ('user_course' === $origin) {
$interbreadcrumb[] = [
'url' => api_get_path(WEB_COURSE_PATH).$courseInfo['directory'],
'name' => $courseInfo['name'],

@ -39,8 +39,14 @@ if (Database::num_rows($result_course) > 0) {
$export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet.
echo Display::return_message($export_result, 'error');
}
echo '<table class="table table-hover table-striped data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('TempsFrequentation').'</th><th>'.get_lang('Progression').'</th><th>'.get_lang('MoyenneTest').'</th></tr>';
$header = [get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', '')];
echo '<table class="table table-hover table-striped data_table">
<tr>
<th>'.get_lang('Course').'</th>
<th>'.get_lang('TempsFrequentation').'</th>
<th>'.get_lang('Progression').'</th>
<th>'.get_lang('MoyenneTest').'</th>
</tr>';
$header = [get_lang('Course'), get_lang('TempsFrequentation'), get_lang('Progression'), get_lang('MoyenneTest')];
while ($a_course = Database::fetch_array($result_course)) {
// TODO: This query is to be checked, there are no HotPotatoes tests results.
$sql_moy_test = "SELECT exe_result,exe_weighting
@ -53,7 +59,7 @@ if (Database::num_rows($result_course) > 0) {
$result = $result + $moy_test['exe_result'];
$weighting = $weighting + $moy_test['exe_weighting'];
}
if ($weighting != 0) {
if (0 != $weighting) {
$moyenne_test = round(($result * 100) / $weighting);
} else {
$moyenne_test = null;

@ -10,13 +10,13 @@ api_block_anonymous_users();
$this_section = SECTION_TRACKING;
$export_csv = false;
if (isset($_REQUEST['export']) && $_REQUEST['export'] === 'csv') {
if (isset($_REQUEST['export']) && 'csv' == $_REQUEST['export']) {
$export_csv = true;
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
$id_coach = api_get_user_id();
if (isset($_REQUEST['id_coach']) && $_REQUEST['id_coach'] != '') {
if (isset($_REQUEST['id_coach']) && '' != $_REQUEST['id_coach']) {
$id_coach = (int) $_REQUEST['id_coach'];
}

@ -17,17 +17,17 @@ if (!$allowToTrack) {
api_not_allowed(true);
}
$export_csv = isset($_GET['export']) && $_GET['export'] === 'csv' ? true : false;
$export_csv = isset($_GET['export']) && 'csv' === $_GET['export'] ? true : false;
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$nameTools = get_lang('Teachers');
$this_section = SECTION_TRACKING;
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('MySpace')];
if (isset($_GET['user_id']) && $_GET['user_id'] != '' && !isset($_GET['type'])) {
if (isset($_GET['user_id']) && '' != $_GET['user_id'] && !isset($_GET['type'])) {
$interbreadcrumb[] = ['url' => 'teachers.php', 'name' => get_lang('Teachers')];
}
if (isset($_GET['user_id']) && $_GET['user_id'] != '' && isset($_GET['type']) && $_GET['type'] === 'coach') {
if (isset($_GET['user_id']) && '' != $_GET['user_id'] && isset($_GET['type']) && 'coach' === $_GET['type']) {
$interbreadcrumb[] = ['url' => 'coaches.php', 'name' => get_lang('Tutors')];
}
@ -46,7 +46,7 @@ function get_count_users()
$coaches = CourseManager::get_coachs_from_course($sessionId, $courseId);
foreach ($coaches as $coach) {
if (!empty($keyword)) {
if (stripos($coach['full_name'], $keyword) === false) {
if (false === stripos($coach['full_name'], $keyword)) {
continue;
}
}
@ -84,7 +84,7 @@ function get_users($from, $limit, $column, $direction)
$coaches = CourseManager::get_coachs_from_course($sessionId, $courseId);
foreach ($coaches as $coach) {
if (!empty($keyword)) {
if (stripos($coach['full_name'], $keyword) === false) {
if (false === stripos($coach['full_name'], $keyword)) {
continue;
}
}
@ -140,7 +140,7 @@ function get_users($from, $limit, $column, $direction)
}
$urlDetails = $url."?student=$student_id&origin=teacher_details";
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
if (isset($_GET['id_coach']) && 0 != intval($_GET['id_coach'])) {
$urlDetails = $url."?student=$student_id&id_coach=$coach_id&id_session=$sessionId";
}

@ -13,7 +13,7 @@ if (!api_is_allowed_to_create_course() && !api_is_drh()) {
api_not_allowed(true);
}
$allowCustomCertificate = api_get_plugin_setting('customcertificate', 'enable_plugin_customcertificate') === 'true';
$allowCustomCertificate = 'true' === api_get_plugin_setting('customcertificate', 'enable_plugin_customcertificate');
$plugin = CustomCertificatePlugin::create();
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
@ -351,7 +351,7 @@ if ($allowCustomCertificate) {
echo Display::toolbarAction('actions', [$actions]);
echo $form->returnForm();
if (count($certificateList) == 0) {
if (0 == count($certificateList)) {
echo Display::return_message(get_lang('NoResultsAvailable'), 'warning');
} else {
echo '<table class="table table-hover table-striped data_table">';

@ -88,7 +88,7 @@ echo MySpace::getTopMenu();
echo '</div>';
echo MySpace::getAdminActions();
if ($action !== 'add_user') {
if ('add_user' !== $action) {
$form = new FormValidator('language_filter');
$form->addHidden('a', 'language_filter');
$form->addSelectLanguage(
@ -133,9 +133,9 @@ echo $style;
$tableContent = '';
if ($action !== 'add_user') {
if ('add_user' !== $action) {
$conditions = ['status' => STUDENT_BOSS, 'active' => 1];
if (!empty($languageFilter) && $languageFilter !== 'placeholder') {
if (!empty($languageFilter) && 'placeholder' !== $languageFilter) {
$conditions['language'] = $languageFilter;
}
$bossList = UserManager::get_user_list($conditions, ['firstname']);

@ -15,7 +15,7 @@ if (!$allowToTrack) {
api_not_allowed(true);
}
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$export_csv = isset($_GET['export']) && 'csv' == $_GET['export'] ? true : false;
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$active = isset($_GET['active']) ? intval($_GET['active']) : 1;
$sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null;
@ -90,7 +90,7 @@ function get_users($from, $limit, $column, $direction)
$drhLoaded = true;
}
if ($drhLoaded == false) {
if (false == $drhLoaded) {
$students = UserManager::getUsersFollowedByUser(
api_get_user_id(),
COURSEMANAGER,
@ -150,7 +150,7 @@ function get_users($from, $limit, $column, $direction)
}
$urlDetails = $url."?student=$student_id&origin=teacher_details";
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
if (isset($_GET['id_coach']) && 0 != intval($_GET['id_coach'])) {
$urlDetails = $url."?student=$student_id&id_coach=$coach_id&id_session=$sessionId";
}

@ -172,7 +172,7 @@ if ($form->validate()) {
$sessionAdded[] = $session['session_id'];
}
if ($showName === false) {
if (false === $showName) {
$name = '';
}
$sessionArray[] = Display::url(

@ -28,7 +28,7 @@ class ch_multiplechoiceother extends survey_question
if (is_array($formData['answers'])) {
foreach ($formData['answers'] as $key => $value) {
if ($value === 'other') {
if ('other' === $value) {
continue;
}
$this->getForm()->addHtmlEditor('answers['.$key.']', null, false, false, $config);
@ -68,7 +68,7 @@ class ch_multiplechoiceother extends survey_question
}
foreach ($questionData['options'] as &$option) {
if ($option === 'other') {
if ('other' === $option) {
$option = '<p>'.get_lang('SurveyOtherAnswerSpecify').'</p>';
}
}

@ -13,7 +13,7 @@ class ch_selectivedisplay extends ch_yesno
if (is_array($questionData['options'])) {
$class = 'radio-inline';
$labelClass = 'radio-inline';
if ($questionData['display'] === 'vertical') {
if ('vertical' === $questionData['display']) {
$class = 'radio-vertical';
}

@ -1164,19 +1164,19 @@ class SurveyManager
if (strlen($form_content['question']) > 1) {
// Checks length of the question
$empty_answer = false;
if ($survey_data['survey_type'] == 1) {
if (1 == $survey_data['survey_type']) {
if (empty($form_content['choose'])) {
return 'PleaseChooseACondition';
}
if (($form_content['choose'] == 2) &&
if ((2 == $form_content['choose']) &&
($form_content['assigned1'] == $form_content['assigned2'])
) {
return 'ChooseDifferentCategories';
}
}
if ($form_content['type'] !== 'percentage') {
if ('percentage' !== $form_content['type']) {
if (isset($form_content['answers'])) {
for ($i = 0; $i < count($form_content['answers']); $i++) {
if (strlen($form_content['answers'][$i]) < 1) {
@ -1611,7 +1611,7 @@ class SurveyManager
$type = $form_content['type'];
// A percentage question type has options 1 -> 100
if ($type === 'percentage') {
if ('percentage' === $type) {
for ($i = 1; $i < 101; $i++) {
$form_content['answers'][] = $i;
}
@ -1933,9 +1933,9 @@ class SurveyManager
answered_user.user as invited_user,
user.firstname,
user.lastname,
user.user_id
user.id as user_id
FROM $table_survey_answer answered_user
LEFT JOIN $table_user as user ON answered_user.user = user.user_id
LEFT JOIN $table_user as user ON answered_user.user = user.id
WHERE
answered_user.c_id = $course_id AND
survey_id= '".$survey_id."' ".
@ -2623,7 +2623,7 @@ class SurveyManager
$result = Database::query($sql);
$countOfQuestions = Database::result($result, 0, 0);
if ($survey['one_question_per_page'] == 1) {
if (1 == $survey['one_question_per_page']) {
if (!empty($countOfQuestions)) {
return $countOfQuestions;
}

@ -26,7 +26,7 @@ if ($isDrhOfCourse) {
exit;
}
if (!api_is_allowed_to_edit(false, true) ||
(api_is_session_general_coach() && $extend_rights_for_coachs == 'false')
(api_is_session_general_coach() && 'false' == $extend_rights_for_coachs)
) {
api_not_allowed(true);
exit;

@ -928,7 +928,7 @@ class SurveyUtil
echo ' <th>'.get_lang('AbsoluteTotal').'</th>';
echo ' <th>'.get_lang('Percentage').'</th>';
echo ' <th>'.get_lang('VisualRepresentation').'</th>';
echo ' <tr>';
echo ' </tr>';
// Displaying the table: the content
foreach ($options as $key => &$value) {
@ -3423,7 +3423,7 @@ class SurveyUtil
LEFT JOIN $table_survey_question survey_question
ON (survey.survey_id = survey_question.survey_id AND survey_question.c_id = $course_id)
LEFT JOIN $table_user user
ON (survey.author = user.user_id)
ON (survey.author = user.id)
WHERE survey.c_id = $course_id
$search_restriction
$condition_session
@ -3573,7 +3573,7 @@ class SurveyUtil
LEFT JOIN $table_survey_question survey_question
ON (survey.survey_id = survey_question.survey_id AND survey.c_id = survey_question.c_id),
$table_user user
WHERE survey.author = user.user_id AND survey.c_id = $course_id $list_condition
WHERE survey.author = user.id AND survey.c_id = $course_id $list_condition
";
$sql .= ' GROUP BY survey.survey_id';
$sql .= " ORDER BY col$column $direction ";

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.tracking
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;
@ -15,7 +12,7 @@ $exportXls = isset($_GET['export']) && $_GET['export'] == 'xls' ? true : false;
$session_id = intval($_REQUEST['id_session']);
$this_section = SECTION_COURSES;
if ($from == 'myspace') {
if ('myspace' === $from) {
$from_myspace = true;
$this_section = 'session_my_space';
}

@ -3,9 +3,6 @@
use ChamiloSession as Session;
/**
* @package chamilo.tracking
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Report.
*
* @package chamilo.tracking
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -3,8 +3,6 @@
/**
* Exams script.
*
* @package chamilo.tracking
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -189,7 +187,7 @@ if (!empty($courseList) && is_array($courseList)) {
$exerciseCount = $exerciseCount + $exerciseCount * count($newSessionList) + $exerciseSessionCount;
// Add course and session list.
if ($exerciseCount == 0) {
if (0 == $exerciseCount) {
$exerciseCount = 2;
}
$html .= "<tr>
@ -203,7 +201,7 @@ if (!empty($courseList) && is_array($courseList)) {
$result = Database::query($sql);
// If main tool is visible.
if (Database::result($result, 0, 'visibility') == 1) {
if (1 == Database::result($result, 0, 'visibility')) {
// Getting the exam list.
if ($global) {
$sql = "SELECT quiz.title, id, session_id

@ -1,11 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Report.
*
* @package chamilo.tracking
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -3,9 +3,6 @@
use ChamiloSession as Session;
/**
* @package chamilo.tracking
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_TRACKING;
@ -19,7 +16,7 @@ $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$session_id = isset($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : 0;
$this_section = SECTION_COURSES;
if ($from == 'myspace') {
if ('myspace' == $from) {
$from_myspace = true;
$this_section = 'session_my_space';
}

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.classes
*
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;

@ -255,7 +255,7 @@ if ($allowTutors === 'true') {
$sql = "SELECT user.lastname,user.firstname,user.username
FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
WHERE
session_rcru.user_id = user.user_id AND
session_rcru.user_id = user.id AND
session_rcru.session_id = '".intval($id_session)."' AND
session_rcru.c_id ='".Database::escape_string($course['id'])."' AND
session_rcru.status=2";

@ -3,8 +3,6 @@
/**
* List sessions in an efficient and usable way.
*
* @package chamilo.admin
*/
$cidReset = true;

@ -325,7 +325,7 @@ function get_number_of_users()
$sql = "SELECT COUNT(u.id)
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'";
ON u.id = cu.user_id AND c_id='".api_get_course_int_id()."'";
// we change the SQL when we have a filter
if (isset($_GET['subscribe_user_filter_value']) &&
@ -335,7 +335,7 @@ function get_number_of_users()
$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
$sql .= "
LEFT JOIN $table_user_field_values field_values
ON field_values.item_id = u.user_id
ON field_values.item_id = u.id
WHERE
cu.user_id IS NULL AND
u.status <> ".DRH." AND
@ -354,7 +354,7 @@ function get_number_of_users()
$sql = "SELECT COUNT(u.id)
FROM $user_table u
LEFT JOIN $course_user_table cu
ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'
ON u.id = cu.user_id AND c_id='".api_get_course_int_id()."'
INNER JOIN $tbl_url_rel_user as url_rel_user
ON (url_rel_user.user_id = u.id)
WHERE cu.user_id IS NULL AND access_url_id= $url_access_id AND u.status <> ".DRH." ";

@ -11,8 +11,8 @@ require_once 'work.lib.php';
$this_section = SECTION_COURSES;
$work_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$documentId = isset($_REQUEST['document_id']) ? intval($_REQUEST['document_id']) : null;
$work_id = isset($_REQUEST['id']) ? (int) ($_REQUEST['id']) : null;
$documentId = isset($_REQUEST['document_id']) ? (int) ($_REQUEST['document_id']) : null;
$is_allowed_to_edit = api_is_allowed_to_edit();
$course_id = api_get_course_int_id();

@ -19,24 +19,24 @@ use Sylius\Component\Attribute\Model\Attribute as BaseAttribute;
*/
class ExtraField extends BaseAttribute
{
const USER_FIELD_TYPE = 1;
const COURSE_FIELD_TYPE = 2;
const SESSION_FIELD_TYPE = 3;
const QUESTION_FIELD_TYPE = 4;
const CALENDAR_FIELD_TYPE = 5;
const LP_FIELD_TYPE = 6;
const LP_ITEM_FIELD_TYPE = 7;
const SKILL_FIELD_TYPE = 8;
const WORK_FIELD_TYPE = 9;
const CAREER_FIELD_TYPE = 10;
const USER_CERTIFICATE = 11;
const SURVEY_FIELD_TYPE = 12;
const SCHEDULED_ANNOUNCEMENT = 13;
const TERMS_AND_CONDITION_TYPE = 14;
const FORUM_CATEGORY_TYPE = 15;
const FORUM_POST_TYPE = 16;
const EXERCISE_FIELD_TYPE = 17;
const TRACK_EXERCISE_FIELD_TYPE = 18;
public const USER_FIELD_TYPE = 1;
public const COURSE_FIELD_TYPE = 2;
public const SESSION_FIELD_TYPE = 3;
public const QUESTION_FIELD_TYPE = 4;
public const CALENDAR_FIELD_TYPE = 5;
public const LP_FIELD_TYPE = 6;
public const LP_ITEM_FIELD_TYPE = 7;
public const SKILL_FIELD_TYPE = 8;
public const WORK_FIELD_TYPE = 9;
public const CAREER_FIELD_TYPE = 10;
public const USER_CERTIFICATE = 11;
public const SURVEY_FIELD_TYPE = 12;
public const SCHEDULED_ANNOUNCEMENT = 13;
public const TERMS_AND_CONDITION_TYPE = 14;
public const FORUM_CATEGORY_TYPE = 15;
public const FORUM_POST_TYPE = 16;
public const EXERCISE_FIELD_TYPE = 17;
public const TRACK_EXERCISE_FIELD_TYPE = 18;
/**
* @var int

Loading…
Cancel
Save