ILIAS  Release_4_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_obj_id, $a_ref_id)
 getRefId ()
 getObjId ()
 setObjId ($a_obj_id)
 getMembers ()
 setMembers ($a_members)
 assignMember ($a_usr_id)
 Assign a user to the exercise.
 isAssigned ($a_id)
 assignMembers ($a_members)
 deassignMember ($a_usr_id)
 Detaches a user from an exercise.
 deassignMembers ($a_members)
 setStatus ($a_status)
 getStatus ()
 getStatusByMember ($a_member_id)
 setStatusForMember ($a_member_id, $a_status)
 set status for member (notgraded|passed|failed)
 updateStatusTimeForMember ($a_member_id)
 Update status time (last change) for member.
 setStatusSent ($a_status)
 getStatusSent ()
 getStatusSentByMember ($a_member_id)
 setStatusSentForMember ($a_member_id, $a_status)
 getStatusReturned ()
 setStatusReturned ($a_status)
 getStatusReturnedByMember ($a_member_id)
 setStatusReturnedForMember ($a_member_id, $a_status)
 setStatusFeedback ($a_status)
 getStatusFeedback ()
 getStatusFeedbackByMember ($a_member_id)
 setStatusFeedbackForMember ($a_member_id, $a_status)
 getNotice ()
 setNotice ($a_notice)
 getNoticeByMember ($a_member_id)
 hasReturned ($a_member_id)
 getAllDeliveredFiles ()
 Get all delivered files.
 getDeliveredFiles ($a_member_id)
 Returns an array of all delivered files of an user.
 deleteDeliveredFiles ($file_id_array, $a_member_id)
 Deletes already delivered files.
 deliverReturnedFiles ($a_member_id, $a_only_new=false)
 Delivers the returned files of an user.
 updateTutorDownloadTime ($a_member_id)
 Update the timestamp of the last download of current user (=tutor) for member $a_member_id.
 downloadSelectedFiles ($array_file_id, $a_user_id)
 downloadSingleFile ($filename, $filetitle)
 downloadMultipleFiles ($array_filenames, $pathname, $a_member_id=0)
 setNoticeForMember ($a_member_id, $a_notice)
 read ()
 ilClone ($a_new_id)
 delete ()
 _getMembers ($a_obj_id)
 _getReturned ($a_obj_id)
 _getPassedUsers ($a_obj_id)
 _getFailedUsers ($a_obj_id)
 _lookupStatus ($a_obj_id, $a_user_id)
 lookup current status (notgraded|passed|failed)

Data Fields

 $ilias
 $ref_id
 $obj_id
 $members
 $status
 $status_feedback
 $status_sent
 $status_returned
 $notice

Detailed Description

Class ilExerciseMembers.

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilExerciseMembers.php 23824 2010-05-10 15:45:28Z akill

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

Member Function Documentation

ilExerciseMembers::_getFailedUsers (   $a_obj_id)

Definition at line 888 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 836 of file class.ilExerciseMembers.php.

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

Referenced by ilLPStatusExerciseReturned\_getNotAttempted().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) as ud FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
$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)

Definition at line 873 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)

Definition at line 852 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::_lookupStatus (   $a_obj_id,
  $a_user_id 
)

lookup current status (notgraded|passed|failed)

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 909 of file class.ilExerciseMembers.php.

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

Referenced by ilObjExercise\_checkCondition(), ilExerciseMemberTableGUI\fillRow(), and ilObjExerciseGUI\infoScreen().

{
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::assignMember (   $a_usr_id)

Assign a user to the exercise.

Parameters
int$a_usr_iduser id

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

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

Referenced by assignMembers().

{
global $ilDB;
$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")." ");
$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));
$this->read();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::assignMembers (   $a_members)

Definition at line 86 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 118 of file class.ilExerciseMembers.php.

