41 $this->db = $DIC->database();
43 $this->obj_id = $a_exc->
getId();
47 $this->individual_deadlines = $DIC->exercise()->internal()->domain()->individualDeadline();
64 $this->obj_id = $a_obj_id;
69 return $this->members ?: array();
74 $this->members = $a_members;
84 $ilDB->manipulate(
"DELETE FROM exc_members " .
85 "WHERE obj_id = " .
$ilDB->quote($this->getObjId(),
"integer") .
" " .
86 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ");
90 "INSERT INTO exc_members (obj_id, usr_id, status, sent, feedback) " .
91 " VALUES (%s,%s,%s,%s,%s)",
92 array(
"integer",
"integer",
"text",
"integer",
"integer"),
93 array($this->
getObjId(), $a_usr_id,
'notgraded', 0, 0)
117 if (is_array($a_members)) {
118 foreach ($a_members as $member) {
126 if ($assigned == count($a_members)) {
141 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->
getRefId());
142 $this->individual_deadlines->deleteAllOfUserInExercise($this->
getObjId(), $a_usr_id,
false);
144 $query =
"DELETE FROM exc_members " .
145 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer") .
" " .
146 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ";
148 $ilDB->manipulate($query);
170 $tmp_arr_members = array();
172 $query =
"SELECT * FROM exc_members " .
173 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
176 while ($row =
$ilDB->fetchObject(
$res)) {
178 $tmp_arr_members[] = $row->usr_id;
191 $query =
"SELECT * FROM exc_members " .
192 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
195 while ($row =
$ilDB->fetchObject(
$res)) {
196 $data[] = array(
"usr_id" => $row->usr_id,
197 "notice" => $row->notice,
198 "returned" => $row->returned,
199 "status" => $row->status,
200 "sent" => $row->sent,
201 "feedback" => $row->feedback
204 foreach (
$data as $row) {
206 "INSERT INTO exc_members " .
207 " (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES " .
208 " (%s,%s,%s,%s,%s,%s,%s)",
209 array(
"integer",
"integer",
"text",
"integer",
"text",
"integer",
"integer"),
210 array($a_new_id, $row[
"usr_id"], $row[
"notice"], (
int) $row[
"returned"],
211 $row[
"status"], (
int) $row[
"feedback"], (
int) $row[
"sent"])
219 public function delete():
void 223 $query =
"DELETE FROM exc_members WHERE obj_id = " .
225 $ilDB->manipulate($query);
234 $ilDB = $DIC->database();
237 $query =
"SELECT DISTINCT(excm.usr_id) ud" .
238 " FROM exc_members excm" .
239 " JOIN object_data od ON (od.obj_id = excm.usr_id)" .
240 " WHERE excm.obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
241 " AND od.type = " .
$ilDB->quote(
"usr",
"text");
245 while ($row =
$ilDB->fetchObject(
$res)) {
246 $usr_ids[] = $row->ud;
262 public static function _lookupStatus(
int $a_obj_id,
int $a_user_id): ?string
266 $ilDB = $DIC->database();
268 $query =
"SELECT status FROM exc_members " .
269 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
270 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer");
274 return $row[
"status"];
293 $ilDB = $DIC->database();
296 "UPDATE exc_members SET " .
297 " status = " .
$ilDB->quote($a_status,
"text") .
298 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
299 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
320 $ilDB = $DIC->database();
323 "UPDATE exc_members SET " .
324 " returned = " .
$ilDB->quote($a_status,
"integer") .
325 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
326 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
345 $ilDB = $DIC->database();
347 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members " .
348 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
353 while ($row =
$ilDB->fetchObject(
$res)) {
354 $usr_ids[] = $row->ud;
363 public static function _hasReturned(
int $a_obj_id,
int $a_user_id): bool
367 $ilDB = $DIC->database();
370 "SELECT DISTINCT(usr_id) FROM exc_members WHERE " .
371 " obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" AND " .
372 " returned = " .
$ilDB->quote(1,
"integer") .
" AND " .
373 " usr_id = " .
$ilDB->quote($a_user_id,
"integer")
375 return (
bool)
$ilDB->fetchAssoc($set);
385 $ilDB = $DIC->database();
387 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
388 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
389 "AND status = " .
$ilDB->quote(
"passed",
"text");
392 while ($row =
$ilDB->fetchObject(
$res)) {
393 $usr_ids[] = $row->usr_id;
405 $ilDB = $DIC->database();
407 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
408 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
409 "AND status = " .
$ilDB->quote(
"failed",
"text");
412 while ($row =
$ilDB->fetchObject(
$res)) {
413 $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?
static createNewUserRecords(int $a_user_id, int $a_exc_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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) ...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__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)
Deletes already delivered files.
static _lookupType(int $id, bool $reference=false)
deassignMember(int $a_usr_id)
Detaches a user from an exercise.
IndividualDeadlineManager $individual_deadlines
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)