ILIAS  release_8 Revision v8.24
ilTestLP Class Reference
+ Inheritance diagram for ilTestLP:
+ Collaboration diagram for ilTestLP:

Public Member Functions

 __construct (int $obj_id)
 
 getDefaultMode ()
 
 getValidModes ()
 
 isAnonymized ()
 
 setTestObject (\ilObjTest $test)
 
- Public Member Functions inherited from ilObjectLP
 resetCaches ()
 
 isAnonymized ()
 
 getDefaultMode ()
 
 getValidModes ()
 
 getCurrentMode ()
 
 isActive ()
 
 getModeText (int $mode)
 
 getModeInfoText (int $mode)
 
 getSettingsInfo ()
 
 getCollectionInstance ()
 
 getMembers (bool $search=true)
 
 resetLPDataForCompleteObject (bool $recursive=true)
 
 resetLPDataForUserIds (array $user_ids, bool $recursive=true)
 
 handleToTrash ()
 
 handleDelete ()
 
 getMailTemplateId ()
 
 hasIndividualModeOptions ()
 
 initInvidualModeOptions (ilRadioGroupInputGUI $modeRadio)
 
 shouldFetchIndividualModeFromFormSubmission ()
 
 fetchIndividualModeFromFormSubmission (ilPropertyFormGUI $form)
 
 appendModeConfiguration (int $mode, ilRadioOption $modeElement)
 
 saveModeConfiguration (ilPropertyFormGUI $form, bool &$modeChanged)
 

Static Public Member Functions

static getDefaultModes (bool $a_lp_active)
 Get available type-specific default modes (no administration needed) More...
 
- Static Public Member Functions inherited from ilObjectLP
static getInstance (int $obj_id)
 
static getTypeClass (string $type)
 
static getSupportedObjectTypes ()
 
static isSupportedObjectType (string $type)
 
static handleMove (int $source_ref_id)
 
static getLPMemberships (int $usr_id, array $obj_ids, ?int $parent_ref_id=null, bool $mapped_ref_ids=false)
 Get all objects where given user is member (from LP POV) More...
 
static supportsSpentSeconds (string $obj_type)
 
static supportsMark (string $obj_type)
 
static supportsMatrixView (string $obj_type)
 
static getDefaultModes (bool $lp_active)
 Get available type-specific default modes (no administration needed) More...
 
static saveTypeDefaults (array $data)
 
static getTypeDefault (string $type)
 

Protected Member Functions

 resetCustomLPDataForUserIds (array $user_ids, bool $recursive=true)
 
- Protected Member Functions inherited from ilObjectLP
 __construct (int $obj_id)
 
 resetCustomLPDataForUserIds (array $user_ids, bool $recursive=true)
 
 gatherLPUsers ()
 
 updateParentCollections ()
 

Static Protected Member Functions

static isLPMember (array &$a_res, int $a_usr_id, array $a_obj_ids)
 Find (lp-relevant) members for given object ids. More...
 
- Static Protected Member Functions inherited from ilObjectLP
static isLPMember (array &$res, int $usr_id, array $obj_ids)
 Find (lp-relevant) members for given object ids. More...
 
static findMembershipsByPath (array &$res, int $usr_id, int $parent_ref_id, array $obj_ids, bool $mapped_ref_ids=false)
 Find (lp-relevant) memberships by path. More...
 
static getTypeDefaultFromDB (string $type)
 

Protected Attributes

 $testObj
 
- Protected Attributes inherited from ilObjectLP
ilTree $tree
 
ilDBInterface $db
 
ilObjectDefinition $objectDefinition
 
int $obj_id
 
ilLPCollection $collection_instance = null
 
int $mode = null
 

Private Attributes

ILIAS Test InternalRequestService $request
 

Additional Inherited Members

- Static Protected Attributes inherited from ilObjectLP
static array $type_defaults = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestLP::__construct ( int  $obj_id)

Reimplemented from ilObjectLP.

Definition at line 35 of file class.ilTestLP.php.

