ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 note: title, description and type should be set when this function is called More...
 
 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, int $new_obj_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 getIconForType (string $type)
 
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
 
LOMServices $lom_services
 
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 775 of file class.ilObjExercise.php.

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

References $DIC, and $ilDB.

◆ checkDate()

ilObjExercise::checkDate ( )

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

185 : bool
186 {
187 return $this->hour == (int) date("H", $this->timestamp) and
188 $this->minutes == (int) date("i", $this->timestamp) and
189 $this->day == (int) date("d", $this->timestamp) and
190 $this->month == (int) date("m", $this->timestamp) and
191 $this->year == (int) date("Y", $this->timestamp);
192 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ create()

ilObjExercise::create ( )

note: title, description and type should be set when this function is called

Reimplemented from ilObject.

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

386 : int
387 {
388 $id = parent::create();
389 $this->createMetaData();
390 return $id;
391 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ delete()

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

Reimplemented from ilObject.

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

316 : bool
317 {
319 $ilAppEventHandler = $this->app_event_handler;
320
321 // always call parent delete function first!!
322 if (!parent::delete()) {
323 return false;
324 }
325
326 $em = $this->service->domain()->exercise($this->getId());
327 $em->delete($this);
328
329 // members
330 $members = new ilExerciseMembers($this);
331 $members->delete();
332
333 // put here course specific stuff
334 $this->deleteMetaData();
335
336 $ilDB->manipulate("DELETE FROM exc_data " .
337 "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"));
338
339
340 // remove all notifications
342
343 $ilAppEventHandler->raise(
344 'components/ILIAS/Exercise',
345 'delete',
346 array('obj_id' => $this->getId())
347 );
348
349 return true;
350 }
Class ilExerciseMembers.
static removeForObject(int $type, int $id)
Remove all notifications for given object.
ilAppEventHandler $app_event_handler
ilDBInterface $db

References $ilDB, ILIAS\Survey\Mode\getId(), ilNotification\removeForObject(), and ilNotification\TYPE_EXERCISE_SUBMISSION.

+ Here is the call graph for this function:

◆ exportGradesExcel()

ilObjExercise::exportGradesExcel ( )

Exports grades as excel.

Exceptions

PhpOffice\PhpSpreadsheet\Exception

Exceptions
ilExcUnknownAssignmentTypeException

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

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

References Vendor\Package\$d, $GLOBALS, $user_id, ilLPMarks\_lookupMark(), ilObjUser\_lookupName(), ilExerciseMembers\_lookupStatus(), ilFileUtils\getASCIIFilename(), ILIAS\Survey\Mode\getId(), ilExAssignment\getInstancesByExercise(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ILIAS\Repository\lng(), and ilArrayUtil\sortArray().

+ 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 797 of file class.ilObjExercise.php.

797 : int
798 {
799 return (strlen($this->certificate_visibility) !== 0) ? $this->certificate_visibility : 0;
800 }

◆ getInstruction()

ilObjExercise::getInstruction ( )

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

128 : string
129 {
130 return $this->instruction;
131 }

◆ getNrMandatoryRandom()

ilObjExercise::getNrMandatoryRandom ( )

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

180 : int
181 {
183 }

◆ getPassMode()

ilObjExercise::getPassMode ( )

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

141 : string
142 {
143 return $this->pass_mode;
144 }

◆ getPassNr()

ilObjExercise::getPassNr ( )

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

154 : int
155 {
156 return $this->pass_nr;
157 }

◆ getShowSubmissions()

ilObjExercise::getShowSubmissions ( )

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

167 : bool
168 {
170 }

◆ getTimestamp()

ilObjExercise::getTimestamp ( )

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

111 : int
112 {
113 return $this->timestamp;
114 }

References $timestamp.

◆ getTutorFeedback()

ilObjExercise::getTutorFeedback ( )
protected

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

209 : int
210 {
212 }

◆ hasTutorFeedbackFile()

ilObjExercise::hasTutorFeedbackFile ( )

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

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

◆ hasTutorFeedbackMail()

ilObjExercise::hasTutorFeedbackMail ( )

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

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

◆ hasTutorFeedbackText()

ilObjExercise::hasTutorFeedbackText ( )

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

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

◆ isCompletionBySubmissionEnabled()

ilObjExercise::isCompletionBySubmissionEnabled ( )

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

722 : bool
723 {
725 }

◆ processExerciseStatus()

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

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

743 : void {
744 foreach ($a_user_ids as $user_id) {
745 $member_status = $a_ass->getMemberStatus($user_id);
746 $member_status->setReturned($a_has_submitted);
747 $member_status->update();
748
749 ilExerciseMembers::_writeReturned($this->getId(), $user_id, $a_has_submitted);
750 }
751
752 // re-evaluate exercise status
753 if ($this->isCompletionBySubmissionEnabled()) {
754 foreach ($a_user_ids as $user_id) {
755 $status = 'notgraded';
756 if ($a_has_submitted) {
757 if (!is_array($a_valid_submissions) ||
758 $a_valid_submissions[$user_id]) {
759 $status = 'passed';
760 }
761 }
762
763 $member_status = $a_ass->getMemberStatus($user_id);
764 $member_status->setStatus($status);
765 $member_status->update();
766 }
767 }
768 }
getMemberStatus(?int $a_user_id=null)
static _writeReturned(int $a_obj_id, int $a_user_id, int $a_status)
Write returned status.

References $user_id, ilExerciseMembers\_writeReturned(), ILIAS\Survey\Mode\getId(), and ilExAssignment\getMemberStatus().

+ Here is the call graph for this function:

◆ read()

ilObjExercise::read ( )
Exceptions
ilObjectNotFoundException
ilObjectTypeMismatchException

Reimplemented from ilObject.

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

356 : void
357 {
359
360 parent::read();
361
362 $query = "SELECT * FROM exc_data " .
363 "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
364
365 $res = $ilDB->query($query);
366 while ($row = $ilDB->fetchObject($res)) {
367 $this->setInstruction((string) $row->instruction);
368 $this->setTimestamp((int) $row->time_stamp);
369 $pm = ($row->pass_mode == "")
370 ? "all"
371 : $row->pass_mode;
372 $this->setPassMode((string) $pm);
373 $this->setShowSubmissions((bool) $row->show_submissions);
374 if ($row->pass_mode == "nr") {
375 $this->setPassNr((int) $row->pass_nr);
376 }
377 $this->setNrMandatoryRandom((int) $row->nr_mandatory_random);
378 $this->setCompletionBySubmission($row->compl_by_submission == 1);
379 $this->setCertificateVisibility((int) $row->certificate_visibility);
380 $this->setTutorFeedback((int) $row->tfeedback);
381 }
382
383 $this->members_obj = new ilExerciseMembers($this);
384 }
setShowSubmissions(bool $a_val)
setCertificateVisibility(int $a_value)
setTimestamp(int $a_timestamp)
setTutorFeedback(int $a_value)
setCompletionBySubmission(bool $bool)
setNrMandatoryRandom(int $a_val)
setInstruction(string $a_instruction)
$res
Definition: ltiservices.php:69

References $ilDB, $res, and ILIAS\Survey\Mode\getId().

+ 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 813 of file class.ilObjExercise.php.

815 : void {
817
818 $ilDB->manipulateF(
819 "UPDATE exc_data SET certificate_visibility = %s WHERE obj_id = %s",
820 array('integer', 'integer'),
821 array($a_value, $this->getId())
822 );
823 }

◆ saveData()

ilObjExercise::saveData ( )

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

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

References $ilDB, and ILIAS\Survey\Mode\getId().

+ 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 805 of file class.ilObjExercise.php.

805 : void
806 {
807 $this->certificate_visibility = $a_value;
808 }

◆ setCompletionBySubmission()

ilObjExercise::setCompletionBySubmission ( bool  $bool)

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

728 : self
729 {
730 $this->completion_by_submission = $bool;
731
732 return $this;
733 }

◆ setDate()

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

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

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

◆ setId()

ilObjExercise::setId ( int  $a_id)
Exceptions
ilExcUnknownAssignmentTypeException

Reimplemented from ilObject.

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

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

◆ setInstruction()

ilObjExercise::setInstruction ( string  $a_instruction)

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

124 : void {
125 $this->instruction = $a_instruction;
126 }

◆ setNrMandatoryRandom()

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

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

175 : void
176 {
177 $this->nr_random_mand = $a_val;
178 }

◆ 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 136 of file class.ilObjExercise.php.

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

◆ setPassNr()

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

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

149 : void
150 {
151 $this->pass_nr = $a_val;
152 }

◆ setShowSubmissions()

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

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

162 : void
163 {
164 $this->show_submissions = $a_val;
165 }

◆ setTimestamp()

ilObjExercise::setTimestamp ( int  $a_timestamp)

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

118 : void {
119 $this->timestamp = $a_timestamp;
120 }

◆ setTutorFeedback()

ilObjExercise::setTutorFeedback ( int  $a_value)

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

214 : void
215 {
216 $this->tutor_feedback = $a_value;
217 }

◆ update()

ilObjExercise::update ( )
Exceptions
ilExcUnknownAssignmentTypeException

Reimplemented from ilObject.

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

396 : bool
397 {
399
400 parent::update();
401
402 $ilDB->update("exc_data", array(
403 "instruction" => array("clob", $this->getInstruction()),
404 "time_stamp" => array("integer", $this->getTimestamp()),
405 "pass_mode" => array("text", $this->getPassMode()),
406 "pass_nr" => array("integer", $this->getPassNr()),
407 "nr_mandatory_random" => array("integer", $this->getNrMandatoryRandom()),
408 "show_submissions" => array("integer", (int) $this->getShowSubmissions()),
409 'compl_by_submission' => array('integer', (int) $this->isCompletionBySubmissionEnabled()),
410 'tfeedback' => array('integer', $this->getTutorFeedback()),
411 ), array(
412 "obj_id" => array("integer", $this->getId())
413 ));
414
415 $this->updateAllUsersStatus();
416 $this->updateMetaData();
417
418 return true;
419 }
updateAllUsersStatus()
Update status of all users.

References $ilDB, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ updateAllUsersStatus()

ilObjExercise::updateAllUsersStatus ( )

Update status of all users.

Exceptions
ilExcUnknownAssignmentTypeException

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

603 : void
604 {
605 if (!isset($this->members_obj)) {
606 $this->members_obj = new ilExerciseMembers($this);
607 }
608
609 $mems = $this->members_obj->getMembers();
610 foreach ($mems as $mem) {
611 $this->updateUserStatus($mem);
612 }
613 }
updateUserStatus(int $a_user_id=0)
Update exercise status of user.

Referenced by ilExAssignment\delete().

+ 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 582 of file class.ilObjExercise.php.

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

References ilExerciseMembers\_writeStatus(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

Field Documentation

◆ $certificate_visibility

int ilObjExercise::$certificate_visibility = 0
protected

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

◆ $completion_by_submission

bool ilObjExercise::$completion_by_submission = false
protected

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

◆ $day

int ilObjExercise::$day = 0
protected

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

◆ $file_obj

ilFileDataMail ilObjExercise::$file_obj
protected

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

◆ $hour

int ilObjExercise::$hour = 0
protected

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

◆ $instruction

string ilObjExercise::$instruction = ""
protected

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

◆ $mandatory_manager

MandatoryAssignmentsManager ilObjExercise::$mandatory_manager
protected

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

◆ $members_obj

ilExerciseMembers ilObjExercise::$members_obj = null

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

◆ $minutes

int ilObjExercise::$minutes = 0
protected

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

◆ $month

int ilObjExercise::$month = 0
protected

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

◆ $nr_random_mand

int ilObjExercise::$nr_random_mand = 0
protected

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

◆ $pass_mode

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

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

◆ $pass_nr

int ilObjExercise::$pass_nr = 0
protected

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

◆ $service

InternalService ilObjExercise::$service
protected

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

◆ $show_submissions

bool ilObjExercise::$show_submissions = false
protected

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

◆ $timestamp

int ilObjExercise::$timestamp = 0
protected

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

◆ $tutor_feedback

int ilObjExercise::$tutor_feedback = 7
protected

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

◆ $user

ilObjUser ilObjExercise::$user
protected

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

◆ $webFilesystem

Filesystem ilObjExercise::$webFilesystem
protected

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

◆ $year

int ilObjExercise::$year = 0
protected

Definition at line 52 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

◆ TUTOR_FEEDBACK_MAIL

◆ TUTOR_FEEDBACK_TEXT


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