32 $this->db = $DIC->database();
34 $this->obj_id = $a_exc->getId();
35 $this->ref_id = $a_exc->getRefId();
60 $this->obj_id = $a_obj_id;
68 return $this->members ? $this->members : array();
76 $this->members = $a_members;
88 if ($this->exc->hasAddToDesktop()) {
90 $tmp_user->addDesktopItem($this->
getRefId(),
"exc");
93 $ilDB->manipulate(
"DELETE FROM exc_members " .
94 "WHERE obj_id = " .
$ilDB->quote($this->getObjId(),
"integer") .
" " .
95 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ");
99 "INSERT INTO exc_members (obj_id, usr_id, status, sent, feedback) " .
100 " VALUES (%s,%s,%s,%s,%s)",
101 array(
"integer",
"integer",
"text",
"integer",
"integer"),
102 array($this->
getObjId(), $a_usr_id,
'notgraded', 0, 0)
105 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
110 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
130 if (is_array($a_members)) {
131 foreach ($a_members as $member) {
139 if ($assigned == count($a_members)) {
156 $tmp_user->dropDesktopItem($this->
getRefId(),
"exc");
158 $query =
"DELETE FROM exc_members " .
159 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer") .
" " .
160 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ";
166 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
170 include_once(
"./Modules/Exercise/classes/class.ilExSubmission.php");
183 if (is_array($a_members)) {
184 foreach ($a_members as $member) {
199 $tmp_arr_members = array();
201 $query =
"SELECT * FROM exc_members " .
202 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
207 $tmp_arr_members[] =
$row->usr_id;
222 $query =
"SELECT * FROM exc_members " .
223 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
227 $data[] = array(
"usr_id" =>
$row->usr_id,
228 "notice" =>
$row->notice,
229 "returned" =>
$row->returned,
230 "status" =>
$row->status,
231 "sent" =>
$row->sent,
232 "feedback" =>
$row->feedback
237 "INSERT INTO exc_members " .
238 " (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES " .
239 " (%s,%s,%s,%s,%s,%s,%s)",
240 array(
"integer",
"integer",
"text",
"integer",
"text",
"integer",
"integer"),
241 array($a_new_id, $row[
"usr_id"], $row[
"notice"], (
int) $row[
"returned"],
242 $row[
"status"], (
int) $row[
"feedback"], (
int) $row[
"sent"])
245 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
252 public function delete()
256 $query =
"DELETE FROM exc_members WHERE obj_id = " .
260 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
270 $ilDB = $DIC->database();
273 $query =
"SELECT DISTINCT(excm.usr_id) ud" .
274 " FROM exc_members excm" .
275 " JOIN object_data od ON (od.obj_id = excm.usr_id)" .
276 " WHERE excm.obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
277 " AND od.type = " .
$ilDB->quote(
"usr",
"text");
281 $usr_ids[] =
$row->ud;
284 return $usr_ids ? $usr_ids : array();
301 $ilDB = $DIC->database();
303 $query =
"SELECT status FROM exc_members " .
304 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
305 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer");
309 return $row[
"status"];
330 $ilDB = $DIC->database();
333 "UPDATE exc_members SET " .
334 " status = " .
$ilDB->quote($a_status,
"text") .
335 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
336 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
339 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
359 $ilDB = $DIC->database();
362 "UPDATE exc_members SET " .
363 " returned = " .
$ilDB->quote($a_status,
"integer") .
364 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
365 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
368 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
385 $ilDB = $DIC->database();
387 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members " .
388 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
393 $usr_ids[] =
$row->ud;
396 return $usr_ids ? $usr_ids : array();
410 $ilDB = $DIC->database();
413 "SELECT DISTINCT(usr_id) FROM exc_members WHERE " .
414 " obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" AND " .
415 " returned = " .
$ilDB->quote(1,
"integer") .
" AND " .
416 " usr_id = " .
$ilDB->quote($a_user_id,
"integer")
418 if ($rec =
$ilDB->fetchAssoc($set)) {
431 $ilDB = $DIC->database();
433 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
434 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
435 "AND status = " .
$ilDB->quote(
"passed",
"text");
438 $usr_ids[] =
$row->usr_id;
440 return $usr_ids ? $usr_ids : array();
450 $ilDB = $DIC->database();
452 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
453 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
454 "AND status = " .
$ilDB->quote(
"failed",
"text");
457 $usr_ids[] =
$row->usr_id;
459 return $usr_ids ? $usr_ids : array();
static deleteUser($a_exc_id, $a_user_id)
Delete all delivered files of user.
getMembers()
Get members array.
getRefId()
Get exercise ref id.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _getReturned($a_obj_id)
Get returned status for all members (if they have anything returned for any assignment) ...
getObjId()
Get exercise id.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static _writeStatus($a_obj_id, $a_user_id, $a_status)
Write user status.
static _writeReturned($a_obj_id, $a_user_id, $a_status)
Write returned status.
static _hasReturned($a_obj_id, $a_user_id)
Has user returned anything in any assignment?
foreach($_POST as $key=> $value) $res
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current status (notgraded|passed|failed)
static _getFailedUsers($a_obj_id)
Get all users that failed the exercise.
setObjId($a_obj_id)
Set exercise id.
deassignMember($a_usr_id)
Detaches a user from an exercise.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
deassignMembers($a_members)
Deassign members.
assignMembers($a_members)
Assign members to exercise.
static _getPassedUsers($a_obj_id)
Get all users that passed the exercise.
static createNewUserRecords($a_user_id, $a_exc_id)
Create member status record for a new participant for all assignments.
setMembers($a_members)
Set members array.
static _getMembers($a_obj_id)
isAssigned($a_id)
Is user assigned to exercise?
assignMember($a_usr_id)
Assign a user to the exercise.