ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 create ()
 
 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...
 
 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
 getObjectProperties ()
 
 flushObjectProperties ()
 
 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 $description)
 
 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
 
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 = ""
 
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 777 of file class.ilObjExercise.php.

References $DIC, and $ilDB.

777  : array
778  {
779  global $DIC;
780 
781  $ilDB = $DIC->database();
782 
783  $set = $ilDB->query("SELECT obj_id, status FROM exc_members" .
784  " WHERE usr_id = " . $ilDB->quote($a_user_id, "integer") .
785  " AND (status = " . $ilDB->quote("passed", "text") .
786  " OR status = " . $ilDB->quote("failed", "text") . ")");
787 
788  $all = array();
789  while ($row = $ilDB->fetchAssoc($set)) {
790  $all[$row["obj_id"]] = ($row["status"] == "passed");
791  }
792  return $all;
793  }
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:

◆ create()

ilObjExercise::create ( )

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

References $id, and ilObject\createMetaData().

389  : int
390  {
391  $id = parent::create();
392  $this->createMetaData();
393  return $id;
394  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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 319 of file class.ilObjExercise.php.

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

319  : bool
320  {
321  $ilDB = $this->db;
322  $ilAppEventHandler = $this->app_event_handler;
323 
324  // always call parent delete function first!!
325  if (!parent::delete()) {
326  return false;
327  }
328 
329  $em = $this->service->domain()->exercise($this->getId());
330  $em->delete($this);
331 
332  // members
333  $members = new ilExerciseMembers($this);
334  $members->delete();
335 
336  // put here course specific stuff
337  $this->deleteMetaData();
338 
339  $ilDB->manipulate("DELETE FROM exc_data " .
340  "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"));
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  }
Class ilExerciseMembers.
ilAppEventHandler $app_event_handler
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 622 of file class.ilObjExercise.php.

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

622  : void
623  {
624  $ass_data = ilExAssignment::getInstancesByExercise($this->getId());
625 
626  $excel = new ilExcel();
627  $excel->addSheet($this->lng->txt("exc_status"));
628 
629  //
630  // status
631  //
632 
633  // header row
634  $row = $cnt = 1;
635  $excel->setCell($row, 0, $this->lng->txt("name"));
636  foreach ($ass_data as $ass) {
637  $excel->setCell($row, $cnt++, ($cnt / 2) . " - " . $this->lng->txt("exc_tbl_status"));
638  $excel->setCell($row, $cnt++, (($cnt - 1) / 2) . " - " . $this->lng->txt("exc_tbl_mark"));
639  }
640  $excel->setCell($row, $cnt++, $this->lng->txt("exc_total_exc"));
641  $excel->setCell($row, $cnt++, $this->lng->txt("exc_mark"));
642  $excel->setCell($row++, $cnt, $this->lng->txt("exc_comment_for_learner"));
643  $excel->setBold("A1:" . $excel->getColumnCoord($cnt) . "1");
644 
645  // data rows
646  $mem_obj = new ilExerciseMembers($this);
647 
648  $filtered_members = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
649  'edit_submissions_grades',
650  'edit_submissions_grades',
651  $this->getRefId(),
652  $mem_obj->getMembers()
653  );
654  $mems = [];
655  foreach ((array) $filtered_members as $user_id) {
656  $mems[$user_id] = ilObjUser::_lookupName($user_id);
657  }
658  $mems = ilArrayUtil::sortArray($mems, "lastname", "asc", false, true);
659 
660  foreach ($mems as $user_id => $d) {
661  $col = 0;
662 
663  // name
664  $excel->setCell($row, $col++, $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]");
665 
666  reset($ass_data);
667  foreach ($ass_data as $ass) {
668  $status = $ass->getMemberStatus($user_id)->getStatus();
669  $mark = $ass->getMemberStatus($user_id)->getMark();
670  $excel->setCell($row, $col++, $this->lng->txt("exc_" . $status));
671  $excel->setCell($row, $col++, $mark);
672  }
673 
674  // total status
675  $status = ilExerciseMembers::_lookupStatus($this->getId(), $user_id);
676  $excel->setCell($row, $col++, $this->lng->txt("exc_" . $status));
677 
678  // #18096
679  $marks_obj = new ilLPMarks($this->getId(), $user_id);
680  $excel->setCell($row, $col++, $marks_obj->getMark());
681  $excel->setCell($row++, $col, $marks_obj->getComment());
682  }
683 
684 
685  //
686  // mark
687  //
688 
689  $excel->addSheet($this->lng->txt("exc_mark"));
690 
691  // header row
692  $row = $cnt = 1;
693  $excel->setCell($row, 0, $this->lng->txt("name"));
694  foreach ($ass_data as $ass) {
695  $excel->setCell($row, $cnt++, $cnt - 1);
696  }
697  $excel->setCell($row++, $cnt++, $this->lng->txt("exc_total_exc"));
698  $excel->setBold("A1:" . $excel->getColumnCoord($cnt) . "1");
699 
700  // data rows
701  reset($mems);
702  foreach ($mems as $user_id => $d) {
703  $col = 0;
704 
705  // name
706  $d = ilObjUser::_lookupName($user_id);
707  $excel->setCell($row, $col++, $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]");
708 
709  reset($ass_data);
710  foreach ($ass_data as $ass) {
711  $excel->setCell($row, $col++, $ass->getMemberStatus($user_id)->getMark());
712  }
713 
714  // total mark
715  $excel->setCell($row++, $col, ilLPMarks::_lookupMark($user_id, $this->getId()));
716  }
717 
718  $exc_name = ilFileUtils::getASCIIFilename(preg_replace("/\s/", "_", $this->getTitle()));
719  $excel->sendToClient($exc_name);
720  }
Class ilExerciseMembers.
static _lookupName(int $a_user_id)
lookup user name
static getASCIIFilename(string $a_filename)
$GLOBALS["DIC"]
Definition: wac.php:31
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)
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 799 of file class.ilObjExercise.php.

