ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilExerciseMembers Class Reference

Class ilExerciseMembers. More...

+ Collaboration diagram for ilExerciseMembers:

Public Member Functions

 ilExerciseMembers ($a_exc)
 getRefId ()
 Get exercise ref id.
 getObjId ()
 Get exercise id.
 setObjId ($a_obj_id)
 Set exercise id.
 getMembers ()
 Get members array.
 setMembers ($a_members)
 Set members array.
 assignMember ($a_usr_id)
 Assign a user to the exercise.
 isAssigned ($a_id)
 Is user assigned to exercise?
 assignMembers ($a_members)
 Assign members to exercise.
 deassignMember ($a_usr_id)
 Detaches a user from an exercise.
 deassignMembers ($a_members)
 Deassign members.
 read ()
 Read all members.
 ilClone ($a_new_id)
 delete ()
 _getMembers ($a_obj_id)
 _getReturned ($a_obj_id)
 Get returned status for all members (if they have anything returned for any assignment)
 _hasReturned ($a_obj_id, $a_user_id)
 Has user returned anything in any assignment?
 _getPassedUsers ($a_obj_id)
 Get all users that passed the exercise.
 _getFailedUsers ($a_obj_id)
 Get all users that failed the exercise.
 _lookupStatus ($a_obj_id, $a_user_id)
 Lookup current status (notgraded|passed|failed)
 _writeStatus ($a_obj_id, $a_user_id, $a_status)
 Write user status.
 _writeReturned ($a_obj_id, $a_user_id, $a_status)
 Write returned status.

Data Fields

 $ref_id
 $obj_id
 $members
 $status

Detailed Description

Class ilExerciseMembers.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilExerciseMembers.php 58439 2015-03-16 11:37:53Z gitmgr

Definition at line 12 of file class.ilExerciseMembers.php.

Member Function Documentation

ilExerciseMembers::_getFailedUsers (   $a_obj_id)

Get all users that failed the exercise.

Definition at line 354 of file class.ilExerciseMembers.php.

References $ilDB, $query, $res, and $row.

Referenced by ilLPStatusExerciseReturned\_getFailed().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")." ".
"AND status = ".$ilDB->quote("failed", "text");
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$usr_ids[] = $row->usr_id;
}
return $usr_ids ? $usr_ids : array();
}

+ Here is the caller graph for this function:

ilExerciseMembers::_getMembers (   $a_obj_id)

Definition at line 268 of file class.ilExerciseMembers.php.

References $ilDB, $query, $res, and $row.

Referenced by ilLPStatusExerciseReturned\getMembers(), ilExerciseXMLWriter\handleAssignmentMembers(), ilExAssignment\sendFeedbackNotifications(), and ilExAssignment\validatePeerReviewGroups().

{
global $ilDB;
// #14963 - see ilExAssignment::getMemberListData()
$query = "SELECT DISTINCT(excm.usr_id) ud".
" FROM exc_members excm".
" JOIN object_data od ON (od.obj_id = excm.usr_id)".
" WHERE excm.obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND od.type = ".$ilDB->quote("usr", "text");
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$usr_ids[] = $row->ud;
}
return $usr_ids ? $usr_ids : array();
}

+ Here is the caller graph for this function:

ilExerciseMembers::_getPassedUsers (   $a_obj_id)

Get all users that passed the exercise.

Definition at line 336 of file class.ilExerciseMembers.php.

References $ilDB, $query, $res, and $row.

Referenced by ilLPStatusExerciseReturned\_getCompleted().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")." ".
"AND status = ".$ilDB->quote("passed", "text");
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$usr_ids[] = $row->usr_id;
}
return $usr_ids ? $usr_ids : array();
}

+ Here is the caller graph for this function:

ilExerciseMembers::_getReturned (   $a_obj_id)

Get returned status for all members (if they have anything returned for any assignment)

Definition at line 293 of file class.ilExerciseMembers.php.

References $ilDB, $query, $res, and $row.

Referenced by ilLPStatusExerciseReturned\_getInProgress().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) as ud FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")." ".
"AND returned = 1";
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$usr_ids[] = $row->ud;
}
return $usr_ids ? $usr_ids : array();
}

+ Here is the caller graph for this function:

ilExerciseMembers::_hasReturned (   $a_obj_id,
  $a_user_id 
)

Has user returned anything in any assignment?

Parameters
integerobject id
integeruser id
Returns
boolean true/false

Definition at line 317 of file class.ilExerciseMembers.php.

References $ilDB.

Referenced by ilLPStatusExerciseReturned\determineStatus().

