diff --git a/Services/MyStaff/classes/ListCourses/class.ilMStListCourses.php b/Services/MyStaff/classes/ListCourses/class.ilMStListCourses.php index 8033bdc6d920..b5b3be78014b 100644 --- a/Services/MyStaff/classes/ListCourses/class.ilMStListCourses.php +++ b/Services/MyStaff/classes/ListCourses/class.ilMStListCourses.php @@ -47,7 +47,7 @@ final public function getData(array $arr_usr_ids = array(), array $options = arr SELECT reg.obj_id, reg.usr_id, ' . ilMStListCourse::MEMBERSHIP_STATUS_REGISTERED . ' AS reg_status, lp.status AS lp_status FROM obj_members AS reg LEFT JOIN ut_lp_marks AS lp on lp.obj_id = reg.obj_id AND lp.usr_id = reg.usr_id - WHERE ' . $this->dic->database()->in('reg.usr_id', $arr_usr_ids, false, 'integer') . ' + WHERE ' . $this->dic->database()->in('reg.usr_id', $arr_usr_ids, false, 'integer') . ' AND (reg.admin = 1 OR reg.tutor = 1 OR reg.member = 1) UNION SELECT obj_id, usr_id, ' . ilMStListCourse::MEMBERSHIP_STATUS_WAITINGLIST . ' AS reg_status, 0 AS lp_status FROM crs_waiting_list AS waiting WHERE ' . $this->dic->database()->in('waiting.usr_id', $arr_usr_ids, false, 'integer') . ' @@ -172,6 +172,10 @@ protected function createWhereStatement(array $arr_filter): string 'integer') . ')'; } + if (isset($arr_filter['usr_id']) && is_numeric($arr_filter['usr_id'])) { + $where[] = 'usr_id = ' . $this->dic->database()->quote($arr_filter['usr_id'], \ilDBConstants::T_INTEGER); + } + if (!empty($where)) { return ' WHERE ' . implode(' AND ', $where) . ' '; } else { diff --git a/Services/MyStaff/classes/ShowUser/Courses/class.ilMStShowUserCoursesTableGUI.php b/Services/MyStaff/classes/ShowUser/Courses/class.ilMStShowUserCoursesTableGUI.php index 7759001706a2..7cc8b9ea380d 100644 --- a/Services/MyStaff/classes/ShowUser/Courses/class.ilMStShowUserCoursesTableGUI.php +++ b/Services/MyStaff/classes/ShowUser/Courses/class.ilMStShowUserCoursesTableGUI.php @@ -27,7 +27,12 @@ class ilMStShowUserCoursesTableGUI extends ilTable2GUI protected int $usr_id; protected array $filter = array(); protected ilMyStaffAccess $access; + protected ?array $columnDefinition = null; + /** + * @param ilMStShowUserCoursesGUI $parent_obj + * @param string $parent_cmd + */ public function __construct(ilMStShowUserCoursesGUI $parent_obj, $parent_cmd = ilMStShowUserCoursesGUI::CMD_INDEX) { global $DIC; @@ -154,6 +159,10 @@ final public function getSelectableColumns() : array { global $DIC; + if ($this->columnDefinition !== null) { + return $this->columnDefinition; + } + $cols = array(); $cols['crs_title'] = array( @@ -177,7 +186,9 @@ final public function getSelectableColumns() : array ); } - return $cols; + $this->columnDefinition = $cols; + + return $this->columnDefinition; } private function addColumns() : void