Referenced by saveData().

799  : int
800  {
801  return (strlen($this->certificate_visibility) !== 0) ? $this->certificate_visibility : 0;
802  }
+ 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 724 of file class.ilObjExercise.php.

References $completion_by_submission.

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

724  : bool
725  {
727  }
+ 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 740 of file class.ilObjExercise.php.

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

Referenced by ilExAssTypeWikiTeam\handleNewUpload().

745  : void {
746  foreach ($a_user_ids as $user_id) {
747  $member_status = $a_ass->getMemberStatus($user_id);
748  $member_status->setReturned($a_has_submitted);
749  $member_status->update();
750 
751  ilExerciseMembers::_writeReturned($this->getId(), $user_id, $a_has_submitted);
752  }
753 
754  // re-evaluate exercise status
755  if ($this->isCompletionBySubmissionEnabled()) {
756  foreach ($a_user_ids as $user_id) {
757  $status = 'notgraded';
758  if ($a_has_submitted) {
759  if (!is_array($a_valid_submissions) ||
760  $a_valid_submissions[$user_id]) {
761  $status = 'passed';
762  }
763  }
764 
765  $member_status = $a_ass->getMemberStatus($user_id);
766  $member_status->setStatus($status);
767  $member_status->update();
768  }
769  }
770  }
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, $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
Class ilExerciseMembers.
setCompletionBySubmission(bool $bool)
setTimestamp(int $a_timestamp)
setCertificateVisibility(int $a_value)
ilDBInterface $db
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 815 of file class.ilObjExercise.php.

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

817  : void {
818  $ilDB = $this->db;
819 
820  $ilDB->manipulateF(
821  "UPDATE exc_data SET certificate_visibility = %s WHERE obj_id = %s",
822  array('integer', 'integer'),
823  array($a_value, $this->getId())
824  );
825  }
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(), CLIENT_WEB_DIR, ilExAssignment\cloneAssignmentsOfExercise(), ilObject\cloneMetaData(), 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:

◆ setCertificateVisibility()

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

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

Referenced by read().

807  : void
808  {
809  $this->certificate_visibility = $a_value;
810  }
+ Here is the caller graph for this function:

◆ setCompletionBySubmission()

ilObjExercise::setCompletionBySubmission ( bool  $bool)

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

Referenced by read().

730  : self
731  {
732  $this->completion_by_submission = $bool;
733 
734  return $this;
735  }
+ 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 399 of file class.ilObjExercise.php.

References Vendor\Package\$a, ilObject\$db, $GLOBALS, $ilDB, ilObject\$lng, $mandatory_manager, $user, 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(), updateAllUsersStatus(), and ilObject\updateMetaData().

399  : bool
400  {
401  $ilDB = $this->db;
402 
403  parent::update();
404 
405  $ilDB->update("exc_data", array(
406  "instruction" => array("clob", $this->getInstruction()),
407  "time_stamp" => array("integer", $this->getTimestamp()),
408  "pass_mode" => array("text", $this->getPassMode()),
409  "pass_nr" => array("integer", $this->getPassNr()),
410  "nr_mandatory_random" => array("integer", $this->getNrMandatoryRandom()),
411  "show_submissions" => array("integer", (int) $this->getShowSubmissions()),
412  'compl_by_submission' => array('integer', (int) $this->isCompletionBySubmissionEnabled()),
413  'tfeedback' => array('integer', $this->getTutorFeedback()),
414  ), array(
415  "obj_id" => array("integer", $this->getId())
416  ));
417 
418  $this->updateAllUsersStatus();
419  $this->updateMetaData();
420 
421  return true;
422  }
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 605 of file class.ilObjExercise.php.

References updateUserStatus().

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

605  : void
606  {
607  if (!isset($this->members_obj)) {
608  $this->members_obj = new ilExerciseMembers($this);
609  }
610 
611  $mems = $this->members_obj->getMembers();
612  foreach ($mems as $mem) {
613  $this->updateUserStatus($mem);
614  }
615  }
Class ilExerciseMembers.
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 584 of file class.ilObjExercise.php.

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

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

584  : void
585  {
586  $ilUser = $this->user;
587 
588  if ($a_user_id == 0) {
589  $a_user_id = $ilUser->getId();
590  }
591 
592  $st = $this->determinStatusOfUser($a_user_id);
593 
595  $this->getId(),
596  $a_user_id,
597  $st["overall_status"]
598  );
599  }
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...
+ 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: