26 $this->obj_id = $a_exc->getId();
27 $this->ref_id = $a_exc->getRefId();
52 $this->obj_id = $a_obj_id;
60 return $this->members ? $this->members : array();
68 $this->members = $a_members;
81 $tmp_user->addDesktopItem($this->
getRefId(),
"exc");
83 $ilDB->manipulate(
"DELETE FROM exc_members ".
84 "WHERE obj_id = ".$ilDB->quote($this->getObjId(),
"integer").
" ".
85 "AND usr_id = ".$ilDB->quote($a_usr_id,
"integer").
" ");
88 $ilDB->manipulateF(
"INSERT INTO exc_members (obj_id, usr_id, status, sent, feedback) ".
89 " VALUES (%s,%s,%s,%s,%s)",
90 array(
"integer",
"integer",
"text",
"integer",
"integer"),
91 array($this->
getObjId(), $a_usr_id,
'notgraded', 0, 0));
93 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
98 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
118 if(is_array($a_members))
120 foreach($a_members as $member)
132 if($assigned == count($a_members))
152 $tmp_user->dropDesktopItem($this->
getRefId(),
"exc");
154 $query =
"DELETE FROM exc_members ".
155 "WHERE obj_id = ".$ilDB->quote($this->
getObjId(),
"integer").
" ".
156 "AND usr_id = ".$ilDB->quote($a_usr_id,
"integer").
" ";
158 $ilDB->manipulate(
$query);
162 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
166 $this->exc->deleteAllDeliveredFilesOfUser($a_usr_id);
178 if(is_array($a_members))
180 foreach($a_members as $member)
198 $tmp_arr_members = array();
200 $query =
"SELECT * FROM exc_members ".
201 "WHERE obj_id = ".$ilDB->quote($this->
getObjId(),
"integer");
204 while(
$row = $ilDB->fetchObject(
$res))
206 $tmp_arr_members[] =
$row->usr_id;
220 $query =
"SELECT * FROM exc_members ".
221 "WHERE obj_id = ".$ilDB->quote($this->
getObjId(),
"integer");
224 while(
$row = $ilDB->fetchObject(
$res))
226 $data[] = array(
"usr_id" =>
$row->usr_id,
227 "notice" =>
$row->notice,
228 "returned" =>
$row->returned,
229 "status" =>
$row->status,
230 "sent" =>
$row->sent,
231 "feedback" =>
$row->feedback
234 foreach($data as
$row)
236 $ilDB->manipulateF(
"INSERT INTO exc_members ".
237 " (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES ".
238 " (%s,%s,%s,%s,%s,%s,%s)",
239 array (
"integer",
"integer",
"text",
"integer",
"text",
"integer",
"integer"),
240 array ($a_new_id, $row[
"usr_id"], $row[
"notice"], (
int) $row[
"returned"],
241 $row[
"status"], (
int) $row[
"feedback"], (
int) $row[
"sent"])
244 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
255 $query =
"DELETE FROM exc_members WHERE obj_id = ".
256 $ilDB->quote($this->
getObjId(),
"integer");
257 $ilDB->manipulate(
$query);
259 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
270 $query =
"SELECT DISTINCT(excm.usr_id) ud".
271 " FROM exc_members excm".
272 " JOIN object_data od ON (od.obj_id = excm.usr_id)".
273 " WHERE excm.obj_id = ".$ilDB->quote($a_obj_id,
"integer").
274 " AND od.type = ".$ilDB->quote(
"usr",
"text");
277 while(
$row = $ilDB->fetchObject(
$res))
279 $usr_ids[] =
$row->ud;
282 return $usr_ids ? $usr_ids : array();
294 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members ".
295 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
299 while(
$row = $ilDB->fetchObject(
$res))
301 $usr_ids[] =
$row->ud;
304 return $usr_ids ? $usr_ids : array();
318 $set = $ilDB->query(
"SELECT DISTINCT(usr_id) FROM exc_members WHERE ".
319 " obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" AND ".
320 " returned = ".$ilDB->quote(1,
"integer").
" AND ".
321 " usr_id = ".$ilDB->quote($a_user_id,
"integer")
323 if ($rec = $ilDB->fetchAssoc($set))
337 $query =
"SELECT DISTINCT(usr_id) FROM exc_members ".
338 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
339 "AND status = ".$ilDB->quote(
"passed",
"text");
341 while(
$row = $ilDB->fetchObject(
$res))
343 $usr_ids[] =
$row->usr_id;
345 return $usr_ids ? $usr_ids : array();
355 $query =
"SELECT DISTINCT(usr_id) FROM exc_members ".
356 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
357 "AND status = ".$ilDB->quote(
"failed",
"text");
359 while(
$row = $ilDB->fetchObject(
$res))
361 $usr_ids[] =
$row->usr_id;
363 return $usr_ids ? $usr_ids : array();
380 $query =
"SELECT status FROM exc_members ".
381 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
382 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer");
387 return $row[
"status"];
408 $ilDB->manipulate(
"UPDATE exc_members SET ".
409 " status = ".$ilDB->quote($a_status,
"text").
410 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
411 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer")
414 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
434 $ilDB->manipulate(
"UPDATE exc_members SET ".
435 " returned = ".$ilDB->quote($a_status,
"text").
436 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
437 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer")
440 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");