ILIAS  Release_3_10_x_branch Revision 61812
 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 20455 2009-07-07 13:31:41Z smeyer

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

Member Function Documentation

ilExerciseMembers::_getFailedUsers (   $a_obj_id)

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

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilLPStatusExerciseReturned\_getFailed().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND status = 'failed'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$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 816 of file class.ilExerciseMembers.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilLPStatusExerciseReturned\_getNotAttempted().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) as ud FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$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 853 of file class.ilExerciseMembers.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilLPStatusExerciseReturned\_getCompleted().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND status = 'passed'";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$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 832 of file class.ilExerciseMembers.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilLPStatusExerciseReturned\_getInProgress().

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) as ud FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND returned = 1";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$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 889 of file class.ilExerciseMembers.php.

References $res, and DB_FETCHMODE_ASSOC.

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

{
global $ilDB;
$query = "SELECT status FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id).
"AND usr_id = ".$ilDB->quote($a_user_id);
$res = $ilDB->query($query);
if($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
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 82 of file class.ilExerciseMembers.php.

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

Referenced by assignMembers().

{
global $ilDB;
$tmp_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
$tmp_user->addDesktopItem($this->getRefId(),"exc");
$query = "REPLACE INTO exc_members ".
"SET obj_id = ".$ilDB->quote($this->getObjId()).", ".
"usr_id = ".$ilDB->quote($a_usr_id).", ".
"status = 'notgraded', sent = '0', feedback='0'";
$res = $this->ilias->db->query($query);
$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 105 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 137 of file class.ilExerciseMembers.php.

References $dir, 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())." ".
"AND usr_id = ".$ilDB->quote($a_usr_id)." ";
$this->ilias->db->query($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 173 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 806 of file class.ilExerciseMembers.php.

References getObjId().

{
global $ilDB;
$query = "DELETE FROM exc_members WHERE obj_id = ".$ilDB->quote($this->getObjId());
$this->ilias->db->query($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 457 of file class.ilExerciseMembers.php.

References $result, ilObjExercise\_fixFilename(), DB_FETCHMODE_ASSOC, and ilUtil\quoteArray().

Referenced by deassignMember().

{
global $ilDB;
if (count($file_id_array))
{
$query = sprintf("SELECT * FROM exc_returned WHERE user_id = %s AND returned_id IN (".
implode(ilUtil::quoteArray($file_id_array) ,",").")",
$this->ilias->db->quote($a_member_id . "")
);
$result = $this->ilias->db->query($query);
if ($result->numRows())
{
$result_array = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
array_push($result_array, $row);
}
// delete the entries in the database
$query = sprintf("DELETE FROM exc_returned WHERE user_id = %s AND returned_id IN ("
.implode(ilUtil::quoteArray($file_id_array) ,",").")",
$this->ilias->db->quote($a_member_id . "")
);
$result = $this->ilias->db->query($query);
// 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 495 of file class.ilExerciseMembers.php.

References $dir, $file, $filename, $result, ilObjExercise\_fixFilename(), DB_FETCHMODE_ASSOC, 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())." AND ".
" usr_id = ".$ilDB->quote($a_member_id)." AND ".
" tutor_id = ".$ilDB->quote($ilUser->getId());
$lu_set = $ilDB->query($q);
if ($lu_rec = $lu_set->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($lu_rec["download_time"] > 0)
{
$and_str = " AND timestamp > ".$ilDB->quote($lu_rec["download_time"]);
}
}
}
$this->updateTutorDownloadTime($a_member_id);
$query = sprintf("SELECT * FROM exc_returned WHERE obj_id = %s AND user_id = %s".
$and_str,
$this->ilias->db->quote($this->getObjId() . ""),
$this->ilias->db->quote($a_member_id . "")
);
$result = $this->ilias->db->query($query);
$count = $result->numRows();
if ($count == 1)
{
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
$this->downloadSingleFile(ilObjExercise::_fixFilename($row["filename"]), $row["filetitle"]);
}
else if ($count > 0)
{
$array_files = array();
$filename = "";
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$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 618 of file class.ilExerciseMembers.php.

References $filename, $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 572 of file class.ilExerciseMembers.php.

References $dir, $file, $result, ilObjExercise\_fixFilename(), DB_FETCHMODE_ASSOC, downloadMultipleFiles(), downloadSingleFile(), and ilUtil\quoteArray().

{
global $ilDB;
if (count($array_file_id))
{
$query = "SELECT * FROM exc_returned ".
"WHERE user_id = ".$ilDB->quote($a_user_id)." ".
"AND returned_id IN (".
implode(ilUtil::quoteArray($array_file_id) ,",").")";
$result = $this->ilias->db->query($query);
if ($result->numRows())
{
$array_found = array();
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
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 612 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 405 of file class.ilExerciseMembers.php.

References $res, ilObjExercise\_fixFilenameArray(), DB_FETCHMODE_ASSOC, and getObjId().

{
global $ilDB;
$query = "SELECT * FROM exc_returned WHERE obj_id = ".
$ilDB->quote($this->getObjId());
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$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 430 of file class.ilExerciseMembers.php.

References $result, ilObjExercise\_fixFilenameArray(), and DB_FETCHMODE_ASSOC.

Referenced by deassignMember().

{
$query = sprintf("SELECT *, TIMESTAMP + 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);
$delivered_files = array();
if ($result->numRows())
{
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
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 68 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 363 of file class.ilExerciseMembers.php.

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

Definition at line 378 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 56 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 195 of file class.ilExerciseMembers.php.

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

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

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

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

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

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

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

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

References $result.

{
global $ilDB;
$query = sprintf("SELECT returned_id FROM exc_returned WHERE obj_id = %s AND user_id = %s",
$this->ilias->db->quote($this->getObjId() . ""),
$this->ilias->db->quote($a_member_id . "")
);
$result = $this->ilias->db->query($query);
return $result->numRows();
}
ilExerciseMembers::ilClone (   $a_new_id)

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

References $data, $res, DB_FETCHMODE_OBJECT, and getObjId().

{
global $ilDB;
$data = array();
$query = "SELECT * FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId());
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$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)
{
$query = "INSERT INTO exc_members ".
"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 46 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 100 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 735 of file class.ilExerciseMembers.php.

References $res, DB_FETCHMODE_OBJECT, 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());
$res = $this->ilias->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$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 72 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 368 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 673 of file class.ilExerciseMembers.php.

References getObjId(), and read().

{
global $ilDB;
$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 64 of file class.ilExerciseMembers.php.

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

Definition at line 187 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 326 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 347 of file class.ilExerciseMembers.php.

References getObjId(), and read().

{
global $ilDB;
$query = "UPDATE exc_members ".
"SET feedback = ".$ilDB->quote(($a_status ? 1 : 0)).", ".
"feedback_time=".$ilDB->quote(($a_status ? (date("Y-m-d H:i:s")) : ("0000-00-00 00:00:00"))).
" 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::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 214 of file class.ilExerciseMembers.php.

References getObjId(), and read().

{
global $ilDB;
$query = "UPDATE exc_members ".
"SET status = ".$ilDB->quote($a_status).", ".
"status_time= ".$ilDB->quote(date("Y-m-d H:i:s"))." ".
" WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
"AND usr_id = ".$ilDB->quote($a_member_id)." ".
" AND status <> ".$ilDB->quote($a_status);
$this->ilias->db->query($query);
$this->read();
return true;
}

+ Here is the call graph for this function:

ilExerciseMembers::setStatusReturned (   $a_status)

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

References getObjId(), and read().

{
global $ilDB;
$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 252 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 272 of file class.ilExerciseMembers.php.

References getObjId(), and read().

{
global $ilDB;
$query = "UPDATE exc_members ".
"SET sent = ".$ilDB->quote(($a_status ? 1 : 0))." , ".
"sent_time=".$ilDB->quote(($a_status ? (date("Y-m-d H:i:s")) : ("0000-00-00 00:00:00"))).
" 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::updateStatusTimeForMember (   $a_member_id)

Update status time (last change) for member.

Parameters
int$a_member_iduser id of member

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

References getObjId(), and read().

{
global $ilDB;
$query = "UPDATE exc_members ".
"SET status_time= ".$ilDB->quote(date("Y-m-d H:i:s"))." ".
" 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::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 getObjId().

Referenced by deliverReturnedFiles().

{
global $ilUser, $ilDB;
// set download time
$q = "REPLACE INTO exc_usr_tutor (obj_id, usr_id, tutor_id, download_time) VALUES ".
"(".$ilDB->quote($this->getObjId()).",".$ilDB->quote($a_member_id).
",".$ilDB->quote($ilUser->getId()).",now())";
$ilDB->query($q);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilExerciseMembers::$ilias

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

Referenced by ilExerciseMembers().

ilExerciseMembers::$members

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

ilExerciseMembers::$notice

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

ilExerciseMembers::$obj_id

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

Referenced by getObjId().

ilExerciseMembers::$ref_id

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

Referenced by getRefId().

ilExerciseMembers::$status

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

ilExerciseMembers::$status_feedback

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

ilExerciseMembers::$status_returned

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

ilExerciseMembers::$status_sent

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


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