{
global $ilDB;
$set = $ilDB->query("SELECT DISTINCT(usr_id) FROM exc_members WHERE ".
" obj_id = ".$ilDB->quote($a_obj_id, "integer")." AND ".
" returned = ".$ilDB->quote(1, "integer")." AND ".
" usr_id = ".$ilDB->quote($a_user_id, "integer")
);
if ($rec = $ilDB->fetchAssoc($set))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilExerciseMembers::_lookupStatus (   $a_obj_id,
  $a_user_id 
)

Lookup current status (notgraded|passed|failed)

This information is determined by the assignment status and saved redundtantly in this table for performance reasons.

Parameters
int$a_obj_idexercise id
int$a_user_idmember id
Returns
mixed false (if user is no member) or notgraded|passed|failed

Definition at line 379 of file class.ilExerciseMembers.php.

References $ilDB, $query, $res, and $row.

Referenced by ilObjExerciseAccess\checkCondition(), ilObjExercise\exportGradesExcel(), ilExGradesTableGUI\fillRow(), ilExerciseCertificateAdapter\getCertificateVariablesForPresentation(), and ilObjExercise\hasUserCertificate().

{
global $ilDB;
$query = "SELECT status FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer");
$res = $ilDB->query($query);
if($row = $ilDB->fetchAssoc($res))
{
return $row["status"];
}
return false;
}

+ Here is the caller graph for this function:

ilExerciseMembers::_writeReturned (   $a_obj_id,
  $a_user_id,
  $a_status 
)

Write returned status.

The returned status is initially 0. If the first file is returned by a user for any assignment of the exercise, the returned status is set to 1 and it will stay that way, even if this file is deleted again. -> learning progress uses this to determine "in progress" status

Parameters
intexercise id
intuser id
textstatus

Definition at line 433 of file class.ilExerciseMembers.php.

References $ilDB, and ilLPStatusWrapper\_updateStatus().

Referenced by ilObjExercise\addResourceObject(), ilObjExerciseGUI\addTeamMemberActionObject(), ilObjExercise\deliverFile(), ilObjExercise\processUploadedFile(), and ilObjExerciseGUI\removeTeamMemberObject().

