ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjExercise Class Reference

Class ilObjExercise. More...

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

Public Member Functions

 setId (int $a_id)
 
 setDate (int $a_hour, int $a_minutes, int $a_day, int $a_month, int $a_year)
 
 getTimestamp ()
 
 setTimestamp (int $a_timestamp)
 
 setInstruction (string $a_instruction)
 
 getInstruction ()
 
 setPassMode (string $a_val)
 
 getPassMode ()
 
 setPassNr (int $a_val)
 
 getPassNr ()
 
 setShowSubmissions (bool $a_val)
 
 getShowSubmissions ()
 
 setNrMandatoryRandom (int $a_val)
 
 getNrMandatoryRandom ()
 
 checkDate ()
 
 hasTutorFeedbackText ()
 
 hasTutorFeedbackMail ()
 
 hasTutorFeedbackFile ()
 
 setTutorFeedback (int $a_value)
 
 saveData ()
 
 delete ()
 
 read ()
 
 update ()
 
 updateUserStatus (int $a_user_id=0)
 Update exercise status of user. More...
 
 updateAllUsersStatus ()
 Update status of all users. More...
 
 exportGradesExcel ()
 Exports grades as excel. More...
 
 sendFeedbackFileNotification (string $a_feedback_file, array $user_ids, int $a_ass_id, bool $a_is_text_feedback=false)
 
 isCompletionBySubmissionEnabled ()
 
 setCompletionBySubmission (bool $bool)
 
 processExerciseStatus (ilExAssignment $a_ass, array $a_user_ids, bool $a_has_submitted, array $a_valid_submissions=null)
 
 getCertificateVisibility ()
 
 setCertificateVisibility (int $a_value)
 
 saveCertificateVisibility (int $a_value)
 
- Public Member Functions inherited from ilObject
 __construct (int $id=0, bool $reference=true)
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $desc)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 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. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _lookupFinishedUserExercises (int $a_user_id)
 Get all finished exercises for user. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Data Fields

const TUTOR_FEEDBACK_MAIL = 1
 
const TUTOR_FEEDBACK_TEXT = 2
 
const TUTOR_FEEDBACK_FILE = 4
 
const PASS_MODE_NR = "nr"
 
const PASS_MODE_ALL = "all"
 
const PASS_MODE_RANDOM = "random"
 
ilExerciseMembers $members_obj = null
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Member Functions

 getTutorFeedback ()
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

ilObjUser $user
 
ilFileDataMail $file_obj
 
int $timestamp = 0
 
int $hour = 0
 
int $minutes = 0
 
int $day = 0
 
int $month = 0
 
int $year = 0
 
string $instruction = ""
 
int $certificate_visibility = 0
 
int $tutor_feedback = 7
 
int $nr_random_mand = 0
 
bool $completion_by_submission = false
 
Filesystem $webFilesystem
 
MandatoryAssignmentsManager $mandatory_manager
 
int $pass_nr = 0
 
InternalService $service
 
string $pass_mode = self::PASS_MODE_ALL
 
bool $show_submissions = false
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
int $id
 
bool $referenced
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Detailed Description

Member Function Documentation

◆ _lookupFinishedUserExercises()

static ilObjExercise::_lookupFinishedUserExercises ( int  $a_user_id)
static

Get all finished exercises for user.

Parameters
int$a_user_id
Returns
bool[] (exercise id => passed)

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

References $DIC, and $ilDB.

790  : array
791  {
792  global $DIC;
793 
794  $ilDB = $DIC->database();
795 
796  $set = $ilDB->query("SELECT obj_id, status FROM exc_members" .
797  " WHERE usr_id = " . $ilDB->quote($a_user_id, "integer") .
798  " AND (status = " . $ilDB->quote("passed", "text") .
799  " OR status = " . $ilDB->quote("failed", "text") . ")");
800 
801  $all = array();
802  while ($row = $ilDB->fetchAssoc($set)) {
803  $all[$row["obj_id"]] = ($row["status"] == "passed");
804  }
805  return $all;
806  }
global $DIC
Definition: feed.php:28

◆ checkDate()

ilObjExercise::checkDate ( )

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

References ILIAS\Repository\int().

