ILIAS  Release_4_2_x_branch Revision 61807
 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)
 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)

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.

Data Fields

const TYPE_UPLOAD = 1
const TYPE_BLOG = 2
const TYPE_PORTFOLIO = 3

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 20 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 1374 of file class.ilExAssignment.php.

References $ilDB, $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::cloneAssignmentsOfExercise (   $a_old_exc_id,
  $a_new_exc_id 
)

Clone assignments of exercise.

Parameters
@return

Definition at line 362 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 517 of file class.ilExAssignment.php.

References $ilDB.

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 1576 of file class.ilExAssignment.php.

References $ilDB.

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 1556 of file class.ilExAssignment.php.

References $ilDB, and 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 312 of file class.ilExAssignment.php.

References $ilDB, and 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 943 of file class.ilExAssignment.php.

References $d, $filename, and $ilDB.

{
global $ilDB;
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
// 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))
{
$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
$ilDB->manipulate($d = "DELETE FROM exc_returned WHERE ".
" obj_id = ".$ilDB->quote($a_exc_id, "integer").
" AND user_id = ".$ilDB->quote($a_user_id, "integer")
);
}
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 894 of file class.ilExAssignment.php.

References $filename, $ilDB, $result, and $row.

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))
{
$result = $ilDB->query("SELECT * FROM exc_returned WHERE user_id = ".
$ilDB->quote($a_user_id, "integer")." AND ".
$ilDB->in("returned_id", $file_id_array, false, "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 user_id = ".
$ilDB->quote($a_user_id, "integer")." AND ".
$ilDB->in("returned_id", $file_id_array, false, "integer"));
//returned_id IN ("
//.implode(ilUtil::quoteArray($file_id_array) ,",").")",
//$this->ilias->db->quote($a_member_id . "")
// delete the files
foreach ($result_array as $key => $value)
{
if($value["filename"])
{
$filename = $fs->getAbsoluteSubmissionPath().
"/".$value["user_id"]."/".basename($value["filename"]);
unlink($filename);
}
}
}
}
}

+ 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 977 of file class.ilExAssignment.php.

References $dir, $filename, $ilDB, $query, $result, $row, ilObjUser\_lookupName(), ilObject\_lookupTitle(), downloadMultipleFiles(), downloadSingleFile(), lookupTitle(), and updateTutorDownloadTime().

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

{
global $ilUser, $ilDB;
// 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 ".
" usr_id = ".$ilDB->quote($a_user_id, "integer")." AND ".
" tutor_id = ".$ilDB->quote($ilUser->getId(), "integer");
$lu_set = $ilDB->query($q);
if ($lu_rec = $ilDB->fetchAssoc($lu_set))
{
if ($lu_rec["download_time"] > 0)
{
$and_str = " AND ts > ".$ilDB->quote($lu_rec["download_time"], "timestamp");
}
}
}
ilExAssignment::updateTutorDownloadTime($a_exc_id, $a_ass_id, $a_user_id);
$query = sprintf("SELECT * FROM exc_returned WHERE ass_id = %s AND user_id = %s".
$and_str,
$ilDB->quote($a_ass_id, "integer"),
$ilDB->quote($a_user_id, "integer"));
$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($a_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, $a_user_id,
$row["filename"], $row["filetitle"]);
}
else if ($count > 0)
{
$array_files = array();
$filename = "";
while ($row = $ilDB->fetchAssoc($result))
{
array_push($array_files, basename($row["filename"]));
// $filename = $row["filename"];
// $pathinfo = pathinfo($filename);
// $dir = $pathinfo["dirname"];
// $file = $pathinfo["basename"];
// array_push($array_files, $file);
}
$pathinfo = pathinfo($filename);
$dir = $pathinfo["dirname"];
ilExAssignment::downloadMultipleFiles($a_exc_id, $a_ass_id, $array_files, $a_user_id);
}
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 1231 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);
foreach ($sourcefiles as $sourcefile) {
if ($sourcefile == "." || $sourcefile == "..")
{
continue;
}
$targetfile = trim(basename($sourcefile));
$pos = strpos($targetfile, "_");
if ($pos !== false)
{
$targetfile= substr($targetfile, $pos + 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 
)

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

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

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

Referenced by deliverReturnedFiles(), and downloadSelectedFiles().

{
global $lng, $ilObjDataCache;
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$fs = new ilFSStorageExercise($a_exc_id, $a_ass_id);
$pathname = $fs->getAbsoluteSubmissionPath().
"/".$a_user_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)
{
$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
foreach ($array_filenames as $key => $filename)
{
// remove timestamp
$newFilename = trim($filename);
$pos = strpos($newFilename , "_");
if ($pos === false)
{
} else
{
$newFilename= substr($newFilename, $pos + 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));
$array_filenames[$key] = ilUtil::escapeShellArg($deliverFilename.DIRECTORY_SEPARATOR.basename($newFilename)); //$array_filenames[$key]);
}
chdir($tmpdir);
$zipcmd = $zip." ".ilUtil::escapeShellArg($tmpzipfile)." ".join($array_filenames, " ");
//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 1078 of file class.ilExAssignment.php.

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

Referenced by ilObjExerciseGUI\downloadObject().

{
global $ilDB;
if (count($array_file_id))
{
$result = $ilDB->query("SELECT * FROM exc_returned WHERE ".
$ilDB->in("returned_id", $array_file_id, false, "integer").
" AND user_id = ".$ilDB->quote($a_user_id));
if ($ilDB->numRows($result))
{
$array_found = array();
while ($row = $ilDB->fetchAssoc($result))
{
$row["timestamp"] = $row["ts"];
array_push($array_found, $row);
}
if (count($array_found) == 1)
{
// 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, $a_user_id,
$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);
array_push($filenames, basename($value["filename"]));
}
$filenames, $a_user_id);
}
}
}
}