36 {
37 global $DIC;
38 $this->request = $DIC->test()->internal()->request();
39
41 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ilObjectLP\$obj_id, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultMode()

ilTestLP::getDefaultMode ( )

Reimplemented from ilObjectLP.

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

52 : int
53 {
55 }

References ilLPObjSettings\LP_MODE_TEST_PASSED.

◆ getDefaultModes()

static ilTestLP::getDefaultModes ( bool  $lp_active)
static

Get available type-specific default modes (no administration needed)

Returns
int[]

Reimplemented from ilObjectLP.

Definition at line 43 of file class.ilTestLP.php.

References ilLPObjSettings\LP_MODE_DEACTIVATED, ilLPObjSettings\LP_MODE_TEST_FINISHED, and ilLPObjSettings\LP_MODE_TEST_PASSED.

◆ getValidModes()

ilTestLP::getValidModes ( )

◆ isAnonymized()

ilTestLP::isAnonymized ( )

Reimplemented from ilObjectLP.

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

66 : bool
67 {
68 return (bool) ilObjTest::_lookupAnonymity($this->obj_id);
69 }
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.

References ilObjTest\_lookupAnonymity().

+ Here is the call graph for this function:

◆ isLPMember()

static ilTestLP::isLPMember ( array &  $res,
int  $usr_id,
array  $obj_ids 
)
staticprotected

Find (lp-relevant) members for given object ids.

Reimplemented from ilObjectLP.

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

122 : bool
123 {
124 global $DIC;
125 $ilDB = $DIC['ilDB'];
126
127 // if active id
128 $set = $ilDB->query("SELECT tt.obj_fi" .
129 " FROM tst_active ta" .
130 " JOIN tst_tests tt ON (ta.test_fi = tt.test_id)" .
131 " WHERE " . $ilDB->in("tt.obj_fi", (array) $a_obj_ids, false, "integer") .
132 " AND ta.user_fi = " . $ilDB->quote($a_usr_id, "integer"));
133 while ($row = $ilDB->fetchAssoc($set)) {
134 $a_res[$row["obj_fi"]] = true;
135 }
136
137 return true;
138 }

References $DIC, and $ilDB.

◆ resetCustomLPDataForUserIds()

ilTestLP::resetCustomLPDataForUserIds ( array  $user_ids,
bool  $recursive = true 
)
protected

Reimplemented from ilObjectLP.

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

79 : void
80 {
81 /* @var ilObjTest $testOBJ */
82 if ($this->testObj) {
83 // #19247
84 $testOBJ = $this->testObj;
85 } else {
86 $testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id);
87 }
88 $testOBJ->removeTestResultsByUserIds($user_ids);
89
90 // :TODO: there has to be a better way
91 $test_ref_id = $this->request->int('ref_id');
92 if ($this->testObj && $this->testObj->getRefId()) {
93 $test_ref_id = $this->testObj->getRefId();
94 }
95
96 if ($test_ref_id === 0) {
97 return;
98 }
99
100 $course_obj_id = ilLOTestAssignments::lookupContainerForTest($test_ref_id);
101 if ($course_obj_id === 0) {
102 return;
103 }
104
105 // remove objective results data
106 $lo_assignments = ilLOTestAssignments::getInstance($course_obj_id);
108 $course_obj_id,
109 $user_ids,
110 $lo_assignments->getTypeByTest($test_ref_id) === ilLOSettings::TYPE_TEST_INITIAL,
111 $lo_assignments->getTypeByTest($test_ref_id) === ilLOSettings::TYPE_TEST_QUALIFIED,
113 );
114 $lp_status = ilLPStatusFactory::_getInstance($course_obj_id);
115 if (strtolower(get_class($lp_status)) !== 'illpstatus') {
116 foreach ($user_ids as $user_id) {
117 $lp_status->_updateStatus($course_obj_id, $user_id);
118 }
119 }
120 }
static lookupContainerForTest(int $a_test_ref_id)
static lookupObjectivesForTest(int $a_test_ref_id)
static getInstance(int $a_container_id)
static deleteResultsFromLP(int $a_course_id, array $a_user_ids, bool $a_remove_initial, bool $a_remove_qualified, array $a_objective_ids)
static _getInstance(int $a_obj_id, ?int $a_mode=null)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id

References $testObj, ilLPStatusFactory\_getInstance(), ilLOUserResults\deleteResultsFromLP(), ilLOTestAssignments\getInstance(), ilObjectFactory\getInstanceByObjId(), ilLOTestAssignments\lookupContainerForTest(), ilLOTestAssignments\lookupObjectivesForTest(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

+ Here is the call graph for this function:

◆ setTestObject()

ilTestLP::setTestObject ( \ilObjTest  $test)
Parameters
ilObjTest$test

Definition at line 74 of file class.ilTestLP.php.

75 {
76 $this->testObj = $test;
77 }

Field Documentation

◆ $request

ILIAS Test InternalRequestService ilTestLP::$request
private

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

◆ $testObj

ilTestLP::$testObj
protected

Definition at line 33 of file class.ilTestLP.php.

Referenced by resetCustomLPDataForUserIds().


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