ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilExAssignment Class Reference

Exercise assignment. More...

+ Collaboration diagram for ilExAssignment:

Public Member Functions

 __construct ($a_id=0)
 Constructor.
 setId ($a_val)
 Set assignment id.
 getId ()
 Get assignment id.
 setExerciseId ($a_val)
 Set exercise id.
 getExerciseId ()
 Get exercise id.
 setStartTime ($a_val)
 Set start time (timestamp)
 getStartTime ()
 Get start time (timestamp)
 setDeadline ($a_val)
 Set deadline (timestamp)
 getDeadline ()
 Get deadline (timestamp)
 setInstruction ($a_val)
 Set instruction.
 getInstruction ()
 Get instruction.
 setTitle ($a_val)
 Set title.
 getTitle ()
 Get title.
 setMandatory ($a_val)
 Set mandatory.
 getMandatory ()
 Get mandatory.
 setOrderNr ($a_val)
 Set order nr.
 getOrderNr ()
 Get order nr.
 setType ($a_value)
 Set type.
 getType ()
 Get type.
 isValidType ($a_value)
 Is given type valid?
 read ()
 Read from db.
 save ()
 Save assignment.
 update ()
 Update.
 delete ()
 Delete assignment.
 cloneAssignmentsOfExercise ($a_old_exc_id, $a_new_exc_id)
 Clone assignments of exercise.
 saveAssOrderOfExercise ($a_ex_id, $a_order)
 Save ordering of all assignments of an exercise.
 orderAssByDeadline ($a_ex_id)
 Order assignments by deadline date.
 countMandatory ($a_ex_id)
 Order assignments by deadline date.
 lookupCommentForUser ($a_ass_id, $a_user_id)
 Lookup comment for the user.
 updateCommentForUser ($a_ass_id, $a_user_id, $a_value)
 Update comment.
 lookupMarkOfUser ($a_ass_id, $a_user_id)
 Lookup user mark.
 updateMarkOfUser ($a_ass_id, $a_user_id, $a_value)
 Update mark.
 lookupStatusOfUser ($a_ass_id, $a_user_id)
 was: getStatusByMember
 updateStatusOfUser ($a_ass_id, $a_user_id, $a_status)
 was: setStatusForMember($a_member_id,$a_status)
 updateStatusTimeOfUser ($a_ass_id, $a_user_id)
 was: updateStatusTimeForMember($a_user_id)
 lookupStatusSentOfUser ($a_ass_id, $a_user_id)
 was: getStatusSentByMember($a_member_id)
 updateStatusSentForUser ($a_ass_id, $a_user_id, $a_status)
 was: setStatusSentForMember($a_member_id,$a_status)
 lookupStatusReturnedOfUser ($a_ass_id, $a_user_id)
 was: getStatusReturnedByMember($a_member_id)
 updateStatusReturnedForUser ($a_ass_id, $a_user_id, $a_status)
 was: setStatusReturnedForMember($a_member_id,$a_status)
 lookupStatusFeedbackOfUser ($a_ass_id, $a_user_id)
 was: getStatusFeedbackByMember($a_member_id)
 updateStatusFeedbackForUser ($a_ass_id, $a_user_id, $a_status)
 was: setStatusFeedbackForMember($a_member_id,$a_status)
 lookupNoticeOfUser ($a_ass_id, $a_user_id)
 was: getNoticeByMember($a_member_id)
 hasReturned ($a_ass_id, $a_user_id)
 was: hasReturned($a_member_id)
 getAllDeliveredFiles ($a_exc_id, $a_ass_id)
 was: getAllDeliveredFiles()
 getDeliveredFiles ($a_exc_id, $a_ass_id, $a_user_id, $a_filter_empty_filename=false)
 was: getDeliveredFiles($a_member_id)
 deleteDeliveredFiles ($a_exc_id, $a_ass_id, $file_id_array, $a_user_id)
 was: deleteDeliveredFiles($file_id_array, $a_member_id)
 deliverReturnedFiles ($a_exc_id, $a_ass_id, $a_user_id, $a_only_new=false)
 was: deliverReturnedFiles($a_member_id, $a_only_new = false)
 updateTutorDownloadTime ($a_exc_id, $a_ass_id, $a_user_id)
 was: updateTutorDownloadTime($member_id)
 downloadSelectedFiles ($a_exc_id, $a_ass_id, $a_user_id, $array_file_id)
 was: downloadSelectedFiles($array_file_id,$a_user_id)?
 downloadSingleFile ($a_exc_id, $a_ass_id, $a_user_id, $filename, $filetitle)
 was: downloadSingleFile($filename, $filetitle)
 downloadMultipleFiles ($a_exc_id, $a_ass_id, $array_filenames, $a_user_id, $a_multi_user=false)
 was: downloadMultipleFiles($array_filenames, $pathname, $a_member_id = 0)
 downloadAllDeliveredFiles ($a_exc_id, $a_ass_id, $members)
 Download all submitted files of an assignment (all user)
 updateNoticeForUser ($a_ass_id, $a_user_id, $a_notice)
 was: setNoticeForMember($a_member_id,$a_notice)
 _getReturned ($a_ass_id)
 was: _getReturned($a_obj_id)
 getMemberListData ($a_exc_id, $a_ass_id)
 get member list data
 uploadAssignmentFiles ($a_files)
 Upload assignment files (from creation form)
 getTeamId ($a_user_id, $a_create_on_demand=false)
 Get team id for member id.
 getTeamMembers ($a_team_id)
 Get members of assignment team.
 getMembersOfAllTeams ()
 Get members for all teams of assignment.
 addTeamMember ($a_team_id, $a_user_id, $a_exc_ref_id)
 Add new member to team.
 removeTeamMember ($a_team_id, $a_user_id, $a_exc_ref_id)
 Remove member from team.
 sendNotification ($a_exc_ref_id, $a_user_id, $a_action)
 Send notification about team status.

Static Public Member Functions

static getAssignmentDataOfExercise ($a_exc_id)
 Get assignments data of an exercise in an array.
static getFiles ($a_exc_id, $a_ass_id)
 Get files.
static lookupMaxOrderNrForEx ($a_exc_id)
 Select the maximum order nr for an exercise.
static lookupAssignmentOnline ($a_ass_id)
 Check if assignment is online.
static lookupTitle ($a_id)
 Lookup title.
static lookupType ($a_id)
 Lookup type.
static lookupSentTimeOfUser ($a_ass_id, $a_user_id)
 Get time when exercise has been sent per e-mail to user.
static lookupFeedbackTimeOfUser ($a_ass_id, $a_user_id)
 Get time when feedback mail has been sent.
static lookupStatusTimeOfUser ($a_ass_id, $a_user_id)
 Get status time.
static deleteAllDeliveredFilesOfUser ($a_exc_id, $a_user_id)
 Delete all delivered files of user.
static getLastSubmission ($a_ass_id, $a_user_id)
 Get the date of the last submission of a user for the assignment.
static lookupAnyExerciseSent ($a_exc_id, $a_ass_id)
 Check whether exercise has been sent to any student per mail.
static lookupUpdatedSubmission ($ass_id, $member_id)
 Check whether student has upload new files after tutor has set the exercise to another than notgraded.
static lookupNewFiles ($ass_id, $member_id)
 Check how much files have been uploaded by the learner after the last download of the tutor.
static createNewUserRecords ($a_user_id, $a_exc_id)
 Create member status record for a new participant for all assignments.
static createNewAssignmentRecords ($a_ass_id, $a_exc)
 Create member status record for a new assignment for all participants.
static getTeamMembersByAssignmentId ($a_ass_id, $a_user_id)
 Find team members by assignment and team member.
static getTeamIdByAssignment ($a_ass_id, $a_user_id)
 Find team by assignment.
static getAssignmentTeamMap ($a_ass_id)
 Get team structure for assignment.
static writeTeamLog ($a_team_id, $a_action, $a_details=null)
 Add entry to team log.
static getTeamLog ($a_team_id)
 Get all log entries for team.

Data Fields

const TYPE_UPLOAD = 1
const TYPE_BLOG = 2
const TYPE_PORTFOLIO = 3
const TYPE_UPLOAD_TEAM = 4
const TEAM_LOG_CREATE_TEAM = 1
const TEAM_LOG_ADD_MEMBER = 2
const TEAM_LOG_REMOVE_MEMBER = 3
const TEAM_LOG_ADD_FILE = 4
const TEAM_LOG_REMOVE_FILE = 5

Private Member Functions

 lookupAssMemberField ($a_ass_id, $a_user_id, $a_field)
 Lookup a field value of ass/member table.
 updateAssMemberField ($a_ass_id, $a_user_id, $a_field, $a_value, $a_type)
 Update a field value of ass/member table.

Static Private Member Functions

static lookup ($a_id, $a_field)
 Private lookup.

Detailed Description

Exercise assignment.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 11 of file class.ilExAssignment.php.

Constructor & Destructor Documentation

ilExAssignment::__construct (   $a_id = 0)

Constructor.

Definition at line 27 of file class.ilExAssignment.php.

References read(), setId(), and setType().

