ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestLP Class Reference
+ Inheritance diagram for ilTestLP:
+ Collaboration diagram for ilTestLP:

Public Member Functions

 getDefaultMode ()
 
 getValidModes ()
 
 isAnonymized ()
 
 setTestObject (\ilObjTest $test)
 
- Public Member Functions inherited from ilObjectLP
 resetCaches ()
 
 isAnonymized ()
 
 getDefaultMode ()
 
 getValidModes ()
 
 getCurrentMode ()
 
 isActive ()
 
 getModeText ($a_mode)
 
 getModeInfoText ($a_mode)
 
 getSettingsInfo ()
 
 getCollectionInstance ()
 
 getMembers ($a_search=true)
 
 resetLPDataForCompleteObject ($a_recursive=true)
 
 resetLPDataForUserIds (array $a_user_ids, $a_recursive=true)
 
 handleToTrash ()
 
 handleDelete ()
 
 getMailTemplateId ()
 

Static Public Member Functions

static getDefaultModes ($a_lp_active)
 Get available type-specific default modes (no administration needed) More...
 
- Static Public Member Functions inherited from ilObjectLP
static getInstance ($a_obj_id)
 
static getTypeClass ($a_type)
 
static isSupportedObjectType ($a_type)
 
static handleMove ($a_source_ref_id)
 
static getLPMemberships ($a_usr_id, array $a_obj_ids, $a_parent_ref_id=null, $a_mapped_ref_ids=false)
 Get all objects where given user is member (from LP POV) More...
 
static supportsSpentSeconds ($a_obj_type)
 
static supportsMark ($a_obj_type)
 
static supportsMatrixView ($a_obj_type)
 
static getDefaultModes ($a_lp_active)
 Get available type-specific default modes (no administration needed) More...
 
static saveTypeDefaults (array $a_data)
 
static getTypeDefault ($a_type)
 Get current type default. More...
 

Protected Member Functions

 resetCustomLPDataForUserIds (array $a_user_ids, $a_recursive=true)
 
- Protected Member Functions inherited from ilObjectLP
 __construct ($a_obj_id)
 
 resetCustomLPDataForUserIds (array $a_user_ids, $a_recursive=true)
 
 gatherLPUsers ()
 
 updateParentCollections ()
 

Static Protected Member Functions

static isLPMember (array &$a_res, $a_usr_id, $a_obj_ids)
 Find (lp-relevant) members for given object ids. More...
 
- Static Protected Member Functions inherited from ilObjectLP
static isLPMember (array &$a_res, $a_usr_id, $a_obj_ids)
 Find (lp-relevant) members for given object ids. More...
 
static findMembershipsByPath (array &$a_res, $a_usr_id, $a_parent_ref_id, array $a_obj_ids, $a_mapped_ref_ids=false)
 Find (lp-relevant) memberships by path. More...
 
static getTypeDefaultFromDB ($a_type)
 

Protected Attributes

 $testObj
 
- Protected Attributes inherited from ilObjectLP
 $tree
 
 $db
 
 $obj_id
 
 $collection_instance
 
 $mode
 

Additional Inherited Members

- Static Protected Attributes inherited from ilObjectLP
static $type_defaults
 

Detailed Description

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

Member Function Documentation

◆ getDefaultMode()

ilTestLP::getDefaultMode ( )

Reimplemented from ilObjectLP.

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

References ilLPObjSettings\LP_MODE_TEST_PASSED.

◆ getDefaultModes()

static ilTestLP::getDefaultModes (   $a_lp_active)
static

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

Parameters
bool$a_lp_active
Returns
array

Reimplemented from ilObjectLP.

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

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

◆ getValidModes()

◆ isAnonymized()

ilTestLP::isAnonymized ( )

Reimplemented from ilObjectLP.

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

44 {
45 include_once './Modules/Test/classes/class.ilObjTest.php';
46 return (bool) ilObjTest::_lookupAnonymity($this->obj_id);
47 }
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 &  $a_res,
  $a_usr_id,
  $a_obj_ids 
)
staticprotected

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