{
global $ilDB;
$ilDB->manipulate("UPDATE exc_members SET ".
" returned = ".$ilDB->quote($a_status, "text").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer")
);
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::_writeStatus (   $a_obj_id,
  $a_user_id,
  $a_status 
)

Write user status.

This information is determined by the assignment status and saved redundtantly in this table for performance reasons. See ilObjExercise->updateUserStatus().

Parameters
intexercise id
intuser id
textstatus

Definition at line 407 of file class.ilExerciseMembers.php.

References $ilDB, and ilLPStatusWrapper\_updateStatus().

Referenced by ilObjExercise\updateUserStatus().

{
global $ilDB;
$ilDB->manipulate("UPDATE exc_members SET ".
" status = ".$ilDB->quote($a_status, "text").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer")
);
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_updateStatus($a_obj_id, $a_user_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::assignMember (   $a_usr_id)

Assign a user to the exercise.

Parameters
int$a_usr_iduser id

Definition at line 76 of file class.ilExerciseMembers.php.

References $ilDB, ilLPStatusWrapper\_updateStatus(), ilExAssignment\createNewUserRecords(), ilObjectFactory\getInstanceByObjId(), getObjId(), getRefId(), and read().

Referenced by assignMembers().

{
global $ilDB;
if($this->exc->hasAddToDesktop())
{
$tmp_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
$tmp_user->addDesktopItem($this->getRefId(),"exc");
}
$ilDB->manipulate("DELETE FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId(), "integer")." ".
"AND usr_id = ".$ilDB->quote($a_usr_id, "integer")." ");
// @todo: some of this fields may not be needed anymore
$ilDB->manipulateF("INSERT INTO exc_members (obj_id, usr_id, status, sent, feedback) ".
" VALUES (%s,%s,%s,%s,%s)",
array("integer", "integer", "text", "integer", "integer"),
array($this->getObjId(), $a_usr_id, 'notgraded', 0, 0));
include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
$this->read();
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::assignMembers (   $a_members)

Assign members to exercise.

Definition at line 118 of file class.ilExerciseMembers.php.

References assignMember(), and isAssigned().

{
$assigned = 0;
if(is_array($a_members))
{
foreach($a_members as $member)
{
if(!$this->isAssigned($member))
{
$this->assignMember($member);
}
else
{
++$assigned;
}
}
}
if($assigned == count($a_members))
{
return false;
}
else
{
return true;
}
}

+ Here is the call graph for this function:

ilExerciseMembers::deassignMember (   $a_usr_id)

Detaches a user from an exercise.

Parameters
int$a_usr_iduser id

Definition at line 150 of file class.ilExerciseMembers.php.

References $ilDB, $query, ilLPStatusWrapper\_updateStatus(), ilObjectFactory\getInstanceByObjId(), getObjId(), getRefId(), and read().

Referenced by deassignMembers().

{
global $ilDB;
$tmp_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
$tmp_user->dropDesktopItem($this->getRefId(),"exc");
$query = "DELETE FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId(), "integer")." ".
"AND usr_id = ".$ilDB->quote($a_usr_id, "integer")." ";
$ilDB->manipulate($query);
$this->read();
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
// delete all delivered files of the member
$this->exc->deleteAllDeliveredFilesOfUser($a_usr_id);
// @todo: delete all assignment associations (and their files)
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::deassignMembers (   $a_members)

Deassign members.

Definition at line 179 of file class.ilExerciseMembers.php.

References deassignMember().

{
if(is_array($a_members))
{
foreach($a_members as $member)
{
$this->deassignMember($member);
}
}
else
{
return false;
}
}

+ Here is the call graph for this function:

ilExerciseMembers::delete ( )

Definition at line 254 of file class.ilExerciseMembers.php.

References $ilDB, $query, ilLPStatusWrapper\_refreshStatus(), and getObjId().

{
global $ilDB;
$query = "DELETE FROM exc_members WHERE obj_id = ".
$ilDB->quote($this->getObjId(), "integer");
$ilDB->manipulate($query);
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::getMembers ( )

Get members array.

Definition at line 58 of file class.ilExerciseMembers.php.

Referenced by isAssigned().

{
return $this->members ? $this->members : array();
}

+ Here is the caller graph for this function:

ilExerciseMembers::getObjId ( )

Get exercise id.

Definition at line 42 of file class.ilExerciseMembers.php.

References $obj_id.

Referenced by assignMember(), deassignMember(), delete(), ilClone(), and read().

{
return $this->obj_id;
}

+ Here is the caller graph for this function:

ilExerciseMembers::getRefId ( )

Get exercise ref id.

Definition at line 34 of file class.ilExerciseMembers.php.

References $ref_id.

Referenced by assignMember(), and deassignMember().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilExerciseMembers::ilClone (   $a_new_id)

Definition at line 217 of file class.ilExerciseMembers.php.

References $ilDB, $query, $res, $row, ilLPStatusWrapper\_updateStatus(), and getObjId().

{
global $ilDB;
$data = array();
$query = "SELECT * FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId(), "integer");
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$data[] = array("usr_id" => $row->usr_id,
"notice" => $row->notice,
"returned" => $row->returned,
"status" => $row->status,
"sent" => $row->sent,
"feedback" => $row->feedback
);
}
foreach($data as $row)
{
$ilDB->manipulateF("INSERT INTO exc_members ".
" (obj_id, usr_id, notice, returned, status, feedback, sent) VALUES ".
" (%s,%s,%s,%s,%s,%s,%s)",
array ("integer", "integer", "text", "integer", "text", "integer", "integer"),
array ($a_new_id, $row["usr_id"], $row["notice"], (int) $row["returned"],
$row["status"], (int) $row["feedback"], (int) $row["sent"])
);
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_updateStatus($a_new_id, $row["usr_id"]);
}
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::ilExerciseMembers (   $a_exc)

Definition at line 23 of file class.ilExerciseMembers.php.

References read().

{
$this->exc = $a_exc;
$this->obj_id = $a_exc->getId();
$this->ref_id = $a_exc->getRefId();
$this->read();
}

+ Here is the call graph for this function:

ilExerciseMembers::isAssigned (   $a_id)

Is user assigned to exercise?

Definition at line 110 of file class.ilExerciseMembers.php.

References getMembers().

Referenced by assignMembers().

{
return in_array($a_id,$this->getMembers());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::read ( )

Read all members.

Definition at line 197 of file class.ilExerciseMembers.php.

References $ilDB, $query, $res, $row, getObjId(), and setMembers().

Referenced by assignMember(), deassignMember(), and ilExerciseMembers().

{
global $ilDB;
$tmp_arr_members = array();
$query = "SELECT * FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId(), "integer");
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$tmp_arr_members[] = $row->usr_id;
}
$this->setMembers($tmp_arr_members);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::setMembers (   $a_members)

Set members array.

Definition at line 66 of file class.ilExerciseMembers.php.

Referenced by read().

{
$this->members = $a_members;
}

+ Here is the caller graph for this function:

ilExerciseMembers::setObjId (   $a_obj_id)

Set exercise id.

Definition at line 50 of file class.ilExerciseMembers.php.

{
$this->obj_id = $a_obj_id;
}

Field Documentation

ilExerciseMembers::$members

Definition at line 16 of file class.ilExerciseMembers.php.

ilExerciseMembers::$obj_id

Definition at line 15 of file class.ilExerciseMembers.php.

Referenced by getObjId().

ilExerciseMembers::$ref_id

Definition at line 14 of file class.ilExerciseMembers.php.

Referenced by getRefId().

ilExerciseMembers::$status

Definition at line 17 of file class.ilExerciseMembers.php.


The documentation for this class was generated from the following file: