Fix psalm issues: Double casting, add phpdoc, fix php warning

pull/3768/head
Julio Montoya 5 years ago
parent f4c617d09c
commit a8affdffce
  1. 1
      public/legacy.php
  2. 16
      public/main/exercise/exercise.class.php
  3. 6
      public/main/gradebook/gradebook_flatview.php
  4. 10
      public/main/gradebook/gradebook_view_result.php
  5. 12
      public/main/gradebook/lib/be/abstractlink.class.php
  6. 2
      public/main/gradebook/lib/be/evaluation.class.php
  7. 6
      public/main/gradebook/lib/fe/catform.class.php
  8. 4
      public/main/gradebook/lib/fe/exportgradebook.php
  9. 2
      public/main/gradebook/lib/flatview_data_generator.class.php
  10. 2
      public/main/inc/lib/SortableTableFromArrayConfig.php
  11. 2
      public/main/inc/lib/api.lib.php
  12. 2
      public/main/inc/lib/career.lib.php
  13. 14
      public/main/inc/lib/course.lib.php
  14. 19
      public/main/inc/lib/dashboard.lib.php
  15. 2
      public/main/inc/lib/link.lib.php
  16. 4
      public/main/inc/lib/online.inc.php
  17. 4
      public/main/inc/lib/sessionmanager.lib.php
  18. 6
      public/main/inc/lib/social.lib.php
  19. 1
      public/main/lp/learnpath.class.php
  20. 4
      public/main/session/add_users_to_session.php
  21. 4
      public/main/session/add_users_to_session_course.php
  22. 2
      src/CoreBundle/Framework/Container.php

@ -17,4 +17,3 @@ require_once __DIR__.'/main/inc/lib/fileDisplay.lib.php';
require_once __DIR__.'/main/inc/lib/specific_fields_manager.lib.php'; require_once __DIR__.'/main/inc/lib/specific_fields_manager.lib.php';
require_once __DIR__.'/main/forum/forumfunction.inc.php'; require_once __DIR__.'/main/forum/forumfunction.inc.php';
require_once __DIR__.'/main/work/work.lib.php'; require_once __DIR__.'/main/work/work.lib.php';

@ -3630,7 +3630,7 @@ class Exercise
if (ORAL_EXPRESSION == $answerType) { if (ORAL_EXPRESSION == $answerType) {
$exe_info = Event::get_exercise_results_by_attempt($exeId); $exe_info = Event::get_exercise_results_by_attempt($exeId);
$exe_info = isset($exe_info[$exeId]) ? $exe_info[$exeId] : null; $exe_info = isset($exe_info[$exeId]) ? $exe_info[$exeId] : null;
/** @var OralExpression $objQuestionTmp */
$objQuestionTmp->initFile( $objQuestionTmp->initFile(
api_get_session_id(), api_get_session_id(),
isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(), isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(),
@ -5058,13 +5058,13 @@ class Exercise
$showTotalScoreAndUserChoicesInLastAttempt $showTotalScoreAndUserChoicesInLastAttempt
); );
} elseif (HOT_SPOT_ORDER == $answerType) { } elseif (HOT_SPOT_ORDER == $answerType) {
ExerciseShowFunctions::display_hotspot_order_answer( /*ExerciseShowFunctions::display_hotspot_order_answer(
$feedback_type, $feedback_type,
$answerId, $answerId,
$answer, $answer,
$studentChoice, $studentChoice,
$answerComment $answerComment
); );*/
} elseif (HOT_SPOT_DELINEATION == $answerType) { } elseif (HOT_SPOT_DELINEATION == $answerType) {
$user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId];
@ -5422,6 +5422,7 @@ class Exercise
break; break;
case ORAL_EXPRESSION: case ORAL_EXPRESSION:
/** @var OralExpression $objQuestionTmp */
echo '<tr> echo '<tr>
<td valign="top">'. <td valign="top">'.
ExerciseShowFunctions::display_oral_expression_answer( ExerciseShowFunctions::display_oral_expression_answer(
@ -5588,13 +5589,13 @@ class Exercise
break; break;
case HOT_SPOT_ORDER: case HOT_SPOT_ORDER:
ExerciseShowFunctions::display_hotspot_order_answer( /*ExerciseShowFunctions::display_hotspot_order_answer(
$feedback_type, $feedback_type,
$answerId, $answerId,
$answer, $answer,
$studentChoice, $studentChoice,
$answerComment $answerComment
); );*/
break; break;
case DRAGGABLE: case DRAGGABLE:
@ -5755,8 +5756,7 @@ class Exercise
echo $message; echo $message;
$_SESSION['hotspot_delineation_result'][$this->getId()][$questionId][0] = $message; $_SESSION['hotspot_delineation_result'][$this->getId()][$questionId][0] = $message;
$_SESSION['hotspot_delineation_result'][$this->selgetIdectId( $_SESSION['hotspot_delineation_result'][$this->getId()][$questionId][1] = $_SESSION['exerciseResultCoordinates'][$questionId];
)][$questionId][1] = $_SESSION['exerciseResultCoordinates'][$questionId];
} else { } else {
echo $hotspot_delineation_result[0]; echo $hotspot_delineation_result[0];
} }
@ -9504,7 +9504,7 @@ class Exercise
$currentRow['id'] = $exercise->id; $currentRow['id'] = $exercise->id;
$currentRow['url'] = $webPath.'exercise/overview.php?' $currentRow['url'] = $webPath.'exercise/overview.php?'
.api_get_cidreq_params($courseInfo['code'], $sessionId).'&' .api_get_cidreq_params($courseInfo['code'], $sessionId).'&'
."$mylpid$mylpitemid&exerciseId={$row['id']}"; ."$mylpid$mylpitemid&exerciseId={$exercise->id}";
$currentRow['name'] = $currentRow[0]; $currentRow['name'] = $currentRow[0];
} }
} }

@ -3,7 +3,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/fe/exportgradebook.php'; require_once __DIR__.'/lib/fe/exportgradebook.php';
$current_course_tool = TOOL_GRADEBOOK; $current_course_tool = TOOL_GRADEBOOK;
@ -51,7 +51,7 @@ if ($showlink) {
$alllinks = $cat[0]->get_links($userId, true); $alllinks = $cat[0]->get_links($userId, true);
} }
global $file_type; /*global $file_type;
if (isset($export_flatview_form) && 'pdf' === !$file_type) { if (isset($export_flatview_form) && 'pdf' === !$file_type) {
Display::addFlash( Display::addFlash(
Display::return_message( Display::return_message(
@ -60,7 +60,7 @@ if (isset($export_flatview_form) && 'pdf' === !$file_type) {
false false
) )
); );
} }*/
$category_id = 0; $category_id = 0;
if (isset($_GET['selectcat'])) { if (isset($_GET['selectcat'])) {
$category_id = (int) $_GET['selectcat']; $category_id = (int) $_GET['selectcat'];

@ -3,7 +3,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/fe/exportgradebook.php'; require_once __DIR__.'/lib/fe/exportgradebook.php';
api_block_anonymous_users(); api_block_anonymous_users();
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
@ -23,9 +23,11 @@ $interbreadcrumb[] = [
//load the evaluation & category //load the evaluation & category
$select_eval = (int) $_GET['selecteval']; $select_eval = (int) $_GET['selecteval'];
if (empty($select_eval)) { if (empty($select_eval)) {
api_not_allowed(); api_not_allowed(true);
} }
$_course = api_get_course_info();
$_user = api_get_user_info();
$displayscore = ScoreDisplay::instance(); $displayscore = ScoreDisplay::instance();
$eval = Evaluation::load($select_eval); $eval = Evaluation::load($select_eval);
$overwritescore = 0; $overwritescore = 0;
@ -360,7 +362,7 @@ if (isset($_GET['export'])) {
$filename = 'export_results_'.gmdate('Y-m-d_H-i-s'); $filename = 'export_results_'.gmdate('Y-m-d_H-i-s');
$results = Result::load(null, null, $select_eval); $results = Result::load(null, null, $select_eval);
$data = []; //when file type is csv, add a header to the output file $data = []; //when file type is csv, add a header to the output file
if ('csv' == $file_type) { if ('csv' === $file_type) {
$alldata[] = [ $alldata[] = [
'username', 'username',
'official_code', 'official_code',
@ -372,7 +374,7 @@ if (isset($_GET['export'])) {
} }
// export results to pdf file // export results to pdf file
if ('pdf' == $file_type) { if ('pdf' === $file_type) {
$number_decimals = api_get_setting('gradebook_number_decimals'); $number_decimals = api_get_setting('gradebook_number_decimals');
$datagen = new ResultsDataGenerator($eval[0], $allresults); $datagen = new ResultsDataGenerator($eval[0], $allresults);

@ -372,13 +372,11 @@ abstract class AbstractLink implements GradebookItem
public function add() public function add()
{ {
$this->add_linked_data(); $this->add_linked_data();
if (isset($this->type) && if (!empty($this->type) &&
isset($this->ref_id) && !empty($this->ref_id) &&
isset($this->user_id) && !empty($this->user_id) &&
isset($this->course_code) && !empty($this->course_code) &&
isset($this->category) && !empty($this->category)
isset($this->weight) &&
isset($this->visible)
) { ) {
$table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = "SELECT count(*) count FROM $table $sql = "SELECT count(*) count FROM $table

@ -393,7 +393,7 @@ class Evaluation implements GradebookItem
$sql .= 'null'; $sql .= 'null';
} }
$sql .= ', category_id = '; $sql .= ', category_id = ';
if (isset($this->category)) { if (!empty($this->category)) {
$sql .= intval($this->get_category_id()); $sql .= intval($this->get_category_id());
} else { } else {
$sql .= 'null'; $sql .= 'null';

@ -153,7 +153,7 @@ class CatForm extends FormValidator
$category_name = $this->category_object->get_name(); $category_name = $this->category_object->get_name();
// The main course category: // The main course category:
if (isset($this->category_object) && 0 == $this->category_object->get_parent_id()) { if (!empty($this->category_object) && 0 == $this->category_object->get_parent_id()) {
if (empty($category_name)) { if (empty($category_name)) {
$category_name = $course_code; $category_name = $course_code;
} }
@ -219,9 +219,7 @@ class CatForm extends FormValidator
); );
$this->addRule('name', get_lang('Required field'), 'required'); $this->addRule('name', get_lang('Required field'), 'required');
if (isset($this->category_object) && if (!empty($this->category_object) && 0 == $this->category_object->get_parent_id()) {
0 == $this->category_object->get_parent_id()
) {
// we can't change the root category // we can't change the root category
$this->freeze('name'); $this->freeze('name');
} }

@ -1,8 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/**
* Script.
*/
/** /**
* Prints an HTML page with a table containing the gradebook data. * Prints an HTML page with a table containing the gradebook data.

@ -344,7 +344,7 @@ class FlatViewDataGenerator
$mainCategoryId = $mainCourseCategory->get_id(); $mainCategoryId = $mainCourseCategory->get_id();
} }
if (isset($this->category) && !empty($this->category)) { if (!empty($this->category)) {
$categories = Category::load( $categories = Category::load(
null, null,
null, null,

@ -97,7 +97,7 @@ class SortableTableFromArrayConfig extends SortableTable
*/ */
public function get_total_number_of_items() public function get_total_number_of_items()
{ {
if (isset($this->total_number_of_items) && !empty($this->total_number_of_items)) { if (!empty($this->total_number_of_items) && $this->total_number_of_items !== -1) {
return $this->total_number_of_items; return $this->total_number_of_items;
} else { } else {
if (!empty($this->table_data)) { if (!empty($this->table_data)) {

@ -1889,7 +1889,7 @@ function api_get_user_info_from_entity(
$result['user_is_online'] = true == $result['user_is_online'] ? 1 : 0; $result['user_is_online'] = true == $result['user_is_online'] ? 1 : 0;
} }
if (isset($result['user_is_online_in_chat'])) { if (isset($result['user_is_online_in_chat'])) {
$result['user_is_online_in_chat'] = (int) $result['user_is_online_in_chat']; $result['user_is_online_in_chat'] = $result['user_is_online_in_chat'];
} }
$result['password'] = ''; $result['password'] = '';

@ -594,7 +594,7 @@ class Career extends Model
'', '',
$value $value
); );
$simpleSecondConnection = 'g'.(int) $groupValueId; $simpleSecondConnection = 'g'.$groupValueId;
} else { } else {
// Course block (row_123 id) // Course block (row_123 id)
if (!empty($explode[0]) && isset($explode[1])) { if (!empty($explode[0]) && isset($explode[1])) {

@ -289,7 +289,7 @@ class CourseManager
if (!in_array($orderdirection, ['ASC', 'DESC'])) { if (!in_array($orderdirection, ['ASC', 'DESC'])) {
$sql .= 'ASC'; $sql .= 'ASC';
} else { } else {
$sql .= ('ASC' == $orderdirection ? 'ASC' : 'DESC'); $sql .= ('ASC' === $orderdirection ? 'ASC' : 'DESC');
} }
if (!empty($howmany) && is_int($howmany) and $howmany > 0) { if (!empty($howmany) && is_int($howmany) and $howmany > 0) {
@ -299,7 +299,7 @@ class CourseManager
} }
if (!empty($from)) { if (!empty($from)) {
$from = (int) $from; $from = (int) $from;
$sql .= ' OFFSET '.(int) $from; $sql .= ' OFFSET '.$from;
} else { } else {
$sql .= ' OFFSET 0'; $sql .= ' OFFSET 0';
} }
@ -476,7 +476,6 @@ class CourseManager
// Erase user student publications (works) in the course - by André Boivin // Erase user student publications (works) in the course - by André Boivin
if (!empty($userList)) { if (!empty($userList)) {
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
foreach ($userList as $userId) { foreach ($userList as $userId) {
// Getting all work from user // Getting all work from user
$workList = getWorkPerUser($userId); $workList = getWorkPerUser($userId);
@ -891,7 +890,7 @@ class CourseManager
'status' => $status, 'status' => $status,
'sort' => $maxSort + 1, 'sort' => $maxSort + 1,
'relation_type' => 0, 'relation_type' => 0,
'user_course_cat' => (int) $userCourseCategoryId, 'user_course_cat' => $userCourseCategoryId,
]; ];
$insertId = Database::insert($courseUserTable, $params); $insertId = Database::insert($courseUserTable, $params);
@ -924,11 +923,9 @@ class CourseManager
$subscribe = (int) api_get_course_setting('subscribe_users_to_forum_notifications', $courseInfo); $subscribe = (int) api_get_course_setting('subscribe_users_to_forum_notifications', $courseInfo);
if (1 === $subscribe) { if (1 === $subscribe) {
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forums = get_forums(0, $courseCode, true, $sessionId); $forums = get_forums(0, $courseCode, true, $sessionId);
foreach ($forums as $forum) { foreach ($forums as $forum) {
$forumId = $forum['iid']; set_notification('forum', $forum->getIid(), false, $userInfo, $courseInfo);
set_notification('forum', $forumId, false, $userInfo, $courseInfo);
} }
} }
@ -2926,8 +2923,9 @@ class CourseManager
// Restriction by user id // Restriction by user id
$currentUserRestriction = ''; $currentUserRestriction = '';
if ($byUserId > 0) {
$byUserId = (int) $byUserId; $byUserId = (int) $byUserId;
if ($byUserId > 0) {
$currentUserRestriction = " AND tcruc.user_id = $byUserId "; $currentUserRestriction = " AND tcruc.user_id = $byUserId ";
} }

@ -47,13 +47,13 @@ class DashboardManager
// change index to lower case // change index to lower case
$plugin_info = array_change_key_case($plugin_info); $plugin_info = array_change_key_case($plugin_info);
echo '<tr>'; echo '<tr>';
self::display_dashboard_plugin_checkboxes($testplugin); self::display_dashboard_plugin_checkboxes($testplugin);
for ($i = 0; $i < count($table_cols); $i++) { for ($i = 0; $i < count($table_cols); $i++) {
if (isset($plugin_info[strtolower($table_cols[$i])])) { $key = $table_cols[$i];
if (isset($plugin_info[$key])) {
echo '<td>'; echo '<td>';
echo $plugin_info[$table_cols[$i]]; echo $plugin_info[$key];
echo '</td>'; echo '</td>';
} else { } else {
echo '<td></td>'; echo '<td></td>';
@ -80,15 +80,16 @@ class DashboardManager
echo '<tr style="background-color:#eee">'; echo '<tr style="background-color:#eee">';
echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>'; echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>';
for ($j = 0; $j < count($table_cols); $j++) { for ($j = 0; $j < count($table_cols); $j++) {
if (isset($disabled_block[strtolower($table_cols[$j])])) { $key = $table_cols[$j];
if (isset($disabled_block[$key])) {
if (2 == $j) { if (2 == $j) {
echo '<td>'; echo '<td>';
echo '<font color="#aaa">'.$disabled_block[$table_cols[$j]].'</font><br />'; echo '<font color="#aaa">'.$disabled_block[$key].'</font><br />';
echo '<font color="red">'.get_lang('This plugin has been deleted from the dashboard plugin directory').'</font>'; echo '<font color="red">'.get_lang('This plugin has been deleted from the dashboard plugin directory').'</font>';
echo '</td>'; echo '</td>';
} else { } else {
echo '<td>'; echo '<td>';
echo '<font color="#aaa">'.$disabled_block[$table_cols[$j]].'</font>'; echo '<font color="#aaa">'.$disabled_block[$key].'</font>';
echo '</td>'; echo '</td>';
} }
} else { } else {
@ -101,7 +102,11 @@ class DashboardManager
echo '</table>'; echo '</table>';
echo '<br />'; echo '<br />';
echo '<button class="btn btn-default" type="submit" name="submit_dashboard_plugins" value="'.get_lang('EnableDashboard plugins').'">'. echo '<button
class="btn btn-default"
type="submit"
name="submit_dashboard_plugins"
value="'.get_lang('EnableDashboard plugins').'">'.
get_lang('EnableDashboard plugins').'</button></form>'; get_lang('EnableDashboard plugins').'</button></form>';
} }

@ -628,7 +628,7 @@ class Link extends Model
SE_COURSE_ID => $course_id, SE_COURSE_ID => $course_id,
SE_TOOL_ID => TOOL_LINK, SE_TOOL_ID => TOOL_LINK,
SE_DATA => [ SE_DATA => [
'link_id' => (int) $id, 'link_id' => $id,
], ],
SE_USER => (int) api_get_user_id(), SE_USER => (int) api_get_user_id(),
]; ];

@ -287,10 +287,12 @@ function who_is_online(
} }
} }
$direction = strtolower($direction);
if (empty($direction)) { if (empty($direction)) {
$direction = 'DESC'; $direction = 'DESC';
} else { } else {
if (!in_array(strtolower($direction), ['asc', 'desc'])) { if (!in_array($direction, ['asc', 'desc'])) {
$direction = 'DESC'; $direction = 'DESC';
} }
} }

@ -2428,13 +2428,13 @@ class SessionManager
} }
} }
if (!empty($forums)) { /*if (!empty($forums)) {
$userInfo = api_get_user_info($enreg_user); $userInfo = api_get_user_info($enreg_user);
foreach ($forums as $forum) { foreach ($forums as $forum) {
$forumId = $forum['iid']; $forumId = $forum['iid'];
//set_notification('forum', $forumId, false, $userInfo, $courseInfo); //set_notification('forum', $forumId, false, $userInfo, $courseInfo);
} }
} }*/
// Checking if user exists in session - user table. // Checking if user exists in session - user table.
$sql = "SELECT count(user_id) as count $sql = "SELECT count(user_id) as count

@ -2934,6 +2934,7 @@ class SocialManager extends UserManager
*/ */
public static function getThreadList($userId) public static function getThreadList($userId)
{ {
return [];
$forumCourseId = api_get_configuration_value('global_forums_course_id'); $forumCourseId = api_get_configuration_value('global_forums_course_id');
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
@ -2941,16 +2942,15 @@ class SocialManager extends UserManager
$threads = []; $threads = [];
if (!empty($forumCourseId)) { if (!empty($forumCourseId)) {
$courseInfo = api_get_course_info_by_id($forumCourseId); $courseInfo = api_get_course_info_by_id($forumCourseId);
getNotificationsPerUser($userId, true, $forumCourseId); /*getNotificationsPerUser($userId, true, $forumCourseId);
$notification = Session::read('forum_notification'); $notification = Session::read('forum_notification');
Session::erase('forum_notification'); Session::erase('forum_notification');*/
$threadUrlBase = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.http_build_query([ $threadUrlBase = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.http_build_query([
'cid' => $courseInfo['real_id'], 'cid' => $courseInfo['real_id'],
]).'&'; ]).'&';
if (isset($notification['thread']) && !empty($notification['thread'])) { if (isset($notification['thread']) && !empty($notification['thread'])) {
$threadList = array_filter(array_unique($notification['thread'])); $threadList = array_filter(array_unique($notification['thread']));
$em = Database::getManager();
$repo = Container::getForumThreadRepository(); $repo = Container::getForumThreadRepository();
foreach ($threadList as $threadId) { foreach ($threadList as $threadId) {
/** @var CForumThread $thread */ /** @var CForumThread $thread */

@ -7182,6 +7182,7 @@ class learnpath
$item_type = 'dir'; $item_type = 'dir';
$lpItem = new CLpItem(); $lpItem = new CLpItem();
$lpItem->setTitle('dir');
$lpItem->setItemType('dir'); $lpItem->setItemType('dir');
$url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; $url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;

@ -65,8 +65,7 @@ if (is_array($extra_field_list)) {
function search_users($needle, $type) function search_users($needle, $type)
{ {
global $id_session; $id_session = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
@ -101,7 +100,6 @@ function search_users($needle, $type)
// Only for single & multiple // Only for single & multiple
if (in_array($type, ['single', 'multiple'])) { if (in_array($type, ['single', 'multiple'])) {
if (!empty($id_session)) { if (!empty($id_session)) {
$id_session = (int) $id_session;
// check id_user from session_rel_user table // check id_user from session_rel_user table
$sql = " $sql = "
SELECT user_id FROM $tbl_session_rel_user SELECT user_id FROM $tbl_session_rel_user

@ -78,7 +78,8 @@ if (is_array($extra_field_list)) {
function search_users($needle, $type) function search_users($needle, $type)
{ {
global $id_session, $courseId; $courseId = isset($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
$id_session = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
@ -115,7 +116,6 @@ function search_users($needle, $type)
// Only for single & multiple // Only for single & multiple
if (in_array($type, ['single', 'multiple'])) { if (in_array($type, ['single', 'multiple'])) {
if (!empty($id_session)) { if (!empty($id_session)) {
$id_session = (int) $id_session;
// check id_user from session_rel_user table // check id_user from session_rel_user table
$sql = " $sql = "
SELECT su.user_id SELECT su.user_id

@ -151,7 +151,7 @@ class Container
*/ */
public static function getProjectDir() public static function getProjectDir()
{ {
if (isset(self::$container)) { if (self::$container) {
return self::$container->get('kernel')->getProjectDir().'/'; return self::$container->get('kernel')->getProjectDir().'/';
} }

Loading…
Cancel
Save