36 $this->db = $DIC->database();
38 $this->obj_id = $a_exc->getId();
39 $this->ref_id = $a_exc->getRefId();
66 $this->obj_id = $a_obj_id;
74 return $this->members ? $this->members : array();
82 $this->members = $a_members;
98 $ilDB->manipulate(
"DELETE FROM exc_members " .
99 "WHERE obj_id = " .
$ilDB->quote($this->getObjId(),
"integer") .
" " .
100 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ");
104 "INSERT INTO exc_members (obj_id, usr_id, status, sent, feedback) " .
105 " VALUES (%s,%s,%s,%s,%s)",
106 array(
"integer",
"integer",
"text",
"integer",
"integer"),
107 array($this->
getObjId(), $a_usr_id,
'notgraded', 0, 0)
133 if (is_array($a_members)) {
134 foreach ($a_members as $member) {
142 if ($assigned == count($a_members)) {
158 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->
getRefId());
160 $query =
"DELETE FROM exc_members " .
161 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer") .
" " .
162 "AND usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" ";
189 if (is_array($a_members)) {
190 foreach ($a_members as $member) {
205 $tmp_arr_members = array();
207 $query =
"SELECT * FROM exc_members " .
208 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
211 while ($row =
$ilDB->fetchObject(
$res)) {
213 $tmp_arr_members[] = $row->usr_id;
228 $query =
"SELECT * FROM exc_members " .
229 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
"integer");
232 while ($row =
$ilDB->fetchObject(
$res)) {
233 $data[] = array(
"usr_id" => $row->usr_id,
234 "notice" => $row->notice,
235 "returned" => $row->returned,
236 "status" => $row->status,
237 "sent" => $row->sent,
238 "feedback" => $row->feedback
241 foreach (
$data as $row) {
243 "INSERT INTO exc_members " .
244 " (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES " .
245 " (%s,%s,%s,%s,%s,%s,%s)",
246 array(
"integer",
"integer",
"text",
"integer",
"text",
"integer",
"integer"),
247 array($a_new_id, $row[
"usr_id"], $row[
"notice"], (
int) $row[
"returned"],
248 $row[
"status"], (
int) $row[
"feedback"], (
int) $row[
"sent"])
257 public function delete()
261 $query =
"DELETE FROM exc_members WHERE obj_id = " .
274 $ilDB = $DIC->database();
277 $query =
"SELECT DISTINCT(excm.usr_id) ud" .
278 " FROM exc_members excm" .
279 " JOIN object_data od ON (od.obj_id = excm.usr_id)" .
280 " WHERE excm.obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
281 " AND od.type = " .
$ilDB->quote(
"usr",
"text");
284 while ($row =
$ilDB->fetchObject(
$res)) {
285 $usr_ids[] = $row->ud;
288 return $usr_ids ? $usr_ids : array();
305 $ilDB = $DIC->database();
307 $query =
"SELECT status FROM exc_members " .
308 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
309 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer");
313 return $row[
"status"];
334 $ilDB = $DIC->database();
337 "UPDATE exc_members SET " .
338 " status = " .
$ilDB->quote($a_status,
"text") .
339 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
340 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
362 $ilDB = $DIC->database();
365 "UPDATE exc_members SET " .
366 " returned = " .
$ilDB->quote($a_status,
"integer") .
367 " WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
368 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer")
387 $ilDB = $DIC->database();
389 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_members " .
390 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
394 while ($row =
$ilDB->fetchObject(
$res)) {
395 $usr_ids[] = $row->ud;
398 return $usr_ids ? $usr_ids : array();
412 $ilDB = $DIC->database();
415 "SELECT DISTINCT(usr_id) FROM exc_members WHERE " .
416 " obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" AND " .
417 " returned = " .
$ilDB->quote(1,
"integer") .
" AND " .
418 " usr_id = " .
$ilDB->quote($a_user_id,
"integer")
420 if ($rec =
$ilDB->fetchAssoc($set)) {
433 $ilDB = $DIC->database();
435 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
436 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
437 "AND status = " .
$ilDB->quote(
"passed",
"text");
439 while ($row =
$ilDB->fetchObject(
$res)) {
440 $usr_ids[] = $row->usr_id;
442 return $usr_ids ? $usr_ids : array();
452 $ilDB = $DIC->database();
454 $query =
"SELECT DISTINCT(usr_id) FROM exc_members " .
455 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
"integer") .
" " .
456 "AND status = " .
$ilDB->quote(
"failed",
"text");
458 while ($row =
$ilDB->fetchObject(
$res)) {
459 $usr_ids[] = $row->usr_id;
461 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.
static getInstance($a_ass_id, $a_participant_id, $a_is_team=false)
Get instance.
static getInstancesByExercise($a_exc_id)
setObjId($a_obj_id)
Set exercise id.
deassignMember($a_usr_id)
Detaches a user from an exercise.
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.
$recommended_content_manager
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.
Recommended content manager (business logic)
static _getMembers($a_obj_id)
isAssigned($a_id)
Is user assigned to exercise?
assignMember($a_usr_id)
Assign a user to the exercise.