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");
199 if(is_array($a_members))
201 foreach($a_members as $member)
219 $tmp_arr_members = array();
221 $query =
"SELECT * FROM exc_members ".
222 "WHERE obj_id = ".$ilDB->quote($this->
getObjId(),
"integer");
225 while(
$row = $ilDB->fetchObject(
$res))
227 $tmp_arr_members[] =
$row->usr_id;
241 $query =
"SELECT * FROM exc_members ".
242 "WHERE obj_id = ".$ilDB->quote($this->
getObjId(),
"integer");
245 while(
$row = $ilDB->fetchObject(
$res))
247 $data[] = array(
"usr_id" =>
$row->usr_id,
248 "notice" =>
$row->notice,
249 "returned" =>
$row->returned,
250 "status" =>
$row->status,
251 "sent" =>
$row->sent,
252 "feedback" =>
$row->feedback
257 $ilDB->manipulateF(
"INSERT INTO exc_members ".
258 " (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES ".
259 " (%s,%s,%s,%s,%s,%s,%s)",
260 array (
"integer",
"integer",
"text",
"integer",
"text",
"integer",
"integer"),
261 array ($a_new_id, $row[
"usr_id"], $row[
"notice"], (
int) $row[
"returned"],
262 $row[
"status"], (
int) $row[
"feedback"], (
int) $row[
"sent"])
265 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
276 $query =
"DELETE FROM exc_members WHERE obj_id = ".
277 $ilDB->quote($this->
getObjId(),
"integer");
278 $ilDB->manipulate(
$query);
280 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
290 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members ".
291 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
294 while(
$row = $ilDB->fetchObject(
$res))
296 $usr_ids[] =
$row->ud;
299 return $usr_ids ? $usr_ids : array();
311 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members ".
312 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
316 while(
$row = $ilDB->fetchObject(
$res))
318 $usr_ids[] =
$row->ud;
321 return $usr_ids ? $usr_ids : array();
335 $set = $ilDB->query(
"SELECT DISTINCT(usr_id) FROM exc_members WHERE ".
336 " obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" AND ".
337 " returned = ".$ilDB->quote(1,
"integer").
" AND ".
338 " usr_id = ".$ilDB->quote($a_user_id,
"integer")
340 if ($rec = $ilDB->fetchAssoc($set))
354 $query =
"SELECT DISTINCT(usr_id) FROM exc_members ".
355 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
356 "AND status = ".$ilDB->quote(
"passed",
"text");
358 while(
$row = $ilDB->fetchObject(
$res))
360 $usr_ids[] =
$row->usr_id;
362 return $usr_ids ? $usr_ids : array();
372 $query =
"SELECT DISTINCT(usr_id) FROM exc_members ".
373 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" ".
374 "AND status = ".$ilDB->quote(
"failed",
"text");
376 while(
$row = $ilDB->fetchObject(
$res))
378 $usr_ids[] =
$row->usr_id;
380 return $usr_ids ? $usr_ids : array();
397 $query =
"SELECT status FROM exc_members ".
398 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
399 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer");
404 return $row[
"status"];
425 $ilDB->manipulate(
"UPDATE exc_members SET ".
426 " status = ".$ilDB->quote($a_status,
"text").
427 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
428 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer")
431 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
451 $ilDB->manipulate(
"UPDATE exc_members SET ".
452 " returned = ".$ilDB->quote($a_status,
"text").
453 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer").
454 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer")
457 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");