28 protected \ILIAS\Exercise\InternalDomainService
$domain;
42 $this->db =
$DIC->database();
44 $this->obj_id = $a_exc->
getId();
48 $this->individual_deadlines =
$DIC->exercise()->internal()->domain()->individualDeadline();
49 $this->domain =
$DIC->exercise()->internal()->domain();
66 $this->obj_id = $a_obj_id;
71 return $this->members ?: array();
76 $this->members = $a_members;
86 $ilDB->manipulate(
"DELETE FROM exc_members " .
87 "WHERE obj_id = " .
$ilDB->quote($this->getObjId(),
"integer") .
" " .
88 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ");
92 "INSERT INTO exc_members (obj_id, usr_id, status, sent, feedback) " .
93 " VALUES (%s,%s,%s,%s,%s)",
94 array(
"integer",
"integer",
"text",
"integer",
"integer"),
95 array($this->
getObjId(), $a_usr_id,
'notgraded', 0, 0)
119 if (is_array($a_members)) {
120 foreach ($a_members as $member) {
128 if ($assigned == count($a_members)) {
143 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->
getRefId());
144 $this->individual_deadlines->deleteAllOfUserInExercise($this->
getObjId(), $a_usr_id,
false);
146 $query =
"DELETE FROM exc_members " .
147 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer") .
" " .
148 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ";
150 $ilDB->manipulate($query);
166 $random = $this->domain->assignment()->randomAssignments($this->exc);
167 $random->deleteAssignmentsOfUser($a_usr_id);
176 $tmp_arr_members = array();
178 $query =
"SELECT * FROM exc_members " .
179 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
182 while ($row =
$ilDB->fetchObject(
$res)) {
184 $tmp_arr_members[] = $row->usr_id;
197 $query =
"SELECT * FROM exc_members " .
198 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
201 while ($row =
$ilDB->fetchObject(
$res)) {
202 $data[] = array(
"usr_id" => $row->usr_id,
203 "notice" => $row->notice,
204 "returned" => $row->returned,
205 "status" => $row->status,
206 "sent" => $row->sent,
207 "feedback" => $row->feedback
210 foreach (
$data as $row) {
212 "INSERT INTO exc_members " .
213 " (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES " .
214 " (%s,%s,%s,%s,%s,%s,%s)",
215 array(
"integer",
"integer",
"text",
"integer",
"text",
"integer",
"integer"),
216 array($a_new_id, $row[
"usr_id"], $row[
"notice"], (
int) $row[
"returned"],
217 $row[
"status"], (
int) $row[
"feedback"], (
int) $row[
"sent"])
225 public function delete():
void
229 $query =
"DELETE FROM exc_members WHERE obj_id = " .
231 $ilDB->manipulate($query);
243 $query =
"SELECT DISTINCT(excm.usr_id) ud" .
244 " FROM exc_members excm" .
245 " JOIN object_data od ON (od.obj_id = excm.usr_id)" .
246 " WHERE excm.obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
247 " AND od.type = " .
$ilDB->quote(
"usr",
"text");
251 while ($row =
$ilDB->fetchObject(
$res)) {
252 $usr_ids[] = $row->ud;
268 public static function _lookupStatus(
int $a_obj_id,
int $a_user_id): ?string
274 $query =
"SELECT status FROM exc_members " .
275 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
276 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer");
280 return $row[
"status"];
302 "UPDATE exc_members SET " .
303 " status = " .
$ilDB->quote($a_status,
"text") .
304 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
305 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
329 "UPDATE exc_members SET " .
330 " returned = " .
$ilDB->quote($a_status,
"integer") .
331 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
332 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
353 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members " .
354 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
359 while ($row =
$ilDB->fetchObject(
$res)) {
360 $usr_ids[] = $row->ud;
369 public static function _hasReturned(
int $a_obj_id,
int $a_user_id): bool
376 "SELECT DISTINCT(usr_id) FROM exc_members WHERE " .
377 " obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" AND " .
378 " returned = " .
$ilDB->quote(1,
"integer") .
" AND " .
379 " usr_id = " .
$ilDB->quote($a_user_id,
"integer")
381 return (
bool)
$ilDB->fetchAssoc($set);
393 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
394 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
395 "AND status = " .
$ilDB->quote(
"passed",
"text");
398 while ($row =
$ilDB->fetchObject(
$res)) {
399 $usr_ids[] = $row->usr_id;
413 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
414 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
415 "AND status = " .
$ilDB->quote(
"failed",
"text");
418 while ($row =
$ilDB->fetchObject(
$res)) {
419 $usr_ids[] = $row->usr_id;
static getInstancesByExercise(int $a_exc_id)
static createNewUserRecords(int $a_user_id, int $a_exc_id)
static deleteUser(int $a_exc_id, int $a_user_id)
Deletes already delivered files.
static getInstance(int $a_ass_id, int $a_participant_id, bool $a_is_team=false)
static _getReturned(int $a_obj_id)
Get returned status for all members (if they have anything returned for any assignment)
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 _getMembers(int $a_obj_id)
static _hasReturned(int $a_obj_id, int $a_user_id)
Has user returned anything in any assignment?
IndividualDeadlineManager $individual_deadlines
assignMember(int $a_usr_id)
Assign a user to the exercise.
ILIAS Exercise InternalDomainService $domain
static _writeReturned(int $a_obj_id, int $a_user_id, int $a_status)
Write returned status.
static _getPassedUsers(int $a_obj_id)
Get all users that passed the exercise.
deassignMember(int $a_usr_id)
Detaches a user from an exercise.
assignMembers(array $a_members)
Assign members to exercise.
ilRecommendedContentManager $recommended_content_manager
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current status (notgraded|passed|failed)
static _getFailedUsers(int $a_obj_id)
Get all users that failed the exercise.
__construct(ilObjExercise $a_exc)
setMembers(array $a_members)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...