Parameters
array$a_res
int$a_usr_id
array$a_obj_ids

Reimplemented from ilObjectLP.

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

104 {
105 global $ilDB;
106
107 // if active id
108 $set = $ilDB->query("SELECT tt.obj_fi" .
109 " FROM tst_active ta" .
110 " JOIN tst_tests tt ON (ta.test_fi = tt.test_id)" .
111 " WHERE " . $ilDB->in("tt.obj_fi", (array) $a_obj_ids, "", "integer") .
112 " AND ta.user_fi = " . $ilDB->quote($a_usr_id, "integer"));
113 while ($row = $ilDB->fetchAssoc($set)) {
114 $a_res[$row["obj_fi"]] = true;
115 }
116
117 return true;
118 }
global $ilDB

References $ilDB, and $row.

◆ resetCustomLPDataForUserIds()

ilTestLP::resetCustomLPDataForUserIds ( array  $a_user_ids,
  $a_recursive = true 
)
protected

Reimplemented from ilObjectLP.

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

58 {
59 /* @var ilObjTest $testOBJ */
60 if ($this->testObj) {
61 // #19247
62 $testOBJ = $this->testObj;
63 } else {
64 require_once 'Services/Object/classes/class.ilObjectFactory.php';
65 $testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id);
66 }
67 $testOBJ->removeTestResultsByUserIds($a_user_ids);
68
69 // :TODO: there has to be a better way
70 $test_ref_id = (int) $_REQUEST["ref_id"];
71 if ($this->testObj && $this->testObj->getRefId()) {
72 $test_ref_id = $this->testObj->getRefId();
73 }
74 if ($test_ref_id) {
75 require_once "Modules/Course/classes/Objectives/class.ilLOSettings.php";
76 $course_obj_id = ilLOSettings::isObjectiveTest($test_ref_id);
77 if ($course_obj_id) {
78 // remove objective results data
79 $lo_settings = ilLOSettings::getInstanceByObjId($course_obj_id);
80
81 require_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
82 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
84 $course_obj_id,
85 $a_user_ids,
86 ($lo_settings->getInitialTest() == $test_ref_id),
87 ($lo_settings->getQualifiedTest() == $test_ref_id),
89 );
90
91 // refresh LP - see ilLPStatusWrapper::_updateStatus()
92 require_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
93 $lp_status = ilLPStatusFactory::_getInstance($course_obj_id);
94 if (strtolower(get_class($lp_status)) != "illpstatus") {
95 foreach ($a_user_ids as $user_id) {
96 $lp_status->_updateStatus($course_obj_id, $user_id);
97 }
98 }
99 }
100 }
101 }
static isObjectiveTest($a_trst_ref_id)
Check if test ref_id is used in an objective course.
static getInstanceByObjId($a_obj_id)
get singleton instance
static lookupObjectivesForTest($a_test_ref_id)
Get all objectives that are assigned to given test.
static deleteResultsFromLP($a_course_id, array $a_user_ids, $a_remove_initial, $a_remove_qualified, array $a_objective_ids)
Delete all (qualified) result entries for course members.
static _getInstance($a_obj_id, $a_mode=null)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id

References $testObj, ilLPStatusFactory\_getInstance(), ilLOUserResults\deleteResultsFromLP(), ilLOSettings\getInstanceByObjId(), ilObjectFactory\getInstanceByObjId(), ilLOSettings\isObjectiveTest(), and ilLOTestAssignments\lookupObjectivesForTest().

+ Here is the call graph for this function:

◆ setTestObject()

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

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

53 {
54 $this->testObj = $test;
55 }
$test
Definition: Utf8Test.php:84

References $test.

Field Documentation

◆ $testObj

ilTestLP::$testObj
protected

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

Referenced by resetCustomLPDataForUserIds().


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