ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjExercise Class Reference

Class ilObjExercise. More...

+ Inheritance diagram for ilObjExercise:
+ Collaboration diagram for ilObjExercise:

Public Member Functions

 ilObjExercise ($a_id=0, $a_call_by_reference=true)
 Constructor public.
 setDate ($a_hour, $a_minutes, $a_day, $a_month, $a_year)
 getTimestamp ()
 setTimestamp ($a_timestamp)
 setInstruction ($a_instruction)
 getInstruction ()
 setPassMode ($a_val)
 Set pass mode (all | nr)
 getPassMode ()
 Get pass mode (all | nr)
 setPassNr ($a_val)
 Set number of assignments that must be passed to pass the exercise.
 getPassNr ()
 Get number of assignments that must be passed to pass the exercise.
 setShowSubmissions ($a_val)
 Set whether submissions of learners should be shown to other learners after deadline.
 getShowSubmissions ()
 Get whether submissions of learners should be shown to other learners after deadline.
 checkDate ()
 deliverFile ($a_http_post_files, $a_ass_id, $user_id, $unzip=false)
 Save submitted file of user.
 addUploadedFile ($a_http_post_files, $unzipUploadedFile=false)
 Upload assigment files.
 deleteFiles ($a_files)
 saveData ()
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone exercise (no member data)
 deleteDeliveredFiles ($a_exc_id, $a_ass_id, $file_id_array, $user_id)
 Deletes already delivered files.
 deliverReturnedFiles ($user_id)
 Delivers the returned files of an user.
 delete ()
 delete course and all related data
 notify ($a_event, $a_ref_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event happend, each object may decide how it reacts.
 read ()
 update ()
 update object in db
 sendAssignment ($a_exc_id, $a_ass_id, $a_members)
 send exercise per mail to members
 _lookupStatusTime ($exc_id, $member_id)
 Get time when exercise has been set to solved.
 __formatBody ($a_ass_id)
 __formatSubject ()
 __formatRecipients ($a_members)
 _checkCondition ($a_exc_id, $a_operator, $a_value, $a_usr_id=0)
 processUploadedFile ($fileTmp, $storageMethod, $persistentErrorMessage, $a_ass_id)
 processes errorhandling etc for uploaded archive
 determinStatusOfUser ($a_user_id=0)
 Determine status of user.
 updateUserStatus ($a_user_id=0)
 Update exercise status of user.
 updateAllUsersStatus ()
 Update status of all users.
 exportGradesExcel ()
 Exports grades as excel.
 sendFeedbackFileNotification ($a_feedback_file, $a_user_id, $a_ass_id)
 Send feedback file notification to user.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 _lookupObjIdByImportId ($a_import_id)
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ()
 create
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupDescription ($a_id)
 lookup object description
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _lookupObjectId ($a_ref_id)
 lookup object id
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public
 createRoleFolder ()
 creates a local role folder
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.

Static Public Member Functions

static _fixFilename ($a_filename)
 This function fixes filenames.
static _fixFilenameArray ($a_array)
 Iterates an associative array and fixes all fields with the key "filename" using the _fixFilename() method.
- Static Public Member Functions inherited from ilObject
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupObjId ($a_id)
static _lookupType ($a_id, $a_reference=false)
 lookup object type
 _exists ($a_id, $a_reference=false)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.

Data Fields

 $file_obj
 $members_obj
 $files
 $timestamp
 $hour
 $minutes
 $day
 $month
 $year
 $instruction
- Data Fields inherited from ilObject
const TITLE_LENGTH = 128
 max length of object title
 $ilias
 $lng
 $id
 $ref_id
 $type
 $title
 $untranslatedTitle
 $desc
 $long_desc
 $owner
 $create_date
 $last_update
 $import_id
 $register = false
 $referenced
 $objectList
 $max_title
 $max_desc
 $add_dots
 $obj_data_record
 object_data record

Detailed Description

Class ilObjExercise.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilObjExercise.php 32741 2012-01-24 09:19:36Z hschottm

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

Member Function Documentation

ilObjExercise::__formatBody (   $a_ass_id)

Definition at line 487 of file class.ilObjExercise.php.

References ilObject\$lng, ilFormat\formatDate(), and ilObject\getType().

Referenced by sendAssignment().

{
global $lng;
include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
$ass = new ilExAssignment($a_ass_id);
$body = $ass->getInstruction();
$body .= "\n\n";
$body .= $lng->txt("exc_edit_until") . ": ".
ilFormat::formatDate(date("Y-m-d H:i:s",$ass->getDeadline()), "datetime", true);
$body .= "\n\n";
$body .= ILIAS_HTTP_PATH.
"/goto.php?target=".
$this->getType().
"_".$this->getRefId()."&client_id=".CLIENT_ID;
return $body;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjExercise::__formatRecipients (   $a_members)

Definition at line 512 of file class.ilObjExercise.php.

References ilObjectFactory\getInstanceByObjId().

Referenced by sendAssignment().

{
foreach($a_members as $member_id => $value)
{
$tmp_obj = ilObjectFactory::getInstanceByObjId($member_id);
$tmp_members[] = $tmp_obj->getLogin();
unset($tmp_obj);
}
return implode(',',$tmp_members ? $tmp_members : array());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjExercise::__formatSubject ( )

Definition at line 507 of file class.ilObjExercise.php.

References ilObject\getDescription(), and ilObject\getTitle().

Referenced by sendAssignment().

{
return $subject = $this->getTitle()." (".$this->getDescription().")";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjExercise::_checkCondition (   $a_exc_id,
  $a_operator,
  $a_value,
  $a_usr_id = 0 
)

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

References ilExerciseMembers\_lookupStatus().

{
global $ilUser;
$a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
switch($a_operator)
{
case 'passed':
if (ilExerciseMembers::_lookupStatus($a_exc_id, $a_usr_id) == "passed")
{
return true;
}
else
{
return false;
}
break;
default:
return true;
}
return true;
}

+ Here is the call graph for this function:

static ilObjExercise::_fixFilename (   $a_filename)
static

This function fixes filenames.

Prior to ILIAS 3.10.0 filenames have been stored with full path in exc_returned.filename, e.g. /opt/ilias/my_client/exercise/547/157/20070813113926_README.doc

Problems occur, if the server is moved from one location to another. We do the following: The filename will be parsed and if it contains the string "/exercise/" we truncate everything before "/exercise/" and replace it with the current CLIENT_DATA_DIR.

Definition at line 614 of file class.ilObjExercise.php.

Referenced by _fixFilenameArray().

{
$ex_pos = strrpos($a_filename, "/exercise/");
if ($ex_pos > 0)
{
$a_filename = CLIENT_DATA_DIR.substr($a_filename, $ex_pos);
}
return $a_filename;
}

+ Here is the caller graph for this function:

static ilObjExercise::_fixFilenameArray (   $a_array)
static

Iterates an associative array and fixes all fields with the key "filename" using the _fixFilename() method.

Definition at line 628 of file class.ilObjExercise.php.

References _fixFilename().

{
if (is_array($a_array))
{
foreach ($a_array as $k => $v)
{
if ($v["filename"] != "")
{
$a_array[$k]["filename"] = ilObjExercise::_fixFilename($a_array[$k]["filename"]);
}
}
}
return $a_array;
}

+ Here is the call graph for this function:

ilObjExercise::_lookupStatusTime (   $exc_id,
  $member_id 
)

Get time when exercise has been set to solved.

Definition at line 469 of file class.ilObjExercise.php.

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

{
global $ilDB, $lng;
$q = "SELECT * ".
"FROM exc_members ".
"WHERE obj_id= ".$ilDB->quote($exc_id, "integer").
" AND usr_id= ".$ilDB->quote($member_id, "integer");
$set = $ilDB->query($q);
if ($rec = $ilDB->fetchAssoc($set))
{
return ilUtil::getMySQLTimestamp($rec["status_time"]);
}
}

+ Here is the call graph for this function:

ilObjExercise::addUploadedFile (   $a_http_post_files,
  $unzipUploadedFile = false 
)

Upload assigment files.

Definition at line 190 of file class.ilObjExercise.php.

References ilObject\$lng, and processUploadedFile().

{
global $lng;
if ($unzipUploadedFile && preg_match("/zip/", $a_http_post_files["type"]) == 1)
{
$this->processUploadedFile($a_http_post_files["tmp_name"], "storeUploadedFile", true);
return true;
}
else
{
$this->file_obj->storeUploadedFile($a_http_post_files, true);
return true;
}
}

+ Here is the call graph for this function:

ilObjExercise::checkDate ( )

Definition at line 140 of file class.ilObjExercise.php.

{
return $this->hour == (int) date("H",$this->timestamp) and
$this->minutes == (int) date("i",$this->timestamp) and
$this->day == (int) date("d",$this->timestamp) and
$this->month == (int) date("m",$this->timestamp) and
$this->year == (int) date("Y",$this->timestamp);
}
ilObjExercise::cloneObject (   $a_target_id,
  $a_copy_id = 0 
)

Clone exercise (no member data)

public

Parameters
inttarget ref_id
intcopy id

Reimplemented from ilObject.

Definition at line 241 of file class.ilObjExercise.php.

References $ilDB, ilExAssignment\cloneAssignmentsOfExercise(), ilObject\getId(), getInstruction(), getPassMode(), getPassNr(), getShowSubmissions(), and getTimestamp().

{
global $ilDB;
// Copy settings
$new_obj = parent::cloneObject($a_target_id,$a_copy_id);
$new_obj->setInstruction($this->getInstruction());
$new_obj->setTimestamp($this->getTimestamp());
$new_obj->setPassMode($this->getPassMode());
$new_obj->saveData();
$new_obj->setPassNr($this->getPassNr());
$new_obj->setShowSubmissions($this->getShowSubmissions());
$new_obj->update();
// Copy assignments
include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
ilExAssignment::cloneAssignmentsOfExercise($this->getId(), $new_obj->getId());
//$tmp_file_obj =& new ilFileDataExercise($this->getId());
//$tmp_file_obj->ilClone($new_obj->getId());
//unset($tmp_file_obj);
// Copy learning progress settings
include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
$obj_settings = new ilLPObjSettings($this->getId());
$obj_settings->cloneSettings($new_obj->getId());
unset($obj_settings);
return $new_obj;
}

+ Here is the call graph for this function:

ilObjExercise::delete ( )

delete course and all related data

public

Returns
boolean true if all object data were removed; false if only a references were removed

Reimplemented from ilObject.

Definition at line 304 of file class.ilObjExercise.php.

References $ilDB, ilObject\getId(), ilNotification\removeForObject(), and ilNotification\TYPE_EXERCISE_SUBMISSION.

{
global $ilDB;
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
// put here course specific stuff
$ilDB->manipulate("DELETE FROM exc_data ".
"WHERE obj_id = ".$ilDB->quote($this->getId(), "integer"));
//$this->ilias->db->query($query);
//$this->file_obj->delete();
//$this->members_obj->delete();
// remove all notifications
include_once "./Services/Notification/classes/class.ilNotification.php";
return true;
}

+ Here is the call graph for this function:

ilObjExercise::deleteDeliveredFiles (   $a_exc_id,
  $a_ass_id,
  $file_id_array,
  $user_id 
)

Deletes already delivered files.

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

Definition at line 277 of file class.ilObjExercise.php.

References ilExAssignment\getDeliveredFiles(), and ilExAssignment\updateStatusReturnedForUser().

{
ilExAssignment::deleteDeliveredFiles($a_exc_id, $a_ass_id, $file_id_array, $user_id);
// Finally update status 'returned' of member if no file exists
if(!count(ilExAssignment::getDeliveredFiles($a_exc_id, $a_ass_id, $user_id)))
{
}
}

+ Here is the call graph for this function:

ilObjExercise::deleteFiles (   $a_files)

Definition at line 207 of file class.ilObjExercise.php.

{
$this->file_obj->unlinkFiles($a_files);
}
ilObjExercise::deliverFile (   $a_http_post_files,
  $a_ass_id,
  $user_id,
  $unzip = false 
)

Save submitted file of user.

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

References $ilDB, $query, ilExerciseMembers\_writeReturned(), ilObject\getId(), ilUtil\now(), and ilExAssignment\updateStatusReturnedForUser().

{
global $ilDB;
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$storage = new ilFSStorageExercise($this->getId(), $a_ass_id);
$deliver_result = $storage->deliverFile($a_http_post_files, $user_id, $unzip);
//var_dump($deliver_result);
if ($deliver_result)
{
$next_id = $ilDB->nextId("exc_returned");
$query = sprintf("INSERT INTO exc_returned ".
"(returned_id, obj_id, user_id, filename, filetitle, mimetype, ts, ass_id) ".
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
$ilDB->quote($next_id, "integer"),
$ilDB->quote($this->getId(), "integer"),
$ilDB->quote($user_id, "integer"),
$ilDB->quote($deliver_result["fullname"], "text"),
$ilDB->quote($a_http_post_files["name"], "text"),
$ilDB->quote($deliver_result["mimetype"], "text"),
$ilDB->quote(ilUtil::now(), "timestamp"),
$ilDB->quote($a_ass_id, "integer")
);
$ilDB->manipulate($query);
if (!$this->members_obj->isAssigned($user_id))
{
$this->members_obj->assignMember($user_id);
}
ilExerciseMembers::_writeReturned($this->getId(), $user_id, 1);
}
return true;
}

+ Here is the call graph for this function:

ilObjExercise::deliverReturnedFiles (   $user_id)

Delivers the returned files of an user.

Parameters
numeric$user_idThe database id of the user public

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

{
require_once "./Services/Utilities/classes/class.ilUtil.php";
}
ilObjExercise::determinStatusOfUser (   $a_user_id = 0)

Determine status of user.

Definition at line 647 of file class.ilObjExercise.php.

References $ret, ilExAssignment\getAssignmentDataOfExercise(), ilObject\getId(), getPassMode(), getPassNr(), and ilExAssignment\lookupStatusOfUser().

Referenced by updateUserStatus().

{
global $ilUser;
if ($a_user_id == 0)
{
$a_user_id = $ilUser->getId();
}
include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
$passed_all_mandatory = true;
$failed_a_mandatory = false;
$cnt_passed = 0;
$cnt_notgraded = 0;
$passed_at_least_one = false;
foreach ($ass as $a)
{
$stat = ilExAssignment::lookupStatusOfUser($a["id"], $a_user_id);
if ($a["mandatory"] && ($stat == "failed" || $stat == "notgraded"))
{
$passed_all_mandatory = false;
}
if ($a["mandatory"] && ($stat == "failed"))
{
$failed_a_mandatory = true;
}
if ($stat == "passed")
{
$cnt_passed++;
}
if ($stat == "notgraded")
{
$cnt_notgraded++;
}
}
if (count($ass) == 0)
{
$passed_all_mandatory = false;
}
if ($this->getPassMode() != "nr")
{
//echo "5";
$overall_stat = "notgraded";
if ($failed_a_mandatory)
{
//echo "6";
$overall_stat = "failed";
}
else if ($passed_all_mandatory && $cnt_passed > 0)
{
//echo "7";
$overall_stat = "passed";
}
}
else
{
//echo "8";
$min_nr = $this->getPassNr();
$overall_stat = "notgraded";
//echo "*".$cnt_passed."*".$cnt_notgraded."*".$min_nr."*";
if ($failed_a_mandatory || ($cnt_passed + $cnt_notgraded < $min_nr))
{
//echo "9";
$overall_stat = "failed";
}
else if ($passed_all_mandatory && $cnt_passed >= $min_nr)
{
//echo "A";
$overall_stat = "passed";
}
}
$ret = array(
"overall_status" => $overall_stat,
"failed_a_mandatory" => $failed_a_mandatory);
//echo "<br>p:".$cnt_passed.":ng:".$cnt_notgraded;
//var_dump($ret);
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjExercise::exportGradesExcel ( )

Exports grades as excel.

Definition at line 771 of file class.ilObjExercise.php.

References $d, $data, ilLPMarks\_lookupMark(), ilObjUser\_lookupName(), ilExerciseMembers\_lookupStatus(), ilExcelUtils\ExcelAdapter(), ilUtil\getASCIIFilename(), ilExAssignment\getAssignmentDataOfExercise(), ilObject\getId(), ilObject\getTitle(), ilExAssignment\lookupMarkOfUser(), ilExAssignment\lookupStatusOfUser(), and ilUtil\sortArray().

{
include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
include_once "./Services/Excel/classes/class.ilExcelUtils.php";
// header row
$adapter->setCellValue(0, 0, $this->lng->txt("name"));
$cnt = 1;
foreach ($ass_data as $ass)
{
$adapter->setCellValue(0, $cnt, $cnt);
$cnt++;
}
$adapter->setCellValue(0, $cnt, $this->lng->txt("exc_total_exc"));
// data rows
$this->mem_obj = new ilExerciseMembers($this);
$getmems = $this->mem_obj->getMembers();
$mems = array();
foreach ($getmems as $user_id)
{
$mems[$user_id] = ilObjUser::_lookupName($user_id);
}
$mems = ilUtil::sortArray($mems, "lastname", "asc", false, true);
$data = array();
$row_cnt = 1;
foreach ($mems as $user_id => $d)
{
$col_cnt = 1;
// name
$adapter->setCellValue($row_cnt, 0,
$d["lastname"].", ".$d["firstname"]." [".$d["login"]."]");
reset($ass_data);
foreach ($ass_data as $ass)
{
$status = ilExAssignment::lookupStatusOfUser($ass["id"], $user_id);
$adapter->setCellValue($row_cnt, $col_cnt, $this->lng->txt("exc_".$status));
$col_cnt++;
}
// total status
$status = ilExerciseMembers::_lookupStatus($this->getId(), $user_id);
$adapter->setCellValue($row_cnt, $col_cnt, $this->lng->txt("exc_".$status));
$row_cnt++;
}
//
// mark
//
$adapter->addWorksheet();
$adapter->setActiveWorksheet($adapter->getWorksheetCount()-1);
// header row
$adapter->setCellValue(0, 0, $this->lng->txt("name"));
$cnt = 1;
foreach ($ass_data as $ass)
{
$adapter->setCellValue(0, $cnt, $cnt);
$cnt++;
}
$adapter->setCellValue(0, $cnt, $this->lng->txt("exc_total_exc"));
// data rows
$data = array();
$row_cnt = 1;
reset($mems);
foreach ($mems as $user_id => $d)
{
$col_cnt = 1;
$d = ilObjUser::_lookupName($user_id);
// name
$adapter->setCellValue($row_cnt, 0,
$d["lastname"].", ".$d["firstname"]." [".$d["login"]."]");
reset($ass_data);
foreach ($ass_data as $ass)
{
$adapter->setCellValue($row_cnt, $col_cnt,
ilExAssignment::lookupMarkOfUser($ass["id"], $user_id));
$col_cnt++;
}
// total mark
include_once 'Services/Tracking/classes/class.ilLPMarks.php';
$adapter->setCellValue($row_cnt, $col_cnt,
ilLPMarks::_lookupMark($user_id, $this->getId()));
$row_cnt++;
}
$exc_name = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->getTitle()));
$adapter->deliver($exc_name.".".$adapter->getFileExtension());
}

+ Here is the call graph for this function:

ilObjExercise::getInstruction ( )

Definition at line 69 of file class.ilObjExercise.php.

References $instruction.

Referenced by cloneObject(), saveData(), and update().

{
}

+ Here is the caller graph for this function:

ilObjExercise::getPassMode ( )

Get pass mode (all | nr)

Returns
string pass mode

Definition at line 89 of file class.ilObjExercise.php.

Referenced by cloneObject(), determinStatusOfUser(), saveData(), and update().

{
return $this->pass_mode;
}

+ Here is the caller graph for this function:

ilObjExercise::getPassNr ( )

Get number of assignments that must be passed to pass the exercise.

Returns
integer pass nr

Definition at line 109 of file class.ilObjExercise.php.

Referenced by cloneObject(), determinStatusOfUser(), saveData(), and update().

{
return $this->pass_nr;
}

+ Here is the caller graph for this function:

ilObjExercise::getShowSubmissions ( )

Get whether submissions of learners should be shown to other learners after deadline.

Returns
integer show submissions

Definition at line 129 of file class.ilObjExercise.php.

Referenced by cloneObject(), saveData(), and update().

{
return $this->show_submissions;
}

+ Here is the caller graph for this function:

ilObjExercise::getTimestamp ( )

Definition at line 57 of file class.ilObjExercise.php.

References $timestamp.

Referenced by cloneObject(), saveData(), and update().

{
}

+ Here is the caller graph for this function:

ilObjExercise::ilObjExercise (   $a_id = 0,
  $a_call_by_reference = true 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

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

References ilObject\ilObject(), and setPassMode().

{
$this->setPassMode("all");
$this->type = "exc";
$this->ilObject($a_id,$a_call_by_reference);
}

+ Here is the call graph for this function:

ilObjExercise::notify (   $a_event,
  $a_ref_id,
  $a_node_id,
  $a_params = 0 
)

notifys an object about an event occured Based on the event happend, each object may decide how it reacts.

public

Parameters
stringevent
integerreference id of object where the event occured
arraypasses optional paramters if required
Returns
boolean

Definition at line 339 of file class.ilObjExercise.php.

{
// object specific event handling
parent::notify($a_event,$a_ref_id,$a_node_id,$a_params);
}
ilObjExercise::processUploadedFile (   $fileTmp,
  $storageMethod,
  $persistentErrorMessage,
  $a_ass_id 
)

processes errorhandling etc for uploaded archive

Parameters
string$tmpFilepath and filename to uploaded file
string$storageMethoddeliverFile or storeUploadedFile
boolean$persistentErrorMessageDefines whether sendInfo will be persistent or not

Definition at line 556 of file class.ilObjExercise.php.

References $filename, ilObject\$lng, ilExerciseMembers\_writeReturned(), ilUtil\delDir(), ilObject\getId(), ilUtil\ilTempnam(), ilUtil\makeDir(), ilFileUtils\processZipFile(), ilFileUtils\recursive_dirscan(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilFileUtils\utf8_encode().

Referenced by addUploadedFile().

{
global $lng, $ilUser;
// Create unzip-directory
$newDir = ilUtil::ilTempnam();
ilUtil::makeDir($newDir);
include_once ("Services/Utilities/classes/class.ilFileUtils.php");
try
{
$processDone = ilFileUtils::processZipFile($newDir,$fileTmp, false);
ilFileUtils::recursive_dirscan($newDir, $filearray);
foreach ($filearray["file"] as $key => $filename)
{
$a_http_post_files["name"] = ilFileUtils::utf8_encode($filename);
$a_http_post_files["type"] = "other";
$a_http_post_files["tmp_name"] = $filearray["path"][$key]."/".$filename;
$a_http_post_files["error"] = 0;
$a_http_post_files["size"] = filesize($filearray["path"][$key]."/".$filename);
if ($storageMethod == "deliverFile")
{
$this->$storageMethod($a_http_post_files, $a_ass_id, $ilUser->id, true);
}
else if ($storageMethod == "storeUploadedFile")
{
$this->file_obj->$storageMethod($a_http_post_files, true, true);
}
}
ilExerciseMembers::_writeReturned($this->getId(), $ilUser->id, 1);
ilUtil::sendSuccess($this->lng->txt("file_added"),$persistentErrorMessage);
}
{
ilUtil::sendFailure($e->getMessage(), $persistentErrorMessage);
}
ilUtil::delDir($newDir);
return $processDone;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjExercise::read ( )

Definition at line 346 of file class.ilObjExercise.php.

References $ilDB, $query, $res, $row, ilObject\getId(), setInstruction(), setPassNr(), setShowSubmissions(), and setTimestamp().

{
global $ilDB;
$query = "SELECT * FROM exc_data ".
"WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
$this->setInstruction($row->instruction);
$this->setTimestamp($row->time_stamp);
$pm = ($row->pass_mode == "")
? "all"
: $row->pass_mode;
$this->setPassMode($pm);
$this->setShowSubmissions($row->show_submissions);
if ($row->pass_mode == "nr")
{
$this->setPassNr($row->pass_nr);
}
}
$this->members_obj = new ilExerciseMembers($this);
// GET FILE ASSIGNED TO EXERCISE
// $this->file_obj = new ilFileDataExercise($this->getId());
// $this->files = $this->file_obj->getFiles();
return true;
}

+ Here is the call graph for this function:

ilObjExercise::saveData ( )

Definition at line 212 of file class.ilObjExercise.php.

References $ilDB, ilObject\getId(), getInstruction(), getPassMode(), getPassNr(), getShowSubmissions(), and getTimestamp().

{
global $ilDB;
// SAVE ONLY EXERCISE SPECIFIC DATA
/*$query = "INSERT INTO exc_data SET ".
"obj_id = ".$ilDB->quote($this->getId()).", ".
"instruction = ".$ilDB->quote($this->getInstruction()).", ".
"time_stamp = ".$ilDB->quote($this->getTimestamp());
$this->ilias->db->query($query);*/
$ilDB->insert("exc_data", array(
"obj_id" => array("integer", $this->getId()),
"instruction" => array("clob", $this->getInstruction()),
"time_stamp" => array("integer", $this->getTimestamp()),
"pass_mode" => array("text", $this->getPassMode()),
"pass_nr" => array("text", $this->getPassNr()),
"show_submissions" => array("integer", (int) $this->getShowSubmissions())
));
return true;
}

+ Here is the call graph for this function:

ilObjExercise::sendAssignment (   $a_exc_id,
  $a_ass_id,
  $a_members 
)

send exercise per mail to members

Definition at line 422 of file class.ilObjExercise.php.

References $_SESSION, $file, $files, __formatBody(), __formatRecipients(), __formatSubject(), and ilExAssignment\updateStatusSentForUser().

{
include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
$storage = new ilFSStorageExercise($a_exc_id, $a_ass_id);
$files = $storage->getFiles();
if(count($files))
{
include_once "./classes/class.ilFileDataMail.php";
$mfile_obj = new ilFileDataMail($_SESSION["AccountId"]);
foreach($files as $file)
{
$mfile_obj->copyAttachmentFile($file["fullpath"], $file["name"]);
$file_names[] = $file["name"];
}
}
include_once "Services/Mail/classes/class.ilMail.php";
$tmp_mail_obj = new ilMail($_SESSION["AccountId"]);
$message = $tmp_mail_obj->sendMail(
$this->__formatRecipients($a_members),"","",
$this->__formatSubject(), $this->__formatBody($a_ass_id),
count($file_names) ? $file_names : array(),array("normal"));
unset($tmp_mail_obj);
if(count($file_names))
{
$mfile_obj->unlinkFiles($file_names);
unset($mfile_obj);
}
// SET STATUS SENT FOR ALL RECIPIENTS
foreach($a_members as $member_id => $value)
{
ilExAssignment::updateStatusSentForUser($a_ass_id, $member_id, 1);
}
return true;
}

+ Here is the call graph for this function:

ilObjExercise::sendFeedbackFileNotification (   $a_feedback_file,
  $a_user_id,
  $a_ass_id 
)

Send feedback file notification to user.

Definition at line 878 of file class.ilObjExercise.php.

References ilObject\getRefId(), and ilExerciseMailNotification\TYPE_FEEDBACK_FILE_ADDED.

{
include_once("./Modules/Exercise/classes/class.ilExerciseMailNotification.php");
$not->setAssignmentId($a_ass_id);
$not->setRefId($this->getRefId());
$not->setRecipients(array($a_user_id));
$not->send();
}

+ Here is the call graph for this function:

ilObjExercise::setDate (   $a_hour,
  $a_minutes,
  $a_day,
  $a_month,
  $a_year 
)

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

{
$this->hour = (int) $a_hour;
$this->minutes = (int) $a_minutes;
$this->day = (int) $a_day;
$this->month = (int) $a_month;
$this->year = (int) $a_year;
$this->timestamp = mktime($this->hour,$this->minutes,0,$this->month,$this->day,$this->year);
return true;
}
ilObjExercise::setInstruction (   $a_instruction)

Definition at line 65 of file class.ilObjExercise.php.

Referenced by read().

{
$this->instruction = $a_instruction;
}

+ Here is the caller graph for this function:

ilObjExercise::setPassMode (   $a_val)

Set pass mode (all | nr)

Parameters
stringpass mode

Definition at line 79 of file class.ilObjExercise.php.

Referenced by ilObjExercise().

{
$this->pass_mode = $a_val;
}

+ Here is the caller graph for this function:

ilObjExercise::setPassNr (   $a_val)

Set number of assignments that must be passed to pass the exercise.

Parameters
integerpass nr

Definition at line 99 of file class.ilObjExercise.php.

Referenced by read().

{
$this->pass_nr = $a_val;
}

+ Here is the caller graph for this function:

ilObjExercise::setShowSubmissions (   $a_val)

Set whether submissions of learners should be shown to other learners after deadline.

Parameters
booleanshow submissions

Definition at line 119 of file class.ilObjExercise.php.

Referenced by read().

{
$this->show_submissions = $a_val;
}

+ Here is the caller graph for this function:

ilObjExercise::setTimestamp (   $a_timestamp)

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

Referenced by read().

{
$this->timestamp = $a_timestamp;
}

+ Here is the caller graph for this function:

ilObjExercise::update ( )

update object in db

public

Returns
boolean true on success

Reimplemented from ilObject.

Definition at line 380 of file class.ilObjExercise.php.

References $ilDB, ilObject\getId(), getInstruction(), getPassMode(), getPassNr(), getShowSubmissions(), getTimestamp(), and updateAllUsersStatus().

{
global $ilDB;
/*$query = "UPDATE exc_data SET ".
"instruction = ".$ilDB->quote($this->getInstruction()).", ".
"time_stamp = ".$ilDB->quote($this->getTimestamp())." ".
"WHERE obj_id = ".$ilDB->quote($this->getId());
*/
if ($this->getPassMode() == "all")
{
$pass_nr = null;
}
else
{
$pass_nr = $this->getPassNr();
}
$ilDB->update("exc_data", array(
"instruction" => array("clob", $this->getInstruction()),
"time_stamp" => array("integer", $this->getTimestamp()),
"pass_mode" => array("text", $this->getPassMode()),
"pass_nr" => array("integer", $this->getPassNr()),
"show_submissions" => array("integer", (int) $this->getShowSubmissions())
), array(
"obj_id" => array("integer", $this->getId())
));
//$res = $this->ilias->db->query($query);
#$this->members_obj->update();
return true;
}

+ Here is the call graph for this function:

ilObjExercise::updateAllUsersStatus ( )

Update status of all users.

Definition at line 754 of file class.ilObjExercise.php.

References updateUserStatus().

Referenced by update().

{
if (!is_object($this->members_obj));
{
$this->members_obj = new ilExerciseMembers($this);
}
$mems = $this->members_obj->getMembers();
foreach ($mems as $mem)
{
$this->updateUserStatus($mem);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjExercise::updateUserStatus (   $a_user_id = 0)

Update exercise status of user.

Definition at line 735 of file class.ilObjExercise.php.

References ilExerciseMembers\_writeStatus(), determinStatusOfUser(), and ilObject\getId().

Referenced by updateAllUsersStatus(), and ilExAssignment\updateStatusOfUser().

{
global $ilUser;
if ($a_user_id == 0)
{
$a_user_id = $ilUser->getId();
}
$st = $this->determinStatusOfUser($a_user_id);
include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
ilExerciseMembers::_writeStatus($this->getId(), $a_user_id,
$st["overall_status"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilObjExercise::$day

Definition at line 28 of file class.ilObjExercise.php.

ilObjExercise::$file_obj

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

ilObjExercise::$files

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

Referenced by sendAssignment().

ilObjExercise::$hour

Definition at line 26 of file class.ilObjExercise.php.

ilObjExercise::$instruction

Definition at line 31 of file class.ilObjExercise.php.

Referenced by getInstruction().

ilObjExercise::$members_obj

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

ilObjExercise::$minutes

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

ilObjExercise::$month

Definition at line 29 of file class.ilObjExercise.php.

ilObjExercise::$timestamp

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

Referenced by getTimestamp().

ilObjExercise::$year

Definition at line 30 of file class.ilObjExercise.php.


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