38 $this->db = $DIC->database();
40 $this->obj_id = $a_exc->
getId();
60 $this->obj_id = $a_obj_id;
65 return $this->members ?: array();
70 $this->members = $a_members;
80 $ilDB->manipulate(
"DELETE FROM exc_members " .
81 "WHERE obj_id = " .
$ilDB->quote($this->getObjId(),
"integer") .
" " .
82 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ");
86 "INSERT INTO exc_members (obj_id, usr_id, status, sent, feedback) " .
87 " VALUES (%s,%s,%s,%s,%s)",
88 array(
"integer",
"integer",
"text",
"integer",
"integer"),
89 array($this->
getObjId(), $a_usr_id,
'notgraded', 0, 0)
113 if (is_array($a_members)) {
114 foreach ($a_members as $member) {
122 if ($assigned == count($a_members)) {
137 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->
getRefId());
139 $query =
"DELETE FROM exc_members " .
140 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer") .
" " .
141 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ";
165 $tmp_arr_members = array();
167 $query =
"SELECT * FROM exc_members " .
168 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
171 while ($row =
$ilDB->fetchObject(
$res)) {
173 $tmp_arr_members[] = $row->usr_id;
186 $query =
"SELECT * FROM exc_members " .
187 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
190 while ($row =
$ilDB->fetchObject(
$res)) {
191 $data[] = array(
"usr_id" => $row->usr_id,
192 "notice" => $row->notice,
193 "returned" => $row->returned,
194 "status" => $row->status,
195 "sent" => $row->sent,
196 "feedback" => $row->feedback
199 foreach (
$data as $row) {
201 "INSERT INTO exc_members " .
202 " (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES " .
203 " (%s,%s,%s,%s,%s,%s,%s)",
204 array(
"integer",
"integer",
"text",
"integer",
"text",
"integer",
"integer"),
205 array($a_new_id, $row[
"usr_id"], $row[
"notice"], (
int) $row[
"returned"],
206 $row[
"status"], (
int) $row[
"feedback"], (
int) $row[
"sent"])
214 public function delete():
void 218 $query =
"DELETE FROM exc_members WHERE obj_id = " .
229 $ilDB = $DIC->database();
232 $query =
"SELECT DISTINCT(excm.usr_id) ud" .
233 " FROM exc_members excm" .
234 " JOIN object_data od ON (od.obj_id = excm.usr_id)" .
235 " WHERE excm.obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
236 " AND od.type = " .
$ilDB->quote(
"usr",
"text");
240 while ($row =
$ilDB->fetchObject(
$res)) {
241 $usr_ids[] = $row->ud;
257 public static function _lookupStatus(
int $a_obj_id,
int $a_user_id): ?string
261 $ilDB = $DIC->database();
263 $query =
"SELECT status FROM exc_members " .
264 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
265 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer");
269 return $row[
"status"];
288 $ilDB = $DIC->database();
291 "UPDATE exc_members SET " .
292 " status = " .
$ilDB->quote($a_status,
"text") .
293 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
294 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
315 $ilDB = $DIC->database();
318 "UPDATE exc_members SET " .
319 " returned = " .
$ilDB->quote($a_status,
"integer") .
320 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
321 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
340 $ilDB = $DIC->database();
342 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members " .
343 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
348 while ($row =
$ilDB->fetchObject(
$res)) {
349 $usr_ids[] = $row->ud;
358 public static function _hasReturned(
int $a_obj_id,
int $a_user_id): bool
362 $ilDB = $DIC->database();
365 "SELECT DISTINCT(usr_id) FROM exc_members WHERE " .
366 " obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" AND " .
367 " returned = " .
$ilDB->quote(1,
"integer") .
" AND " .
368 " usr_id = " .
$ilDB->quote($a_user_id,
"integer")
370 return (
bool)
$ilDB->fetchAssoc($set);
380 $ilDB = $DIC->database();
382 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
383 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
384 "AND status = " .
$ilDB->quote(
"passed",
"text");
387 while ($row =
$ilDB->fetchObject(
$res)) {
388 $usr_ids[] = $row->usr_id;
400 $ilDB = $DIC->database();
402 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
403 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
404 "AND status = " .
$ilDB->quote(
"failed",
"text");
407 while ($row =
$ilDB->fetchObject(
$res)) {
408 $usr_ids[] = $row->usr_id;
static _writeStatus(int $a_obj_id, int $a_user_id, string $a_status)
Write user status This information is determined by the assignment status and saved redundantly in th...
static _writeReturned(int $a_obj_id, int $a_user_id, int $a_status)
Write returned status.
static _hasReturned(int $a_obj_id, int $a_user_id)
Has user returned anything in any assignment?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static createNewUserRecords(int $a_user_id, int $a_exc_id)
static _getPassedUsers(int $a_obj_id)
Get all users that passed the exercise.
static _getReturned(int $a_obj_id)
Get returned status for all members (if they have anything returned for any assignment) ...
__construct(ilObjExercise $a_exc)
static _getFailedUsers(int $a_obj_id)
Get all users that failed the exercise.
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current status (notgraded|passed|failed)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
assignMember(int $a_usr_id)
Assign a user to the exercise.
static getInstancesByExercise(int $a_exc_id)
assignMembers(array $a_members)
Assign members to exercise.
static _getMembers(int $a_obj_id)
static deleteUser(int $a_exc_id, int $a_user_id)
Delete all delivered files of user.
static _lookupType(int $id, bool $reference=false)
deassignMember(int $a_usr_id)
Detaches a user from an exercise.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilRecommendedContentManager $recommended_content_manager
static getInstance(int $a_ass_id, int $a_participant_id, bool $a_is_team=false)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
setMembers(array $a_members)