References $dir, $ilDB, $key, $query, deleteDeliveredFiles(), getDeliveredFiles(), 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();
// delete all delivered files of the member
$delivered_files =& $this->getDeliveredFiles($a_usr_id);
$files_to_delete = array();
$userfile = "";
foreach ($delivered_files as $key => $value)
{
array_push($files_to_delete, $value["returned_id"]);
$userfile = $value["filename"];
}
$this->deleteDeliveredFiles($files_to_delete, $a_usr_id);
// delete the user directory if existing
if ($userfile)
{
$pathinfo = pathinfo($userfile);
$dir = $pathinfo["dirname"];
}
if (is_dir($dir))
{
rmdir($dir);
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::deassignMembers (   $a_members)

Definition at line 155 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 825 of file class.ilExerciseMembers.php.

References $ilDB, $query, and getObjId().

{
global $ilDB;
$query = "DELETE FROM exc_members WHERE obj_id = ".
$ilDB->quote($this->getObjId(), "integer");
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::deleteDeliveredFiles (   $file_id_array,
  $a_member_id 
)

Deletes already delivered files.

Parameters
array$file_id_arrayAn array containing database ids of the delivered files
numeric$a_member_idThe database id of the user public

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

References $ilDB, $key, $result, $row, and ilObjExercise\_fixFilename().

Referenced by deassignMember().

{
global $ilDB;
if (count($file_id_array))
{
$result = $ilDB->query("SELECT * FROM exc_returned WHERE user_id = ".
$ilDB->quote($a_member_id, "integer")." AND ".
$ilDB->in("returned_id", $file_id_array, false, "integer"));
//returned_id IN (".
//implode(ilUtil::quoteArray($file_id_array) ,",").")",
//$this->ilias->db->quote($a_member_id . "")
if ($ilDB->numRows($result))
{
$result_array = array();
while ($row = $ilDB->fetchAssoc($result))
{
$row["timestamp"] = $row["ts"];
array_push($result_array, $row);
}
// delete the entries in the database
$ilDB->manipulate("DELETE FROM exc_returned WHERE user_id = ".
$ilDB->quote($a_member_id, "integer")." AND ".
$ilDB->in("returned_id", $file_id_array, false, "integer"));
//returned_id IN ("
//.implode(ilUtil::quoteArray($file_id_array) ,",").")",
//$this->ilias->db->quote($a_member_id . "")
// delete the files
foreach ($result_array as $key => $value)
{
unlink(ilObjExercise::_fixFilename($value["filename"]));
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::deliverReturnedFiles (   $a_member_id,
  $a_only_new = false 
)

Delivers the returned files of an user.

Parameters
numeric$a_member_idThe database id of the user public

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

References $dir, $file, $filename, $ilDB, $q, $query, $result, $row, ilObjExercise\_fixFilename(), downloadMultipleFiles(), downloadSingleFile(), getObjId(), and updateTutorDownloadTime().

{
global $ilUser, $ilDB;
// get last download time
$and_str = "";
if ($a_only_new)
{
$q = "SELECT download_time FROM exc_usr_tutor WHERE ".
" obj_id = ".$ilDB->quote($this->getObjId(), "integer")." AND ".
" usr_id = ".$ilDB->quote($a_member_id, "integer")." AND ".
" tutor_id = ".$ilDB->quote($ilUser->getId(), "integer");
$lu_set = $ilDB->query($q);
if ($lu_rec = $ilDB->fetchAssoc($lu_set))
{
if ($lu_rec["download_time"] > 0)
{
$and_str = " AND ts > ".$ilDB->quote($lu_rec["download_time"], "timestamp");
}
}
}
$this->updateTutorDownloadTime($a_member_id);
$query = sprintf("SELECT * FROM exc_returned WHERE obj_id = %s AND user_id = %s".
$and_str,
$ilDB->quote($this->getObjId(), "integer"),
$ilDB->quote($a_member_id, "integer"));
$result = $ilDB->query($query);
$count = $ilDB->numRows($result);
if ($count == 1)
{
$row = $ilDB->fetchAssoc($result);
$this->downloadSingleFile(ilObjExercise::_fixFilename($row["filename"]), $row["filetitle"]);
}
else if ($count > 0)
{
$array_files = array();
$filename = "";
while ($row = $ilDB->fetchAssoc($result))
{
$pathinfo = pathinfo($filename);
$dir = $pathinfo["dirname"];
$file = $pathinfo["basename"];
array_push($array_files, $file);
}
$pathinfo = pathinfo($filename);
$dir = $pathinfo["dirname"];
$this->downloadMultipleFiles($array_files, $dir, $a_member_id);
}
else
{
return false;
}
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::downloadMultipleFiles (   $array_filenames,
  $pathname,
  $a_member_id = 0 
)

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

References $filename, $key, $lng, ilObjUser\_lookupName(), ilUtil\delDir(), ilUtil\deliverFile(), ilUtil\escapeShellArg(), getObjId(), ilUtil\ilTempnam(), and ilUtil\makeDir().

Referenced by deliverReturnedFiles(), and downloadSelectedFiles().

{
global $lng, $ilObjDataCache;
require_once "./Services/Utilities/classes/class.ilUtil.php";
$cdir = getcwd();
$zip = PATH_TO_ZIP;
$tmpdir = ilUtil::ilTempnam();
$tmpfile = ilUtil::ilTempnam();
$tmpzipfile = $tmpfile . ".zip";
ilUtil::makeDir($tmpdir);
chdir($tmpdir);
//copy all files to a temporary directory and remove them afterwards
foreach ($array_filenames as $key => $filename)
{
// remove timestamp
$newFilename = trim(basename($array_filenames[$key]));
$pos = strpos($newFilename , "_");
if ($pos === false)
{
} else
{
$newFilename= substr($newFilename, $pos + 1);
}
$newFilename = $tmpdir.DIRECTORY_SEPARATOR.$newFilename;
// copy to temporal directory
$oldFilename = $pathname.DIRECTORY_SEPARATOR.$array_filenames[$key];
if (!copy ($oldFilename, $newFilename))
{
echo 'Could not copy '.$oldFilename.' to '.$newFilename;
}
touch($newFilename, filectime($oldFilename));
$array_filenames[$key] = ilUtil::escapeShellArg(basename($newFilename)); //$array_filenames[$key]);
}
$zipcmd = $zip." ".ilUtil::escapeShellArg($tmpzipfile)." ".join($array_filenames, " ");
exec($zipcmd);
ilUtil::delDir($tmpdir);
$exerciseTitle = $ilObjDataCache->lookupTitle($this->getObjId());
$deliverFilename = $exerciseTitle;
if ($a_member_id > 0)
{
$userName = ilObjUser::_lookupName($a_member_id);
$deliverFilename .= "_".$userName["lastname"]."_".$userName["firstname"];
} else
{
$deliverFilename .= "_files";
}
$deliverFilename .= ".zip";
ilUtil::deliverFile($tmpzipfile, $deliverFilename);
chdir($cdir);
unlink($tmpzipfile);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::downloadSelectedFiles (   $array_file_id,
  $a_user_id 
)

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

References $dir, $file, $ilDB, $key, $result, $row, ilObjExercise\_fixFilename(), downloadMultipleFiles(), and downloadSingleFile().

{
global $ilDB;
if (count($array_file_id))
{
//$query = "SELECT * FROM exc_returned WHERE returned_id IN (".
// implode(ilUtil::quoteArray($array_file_id) ,",").")";
//$result = $this->ilias->db->query($query);
$result = $ilDB->query("SELECT * FROM exc_returned WHERE ".
$ilDB->in("returned_id", $array_file_id, false, "integer").
" AND user_id = ".$ilDB->quote($a_user_id));
if ($ilDB->numRows($result))
{
$array_found = array();
while ($row = $ilDB->fetchAssoc($result))
{
$row["timestamp"] = $row["ts"];
array_push($array_found, $row);
}
if (count($array_found) == 1)
{
$this->downloadSingleFile(ilObjExercise::_fixFilename($array_found[0]["filename"]), $array_found[0]["filetitle"]);
}
else
{
$filenames = array();
$dir = "";
$file = "";
foreach ($array_found as $key => $value)
{
$pathinfo = pathinfo(ilObjExercise::_fixFilename($value["filename"]));
$dir = $pathinfo["dirname"];
$file = $pathinfo["basename"];
array_push($filenames, $file);
}
$this->downloadMultipleFiles($filenames, $dir);
}
}
}
}

+ Here is the call graph for this function:

ilExerciseMembers::downloadSingleFile (   $filename,
  $filetitle 
)

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

References $filename, and ilUtil\deliverFile().

Referenced by deliverReturnedFiles(), and downloadSelectedFiles().

{
require_once "./Services/Utilities/classes/class.ilUtil.php";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::getAllDeliveredFiles ( )

Get all delivered files.

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

References $ilDB, $query, $res, $row, ilObjExercise\_fixFilenameArray(), and getObjId().

{
global $ilDB;
$query = "SELECT * FROM exc_returned WHERE obj_id = ".
$ilDB->quote($this->getObjId(), "integer");
$res = $ilDB->query($query);
while($row = $ilDB->fetchAssoc($res))
{
$row["timestamp"] = $row["ts"];
$delivered[] = $row;
}
$delivered = ilObjExercise::_fixFilenameArray($delivered);
return $delivered ? $delivered : array();
}

+ Here is the call graph for this function:

ilExerciseMembers::getDeliveredFiles (   $a_member_id)

Returns an array of all delivered files of an user.

Parameters
numeric$a_member_idThe user id public
Returns
array An array containing the information on the delivered files

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

References $ilDB, $result, $row, ilObjExercise\_fixFilenameArray(), and getObjId().

Referenced by deassignMember().

{
global $ilDB;
/*$query = sprintf("SELECT *, ts + 0 AS timestamp14 FROM exc_returned WHERE obj_id = %s AND user_id = %s ORDER BY timestamp14",
$this->ilias->db->quote($this->getObjId() . ""),
$this->ilias->db->quote($a_member_id . "")
);
$result = $this->ilias->db->query($query);*/
$result = $ilDB->queryF("SELECT * FROM exc_returned WHERE obj_id = %s AND user_id = %s ORDER BY ts",
array("integer", "integer"),
array($this->getObjId(),$a_member_id));
$delivered_files = array();
if ($ilDB->numRows($result))
{
while ($row = $ilDB->fetchAssoc($result))
{
$row["timestamp"] = $row["ts"];
$row["timestamp14"] = substr($row["ts"], 0, 4).
substr($row["ts"], 5, 2).substr($row["ts"], 8, 2).
substr($row["ts"], 11, 2).substr($row["ts"], 14, 2).
substr($row["ts"], 17, 2);
array_push($delivered_files, $row);
}
}
$delivered_files = ilObjExercise::_fixFilenameArray($delivered_files);
return $delivered_files;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::getMembers ( )

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

Referenced by isAssigned().

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

+ Here is the caller graph for this function:

ilExerciseMembers::getNotice ( )

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

{
return $this->notice ? $this->notice : array(0 => 0);
}
ilExerciseMembers::getNoticeByMember (   $a_member_id)

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

{
if(isset($this->notice[$a_member_id]))
{
return $this->notice[$a_member_id];
}
else
{
return "";
}
}
ilExerciseMembers::getRefId ( )

Definition at line 35 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::getStatus ( )

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

{
return $this->status ? $this->status : array();
}
ilExerciseMembers::getStatusByMember (   $a_member_id)

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

{
if(isset($this->status[$a_member_id]))
{
return $this->status[$a_member_id];
}
return false;
}
ilExerciseMembers::getStatusFeedback ( )

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

{
return $this->status_feedback ? $this->status_feedback : array(0 => 0);
}
ilExerciseMembers::getStatusFeedbackByMember (   $a_member_id)

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

{
if(isset($this->status_feedback[$a_member_id]))
{
return $this->status_feedback[$a_member_id];
}
return false;
}
ilExerciseMembers::getStatusReturned ( )

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

{
return $this->status_returned ? $this->status_returned : array(0 => 0);
}
ilExerciseMembers::getStatusReturnedByMember (   $a_member_id)

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

{
if(isset($this->status_returned[$a_member_id]))
{
return $this->status_returned[$a_member_id];
}
return false;
}
ilExerciseMembers::getStatusSent ( )

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

{
return $this->status_sent ? $this->status_sent : array(0 => 0);
}
ilExerciseMembers::getStatusSentByMember (   $a_member_id)

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

{
if(isset($this->status_sent[$a_member_id]))
{
return $this->status_sent[$a_member_id];
}
return false;
}
ilExerciseMembers::hasReturned (   $a_member_id)

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

References $ilDB, $result, and getObjId().

{
global $ilDB;
$result = $ilDB->queryF("SELECT returned_id FROM exc_returned WHERE obj_id = %s AND user_id = %s",
array("integer", "integer"),
array($this->getObjId(), $a_member_id));
return $ilDB->numRows($result);
}

+ Here is the call graph for this function:

ilExerciseMembers::ilClone (   $a_new_id)

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

References $data, $ilDB, $query, $res, $row, 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"])
);
/*"SET obj_id = ".$ilDB->quote($a_new_id).", ".
"usr_id = ".$ilDB->quote($row["usr_id"]).", ".
"notice = ".$ilDB->quote($row["notice"]).", ".
"returned = ".$ilDB->quote($row["returned"]).", ".
"status = ".$ilDB->quote($row["status"]).", ".
"feedback = ".$ilDB->quote($row["feedback"]).", ".
"sent = ".$ilDB->quote($row["sent"]);
$res = $this->ilias->db->query($query);*/
}
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::ilExerciseMembers (   $a_obj_id,
  $a_ref_id 
)

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

References $ilias.

{
global $ilias;
$this->ilias =& $ilias;
$this->obj_id = $a_obj_id;
$this->ref_id = $a_ref_id;
}
ilExerciseMembers::isAssigned (   $a_id)

Definition at line 81 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 ( )

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

References $ilDB, $query, $res, $row, getObjId(), setMembers(), setNotice(), setStatus(), setStatusFeedback(), setStatusReturned(), and setStatusSent().

Referenced by assignMember(), deassignMember(), setNoticeForMember(), setStatusFeedbackForMember(), setStatusForMember(), setStatusReturnedForMember(), setStatusSentForMember(), and updateStatusTimeForMember().

{
global $ilDB;
$tmp_arr_members = array();
$tmp_arr_status = array();
$tmp_arr_sent = array();
$tmp_arr_notice = array();
$tmp_arr_returned = array();
$tmp_arr_feedback = 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;
$tmp_arr_notice[$row->usr_id] = $row->notice;
$tmp_arr_returned[$row->usr_id] = $row->returned;
$tmp_arr_status[$row->usr_id] = $row->status;
$tmp_arr_sent[$row->usr_id] = $row->sent;
$tmp_arr_feedback[$row->usr_id] = $row->feedback;
}
$this->setMembers($tmp_arr_members);
$this->setNotice($tmp_arr_notice);
$this->setStatus($tmp_arr_status);
$this->setStatusSent($tmp_arr_sent);
$this->setStatusReturned($tmp_arr_returned);
$this->setStatusFeedback($tmp_arr_feedback);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExerciseMembers::setMembers (   $a_members)

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

Referenced by read().

{
$this->members = $a_members;
}

+ Here is the caller graph for this function:

ilExerciseMembers::setNotice (   $a_notice)

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

Referenced by read().

{
if(is_array($a_notice))
{
$this->notice = $a_notice;
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilExerciseMembers::setNoticeForMember (   $a_member_id,
  $a_notice 
)

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

References $ilDB, getObjId(), ilUtil\now(), and read().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_members ".
"SET notice = %s, status_time= %s ".
" WHERE obj_id = %s AND usr_id = %s AND ".
$ilDB->equalsNot("notice", $a_notice, "text", true),
array("text", "timestamp", "integer", "integer"),
array($a_notice, ilUtil::now(), $this->getObjId(), $a_member_id));
//echo "-".$ilDB->equalsNot("notice", $a_notice, "text", true)."-"; exit;
/*$query = "UPDATE exc_members ".
"SET notice = ".$ilDB->quote($a_notice)." ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
"AND usr_id = ".$ilDB->quote($a_member_id);
$this->ilias->db->query($query);*/
$this->read();
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::setObjId (   $a_obj_id)

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

{
$this->obj_id = $a_obj_id;
}
ilExerciseMembers::setStatus (   $a_status)

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

Referenced by read().

{
if(is_array($a_status))
{
$this->status = $a_status;
return true;
}
}

+ Here is the caller graph for this function:

ilExerciseMembers::setStatusFeedback (   $a_status)

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

Referenced by read().

{
if(is_array($a_status))
{
$this->status_feedback = $a_status;
return true;
}
}

+ Here is the caller graph for this function:

ilExerciseMembers::setStatusFeedbackForMember (   $a_member_id,
  $a_status 
)

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

References $ilDB, getObjId(), ilUtil\now(), and read().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_members ".
"SET feedback = %s, status_time= %s, feedback_time = %s ".
" WHERE obj_id = %s AND usr_id = %s",
array("integer", "timestamp", "timestamp", "integer", "integer"),
array((int) $a_status, ilUtil::now(), ($a_status ? ilUtil::now() : null),
$this->getObjId(), $a_member_id));
$this->read();
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::setStatusForMember (   $a_member_id,
  $a_status 
)

set status for member (notgraded|passed|failed)

Parameters
int$a_member_iduser id of member
string$a_status(notgraded|passed|failed)

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

References $ilDB, getObjId(), ilUtil\now(), and read().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_members ".
"SET status = %s, status_time= %s ".
" WHERE obj_id = %s AND usr_id = %s AND status <> %s ",
array("text", "timestamp", "integer", "integer", "text"),
array($a_status, ilUtil::now(), $this->getObjId(), $a_member_id, $a_status));
$this->read();
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::setStatusReturned (   $a_status)

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

Referenced by read().

{
if(is_array($a_status))
{
$this->status_returned = $a_status;
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilExerciseMembers::setStatusReturnedForMember (   $a_member_id,
  $a_status 
)

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

References $ilDB, getObjId(), ilUtil\now(), and read().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_members ".
"SET returned = %s, status_time= %s ".
" WHERE obj_id = %s AND usr_id = %s",
array("integer", "timestamp", "integer", "integer"),
array((int) $a_status, ilUtil::now(),
$this->getObjId(), $a_member_id));
/*$query = "UPDATE exc_members ".
"SET returned = ".$ilDB->quote(($a_status ? 1 : 0))." ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
"AND usr_id = ".$ilDB->quote($a_member_id)." ";
$this->ilias->db->query($query);*/
$this->read();
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::setStatusSent (   $a_status)

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

Referenced by read().

{
if(is_array($a_status))
{
$this->status_sent = $a_status;
return true;
}
}

+ Here is the caller graph for this function:

ilExerciseMembers::setStatusSentForMember (   $a_member_id,
  $a_status 
)

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

References $ilDB, getObjId(), ilUtil\now(), and read().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_members ".
"SET sent = %s, status_time= %s, sent_time = %s ".
" WHERE obj_id = %s AND usr_id = %s ",
array("integer", "timestamp", "timestamp", "integer", "integer"),
array((int) $a_status, ilUtil::now(), ($a_status ? ilUtil::now() : null),
$this->getObjId(), $a_member_id));
$this->read();
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::updateStatusTimeForMember (   $a_member_id)

Update status time (last change) for member.

Parameters
int$a_member_iduser id of member

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

References $ilDB, getObjId(), ilUtil\now(), and read().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_members ".
"SET status_time= %s ".
" WHERE obj_id = %s AND usr_id = %s ",
array("timestamp", "integer", "integer"),
array(ilUtil::now(), $this->getObjId(), $a_member_id));
$this->read();
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::updateTutorDownloadTime (   $a_member_id)

Update the timestamp of the last download of current user (=tutor) for member $a_member_id.

Parameters
int$a_member_idMember ID.

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

References $ilDB, getObjId(), and ilUtil\now().

Referenced by deliverReturnedFiles().

{
global $ilUser, $ilDB;
$ilDB->manipulateF("DELETE FROM exc_usr_tutor ".
"WHERE obj_id = %s AND usr_id = %s AND tutor_id = %s",
array("integer", "integer", "integer"),
array($this->getObjId(), $a_member_id, $ilUser->getId()));
$ilDB->manipulateF("INSERT INTO exc_usr_tutor (obj_id, usr_id, tutor_id, download_time) VALUES ".
"(%s, %s, %s, %s)",
array("integer", "integer", "integer", "timestamp"),
array($this->getObjId(), $a_member_id, $ilUser->getId(), ilUtil::now()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilExerciseMembers::$ilias

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

Referenced by ilExerciseMembers().

ilExerciseMembers::$members

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

ilExerciseMembers::$notice

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

ilExerciseMembers::$obj_id

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

Referenced by getObjId().

ilExerciseMembers::$ref_id

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

Referenced by getRefId().

ilExerciseMembers::$status

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

ilExerciseMembers::$status_feedback

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

ilExerciseMembers::$status_returned

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

ilExerciseMembers::$status_sent

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


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