Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyStaff: Pick fixes from release_6 #4085

Merged
merged 4 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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') . '
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -154,6 +159,10 @@ final public function getSelectableColumns() : array
{
global $DIC;

if ($this->columnDefinition !== null) {
return $this->columnDefinition;
}

$cols = array();

$cols['crs_title'] = array(
Expand All @@ -177,7 +186,9 @@ final public function getSelectableColumns() : array
);
}

return $cols;
$this->columnDefinition = $cols;

return $this->columnDefinition;
}

private function addColumns() : void
Expand Down