ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 Post vars for input groups is taken from array keys. More...
 
 shouldFetchIndividualModeFromFormSubmission ()
 
 fetchIndividualModeFromFormSubmission (string $selected_group, array $group_data)
 
 appendModeConfiguration (int $mode)
 
 saveModeConfiguration (string $selected_group, array $group_data, 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

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

Private Attributes

RequestDataCollector $request
 

Additional Inherited Members

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestLP::__construct ( int  $obj_id)

Reimplemented from ilObjectLP.

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

37 {
38 $this->request = TestDIC::dic()['request_data_collector'];
39
41 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References 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.

Referenced by ilTestLPTest\testGetDefaultModes().

+ Here is the caller graph for this function:

◆ getValidModes()

ilTestLP::getValidModes ( )

◆ isAnonymized()

ilTestLP::isAnonymized ( )

Reimplemented from ilObjectLP.

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

66 : bool
67 {
68 if ($this->test_object === null) {
70 }
71 return (bool) $this->test_object->getAnonymity();
72 }
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
setTestObject(\ilObjTest $test)

References ilObjectFactory\getInstanceByObjId(), and setTestObject().

+ 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 125 of file class.ilTestLP.php.

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

References $DIC, and $ilDB.

◆ resetCustomLPDataForUserIds()

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

Reimplemented from ilObjectLP.

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

82 : void
83 {
84 /* @var ilObjTest $testOBJ */
85 if ($this->test_object) {
86 // #19247
87 $testOBJ = $this->test_object;
88 } else {
89 $testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id);
90 }
91 $testOBJ->removeTestResultsByUserIds($user_ids);
92
93 // :TODO: there has to be a better way
94 $test_ref_id = $this->request->int('ref_id');
95 if ($this->test_object && $this->test_object->getRefId()) {
96 $test_ref_id = $this->test_object->getRefId();
97 }
98
99 if ($test_ref_id === 0) {
100 return;
101 }
102
103 $course_obj_id = ilLOTestAssignments::lookupContainerForTest($test_ref_id);
104 if ($course_obj_id === 0) {
105 return;
106 }
107
108 // remove objective results data
109 $lo_assignments = ilLOTestAssignments::getInstance($course_obj_id);
111 $course_obj_id,
112 $user_ids,
113 $lo_assignments->getTypeByTest($test_ref_id) === ilLOSettings::TYPE_TEST_INITIAL,
114 $lo_assignments->getTypeByTest($test_ref_id) === ilLOSettings::TYPE_TEST_QUALIFIED,
116 );
117 $lp_status = ilLPStatusFactory::_getInstance($course_obj_id);
118 if (strtolower(get_class($lp_status)) !== 'illpstatus') {
119 foreach ($user_ids as $user_id) {
120 $lp_status->_updateStatus($course_obj_id, $user_id);
121 }
122 }
123 }
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)
ilObjTest $test_object

References $test_object, $user_id, 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 77 of file class.ilTestLP.php.

78 {
79 $this->test_object = $test;
80 }

Referenced by isAnonymized().

+ Here is the caller graph for this function:

Field Documentation

◆ $request

RequestDataCollector ilTestLP::$request
private

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

◆ $test_object

ilObjTest ilTestLP::$test_object = null
protected

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

Referenced by resetCustomLPDataForUserIds().


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