186  : bool
187  {
188  return $this->hour == (int) date("H", $this->timestamp) and
189  $this->minutes == (int) date("i", $this->timestamp) and
190  $this->day == (int) date("d", $this->timestamp) and
191  $this->month == (int) date("m", $this->timestamp) and
192  $this->year == (int) date("Y", $this->timestamp);
193  }
+ Here is the call graph for this function:

◆ delete()

ilObjExercise::delete ( )
Returns
bool true if all object data were removed; false if only a references were removed

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

References ilObject\$app_event_handler, ilObject\$db, $ilDB, ilExAssignment\getAssignmentDataOfExercise(), ilObject\getId(), ilExcCriteriaCatalogue\getInstancesByParentId(), ilNotification\removeForObject(), and ilNotification\TYPE_EXERCISE_SUBMISSION.

316  : bool
317  {
318  $ilDB = $this->db;
319  $ilAppEventHandler = $this->app_event_handler;
320 
321  // always call parent delete function first!!
322  if (!parent::delete()) {
323  return false;
324  }
325 
326  foreach (ilExAssignment::getAssignmentDataOfExercise($this->getId()) as $item) {
327  $ass = new ilExAssignment($item["id"]);
328  $ass->delete($this, false);
329  }
330 
331  // members
332  $members = new ilExerciseMembers($this);
333  $members->delete();
334 
335  // put here course specific stuff
336  $ilDB->manipulate("DELETE FROM exc_data " .
337  "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"));
338 
339  foreach (\ilExcCriteriaCatalogue::getInstancesByParentId($this->getId()) as $crit_cat) {
340  $crit_cat->delete();
341  }
342 
343  // remove all notifications
345 
346  $ilAppEventHandler->raise(
347  'Modules/Exercise',
348  'delete',
349  array('obj_id' => $this->getId())
350  );
351 
352  return true;
353  }
Exercise assignment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstancesByParentId(int $a_parent_id)
ilAppEventHandler $app_event_handler
static getAssignmentDataOfExercise(int $a_exc_id)
ilDBInterface $db
static removeForObject(int $type, int $id)
Remove all notifications for given object.
+ Here is the call graph for this function:

◆ exportGradesExcel()

ilObjExercise::exportGradesExcel ( )

Exports grades as excel.

Exceptions

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

References $d, $GLOBALS, ilLPMarks\_lookupMark(), ilObjUser\_lookupName(), ilExerciseMembers\_lookupStatus(), ilFileUtils\getASCIIFilename(), ilObject\getId(), ilExAssignment\getInstancesByExercise(), ilObject\getRefId(), ilObject\getTitle(), ILIAS\Repository\lng(), and ilArrayUtil\sortArray().

614  : void
615  {
616  $ass_data = ilExAssignment::getInstancesByExercise($this->getId());
617 
618  $excel = new ilExcel();
619  $excel->addSheet($this->lng->txt("exc_status"));
620 
621  //
622  // status
623  //
624 
625  // header row
626  $row = $cnt = 1;
627  $excel->setCell($row, 0, $this->lng->txt("name"));
628  foreach ($ass_data as $ass) {
629  $excel->setCell($row, $cnt++, ($cnt / 2) . " - " . $this->lng->txt("exc_tbl_status"));
630  $excel->setCell($row, $cnt++, (($cnt - 1) / 2) . " - " . $this->lng->txt("exc_tbl_mark"));
631  }
632  $excel->setCell($row, $cnt++, $this->lng->txt("exc_total_exc"));
633  $excel->setCell($row, $cnt++, $this->lng->txt("exc_mark"));
634  $excel->setCell($row++, $cnt, $this->lng->txt("exc_comment_for_learner"));
635  $excel->setBold("A1:" . $excel->getColumnCoord($cnt) . "1");
636 
637  // data rows
638  $mem_obj = new ilExerciseMembers($this);
639 
640  $filtered_members = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
641  'edit_submissions_grades',
642  'edit_submissions_grades',
643  $this->getRefId(),
644  $mem_obj->getMembers()
645  );
646  $mems = [];
647  foreach ((array) $filtered_members as $user_id) {
648  $mems[$user_id] = ilObjUser::_lookupName($user_id);
649  }
650  $mems = ilArrayUtil::sortArray($mems, "lastname", "asc", false, true);
651 
652  foreach ($mems as $user_id => $d) {
653  $col = 0;
654 
655  // name
656  $excel->setCell($row, $col++, $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]");
657 
658  reset($ass_data);
659  foreach ($ass_data as $ass) {
660  $status = $ass->getMemberStatus($user_id)->getStatus();
661  $mark = $ass->getMemberStatus($user_id)->getMark();
662  $excel->setCell($row, $col++, $this->lng->txt("exc_" . $status));
663  $excel->setCell($row, $col++, $mark);
664  }
665 
666  // total status
667  $status = ilExerciseMembers::_lookupStatus($this->getId(), $user_id);
668  $excel->setCell($row, $col++, $this->lng->txt("exc_" . $status));
669 
670  // #18096
671  $marks_obj = new ilLPMarks($this->getId(), $user_id);
672  $excel->setCell($row, $col++, $marks_obj->getMark());
673  $excel->setCell($row++, $col, $marks_obj->getComment());
674  }
675 
676 
677  //
678  // mark
679  //
680 
681  $excel->addSheet($this->lng->txt("exc_mark"));
682 
683  // header row
684  $row = $cnt = 1;
685  $excel->setCell($row, 0, $this->lng->txt("name"));
686  foreach ($ass_data as $ass) {
687  $excel->setCell($row, $cnt++, $cnt - 1);
688  }
689  $excel->setCell($row++, $cnt++, $this->lng->txt("exc_total_exc"));
690  $excel->setBold("A1:" . $excel->getColumnCoord($cnt) . "1");
691 
692  // data rows
693  reset($mems);
694  foreach ($mems as $user_id => $d) {
695  $col = 0;
696 
697  // name
698  $d = ilObjUser::_lookupName($user_id);
699  $excel->setCell($row, $col++, $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]");
700 
701  reset($ass_data);
702  foreach ($ass_data as $ass) {
703  $excel->setCell($row, $col++, $ass->getMemberStatus($user_id)->getMark());
704  }
705 
706  // total mark
707  $excel->setCell($row++, $col, ilLPMarks::_lookupMark($user_id, $this->getId()));
708  }
709 
710  $exc_name = ilFileUtils::getASCIIFilename(preg_replace("/\s/", "_", $this->getTitle()));
711  $excel->sendToClient($exc_name);
712  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupName(int $a_user_id)
lookup user name
static getASCIIFilename(string $a_filename)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current status (notgraded|passed|failed)
static getInstancesByExercise(int $a_exc_id)
static _lookupMark(int $a_usr_id, int $a_obj_id)
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:

◆ getCertificateVisibility()

ilObjExercise::getCertificateVisibility ( )
Returns
int visibility settings (0 = always, 1 = only passed, 2 = never)

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

Referenced by saveData().

812  : int
813  {
814  return (strlen($this->certificate_visibility) !== 0) ? $this->certificate_visibility : 0;
815  }
+ Here is the caller graph for this function:

◆ getInstruction()

ilObjExercise::getInstruction ( )

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

References $instruction.

Referenced by saveData(), and update().

129  : string
130  {
131  return $this->instruction;
132  }
+ Here is the caller graph for this function:

◆ getNrMandatoryRandom()

ilObjExercise::getNrMandatoryRandom ( )

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

References $nr_random_mand.

Referenced by saveData(), and update().

181  : int
182  {
183  return $this->nr_random_mand;
184  }
+ Here is the caller graph for this function:

◆ getPassMode()

ilObjExercise::getPassMode ( )

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

References $pass_mode.

Referenced by saveData(), and update().

142  : string
143  {
144  return $this->pass_mode;
145  }
+ Here is the caller graph for this function:

◆ getPassNr()

ilObjExercise::getPassNr ( )

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

References $pass_nr.

Referenced by saveData(), and update().

155  : int
156  {
157  return $this->pass_nr;
158  }
+ Here is the caller graph for this function:

◆ getShowSubmissions()

ilObjExercise::getShowSubmissions ( )

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

References $show_submissions.

Referenced by saveData(), and update().

168  : bool
169  {
171  }
+ Here is the caller graph for this function:

◆ getTimestamp()

ilObjExercise::getTimestamp ( )

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

References $timestamp.

Referenced by saveData(), and update().

112  : int
113  {
114  return $this->timestamp;
115  }
+ Here is the caller graph for this function:

◆ getTutorFeedback()

ilObjExercise::getTutorFeedback ( )
protected

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

References $tutor_feedback.

Referenced by saveData(), and update().

210  : int
211  {
212  return $this->tutor_feedback;
213  }
+ Here is the caller graph for this function:

◆ hasTutorFeedbackFile()

ilObjExercise::hasTutorFeedbackFile ( )

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

205  : int
206  {
207  return $this->tutor_feedback & self::TUTOR_FEEDBACK_FILE;
208  }

◆ hasTutorFeedbackMail()

ilObjExercise::hasTutorFeedbackMail ( )

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

200  : int
201  {
202  return $this->tutor_feedback & self::TUTOR_FEEDBACK_MAIL;
203  }

◆ hasTutorFeedbackText()

ilObjExercise::hasTutorFeedbackText ( )

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

195  : int
196  {
197  return $this->tutor_feedback & self::TUTOR_FEEDBACK_TEXT;
198  }

◆ isCompletionBySubmissionEnabled()

ilObjExercise::isCompletionBySubmissionEnabled ( )

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

References $completion_by_submission.

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

737  : bool
738  {
740  }
+ Here is the caller graph for this function:

◆ processExerciseStatus()

ilObjExercise::processExerciseStatus ( ilExAssignment  $a_ass,
array  $a_user_ids,
bool  $a_has_submitted,
array  $a_valid_submissions = null 
)
Exceptions
ilExcUnknownAssignmentTypeException

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

References ilExerciseMembers\_writeReturned(), ilObject\getId(), ilExAssignment\getMemberStatus(), and isCompletionBySubmissionEnabled().

Referenced by ilExAssTypeWikiTeam\handleNewUpload().