{
$this->setType(self::TYPE_UPLOAD);
if ($a_id > 0)
{
$this->setId($a_id);
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilExAssignment::_getReturned (   $a_ass_id)

was: _getReturned($a_obj_id)

Definition at line 1494 of file class.ilExAssignment.php.

References $query, $res, and $row.

{
global $ilDB;
$query = "SELECT DISTINCT(usr_id) as ud FROM exc_mem_ass_status ".
"WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer")." ".
"AND returned = 1";
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$usr_ids[] = $row->ud;
}
return $usr_ids ? $usr_ids : array();
}
ilExAssignment::addTeamMember (   $a_team_id,
  $a_user_id,
  $a_exc_ref_id 
)

Add new member to team.

Parameters
int$a_team_id
int$a_user_id
int$a_exc_ref_id

Definition at line 1845 of file class.ilExAssignment.php.

References ilObjUser\_lookupFullname(), getId(), getTeamMembers(), sendNotification(), and writeTeamLog().

{
global $ilDB;
$members = $this->getTeamMembers($a_team_id);
if(!in_array($a_user_id, $members))
{
$fields = array("id" => array("integer", $a_team_id),
"ass_id" => array("integer", $this->getId()),
"user_id" => array("integer", $a_user_id));
$ilDB->insert("il_exc_team", $fields);
$this->sendNotification($a_exc_ref_id, $a_user_id, "add");
self::writeTeamLog($a_team_id, self::TEAM_LOG_ADD_MEMBER,
}
}

+ Here is the call graph for this function:

ilExAssignment::cloneAssignmentsOfExercise (   $a_old_exc_id,
  $a_new_exc_id 
)

Clone assignments of exercise.

Parameters
@return

Definition at line 370 of file class.ilExAssignment.php.

References $d, ilFSStorageExercise\create(), getAssignmentDataOfExercise(), and ilUtil\rCopy().

Referenced by ilObjExercise\cloneObject().

{
$ass_data = ilExAssignment::getAssignmentDataOfExercise($a_old_exc_id);
foreach ($ass_data as $d)
{
// clone assignment
$new_ass = new ilExAssignment();
$new_ass->setExerciseId($a_new_exc_id);
$new_ass->setTitle($d["title"]);
$new_ass->setDeadline($d["deadline"]);
$new_ass->setInstruction($d["instruction"]);
$new_ass->setMandatory($d["mandatory"]);
$new_ass->setOrderNr($d["order_val"]);
$new_ass->setStartTime($d["start_time"]);
$new_ass->setType($d["type"]);
$new_ass->save();
// clone assignment files
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$old_storage = new ilFSStorageExercise($a_old_exc_id, (int) $d["id"]);
$new_storage = new ilFSStorageExercise($a_new_exc_id, (int) $new_ass->getId());
$new_storage->create();
if (is_dir($old_storage->getPath()))
{
ilUtil::rCopy($old_storage->getPath(), $new_storage->getPath());
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::countMandatory (   $a_ex_id)

Order assignments by deadline date.

Definition at line 525 of file class.ilExAssignment.php.

Referenced by ilObjExerciseGUI\initEditCustomForm().

{
global $ilDB;
$set = $ilDB->query("SELECT count(*) cntm FROM exc_assignment ".
" WHERE exc_id = ".$ilDB->quote($a_ex_id, "integer").
" AND mandatory = ".$ilDB->quote(1, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec["cntm"];
}

+ Here is the caller graph for this function:

static ilExAssignment::createNewAssignmentRecords (   $a_ass_id,
  $a_exc 
)
static

Create member status record for a new assignment for all participants.

Definition at line 1718 of file class.ilExAssignment.php.

Referenced by save().

{
global $ilDB;
include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
$exmem = new ilExerciseMembers($a_exc);
$mems = $exmem->getMembers();
foreach ($mems as $mem)
{
$ilDB->replace("exc_mem_ass_status", array(
"ass_id" => array("integer", $a_ass_id),
"usr_id" => array("integer", $mem)
), array(
"status" => array("text", "notgraded")
));
}
}

+ Here is the caller graph for this function:

static ilExAssignment::createNewUserRecords (   $a_user_id,
  $a_exc_id 
)
static

Create member status record for a new participant for all assignments.

Definition at line 1698 of file class.ilExAssignment.php.

References getAssignmentDataOfExercise().

Referenced by ilExerciseMembers\assignMember().

{
global $ilDB;
foreach ($ass_data as $ass)
{
//echo "-".$ass["id"]."-".$a_user_id."-";
$ilDB->replace("exc_mem_ass_status", array(
"ass_id" => array("integer", $ass["id"]),
"usr_id" => array("integer", $a_user_id)
), array(
"status" => array("text", "notgraded")
));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::delete ( )

Delete assignment.

Definition at line 320 of file class.ilExAssignment.php.

References getExerciseId().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM exc_assignment WHERE ".
" id = ".$ilDB->quote($this->getId(), "integer")
);
$exc = new ilObjExercise($this->getExerciseId(), false);
$exc->updateAllUsersStatus();
}

+ Here is the call graph for this function:

static ilExAssignment::deleteAllDeliveredFilesOfUser (   $a_exc_id,
  $a_user_id 
)
static

Delete all delivered files of user.

Parameters
int$a_exc_idexcercise id
int$a_user_iduser id

Definition at line 982 of file class.ilExAssignment.php.

References $d, $filename, getTeamMembersByAssignmentId(), TYPE_UPLOAD_TEAM, and updateStatusOfUser().

{
global $ilDB;
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$delete_ids = array();
// get the files and...
$set = $ilDB->query("SELECT * FROM exc_returned ".
" WHERE obj_id = ".$ilDB->quote($a_exc_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$ass = new self($rec["ass_id"]);
if($ass->getType() == self::TYPE_UPLOAD_TEAM)
{
// switch upload to other team member
$team = self::getTeamMembersByAssignmentId($ass->getId(), $a_user_id);
if(sizeof($team) > 1)
{
$new_owner = array_pop($team);
while($new_owner == $a_user_id && sizeof($team))
{
$new_owner = array_pop($team);
}
$ilDB->manipulate("UPDATE exc_returned".
" SET user_id = ".$ilDB->quote($new_owner, "integer").
" WHERE returned_id = ".$ilDB->quote($rec["returned_id"], "integer")
);
// no need to delete
continue;
}
}
$delete_ids[] = $rec["returned_id"];
$fs = new ilFSStorageExercise($a_exc_id, $rec["ass_id"]);
// ...delete files
$filename = $fs->getAbsoluteSubmissionPath().
"/".$a_user_id."/".basename($rec["filename"]);
if (is_file($filename))
{
unlink($filename);
}
}
// delete exc_returned records
if($delete_ids)
{
$ilDB->manipulate("DELETE FROM exc_returned".
" WHERE ".$ilDB->in("returned_id", $delete_ids, "", "integer"));
}
// delete il_exc_team records
$ass_ids = array();
foreach(self::getAssignmentDataOfExercise($a_exc_id) as $item)
{
self::updateStatusOfUser($item["id"], $a_user_id, "notgraded"); // #14900
$ass_ids[] = $item["id"];
}
if($ass_ids)
{
$ilDB->manipulate($d = "DELETE FROM il_exc_team WHERE ".
"user_id = ".$ilDB->quote($a_user_id, "integer").
" AND ".$ilDB->in("ass_id", $ass_ids, "", "integer")
);
}
}

+ Here is the call graph for this function:

ilExAssignment::deleteDeliveredFiles (   $a_exc_id,
  $a_ass_id,
  $file_id_array,
  $a_user_id 
)

was: deleteDeliveredFiles($file_id_array, $a_member_id)

Definition at line 914 of file class.ilExAssignment.php.

References $filename, $result, $row, getTeamIdByAssignment(), getTeamMembersByAssignmentId(), TEAM_LOG_REMOVE_FILE, and writeTeamLog().

Referenced by ilObjExerciseGUI\removeExistingSubmissions().

{
global $ilDB;
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$fs = new ilFSStorageExercise($a_exc_id, $a_ass_id);
if (count($file_id_array))
{
$team_id = self::getTeamIdByAssignment($a_ass_id, $a_user_id);
if($team_id)
{
// #11733
$user_ids = self::getTeamMembersByAssignmentId($a_ass_id, $a_user_id);
if(!$user_ids)
{
return;
}
}
else
{
$user_ids = array($a_user_id);
}
$result = $ilDB->query("SELECT * FROM exc_returned".
" WHERE ".$ilDB->in("returned_id", $file_id_array, false, "integer").
" AND ".$ilDB->in("user_id", $user_ids, "", "integer"));
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 ".$ilDB->in("returned_id", $file_id_array, false, "integer").
" AND ".$ilDB->in("user_id", $user_ids, "", "integer"));
// delete the files
foreach ($result_array as $key => $value)
{
if($value["filename"])
{
if($team_id)
{
ilExAssignment::TEAM_LOG_REMOVE_FILE, $value["filetitle"]);
}
$filename = $fs->getAbsoluteSubmissionPath().
"/".$value["user_id"]."/".basename($value["filename"]);
unlink($filename);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::deliverReturnedFiles (   $a_exc_id,
  $a_ass_id,
  $a_user_id,
  $a_only_new = false 
)

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

Definition at line 1061 of file class.ilExAssignment.php.

References $ilUser, $query, $result, $row, ilObjUser\_lookupName(), ilObject\_lookupTitle(), downloadMultipleFiles(), downloadSingleFile(), getTeamMembersByAssignmentId(), lookupTitle(), and updateTutorDownloadTime().

Referenced by ilObjExerciseGUI\downloadNewReturnedObject(), and ilObjExerciseGUI\downloadReturnedObject().

{
global $ilUser, $ilDB;
// #11000 / #11785
$is_team = true;
$user_ids = self::getTeamMembersByAssignmentId($a_ass_id, $a_user_id);
if(!$user_ids)
{
$is_team = false;
$user_ids = array($a_user_id);
}
// get last download time
$and_str = "";
if ($a_only_new)
{
$q = "SELECT download_time FROM exc_usr_tutor WHERE ".
" ass_id = ".$ilDB->quote($a_ass_id, "integer")." AND ".
$ilDB->in("usr_id", $user_ids, "", "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");
}
}
}
foreach($user_ids as $user_id)
{
ilExAssignment::updateTutorDownloadTime($a_exc_id, $a_ass_id, $user_id);
}
$query = "SELECT * FROM exc_returned".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND ".$ilDB->in("user_id", $user_ids, "", "integer").
$and_str;
$result = $ilDB->query($query);
$count = $ilDB->numRows($result);
if ($count == 1)
{
$row = $ilDB->fetchAssoc($result);
switch(self::lookupType($a_ass_id))
{
case self::TYPE_BLOG:
case self::TYPE_PORTFOLIO:
$row["filetitle"] = ilObjUser::_lookupName($row["user_id"]);
$row["filetitle"] = ilObject::_lookupTitle($a_exc_id)." - ".
self::lookupTitle($a_ass_id)." - ".
$row["filetitle"]["firstname"]." ".
$row["filetitle"]["lastname"]." (".
$row["filetitle"]["login"].").zip";
break;
default:
break;
}
ilExAssignment::downloadSingleFile($a_exc_id, $a_ass_id, $row["user_id"],
$row["filename"], $row["filetitle"]);
}
else if ($count > 0)
{
$array_files = array();
while ($row = $ilDB->fetchAssoc($result))
{
$array_files[$row["user_id"]][] = basename($row["filename"]);
}
ilExAssignment::downloadMultipleFiles($a_exc_id, $a_ass_id, $array_files,
($is_team ? null : $a_user_id), $is_team);
}
else
{
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::downloadAllDeliveredFiles (   $a_exc_id,
  $a_ass_id,
  $members 
)

Download all submitted files of an assignment (all user)

Parameters
$membersarray of user names, key is user id

Definition at line 1337 of file class.ilExAssignment.php.

References $lng, ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilUtil\delDir(), ilUtil\deliverFile(), ilUtil\dirsize(), ilUtil\escapeShellArg(), ilUtil\getASCIIFilename(), ilUtil\ilTempnam(), lookupTitle(), lookupType(), ilUtil\makeDir(), TYPE_BLOG, TYPE_PORTFOLIO, and ilUtil\unzip().

Referenced by ilObjExerciseGUI\downloadAllObject().

{
global $lng, $ilObjDataCache, $ilias;
include_once "./Services/Utilities/classes/class.ilUtil.php";
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$storage = new ilFSStorageExercise($a_exc_id, $a_ass_id);
$storage->create();
ksort($members);
//$savepath = $this->getExercisePath() . "/" . $this->obj_id . "/";
$savepath = $storage->getAbsoluteSubmissionPath();
$cdir = getcwd();
// important check: if the directory does not exist
// ILIAS stays in the current directory (echoing only a warning)
// and the zip command below archives the whole ILIAS directory
// (including the data directory) and sends a mega file to the user :-o
if (!is_dir($savepath))
{
return;
}
// Safe mode fix
// chdir($this->getExercisePath());
chdir($storage->getTempPath());
$zip = PATH_TO_ZIP;
// check first, if we have enough free disk space to copy all files to temporary directory
$tmpdir = ilUtil::ilTempnam();
ilUtil::makeDir($tmpdir);
chdir($tmpdir);
$dirsize = 0;
foreach ($members as $id => $object) {
$directory = $savepath.DIRECTORY_SEPARATOR.$id;
$dirsize += ilUtil::dirsize($directory);
}
if ($dirsize > disk_free_space($tmpdir)) {
return -1;
}
$ass_type = self::lookupType($a_ass_id);
// copy all member directories to the temporary folder
// switch from id to member name and append the login if the member name is double
// ensure that no illegal filenames will be created
// remove timestamp from filename
$cache = array();
foreach ($members as $id => $user)
{
$sourcedir = $savepath.DIRECTORY_SEPARATOR.$id;
if (!is_dir($sourcedir))
continue;
$userName = ilObjUser::_lookupName($id);
$directory = ilUtil::getASCIIFilename(trim($userName["lastname"])."_".trim($userName["firstname"]));
if (array_key_exists($directory, $cache))
{
// first try is to append the login;
$directory = ilUtil::getASCIIFilename($directory."_".trim(ilObjUser::_lookupLogin($id)));
if (array_key_exists($directory, $cache)) {
// second and secure: append the user id as well.
$directory .= "_".$id;
}
}
$cache[$directory] = $directory;
ilUtil::makeDir ($directory);
$sourcefiles = scandir($sourcedir);
$duplicates = array();
foreach ($sourcefiles as $sourcefile) {
if ($sourcefile == "." || $sourcefile == "..")
{
continue;
}
$targetfile = trim(basename($sourcefile));
$pos = strpos($targetfile, "_");
if ($pos !== false)
{
$targetfile= substr($targetfile, $pos + 1);
}
// #14536
if(array_key_exists($targetfile, $duplicates))
{
$suffix = strrpos($targetfile, ".");
$targetfile = substr($targetfile, 0, $suffix).
" (".(++$duplicates[$targetfile]).")".
substr($targetfile, $suffix);
}
else
{
$duplicates[$targetfile] = 1;
}
$targetfile = $directory.DIRECTORY_SEPARATOR.$targetfile;
$sourcefile = $sourcedir.DIRECTORY_SEPARATOR.$sourcefile;
if (!copy ($sourcefile, $targetfile))
{
//echo 'Could not copy '.$sourcefile.' to '.$targetfile;
$ilias->raiseError('Could not copy '.basename($sourcefile)." to '".$targetfile."'.",
$ilias->error_obj->MESSAGE);
}
else
{
// preserve time stamp
touch($targetfile, filectime($sourcefile));
// blogs and portfolios are stored as zip and have to be unzipped
if($ass_type == ilExAssignment::TYPE_PORTFOLIO ||
{
ilUtil::unzip($targetfile);
unlink($targetfile);
}
}
}
}
$tmpfile = ilUtil::ilTempnam();
$tmpzipfile = $tmpfile . ".zip";
// Safe mode fix
$zipcmd = $zip." -r ".ilUtil::escapeShellArg($tmpzipfile)." .";
exec($zipcmd);
ilUtil::delDir($tmpdir);
$assTitle = ilExAssignment::lookupTitle($a_ass_id);
chdir($cdir);
ilUtil::deliverFile($tmpzipfile, (strlen($assTitle) == 0
? strtolower($lng->txt("exc_assignment"))
: $assTitle). ".zip", "", false, true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::downloadMultipleFiles (   $a_exc_id,
  $a_ass_id,
  $array_filenames,
  $a_user_id,
  $a_multi_user = false 
)

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

Definition at line 1247 of file class.ilExAssignment.php.

References $filename, ilObjUser\_lookupName(), ilUtil\delDir(), ilUtil\deliverFile(), ilUtil\escapeShellArg(), exit, ilUtil\getASCIIFilename(), ilUtil\ilTempnam(), lookupTitle(), and ilUtil\makeDir().

Referenced by deliverReturnedFiles(), and downloadSelectedFiles().

{
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$fs = new ilFSStorageExercise($a_exc_id, $a_ass_id);
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);
$assTitle = ilExAssignment::lookupTitle($a_ass_id);
$deliverFilename = str_replace(" ", "_", $assTitle);
if ($a_user_id > 0 && !$a_multi_user)
{
$userName = ilObjUser::_lookupName($a_user_id);
$deliverFilename .= "_".$userName["lastname"]."_".$userName["firstname"];
}
else
{
$deliverFilename .= "_files";
}
$orgDeliverFilename = trim($deliverFilename);
$deliverFilename = ilUtil::getASCIIFilename($orgDeliverFilename);
ilUtil::makeDir($tmpdir."/".$deliverFilename);
chdir($tmpdir."/".$deliverFilename);
//copy all files to a temporary directory and remove them afterwards
$parsed_files = $duplicates = array();
foreach ($array_filenames as $user_id => $files)
{
$pathname = $fs->getAbsoluteSubmissionPath()."/".$user_id;
foreach($files as $filename)
{
// remove timestamp
$newFilename = trim($filename);
$pos = strpos($newFilename , "_");
if ($pos !== false)
{
$newFilename= substr($newFilename, $pos + 1);
}
// #11070
$chkName = strtolower($newFilename);
if(array_key_exists($chkName, $duplicates))
{
$suffix = strrpos($newFilename, ".");
$newFilename = substr($newFilename, 0, $suffix).
" (".(++$duplicates[$chkName]).")".
substr($newFilename, $suffix);
}
else
{
$duplicates[$chkName] = 1;
}
$newFilename = $tmpdir.DIRECTORY_SEPARATOR.$deliverFilename.DIRECTORY_SEPARATOR.$newFilename;
// copy to temporal directory
$oldFilename = $pathname.DIRECTORY_SEPARATOR.$filename;
if (!copy ($oldFilename, $newFilename))
{
echo 'Could not copy '.$oldFilename.' to '.$newFilename;
}
touch($newFilename, filectime($oldFilename));
$parsed_files[] = ilUtil::escapeShellArg($deliverFilename.DIRECTORY_SEPARATOR.basename($newFilename));
}
}
chdir($tmpdir);
$zipcmd = $zip." ".ilUtil::escapeShellArg($tmpzipfile)." ".join($parsed_files, " ");
//echo getcwd()."<br>";
//echo $zipcmd;
exec($zipcmd);
ilUtil::delDir($tmpdir);
chdir($cdir);
ilUtil::deliverFile($tmpzipfile, $orgDeliverFilename.".zip", "", false, true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::downloadSelectedFiles (   $a_exc_id,
  $a_ass_id,
  $a_user_id,
  $array_file_id 
)

was: downloadSelectedFiles($array_file_id,$a_user_id)?

Definition at line 1167 of file class.ilExAssignment.php.

References $result, $row, ilObjUser\_lookupName(), ilObject\_lookupTitle(), downloadMultipleFiles(), downloadSingleFile(), getTeamMembersByAssignmentId(), TYPE_BLOG, and TYPE_PORTFOLIO.

Referenced by ilObjExerciseGUI\downloadObject().

{
global $ilDB;
if (count($array_file_id))
{
// #11785
$is_team = true;
$user_ids = self::getTeamMembersByAssignmentId($a_ass_id, $a_user_id);
if(!$user_ids)
{
$is_team = false;
$user_ids = array($a_user_id);
}
$result = $ilDB->query("SELECT * FROM exc_returned WHERE ".
$ilDB->in("returned_id", $array_file_id, false, "integer").
" AND ".$ilDB->in("user_id", $user_ids, "", "integer"));
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)
{
// blog/portfolio submission
if(is_numeric($array_found[0]["filetitle"]))
{
$ass = new ilExAssignment($array_found[0]["ass_id"]);
if($ass->getType() == ilExAssignment::TYPE_BLOG ||
$ass->getType() == ilExAssignment::TYPE_PORTFOLIO)
{
$user_data = ilObjUser::_lookupName($array_found[0]["user_id"]);
$array_found[0]["filetitle"] = ilObject::_lookupTitle($array_found[0]["obj_id"])." - ".
$ass->getTitle()." - ".
$user_data["firstname"]." ".
$user_data["lastname"]." (".
$user_data["login"].").zip";
}
}
ilExAssignment::downloadSingleFile($a_exc_id, $a_ass_id, $array_found[0]["user_id"],
$array_found[0]["filename"], $array_found[0]["filetitle"]);
}
else
{
$filenames = array();
foreach ($array_found as $value)
{
$filenames[$value["user_id"]][] = basename($value["filename"]);
}
$filenames, ($is_team ? null : $a_user_id), $is_team);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::downloadSingleFile (   $a_exc_id,
  $a_ass_id,
  $a_user_id,
  $filename,
  $filetitle 
)

was: downloadSingleFile($filename, $filetitle)

Definition at line 1231 of file class.ilExAssignment.php.

References $filename, and ilUtil\deliverFile().

Referenced by deliverReturnedFiles(), and downloadSelectedFiles().

{
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$fs = new ilFSStorageExercise($a_exc_id, $a_ass_id);
$filename = $fs->getAbsoluteSubmissionPath().
"/".$a_user_id."/".basename($filename);
require_once "./Services/Utilities/classes/class.ilUtil.php";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::getAllDeliveredFiles (   $a_exc_id,
  $a_ass_id 
)

was: getAllDeliveredFiles()

Definition at line 842 of file class.ilExAssignment.php.

References $query, $res, and $row.

Referenced by ilExerciseMemberTableGUI\__construct(), and ilObjExerciseGUI\getAssignmentValues().

{
global $ilDB;
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$fs = new ilFSStorageExercise($a_exc_id, $a_ass_id);
$query = "SELECT * FROM exc_returned WHERE ass_id = ".
$ilDB->quote($a_ass_id, "integer");
$res = $ilDB->query($query);
while($row = $ilDB->fetchAssoc($res))
{
$row["timestamp"] = $row["ts"];
$row["filename"] = $fs->getAbsoluteSubmissionPath().
"/".$row["user_id"]."/".basename($row["filename"]);
$delivered[] = $row;
}
//$delivered = ilObjExercise::_fixFilenameArray($delivered);
return $delivered ? $delivered : array();
}

+ Here is the caller graph for this function:

static ilExAssignment::getAssignmentDataOfExercise (   $a_exc_id)
static

Get assignments data of an exercise in an array.

Definition at line 335 of file class.ilExAssignment.php.

References $data.

Referenced by ilAssignmentsTableGUI\__construct(), ilExGradesTableGUI\__construct(), ilExParticipantTableGUI\__construct(), ilObjExerciseGUI\addMembersObject(), cloneAssignmentsOfExercise(), createNewUserRecords(), ilObjExercise\determinStatusOfUser(), ilObjExercise\exportGradesExcel(), ilExerciseXMLParser\ilExerciseXMLParser(), ilObjExerciseGUI\infoScreen(), ilObjExerciseGUI\membersObject(), ilObjExerciseGUI\showOverviewObject(), ilObjExerciseGUI\showParticipantObject(), and ilExerciseXMLWriter\start().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM exc_assignment ".
" WHERE exc_id = ".$ilDB->quote($a_exc_id, "integer").
" ORDER BY order_nr ASC");
$data = array();
$order_val = 10;
while ($rec = $ilDB->fetchAssoc($set))
{
$data[] = array(
"id" => $rec["id"],
"exc_id" => $rec["exc_id"],
"deadline" => $rec["time_stamp"],
"instruction" => $rec["instruction"],
"title" => $rec["title"],
"start_time" => $rec["start_time"],
"order_val" => $order_val,
"mandatory" => $rec["mandatory"],
"type" => $rec["type"]
);
$order_val += 10;
}
return $data;
}

+ Here is the caller graph for this function:

static ilExAssignment::getAssignmentTeamMap (   $a_ass_id)
static

Get team structure for assignment.

Parameters
int$a_ass_id
Returns
array

Definition at line 1949 of file class.ilExAssignment.php.

References $row.

Referenced by ilExerciseMemberTableGUI\__construct().

{
global $ilDB;
$map = array();
$sql = "SELECT * FROM il_exc_team".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$map[$row["user_id"]] = $row["id"];
}
return $map;
}

+ Here is the caller graph for this function:

ilExAssignment::getDeadline ( )

Get deadline (timestamp)

Returns
int deadline (timestamp)

Definition at line 113 of file class.ilExAssignment.php.

Referenced by save(), and update().

{
return $this->deadline;
}

+ Here is the caller graph for this function:

ilExAssignment::getDeliveredFiles (   $a_exc_id,
  $a_ass_id,
  $a_user_id,
  $a_filter_empty_filename = false 
)

was: getDeliveredFiles($a_member_id)

Definition at line 869 of file class.ilExAssignment.php.

References $result, $row, and getTeamMembersByAssignmentId().

Referenced by ilObjExerciseGUI\confirmDeleteDeliveredObject(), ilObjExerciseGUI\confirmRemoveTeamMemberObject(), ilObjExercise\deleteDeliveredFiles(), ilObjBlogGUI\downloadExcSubFile(), ilObjPortfolioGUI\downloadExcSubFile(), ilPublicSubmissionsTableGUI\fillRow(), ilExParticipantTableGUI\fillRow(), ilExerciseMemberTableGUI\fillRow(), ilObjBlogGUI\getExerciseInfo(), ilObjPortfolioGUI\getExerciseInfo(), ilExAssignmentGUI\getOverviewBody(), and ilObjExerciseGUI\removeExistingSubmissions().

{
global $ilDB;
$user_ids = self::getTeamMembersByAssignmentId($a_ass_id, $a_user_id);
if(!$user_ids)
{
$user_ids = array($a_user_id);
}
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$fs = new ilFSStorageExercise($a_exc_id, $a_ass_id);
$result = $ilDB->query("SELECT * FROM exc_returned".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND ".$ilDB->in("user_id", $user_ids, "", "integer"));
$delivered_files = array();
if ($ilDB->numRows($result))
{
while ($row = $ilDB->fetchAssoc($result))
{
if($a_filter_empty_filename && !$row["filename"])
{
continue;
}
$row["owner_id"] = $row["user_id"];
$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);
$row["filename"] = $fs->getAbsoluteSubmissionPath().
"/".$row["user_id"]."/".basename($row["filename"]);
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:

ilExAssignment::getExerciseId ( )

Get exercise id.

Returns
int exercise id

Definition at line 73 of file class.ilExAssignment.php.

Referenced by delete(), save(), sendNotification(), update(), and uploadAssignmentFiles().

{
return $this->exc_id;
}

+ Here is the caller graph for this function:

static ilExAssignment::getFiles (   $a_exc_id,
  $a_ass_id 
)
static

Get files.

Definition at line 403 of file class.ilExAssignment.php.

Referenced by ilObjBlogGUI\downloadExcAssFile(), ilObjPortfolioGUI\downloadExcAssFile(), ilObjBlogGUI\getExerciseInfo(), ilObjPortfolioGUI\getExerciseInfo(), and ilExAssignmentGUI\getOverviewBody().

{
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$storage = new ilFSStorageExercise($a_exc_id, $a_ass_id);
return $storage->getFiles();
}

+ Here is the caller graph for this function:

ilExAssignment::getId ( )

Get assignment id.

Returns
int assignment id

Definition at line 53 of file class.ilExAssignment.php.

Referenced by addTeamMember(), getMembersOfAllTeams(), getTeamId(), getTeamMembers(), removeTeamMember(), update(), and uploadAssignmentFiles().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilExAssignment::getInstruction ( )

Get instruction.

Returns
string instruction

Definition at line 133 of file class.ilExAssignment.php.

Referenced by save(), and update().

{
return $this->instruction;
}

+ Here is the caller graph for this function:

static ilExAssignment::getLastSubmission (   $a_ass_id,
  $a_user_id 
)
static

Get the date of the last submission of a user for the assignment.

Parameters
intAssignment ID
intUser ID
Returns
mixed false or mysql timestamp of last submission

Definition at line 1518 of file class.ilExAssignment.php.

References $lng, ilUtil\getMySQLTimestamp(), and getTeamMembersByAssignmentId().

Referenced by ilPublicSubmissionsTableGUI\fillRow(), ilExParticipantTableGUI\fillRow(), ilExerciseMemberTableGUI\fillRow(), getMemberListData(), and ilExAssignmentGUI\getOverviewBody().

{
global $ilDB, $lng;
// team upload?
$user_ids = self::getTeamMembersByAssignmentId($a_ass_id, $a_user_id);
if(!$user_ids)
{
$user_ids = array($a_user_id);
}
$ilDB->setLimit(1);
$q = "SELECT obj_id,user_id,ts FROM exc_returned".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND ".$ilDB->in("user_id", $user_ids, "", "integer").
" ORDER BY ts DESC";
$usr_set = $ilDB->query($q);
$array = $ilDB->fetchAssoc($usr_set);
if ($array["ts"]==NULL)
{
return false;
}
else
{
return ilUtil::getMySQLTimestamp($array["ts"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::getMandatory ( )

Get mandatory.

Returns
int mandatory

Definition at line 173 of file class.ilExAssignment.php.

Referenced by save(), and update().

{
return $this->mandatory;
}

+ Here is the caller graph for this function:

ilExAssignment::getMemberListData (   $a_exc_id,
  $a_ass_id 
)

get member list data

Definition at line 1650 of file class.ilExAssignment.php.

References ilObject\_exists(), ilObjUser\_lookupLogin(), ilObjUser\_lookupName(), ilObject\_lookupType(), and getLastSubmission().

Referenced by ilExerciseMemberTableGUI\__construct(), and ilPublicSubmissionsTableGUI\__construct().

{
global $ilDB;
$mem = array();
// first get list of members from member table
$set = $ilDB->query("SELECT * FROM exc_members ".
"WHERE obj_id = ".$ilDB->quote($a_exc_id, "integer"));
while($rec = $ilDB->fetchAssoc($set))
{
if (ilObject::_exists($rec["usr_id"]) &&
(ilObject::_lookupType($rec["usr_id"]) == "usr"))
{
$name = ilObjUser::_lookupName($rec["usr_id"]);
$login = ilObjUser::_lookupLogin($rec["usr_id"]);
$mem[$rec["usr_id"]] =
array(
"name" => $name["lastname"].", ".$name["firstname"],
"login" => $login,
"usr_id" => $rec["usr_id"],
"lastname" => $name["lastname"],
"firstname" => $name["firstname"]
);
}
}
$q = "SELECT * FROM exc_mem_ass_status ".
"WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer");
$set = $ilDB->query($q);
while($rec = $ilDB->fetchAssoc($set))
{
if (isset($mem[$rec["usr_id"]]))
{
$mem[$rec["usr_id"]]["sent_time"] = $rec["sent_time"];
$mem[$rec["usr_id"]]["submission"] = ilExAssignment::getLastSubmission($a_ass_id, $rec["usr_id"]);
$mem[$rec["usr_id"]]["status_time"] = $rec["status_time"];
$mem[$rec["usr_id"]]["feedback_time"] = $rec["feedback_time"];
$mem[$rec["usr_id"]]["notice"] = $rec["notice"];
$mem[$rec["usr_id"]]["status"] = $rec["status"];
}
}
return $mem;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::getMembersOfAllTeams ( )

Get members for all teams of assignment.

Returns
array

Definition at line 1820 of file class.ilExAssignment.php.

References $row, and getId().

{
global $ilDB;
$ids = array();
$sql = "SELECT user_id".
" FROM il_exc_team".
" WHERE ass_id = ".$ilDB->quote($this->getId(), "integer");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$ids[] = $row["user_id"];
}
return $ids;
}

+ Here is the call graph for this function:

ilExAssignment::getOrderNr ( )

Get order nr.

Returns
int order nr

Definition at line 193 of file class.ilExAssignment.php.

Referenced by save(), and update().

{
return $this->order_nr;
}

+ Here is the caller graph for this function:

ilExAssignment::getStartTime ( )

Get start time (timestamp)

Returns
int start time (timestamp)

Definition at line 93 of file class.ilExAssignment.php.

Referenced by save(), and update().

{
return $this->start_time;
}

+ Here is the caller graph for this function:

ilExAssignment::getTeamId (   $a_user_id,
  $a_create_on_demand = false 
)

Get team id for member id.

team will be created if no team yet

Parameters
int$a_user_id
bool$a_create_on_demand
Returns
int

Definition at line 1762 of file class.ilExAssignment.php.

References $row, ilObjUser\_lookupFullname(), getId(), and writeTeamLog().

{
global $ilDB;
$sql = "SELECT id FROM il_exc_team".
" WHERE ass_id = ".$ilDB->quote($this->getId(), "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer");
$set = $ilDB->query($sql);
$row = $ilDB->fetchAssoc($set);
$id = $row["id"];
if(!$id && $a_create_on_demand)
{
$id = $ilDB->nextId("il_exc_team");
$fields = array("id" => array("integer", $id),
"ass_id" => array("integer", $this->getId()),
"user_id" => array("integer", $a_user_id));
$ilDB->insert("il_exc_team", $fields);
self::writeTeamLog($id, self::TEAM_LOG_CREATE_TEAM);
self::writeTeamLog($id, self::TEAM_LOG_ADD_MEMBER,
}
return $id;
}

+ Here is the call graph for this function:

static ilExAssignment::getTeamIdByAssignment (   $a_ass_id,
  $a_user_id 
)
static

Find team by assignment.

Parameters
int$a_ass_id
int$a_user_id
Returns
int

Definition at line 1923 of file class.ilExAssignment.php.

References $result.

Referenced by deleteDeliveredFiles(), ilObjExercise\deliverFile(), getTeamMembersByAssignmentId(), and ilObjExerciseGUI\showTeamLogObject().

{
global $ilDB;
$result = $ilDB->query("SELECT type".
" FROM exc_assignment".
" WHERE id = ".$ilDB->quote($a_ass_id, "integer"));
$type = $ilDB->fetchAssoc($result);
if($type["type"] == self::TYPE_UPLOAD_TEAM)
{
$set = $ilDB->query("SELECT id".
" FROM il_exc_team".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer"));
$team_id = $ilDB->fetchAssoc($set);
return $team_id["id"];
}
}

+ Here is the caller graph for this function:

static ilExAssignment::getTeamLog (   $a_team_id)
static

Get all log entries for team.

Parameters
int$a_team_id
Returns
array

Definition at line 1994 of file class.ilExAssignment.php.

References $res, and $row.

Referenced by ilExAssignmentTeamLogTableGUI\getItems().

{
global $ilDB;
$res = array();
$sql = "SELECT * FROM il_exc_team_log".
" WHERE team_id = ".$ilDB->quote($a_team_id, "integer").
" ORDER BY tstamp DESC";
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$res[] = $row;
}
return $res;
}

+ Here is the caller graph for this function:

ilExAssignment::getTeamMembers (   $a_team_id)

Get members of assignment team.

Parameters
int$a_team_id
Returns
array

Definition at line 1796 of file class.ilExAssignment.php.

References $row, and getId().

Referenced by addTeamMember().

{
global $ilDB;
$ids = array();
$sql = "SELECT user_id".
" FROM il_exc_team".
" WHERE ass_id = ".$ilDB->quote($this->getId(), "integer").
" AND id = ".$ilDB->quote($a_team_id, "integer");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$ids[] = $row["user_id"];
}
return $ids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilExAssignment::getTeamMembersByAssignmentId (   $a_ass_id,
  $a_user_id 
)
static

Find team members by assignment and team member.

Parameters
int$a_ass_id
int$a_user_id
Returns
array

Definition at line 1894 of file class.ilExAssignment.php.

References $row, and getTeamIdByAssignment().

Referenced by ilObjExerciseGUI\confirmDeassignMembersObject(), deleteAllDeliveredFilesOfUser(), ilObjExercise\deleteDeliveredFiles(), deleteDeliveredFiles(), ilObjExercise\deliverFile(), deliverReturnedFiles(), downloadSelectedFiles(), ilExParticipantTableGUI\fillRow(), getDeliveredFiles(), getLastSubmission(), ilExAssignmentGUI\getOverviewBody(), ilObjExercise\handleSubmission(), hasReturned(), lookupNewFiles(), lookupUpdatedSubmission(), ilObjExerciseGUI\redirectFeedbackMailObject(), and ilObjExerciseGUI\sendMembersObject().

{
global $ilDB;
$ids = array();
$team_id = self::getTeamIdByAssignment($a_ass_id, $a_user_id);
if($team_id)
{
$set = $ilDB->query("SELECT user_id".
" FROM il_exc_team".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND id = ". $ilDB->quote($team_id, "integer"));
while($row = $ilDB->fetchAssoc($set))
{
$ids[] = $row["user_id"];
}
}
return $ids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::getTitle ( )

Get title.

Returns
string title

Definition at line 153 of file class.ilExAssignment.php.

References $title.

Referenced by save(), sendNotification(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilExAssignment::getType ( )

Get type.

Returns
int

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

Referenced by save(), and update().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilExAssignment::hasReturned (   $a_ass_id,
  $a_user_id 
)

was: hasReturned($a_member_id)

Definition at line 823 of file class.ilExAssignment.php.

References $result, and getTeamMembersByAssignmentId().

{
global $ilDB;
$user_ids = self::getTeamMembersByAssignmentId($a_ass_id, $a_user_id);
if(!$user_ids)
{
$user_ids = array($a_user_id);
}
$result = $ilDB->query("SELECT returned_id FROM exc_returned".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND ".$ilDB->in("user_id", $user_ids, "", "integer"));
return $ilDB->numRows($result);
}

+ Here is the call graph for this function:

ilExAssignment::isValidType (   $a_value)

Is given type valid?

Parameters
int$a_value
Returns
bool

Definition at line 227 of file class.ilExAssignment.php.

Referenced by setType().

{
if(in_array((int)$a_value, array(self::TYPE_UPLOAD, self::TYPE_BLOG,
self::TYPE_PORTFOLIO, self::TYPE_UPLOAD_TEAM)))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

static ilExAssignment::lookup (   $a_id,
  $a_field 
)
staticprivate

Private lookup.

Definition at line 449 of file class.ilExAssignment.php.

Referenced by lookupTitle(), and lookupType().

{
global $ilDB;
$set = $ilDB->query("SELECT ".$a_field." FROM exc_assignment ".
" WHERE id = ".$ilDB->quote($a_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec[$a_field];
}

+ Here is the caller graph for this function:

static ilExAssignment::lookupAnyExerciseSent (   $a_exc_id,
  $a_ass_id 
)
static

Check whether exercise has been sent to any student per mail.

Definition at line 1552 of file class.ilExAssignment.php.

Referenced by ilExerciseMemberTableGUI\__construct().

{
global $ilDB;
$q = "SELECT count(*) AS cnt FROM exc_mem_ass_status".
" WHERE NOT sent_time IS NULL".
" AND ass_id = ".$ilDB->quote($a_ass_id, "integer")." ".
" ";
$set = $ilDB->query($q);
$rec = $ilDB->fetchAssoc($set);
if ($rec["cnt"] > 0)
{
return true;
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

static ilExAssignment::lookupAssignmentOnline (   $a_ass_id)
static

Check if assignment is online.

Parameters
int$a_ass_id
Returns
bool

Definition at line 432 of file class.ilExAssignment.php.

References $query, and $res.

Referenced by ilObjExerciseSubItemListGUI\isAssignmentVisible().

{
global $ilDB;
$query = "SELECT id FROM exc_assignment ".
"WHERE start_time <= ".$ilDB->quote(time(),'integer').' '.
"AND time_stamp >= ".$ilDB->quote(time(),'integer').' '.
"AND id = ".$ilDB->quote($a_ass_id,'integer');
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

ilExAssignment::lookupAssMemberField (   $a_ass_id,
  $a_user_id,
  $a_field 
)
private

Lookup a field value of ass/member table.

Definition at line 544 of file class.ilExAssignment.php.

Referenced by lookupCommentForUser(), lookupFeedbackTimeOfUser(), lookupMarkOfUser(), lookupNoticeOfUser(), lookupSentTimeOfUser(), lookupStatusFeedbackOfUser(), lookupStatusOfUser(), lookupStatusReturnedOfUser(), lookupStatusSentOfUser(), and lookupStatusTimeOfUser().

{
global $ilDB;
$set = $ilDB->query("SELECT ".$a_field." FROM exc_mem_ass_status ".
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec[$a_field];
}

+ Here is the caller graph for this function:

ilExAssignment::lookupCommentForUser (   $a_ass_id,
  $a_user_id 
)

Lookup comment for the user.

Definition at line 588 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilExParticipantTableGUI\fillRow(), ilExerciseMemberTableGUI\fillRow(), and ilExAssignmentGUI\getOverviewBody().

{
return ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "u_comment");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilExAssignment::lookupFeedbackTimeOfUser (   $a_ass_id,
  $a_user_id 
)
static

Get time when feedback mail has been sent.

Definition at line 782 of file class.ilExAssignment.php.

References ilUtil\getMySQLTimestamp(), and lookupAssMemberField().

Referenced by ilExParticipantTableGUI\fillRow(), and ilExerciseMemberTableGUI\fillRow().

{
ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "feedback_time"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::lookupMarkOfUser (   $a_ass_id,
  $a_user_id 
)

Lookup user mark.

Definition at line 605 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilObjExercise\exportGradesExcel(), ilExParticipantTableGUI\fillRow(), ilExGradesTableGUI\fillRow(), ilExerciseMemberTableGUI\fillRow(), ilExAssignmentGUI\getOverviewBody(), and ilObjExerciseGUI\saveStatusObject().

{
return ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "mark");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilExAssignment::lookupMaxOrderNrForEx (   $a_exc_id)
static

Select the maximum order nr for an exercise.

Definition at line 413 of file class.ilExAssignment.php.

Referenced by save().

{
global $ilDB;
$set = $ilDB->query("SELECT MAX(order_nr) mnr FROM exc_assignment ".
" WHERE exc_id = ".$ilDB->quote($a_exc_id, "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
return (int) $rec["mnr"];
}
return 0;
}

+ Here is the caller graph for this function:

static ilExAssignment::lookupNewFiles (   $ass_id,
  $member_id 
)
static

Check how much files have been uploaded by the learner after the last download of the tutor.

Definition at line 1616 of file class.ilExAssignment.php.

References $ilUser, and getTeamMembersByAssignmentId().

Referenced by ilExParticipantTableGUI\fillRow(), and ilExerciseMemberTableGUI\fillRow().

{
global $ilDB, $ilUser;
// team upload?
$user_ids = self::getTeamMembersByAssignmentId($ass_id, $member_id);
if(!$user_ids)
{
$user_ids = array($member_id);
}
$q = "SELECT exc_returned.returned_id AS id ".
"FROM exc_usr_tutor, exc_returned ".
"WHERE exc_returned.ass_id = exc_usr_tutor.ass_id ".
" AND exc_returned.user_id = exc_usr_tutor.usr_id ".
" AND exc_returned.ass_id = ".$ilDB->quote($ass_id, "integer").
" AND ".$ilDB->in("exc_returned.user_id", $user_ids, "", "integer").
" AND exc_usr_tutor.tutor_id = ".$ilDB->quote($ilUser->getId(), "integer").
" AND exc_usr_tutor.download_time < exc_returned.ts ";
$new_up_set = $ilDB->query($q);
$new_up = array();
while ($new_up_rec = $ilDB->fetchAssoc($new_up_set))
{
$new_up[] = $new_up_rec["id"];
}
return $new_up;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::lookupNoticeOfUser (   $a_ass_id,
  $a_user_id 
)

was: getNoticeByMember($a_member_id)

Definition at line 815 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilExParticipantTableGUI\fillRow(), and ilExerciseMemberTableGUI\fillRow().

{
return ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "notice");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilExAssignment::lookupSentTimeOfUser (   $a_ass_id,
  $a_user_id 
)
static

Get time when exercise has been sent per e-mail to user.

Definition at line 773 of file class.ilExAssignment.php.

References ilUtil\getMySQLTimestamp(), and lookupAssMemberField().

Referenced by ilExerciseMemberTableGUI\fillRow().

{
ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "sent_time"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::lookupStatusFeedbackOfUser (   $a_ass_id,
  $a_user_id 
)

was: getStatusFeedbackByMember($a_member_id)

Definition at line 750 of file class.ilExAssignment.php.

References lookupAssMemberField().

{
return ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "feedback");
}

+ Here is the call graph for this function:

ilExAssignment::lookupStatusOfUser (   $a_ass_id,
  $a_user_id 
)

was: getStatusByMember

Definition at line 622 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilObjExercise\determinStatusOfUser(), ilObjExercise\exportGradesExcel(), ilExParticipantTableGUI\fillRow(), ilExGradesTableGUI\fillRow(), ilExerciseMemberTableGUI\fillRow(), ilExAssignmentGUI\getOverviewBody(), and ilExAssignmentGUI\getOverviewHeader().

{
$stat = ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "status");
if ($stat == "")
{
$stat = "notgraded";
}
return $stat;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::lookupStatusReturnedOfUser (   $a_ass_id,
  $a_user_id 
)

was: getStatusReturnedByMember($a_member_id)

Definition at line 713 of file class.ilExAssignment.php.

References lookupAssMemberField().

{
return ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "returned");
}

+ Here is the call graph for this function:

ilExAssignment::lookupStatusSentOfUser (   $a_ass_id,
  $a_user_id 
)

was: getStatusSentByMember($a_member_id)

Definition at line 676 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseMemberTableGUI\fillRow().

{
return ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "sent");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilExAssignment::lookupStatusTimeOfUser (   $a_ass_id,
  $a_user_id 
)
static

Get status time.

Definition at line 791 of file class.ilExAssignment.php.

References ilUtil\getMySQLTimestamp(), and lookupAssMemberField().

Referenced by ilExParticipantTableGUI\fillRow(), and ilExerciseMemberTableGUI\fillRow().

{
ilExAssignment::lookupAssMemberField($a_ass_id, $a_user_id, "status_time"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilExAssignment::lookupType (   $a_id)
static

Lookup type.

Definition at line 473 of file class.ilExAssignment.php.

References lookup().

Referenced by ilExerciseMemberTableGUI\__construct(), and downloadAllDeliveredFiles().

{
return ilExAssignment::lookup($a_id, "type");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilExAssignment::lookupUpdatedSubmission (   $ass_id,
  $member_id 
)
static

Check whether student has upload new files after tutor has set the exercise to another than notgraded.

Definition at line 1577 of file class.ilExAssignment.php.

References $lng, and getTeamMembersByAssignmentId().

Referenced by ilExParticipantTableGUI\fillRow(), and ilExerciseMemberTableGUI\fillRow().

{
global $ilDB, $lng;
// team upload?
$user_ids = self::getTeamMembersByAssignmentId($ass_id, $member_id);
if(!$user_ids)
{
$user_ids = array($member_id);
}
$q="SELECT exc_mem_ass_status.status_time, exc_returned.ts ".
"FROM exc_mem_ass_status, exc_returned ".
"WHERE exc_mem_ass_status.status_time < exc_returned.ts ".
"AND NOT exc_mem_ass_status.status_time IS NULL ".
"AND exc_returned.ass_id = exc_mem_ass_status.ass_id ".
"AND exc_returned.user_id = exc_mem_ass_status.usr_id ".
"AND exc_returned.ass_id=".$ilDB->quote($ass_id, "integer").
" AND ".$ilDB->in("exc_returned.user_id", $user_ids, "", "integer");
$usr_set = $ilDB->query($q);
$array = $ilDB->fetchAssoc($usr_set);
if (count($array)==0)
{
return 0;
}
else
{
return 1;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::orderAssByDeadline (   $a_ex_id)

Order assignments by deadline date.

Definition at line 503 of file class.ilExAssignment.php.

Referenced by ilObjExerciseGUI\orderAssignmentsByDeadlineObject().

{
global $ilDB;
$set = $ilDB->query("SELECT id FROM exc_assignment ".
" WHERE exc_id = ".$ilDB->quote($a_ex_id, "integer").
" ORDER BY time_stamp ASC"
);
$nr = 10;
while ($rec = $ilDB->fetchAssoc($set))
{
$ilDB->manipulate("UPDATE exc_assignment SET ".
" order_nr = ".$ilDB->quote($nr, "integer").
" WHERE id = ".$ilDB->quote($rec["id"], "integer")
);
$nr += 10;
}
}

+ Here is the caller graph for this function:

ilExAssignment::read ( )

Read from db.

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

References setDeadline(), setExerciseId(), setInstruction(), setMandatory(), setOrderNr(), setStartTime(), setTitle(), and setType().

Referenced by __construct().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM exc_assignment ".
" WHERE id = ".$ilDB->quote($this->getId(), "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$this->setExerciseId($rec["exc_id"]);
$this->setDeadline($rec["time_stamp"]);
$this->setInstruction($rec["instruction"]);
$this->setTitle($rec["title"]);
$this->setStartTime($rec["start_time"]);
$this->setOrderNr($rec["order_nr"]);
$this->setMandatory($rec["mandatory"]);
$this->setType($rec["type"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::removeTeamMember (   $a_team_id,
  $a_user_id,
  $a_exc_ref_id 
)

Remove member from team.

Parameters
int$a_team_id
int$a_user_id
int$a_exc_ref_id

Definition at line 1871 of file class.ilExAssignment.php.

References ilObjUser\_lookupFullname(), getId(), sendNotification(), and writeTeamLog().

{
global $ilDB;
$sql = "DELETE FROM il_exc_team".
" WHERE ass_id = ".$ilDB->quote($this->getId(), "integer").
" AND id = ".$ilDB->quote($a_team_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer");
$ilDB->manipulate($sql);
$this->sendNotification($a_exc_ref_id, $a_user_id, "rmv");
self::writeTeamLog($a_team_id, self::TEAM_LOG_REMOVE_MEMBER,
}

+ Here is the call graph for this function:

ilExAssignment::save ( )

Save assignment.

Definition at line 263 of file class.ilExAssignment.php.

References createNewAssignmentRecords(), getDeadline(), getExerciseId(), getInstruction(), getMandatory(), getOrderNr(), getStartTime(), getTitle(), getType(), lookupMaxOrderNrForEx(), setId(), and setOrderNr().

{
global $ilDB;
if ($this->getOrderNr() == 0)
{
$this->setOrderNr(
+ 10);
}
$next_id = $ilDB->nextId("exc_assignment");
$ilDB->insert("exc_assignment", array(
"id" => array("integer", $next_id),
"exc_id" => array("integer", $this->getExerciseId()),
"time_stamp" => array("integer", $this->getDeadline()),
"instruction" => array("clob", $this->getInstruction()),
"title" => array("text", $this->getTitle()),
"start_time" => array("integer", $this->getStartTime()),
"order_nr" => array("integer", $this->getOrderNr()),
"mandatory" => array("integer", $this->getMandatory()),
"type" => array("integer", $this->getType())
));
$this->setId($next_id);
$exc = new ilObjExercise($this->getExerciseId(), false);
$exc->updateAllUsersStatus();
}

+ Here is the call graph for this function:

ilExAssignment::saveAssOrderOfExercise (   $a_ex_id,
  $a_order 
)

Save ordering of all assignments of an exercise.

Definition at line 481 of file class.ilExAssignment.php.

References $t.

Referenced by ilObjExerciseGUI\saveAssignmentOrderObject().

{
global $ilDB;
$result_order = array();
asort($a_order);
$nr = 10;
foreach ($a_order as $k => $v)
{
// the check for exc_id is for security reasons. ass ids are unique.
$ilDB->manipulate($t = "UPDATE exc_assignment SET ".
" order_nr = ".$ilDB->quote($nr, "integer").
" WHERE id = ".$ilDB->quote((int) $k, "integer").
" AND exc_id = ".$ilDB->quote((int) $a_ex_id, "integer")
);
$nr+=10;
}
}

+ Here is the caller graph for this function:

ilExAssignment::sendNotification (   $a_exc_ref_id,
  $a_user_id,
  $a_action 
)

Send notification about team status.

Parameters
int$a_exc_ref_id
int$a_user_id
string$a_action

Definition at line 2018 of file class.ilExAssignment.php.

References $ilUser, $ret, ilLanguageFactory\_getLanguageOfUser(), ilLink\_getStaticLink(), ilObjUser\_lookupFullname(), ilObjUser\_lookupLogin(), ilObject\_lookupTitle(), getExerciseId(), ilUserUtil\getNamePresentation(), and getTitle().

Referenced by addTeamMember(), and removeTeamMember().

{
global $ilUser;
// no need to notify current user
if($ilUser->getId() == $a_user_id)
{
return;
}
include_once "./Services/Mail/classes/class.ilMail.php";
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/Language/classes/class.ilLanguageFactory.php";
include_once("./Services/User/classes/class.ilUserUtil.php");
include_once("./Services/Link/classes/class.ilLink.php");
$link = ilLink::_getStaticLink($a_exc_ref_id);
// use language of recipient to compose message
$ulng->loadLanguageModule('exc');
$subject = sprintf($ulng->txt('exc_team_notification_subject_'.$a_action), $this->getTitle());
$message = sprintf($ulng->txt('exc_team_notification_salutation'), ilObjUser::_lookupFullname($a_user_id))."\n\n";
$message .= $ulng->txt('exc_team_notification_body_'.$a_action)."\n\n";
$message .= $ulng->txt('obj_exc').": ".ilObject::_lookupTitle($this->getExerciseId())."\n";
$message .= $ulng->txt('exc_assignment').": ".$this->getTitle()."\n";
$message .= $ulng->txt('exc_team_notification_changed_by').": ".ilUserUtil::getNamePresentation($ilUser->getId())."\n\n";
$message .= $ulng->txt('exc_team_notification_link').": ".$link;
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->appendInstallationSignature(true);
$ret = $mail_obj->sendMail(ilObjUser::_lookupLogin($a_user_id),
"", "", $subject, $message, array(), array("system"));
// var_dump($ret);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::setDeadline (   $a_val)

Set deadline (timestamp)

Parameters
intdeadline (timestamp)

Definition at line 103 of file class.ilExAssignment.php.

Referenced by read().

{
$this->deadline = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setExerciseId (   $a_val)

Set exercise id.

Parameters
intexercise id

Definition at line 63 of file class.ilExAssignment.php.

Referenced by read().

{
$this->exc_id = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setId (   $a_val)

Set assignment id.

Parameters
intassignment id

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

Referenced by __construct(), and save().

{
$this->id = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setInstruction (   $a_val)

Set instruction.

Parameters
stringinstruction

Definition at line 123 of file class.ilExAssignment.php.

Referenced by read().

{
$this->instruction = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setMandatory (   $a_val)

Set mandatory.

Parameters
intmandatory

Definition at line 163 of file class.ilExAssignment.php.

Referenced by read().

{
$this->mandatory = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setOrderNr (   $a_val)

Set order nr.

Parameters
intorder nr

Definition at line 183 of file class.ilExAssignment.php.

Referenced by read(), and save().

{
$this->order_nr = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setStartTime (   $a_val)

Set start time (timestamp)

Parameters
intstart time (timestamp)

Definition at line 83 of file class.ilExAssignment.php.

Referenced by read().

{
$this->start_time = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setTitle (   $a_val)

Set title.

Parameters
stringtitle

Definition at line 143 of file class.ilExAssignment.php.

Referenced by read().

{
$this->title = $a_val;
}

+ Here is the caller graph for this function:

ilExAssignment::setType (   $a_value)

Set type.

Parameters
int$a_value

Definition at line 203 of file class.ilExAssignment.php.

References isValidType().

Referenced by __construct(), and read().

{
if($this->isValidType($a_value))
{
$this->type = (int)$a_value;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::update ( )

Update.

Definition at line 295 of file class.ilExAssignment.php.

References getDeadline(), getExerciseId(), getId(), getInstruction(), getMandatory(), getOrderNr(), getStartTime(), getTitle(), and getType().

{
global $ilDB;
$ilDB->update("exc_assignment",
array(
"exc_id" => array("integer", $this->getExerciseId()),
"time_stamp" => array("integer", $this->getDeadline()),
"instruction" => array("clob", $this->getInstruction()),
"title" => array("text", $this->getTitle()),
"start_time" => array("integer", $this->getStartTime()),
"order_nr" => array("integer", $this->getOrderNr()),
"mandatory" => array("integer", $this->getMandatory()),
"type" => array("integer", $this->getType())
),
array(
"id" => array("integer", $this->getId()),
));
$exc = new ilObjExercise($this->getExerciseId(), false);
$exc->updateAllUsersStatus();
}

+ Here is the call graph for this function:

ilExAssignment::updateAssMemberField (   $a_ass_id,
  $a_user_id,
  $a_field,
  $a_value,
  $a_type 
)
private

Update a field value of ass/member table.

Definition at line 560 of file class.ilExAssignment.php.

Referenced by updateCommentForUser(), updateMarkOfUser(), and updateStatusTimeOfUser().

{
global $ilDB;
$ilDB->manipulate("UPDATE exc_mem_ass_status SET ".
" ".$a_field." = ".$ilDB->quote($a_value, $a_type).
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer")
);
}

+ Here is the caller graph for this function:

ilExAssignment::updateCommentForUser (   $a_ass_id,
  $a_user_id,
  $a_value 
)

Update comment.

Definition at line 596 of file class.ilExAssignment.php.

References updateAssMemberField().

Referenced by ilObjExerciseGUI\saveStatusObject(), and ilExerciseXMLParser\updateMarking().

{
ilExAssignment::updateAssMemberField($a_ass_id, $a_user_id,
"u_comment", $a_value, "text");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateMarkOfUser (   $a_ass_id,
  $a_user_id,
  $a_value 
)

Update mark.

Definition at line 613 of file class.ilExAssignment.php.

References updateAssMemberField().

Referenced by ilObjExerciseGUI\saveStatusObject(), and ilExerciseXMLParser\updateMarking().

{
ilExAssignment::updateAssMemberField($a_ass_id, $a_user_id,
"mark", $a_value, "text");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateNoticeForUser (   $a_ass_id,
  $a_user_id,
  $a_notice 
)

was: setNoticeForMember($a_member_id,$a_notice)

Definition at line 1478 of file class.ilExAssignment.php.

References ilUtil\now().

Referenced by ilObjExerciseGUI\saveStatusObject(), and ilExerciseXMLParser\updateMarking().

{
global $ilDB;
// #12181
$ilDB->manipulate("UPDATE exc_mem_ass_status".
" SET notice = ".$ilDB->quote($a_notice, "text").
",status_time= ".$ilDB->quote(ilUtil::now(), "timestamp").
" WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer").
" AND usr_id = ".$ilDB->quote($a_user_id, "integer").
" AND ".$ilDB->equalsNot("notice", $a_notice, "text", true));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateStatusFeedbackForUser (   $a_ass_id,
  $a_user_id,
  $a_status 
)

was: setStatusFeedbackForMember($a_member_id,$a_status)

Definition at line 758 of file class.ilExAssignment.php.

References ilUtil\now().

Referenced by ilObjExerciseGUI\redirectFeedbackMailObject().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_mem_ass_status ".
"SET feedback = %s, status_time= %s, feedback_time = %s ".
" WHERE ass_id = %s AND usr_id = %s",
array("integer", "timestamp", "timestamp", "integer", "integer"),
array((int) $a_status, ilUtil::now(), ($a_status ? ilUtil::now() : null),
$a_ass_id, $a_user_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateStatusOfUser (   $a_ass_id,
  $a_user_id,
  $a_status 
)

was: setStatusForMember($a_member_id,$a_status)

Definition at line 635 of file class.ilExAssignment.php.

References ilUtil\now(), and ilObjExercise\updateUserStatus().

Referenced by deleteAllDeliveredFilesOfUser(), ilObjExercise\handleSubmission(), ilObjExerciseGUI\saveStatusObject(), and ilExerciseXMLParser\updateMarking().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_mem_ass_status ".
"SET status = %s, status_time= %s ".
" WHERE ass_id = %s AND usr_id = %s AND status <> %s ",
array("text", "timestamp", "integer", "integer", "text"),
array($a_status, ilUtil::now(), $a_ass_id, $a_user_id, $a_status));
$ass = new ilExAssignment($a_ass_id);
$exc = new ilObjExercise($ass->getExerciseId(), false);
$exc->updateUserStatus($a_user_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateStatusReturnedForUser (   $a_ass_id,
  $a_user_id,
  $a_status 
)

was: setStatusReturnedForMember($a_member_id,$a_status)

Definition at line 721 of file class.ilExAssignment.php.

References ilUtil\now().

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

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_mem_ass_status ".
"SET returned = %s, status_time= %s ".
" WHERE ass_id = %s AND usr_id = %s",
array("integer", "timestamp", "integer", "integer"),
array((int) $a_status, ilUtil::now(),
$a_ass_id, $a_user_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateStatusSentForUser (   $a_ass_id,
  $a_user_id,
  $a_status 
)

was: setStatusSentForMember($a_member_id,$a_status)

Definition at line 684 of file class.ilExAssignment.php.

References ilUtil\now().

Referenced by ilObjExercise\sendAssignment().

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_mem_ass_status ".
"SET sent = %s, status_time= %s, sent_time = %s ".
" WHERE ass_id = %s AND usr_id = %s ",
array("integer", "timestamp", "timestamp", "integer", "integer"),
array((int) $a_status, ilUtil::now(), ($a_status ? ilUtil::now() : null),
$a_ass_id, $a_user_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateStatusTimeOfUser (   $a_ass_id,
  $a_user_id 
)

was: updateStatusTimeForMember($a_user_id)

Definition at line 653 of file class.ilExAssignment.php.

References ilUtil\now(), and updateAssMemberField().

Referenced by ilObjExerciseGUI\saveStatusObject().

{
ilExAssignment::updateAssMemberField($a_ass_id, $a_user_id,
"status_time", ilUtil::now(), "timestamp");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::updateTutorDownloadTime (   $a_exc_id,
  $a_ass_id,
  $a_user_id 
)

was: updateTutorDownloadTime($member_id)

Definition at line 1149 of file class.ilExAssignment.php.

References $ilUser, and ilUtil\now().

Referenced by deliverReturnedFiles(), and ilObjExerciseGUI\downloadAllObject().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExAssignment::uploadAssignmentFiles (   $a_files)

Upload assignment files (from creation form)

Definition at line 1741 of file class.ilExAssignment.php.

References getExerciseId(), and getId().

{
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$storage = new ilFSStorageExercise($this->getExerciseId(), $this->getId());
$storage->create();
$storage->uploadAssignmentFiles($a_files);
}

+ Here is the call graph for this function:

static ilExAssignment::writeTeamLog (   $a_team_id,
  $a_action,
  $a_details = null 
)
static

Add entry to team log.

Parameters
int$a_team_id
int$a_action
string$a_details

Definition at line 1973 of file class.ilExAssignment.php.

References $ilUser.

Referenced by addTeamMember(), deleteDeliveredFiles(), ilObjExercise\deliverFile(), getTeamId(), and removeTeamMember().

{
global $ilDB, $ilUser;
$fields = array(
"team_id" => array("integer", $a_team_id),
"user_id" => array("integer", $ilUser->getId()),
"action" => array("integer", $a_action),
"details" => array("text", $a_details),
"tstamp" => array("integer", time())
);
$ilDB->insert("il_exc_team_log", $fields);
}

+ Here is the caller graph for this function:

Field Documentation

const ilExAssignment::TEAM_LOG_ADD_FILE = 4
const ilExAssignment::TEAM_LOG_ADD_MEMBER = 2

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

Referenced by ilExAssignmentTeamLogTableGUI\getItems().

const ilExAssignment::TEAM_LOG_CREATE_TEAM = 1

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

Referenced by ilExAssignmentTeamLogTableGUI\getItems().

const ilExAssignment::TEAM_LOG_REMOVE_FILE = 5
const ilExAssignment::TEAM_LOG_REMOVE_MEMBER = 3

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

Referenced by ilExAssignmentTeamLogTableGUI\getItems().


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