+ 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 1139 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 829 of file class.ilExAssignment.php.

References $ilDB, $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 327 of file class.ilExAssignment.php.

References $data, and $ilDB.

Referenced by ilAssignmentsTableGUI\__construct(), ilExGradesTableGUI\__construct(), ilExParticipantTableGUI\__construct(), 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:

ilExAssignment::getDeadline ( )

Get deadline (timestamp)

Returns
int deadline (timestamp)

Definition at line 106 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 856 of file class.ilExAssignment.php.

References $ilDB, $result, and $row.

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

{
global $ilDB;
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$fs = new ilFSStorageExercise($a_exc_id, $a_ass_id);
$result = $ilDB->queryF("SELECT * FROM exc_returned WHERE ass_id = %s AND user_id = %s ORDER BY ts",
array("integer", "integer"),
array($a_ass_id, $a_user_id));
$delivered_files = array();
if ($ilDB->numRows($result))
{
while ($row = $ilDB->fetchAssoc($result))
{
if($a_filter_empty_filename && !$row["filename"])
{
continue;
}
$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 caller graph for this function:

ilExAssignment::getExerciseId ( )

Get exercise id.

Returns
int exercise id

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

Referenced by delete(), save(), 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 395 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 46 of file class.ilExAssignment.php.

Referenced by update(), and uploadAssignmentFiles().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilExAssignment::getInstruction ( )

Get instruction.

Returns
string instruction

Definition at line 126 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 1398 of file class.ilExAssignment.php.

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

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

{
global $ilDB, $lng;
$q = "SELECT obj_id,user_id,ts FROM exc_returned ".
"WHERE ass_id = ".$ilDB->quote($a_ass_id, "integer")." AND user_id = ".
$ilDB->quote($a_user_id, "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 166 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 1508 of file class.ilExAssignment.php.

References $ilDB, 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::getOrderNr ( )

Get order nr.

Returns
int order nr

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

Referenced by save(), and update().

{
return $this->start_time;
}

+ Here is the caller graph for this function:

ilExAssignment::getTitle ( )

Get title.

Returns
string title

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

References $title.

Referenced by save(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilExAssignment::getType ( )

Get type.

Returns
int

Definition at line 209 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 815 of file class.ilExAssignment.php.

References $ilDB, and $result.

{
global $ilDB;
$result = $ilDB->queryF("SELECT returned_id FROM exc_returned WHERE ass_id = %s AND user_id = %s",
array("integer", "integer"),
array($ass_id, $a_user_id));
return $ilDB->numRows($result);
}
ilExAssignment::isValidType (   $a_value)

Is given type valid?

Parameters
int$a_value
Returns
bool

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

Referenced by setType().

{
if(in_array((int)$a_value, array(self::TYPE_UPLOAD, self::TYPE_BLOG, self::TYPE_PORTFOLIO)))
{
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 441 of file class.ilExAssignment.php.

References $ilDB.

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 1423 of file class.ilExAssignment.php.

References $ilDB.

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 424 of file class.ilExAssignment.php.

References $ilDB, $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 536 of file class.ilExAssignment.php.

References $ilDB.

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 580 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilExerciseMemberTableGUI\fillRow(), ilExParticipantTableGUI\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 774 of file class.ilExAssignment.php.

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

Referenced by ilExerciseMemberTableGUI\fillRow(), and ilExParticipantTableGUI\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 597 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilObjExercise\exportGradesExcel(), ilExerciseMemberTableGUI\fillRow(), ilExParticipantTableGUI\fillRow(), ilExGradesTableGUI\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 405 of file class.ilExAssignment.php.

References $ilDB.

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 1481 of file class.ilExAssignment.php.

References $ilDB.

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

{
global $ilDB, $ilUser;
$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 exc_returned.user_id = ".$ilDB->quote($member_id, "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 caller graph for this function:

ilExAssignment::lookupNoticeOfUser (   $a_ass_id,
  $a_user_id 
)

was: getNoticeByMember($a_member_id)

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

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilExerciseMemberTableGUI\fillRow(), and ilExParticipantTableGUI\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 765 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 742 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 614 of file class.ilExAssignment.php.

References lookupAssMemberField().

Referenced by ilExerciseXMLWriter\attachMarking(), ilObjExercise\determinStatusOfUser(), ilObjExercise\exportGradesExcel(), ilExerciseMemberTableGUI\fillRow(), ilExParticipantTableGUI\fillRow(), ilExGradesTableGUI\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 705 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 668 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 783 of file class.ilExAssignment.php.

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

Referenced by ilExerciseMemberTableGUI\fillRow(), and ilExParticipantTableGUI\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 465 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 1448 of file class.ilExAssignment.php.

References $ilDB, and $lng.

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

{
global $ilDB, $lng;
$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 exc_returned.user_id=".
$ilDB->quote($member_id, "integer");
$usr_set = $ilDB->query($q);
$array = $ilDB->fetchAssoc($usr_set);
if (count($array)==0)
{
return 0;
}
else
{
return 1;
}
}

+ Here is the caller graph for this function:

ilExAssignment::orderAssByDeadline (   $a_ex_id)

Order assignments by deadline date.

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

References $ilDB.

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 232 of file class.ilExAssignment.php.

References $ilDB, 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::save ( )

Save assignment.

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

References $ilDB, 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 473 of file class.ilExAssignment.php.

References $ilDB, and $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::setDeadline (   $a_val)

Set deadline (timestamp)

Parameters
intdeadline (timestamp)

Definition at line 96 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 56 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 36 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 116 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 156 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 176 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 76 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 136 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 196 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 287 of file class.ilExAssignment.php.

References $ilDB, 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 552 of file class.ilExAssignment.php.

References $ilDB.

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 588 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 605 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 1358 of file class.ilExAssignment.php.

References $ilDB, and ilUtil\now().

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

{
global $ilDB;
$ilDB->manipulateF("UPDATE exc_mem_ass_status ".
"SET notice = %s, status_time= %s ".
" WHERE ass_id = %s AND usr_id = %s AND ".
$ilDB->equalsNot("notice", $a_notice, "text", true),
array("text", "timestamp", "integer", "integer"),
array($a_notice, 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::updateStatusFeedbackForUser (   $a_ass_id,
  $a_user_id,
  $a_status 
)

was: setStatusFeedbackForMember($a_member_id,$a_status)

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

References $ilDB, and 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 627 of file class.ilExAssignment.php.

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

Referenced by 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 713 of file class.ilExAssignment.php.

References $ilDB, and ilUtil\now().

Referenced by ilObjExercise\addResourceObject(), ilObjExercise\deleteDeliveredFiles(), and ilObjExercise\deliverFile().

{
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 676 of file class.ilExAssignment.php.

References $ilDB, and 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 645 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 1060 of file class.ilExAssignment.php.

References $ilDB, 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 1599 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:

Field Documentation


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