758  : void {
759  foreach ($a_user_ids as $user_id) {
760  $member_status = $a_ass->getMemberStatus($user_id);
761  $member_status->setReturned($a_has_submitted);
762  $member_status->update();
763 
764  ilExerciseMembers::_writeReturned($this->getId(), $user_id, $a_has_submitted);
765  }
766 
767  // re-evaluate exercise status
768  if ($this->isCompletionBySubmissionEnabled()) {
769  foreach ($a_user_ids as $user_id) {
770  $status = 'notgraded';
771  if ($a_has_submitted) {
772  if (!is_array($a_valid_submissions) ||
773  $a_valid_submissions[$user_id]) {
774  $status = 'passed';
775  }
776  }
777 
778  $member_status = $a_ass->getMemberStatus($user_id);
779  $member_status->setStatus($status);
780  $member_status->update();
781  }
782  }
783  }
static _writeReturned(int $a_obj_id, int $a_user_id, int $a_status)
Write returned status.
getMemberStatus(?int $a_user_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilObjExercise::read ( )
Exceptions
ilObjectNotFoundException
ilObjectTypeMismatchException

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

References ilObject\$db, $ilDB, $query, $res, ilObject\getId(), setCertificateVisibility(), setCompletionBySubmission(), setInstruction(), setNrMandatoryRandom(), setPassNr(), setShowSubmissions(), setTimestamp(), and setTutorFeedback().

359  : void
360  {
361  $ilDB = $this->db;
362 
363  parent::read();
364 
365  $query = "SELECT * FROM exc_data " .
366  "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
367 
368  $res = $ilDB->query($query);
369  while ($row = $ilDB->fetchObject($res)) {
370  $this->setInstruction((string) $row->instruction);
371  $this->setTimestamp((int) $row->time_stamp);
372  $pm = ($row->pass_mode == "")
373  ? "all"
374  : $row->pass_mode;
375  $this->setPassMode((string) $pm);
376  $this->setShowSubmissions((bool) $row->show_submissions);
377  if ($row->pass_mode == "nr") {
378  $this->setPassNr((int) $row->pass_nr);
379  }
380  $this->setNrMandatoryRandom((int) $row->nr_mandatory_random);
381  $this->setCompletionBySubmission($row->compl_by_submission == 1);
382  $this->setCertificateVisibility((int) $row->certificate_visibility);
383  $this->setTutorFeedback((int) $row->tfeedback);
384  }
385 
386  $this->members_obj = new ilExerciseMembers($this);
387  }
$res
Definition: ltiservices.php:69
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setCompletionBySubmission(bool $bool)
setTimestamp(int $a_timestamp)
setCertificateVisibility(int $a_value)
ilDBInterface $db
$query
setNrMandatoryRandom(int $a_val)
setShowSubmissions(bool $a_val)
setInstruction(string $a_instruction)
setTutorFeedback(int $a_value)
+ Here is the call graph for this function:

◆ saveCertificateVisibility()

ilObjExercise::saveCertificateVisibility ( int  $a_value)
Parameters
int$a_valuevisibility settings (0 = always, 1 = only passed, 2 = never)

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

References ilObject\$db, $ilDB, and ilObject\getId().

830  : void {
831  $ilDB = $this->db;
832 
833  $ilDB->manipulateF(
834  "UPDATE exc_data SET certificate_visibility = %s WHERE obj_id = %s",
835  array('integer', 'integer'),
836  array($a_value, $this->getId())
837  );
838  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ saveData()

ilObjExercise::saveData ( )

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

References ilObject\$db, $ilDB, ilContainer\_getContainerSettings(), ilContainer\_writeContainerSetting(), ilExAssignment\cloneAssignmentsOfExercise(), getCertificateVisibility(), ilObject\getId(), ilOrgUnitGlobalSettings\getInstance(), ilExcCriteriaCatalogue\getInstancesByParentId(), getInstruction(), getNrMandatoryRandom(), getPassMode(), getPassNr(), getShowSubmissions(), getTimestamp(), getTutorFeedback(), isCompletionBySubmissionEnabled(), and ilOrgUnitObjectPositionSetting\setActive().

220  : void
221  {
222  $ilDB = $this->db;
223 
224  $ilDB->insert("exc_data", array(
225  "obj_id" => array("integer", $this->getId()),
226  "instruction" => array("clob", $this->getInstruction()),
227  "time_stamp" => array("integer", $this->getTimestamp()),
228  "pass_mode" => array("text", $this->getPassMode()),
229  "nr_mandatory_random" => array("integer", $this->getNrMandatoryRandom()),
230  "pass_nr" => array("text", $this->getPassNr()),
231  "show_submissions" => array("integer", (int) $this->getShowSubmissions()),
232  'compl_by_submission' => array('integer', (int) $this->isCompletionBySubmissionEnabled()),
233  "certificate_visibility" => array("integer", $this->getCertificateVisibility()),
234  "tfeedback" => array("integer", $this->getTutorFeedback())
235  ));
236  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ sendFeedbackFileNotification()

ilObjExercise::sendFeedbackFileNotification ( string  $a_feedback_file,
array  $user_ids,
int  $a_ass_id,
bool  $a_is_text_feedback = false 
)

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

References ilObject\$type, ilObject\getId(), ilObject\getRefId(), ilExerciseMailNotification\TYPE_FEEDBACK_FILE_ADDED, and ilExerciseMailNotification\TYPE_FEEDBACK_TEXT_ADDED.

Referenced by ilExAssignment\saveMultiFeedbackFiles().

720  : void {
721  $type = $a_is_text_feedback
724 
725  $not = new ilExerciseMailNotification();
726  $not->setType($type);
727  $not->setAssignmentId($a_ass_id);
728  $not->setObjId($this->getId());
729  if ($this->getRefId() > 0) {
730  $not->setRefId($this->getRefId());
731  }
732  $not->setRecipients($user_ids);
733  $not->send();
734  }
string $type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCertificateVisibility()

ilObjExercise::setCertificateVisibility ( int  $a_value)
Parameters
int$a_valuevisibility settings (0 = always, 1 = only passed, 2 = never)

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

Referenced by read().

820  : void
821  {
822  $this->certificate_visibility = $a_value;
823  }
+ Here is the caller graph for this function:

◆ setCompletionBySubmission()

ilObjExercise::setCompletionBySubmission ( bool  $bool)

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

Referenced by read().

743  : self
744  {
745  $this->completion_by_submission = $bool;
746 
747  return $this;
748  }
+ Here is the caller graph for this function:

◆ setDate()

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

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

103  : void {
104  $this->hour = $a_hour;
105  $this->minutes = $a_minutes;
106  $this->day = $a_day;
107  $this->month = $a_month;
108  $this->year = $a_year;
109  $this->timestamp = mktime($this->hour, $this->minutes, 0, $this->month, $this->day, $this->year);
110  }

◆ setId()

ilObjExercise::setId ( int  $a_id)
Exceptions
ilExcUnknownAssignmentTypeException

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

90  : void
91  {
92  parent::setId($a_id);
93  // this is needed, since e.g. ilObjectFactory initialises the object with id 0 and later sets the id
94  $this->mandatory_manager = $this->service->domain()->assignment()->mandatoryAssignments($this);
95  }

◆ setInstruction()

ilObjExercise::setInstruction ( string  $a_instruction)

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

Referenced by read().

125  : void {
126  $this->instruction = $a_instruction;
127  }
+ Here is the caller graph for this function:

◆ setNrMandatoryRandom()

ilObjExercise::setNrMandatoryRandom ( int  $a_val)
Parameters
int$a_valnumber of mandatory assignments in random pass mode

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

Referenced by read().

176  : void
177  {
178  $this->nr_random_mand = $a_val;
179  }
+ Here is the caller graph for this function:

◆ setPassMode()

ilObjExercise::setPassMode ( string  $a_val)
Parameters
string$a_val(self::PASS_MODE_NR, self::PASS_MODE_ALL, self::PASS_MODE_RANDOM)

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

137  : void
138  {
139  $this->pass_mode = $a_val;
140  }

◆ setPassNr()

ilObjExercise::setPassNr ( int  $a_val)
Parameters
int$a_valnumber of assignments that must be passed to pass the exercise

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

Referenced by read().

150  : void
151  {
152  $this->pass_nr = $a_val;
153  }
+ Here is the caller graph for this function:

◆ setShowSubmissions()

ilObjExercise::setShowSubmissions ( bool  $a_val)
Parameters
bool$a_valwhether submissions of learners should be shown to other learners after deadline

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

Referenced by read().

163  : void
164  {
165  $this->show_submissions = $a_val;
166  }
+ Here is the caller graph for this function:

◆ setTimestamp()

ilObjExercise::setTimestamp ( int  $a_timestamp)

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

Referenced by read().

119  : void {
120  $this->timestamp = $a_timestamp;
121  }
+ Here is the caller graph for this function:

◆ setTutorFeedback()

ilObjExercise::setTutorFeedback ( int  $a_value)

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

Referenced by read().

215  : void
216  {
217  $this->tutor_feedback = $a_value;
218  }
+ Here is the caller graph for this function:

◆ update()

ilObjExercise::update ( )
Exceptions
ilExcUnknownAssignmentTypeException

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

References Vendor\Package\$a, ilObject\$db, $GLOBALS, $ilDB, $ilUser, ilObject\$lng, $mandatory_manager, $user, ilLink\_getLink(), ilDatePresentation\formatDate(), ilExAssignment\getDeadline(), ilExAssignment\getExerciseId(), ilFSStorageExercise\getFiles(), ilExAssignment\getId(), ilObject\getId(), ilObjectFactory\getInstanceByObjId(), ilExAssignment\getInstancesByExercise(), getInstruction(), ilExAssignment\getInstruction(), ilExAssignment\getMemberStatus(), getNrMandatoryRandom(), getPassMode(), getPassNr(), ilObject\getRefId(), getShowSubmissions(), getTimestamp(), ilObject\getTitle(), ilExAssignment\getTitle(), getTutorFeedback(), IL_CAL_UNIX, isCompletionBySubmissionEnabled(), ILIAS\Exercise\Assignment\Mandatory\MandatoryAssignmentsManager\isMandatoryForUser(), ilLanguage\loadLanguageModule(), ilLanguage\txt(), and updateAllUsersStatus().

392  : bool
393  {
394  $ilDB = $this->db;
395 
396  parent::update();
397 
398  $ilDB->update("exc_data", array(
399  "instruction" => array("clob", $this->getInstruction()),
400  "time_stamp" => array("integer", $this->getTimestamp()),
401  "pass_mode" => array("text", $this->getPassMode()),
402  "pass_nr" => array("integer", $this->getPassNr()),
403  "nr_mandatory_random" => array("integer", $this->getNrMandatoryRandom()),
404  "show_submissions" => array("integer", (int) $this->getShowSubmissions()),
405  'compl_by_submission' => array('integer', (int) $this->isCompletionBySubmissionEnabled()),
406  'tfeedback' => array('integer', $this->getTutorFeedback()),
407  ), array(
408  "obj_id" => array("integer", $this->getId())
409  ));
410 
411  $this->updateAllUsersStatus();
412 
413  return true;
414  }
updateAllUsersStatus()
Update status of all users.
ilDBInterface $db
+ Here is the call graph for this function:

◆ updateAllUsersStatus()

ilObjExercise::updateAllUsersStatus ( )

Update status of all users.

Exceptions
ilExcUnknownAssignmentTypeException

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

References updateUserStatus().

Referenced by ilExAssignment\delete(), and update().

597  : void
598  {
599  if (!isset($this->members_obj)) {
600  $this->members_obj = new ilExerciseMembers($this);
601  }
602 
603  $mems = $this->members_obj->getMembers();
604  foreach ($mems as $mem) {
605  $this->updateUserStatus($mem);
606  }
607  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateUserStatus(int $a_user_id=0)
Update exercise status of user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateUserStatus()

ilObjExercise::updateUserStatus ( int  $a_user_id = 0)

Update exercise status of user.

Exceptions
ilExcUnknownAssignmentTypeException

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

References $ilUser, $user, ilExerciseMembers\_writeStatus(), and ilObject\getId().

Referenced by ilExAssignmentMemberStatus\postUpdateStatus(), and updateAllUsersStatus().

576  : void
577  {
579 
580  if ($a_user_id == 0) {
581  $a_user_id = $ilUser->getId();
582  }
583 
584  $st = $this->determinStatusOfUser($a_user_id);
585 
587  $this->getId(),
588  $a_user_id,
589  $st["overall_status"]
590  );
591  }
static _writeStatus(int $a_obj_id, int $a_user_id, string $a_status)
Write user status This information is determined by the assignment status and saved redundantly in th...
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $certificate_visibility

int ilObjExercise::$certificate_visibility = 0
protected

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

◆ $completion_by_submission

bool ilObjExercise::$completion_by_submission = false
protected

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

Referenced by isCompletionBySubmissionEnabled().

◆ $day

int ilObjExercise::$day = 0
protected

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

◆ $file_obj

ilFileDataMail ilObjExercise::$file_obj
protected

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

◆ $hour

int ilObjExercise::$hour = 0
protected

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

◆ $instruction

string ilObjExercise::$instruction = ""
protected

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

Referenced by getInstruction().

◆ $mandatory_manager

MandatoryAssignmentsManager ilObjExercise::$mandatory_manager
protected

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

Referenced by update().

◆ $members_obj

ilExerciseMembers ilObjExercise::$members_obj = null

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

◆ $minutes

int ilObjExercise::$minutes = 0
protected

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

◆ $month

int ilObjExercise::$month = 0
protected

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

◆ $nr_random_mand

int ilObjExercise::$nr_random_mand = 0
protected

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

Referenced by getNrMandatoryRandom().

◆ $pass_mode

string ilObjExercise::$pass_mode = self::PASS_MODE_ALL
protected

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

Referenced by getPassMode().

◆ $pass_nr

int ilObjExercise::$pass_nr = 0
protected

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

Referenced by getPassNr().

◆ $service

InternalService ilObjExercise::$service
protected

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

◆ $show_submissions

bool ilObjExercise::$show_submissions = false
protected

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

Referenced by getShowSubmissions().

◆ $timestamp

int ilObjExercise::$timestamp = 0
protected

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

Referenced by getTimestamp().

◆ $tutor_feedback

int ilObjExercise::$tutor_feedback = 7
protected

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

Referenced by getTutorFeedback().

◆ $user

ilObjUser ilObjExercise::$user
protected

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

Referenced by update(), and updateUserStatus().

◆ $webFilesystem

Filesystem ilObjExercise::$webFilesystem
protected

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

◆ $year

int ilObjExercise::$year = 0
protected

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

◆ PASS_MODE_ALL

const ilObjExercise::PASS_MODE_ALL = "all"

◆ PASS_MODE_NR

const ilObjExercise::PASS_MODE_NR = "nr"

◆ PASS_MODE_RANDOM

◆ TUTOR_FEEDBACK_FILE

const ilObjExercise::TUTOR_FEEDBACK_FILE = 4

◆ TUTOR_FEEDBACK_MAIL

const ilObjExercise::TUTOR_FEEDBACK_MAIL = 1

◆ TUTOR_FEEDBACK_TEXT

const ilObjExercise::TUTOR_FEEDBACK_TEXT = 2

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