ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilLOUtils Class Reference

Settings for LO courses. More...

+ Collaboration diagram for ilLOUtils:

Static Public Member Functions

static isCompleted (int $a_cont_oid, int $a_test_rid, int $a_objective_id, int $max_points, int $reached, int $limit_perc)
 Check if objective is completed. More...
 
static lookupObjectiveRequiredPercentage (int $a_container_id, int $a_objective_id, int $a_test_ref_id, int $a_max_points)
 
static lookupMaxAttempts (int $a_container_id, int $a_objective_id, int $a_test_ref_id)
 
static lookupRandomTest (int $a_test_obj_id)
 
static hasActiveRun (int $a_container_id, int $a_test_ref_id, int $a_objective_id)
 
static getTestResultLinkForUser (int $a_test_ref_id, int $a_user_id)
 

Static Protected Member Functions

static buildQplTitleByDefinition (ilTestRandomQuestionSetSourcePoolDefinition $def, ilTestQuestionFilterLabelTranslator $trans)
 

Detailed Description

Settings for LO courses.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 24 of file class.ilLOUtils.php.

Member Function Documentation

◆ buildQplTitleByDefinition()

static ilLOUtils::buildQplTitleByDefinition ( ilTestRandomQuestionSetSourcePoolDefinition  $def,
ilTestQuestionFilterLabelTranslator  $trans 
)
staticprotected

Definition at line 151 of file class.ilLOUtils.php.

154 : string {
155 $title = $def->getPoolTitle();
156 $filterTitle = array();
157 $filterTitle[] = $trans->getTaxonomyFilterLabel($def->getMappedTaxonomyFilter());
158 $filterTitle[] = $trans->getTypeFilterLabel($def->getTypeFilter());
159 if (!empty($filterTitle)) {
160 $title .= ' -> ' . implode(' / ', $filterTitle);
161 }
162 return $title;
163 }
getTaxonomyFilterLabel(array $filter=[], string $filter_delimiter='+', string $tax_node_delimiter=':', string $nodes_delimiter=', ')

◆ getTestResultLinkForUser()

static ilLOUtils::getTestResultLinkForUser ( int  $a_test_ref_id,
int  $a_user_id 
)
static

Definition at line 170 of file class.ilLOUtils.php.

170 : string
171 {
172 global $DIC;
173
174 $ilCtrl = $DIC->ctrl();
175 $ilUser = $DIC->user();
176 $ilAccess = $DIC->access();
177
178 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
179 return '';
180 }
181
182 $valid = $tutor = false;
183 if ($a_user_id == $ilUser->getId()) {
184 $valid = $ilAccess->checkAccess('read', '', $a_test_ref_id);
185 }
186 if (!$valid) {
187 $valid = $ilAccess->checkAccess('write', '', $a_test_ref_id);
188 $tutor = true;
189 }
190 if ($valid) {
191 $testObjId = ilObject::_lookupObjId($a_test_ref_id);
192 if (!$tutor) {
193 if (ilObjTestAccess::visibleUserResultExists($testObjId, $a_user_id)) {
194 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', $a_test_ref_id);
195 $ctrlClasses = array('ilRepositoryGUI', 'ilObjTestGUI', 'ilTestResultsGUI');
196 $link = $ilCtrl->getLinkTargetByClass($ctrlClasses);
197 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', '');
198 return $link;
199 }
200 } else {
201 $testId = ilObjTest::_getTestIDFromObjectID($testObjId);
202 if ($testId) {
203 $userActiveId = ilObjTest::_getActiveIdOfUser($a_user_id, $testId);
204 if ($userActiveId) {
205 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', $a_test_ref_id);
206 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', $userActiveId);
207 $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI',
208 'ilObjTestGUI',
209 'ilTestEvaluationGUI'
210 ), 'outParticipantsResultsOverview');
211 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', '');
212 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', '');
213 return $link;
214 }
215 }
216 }
217 }
218 return '';
219 }
static visibleUserResultExists(int $test_obj_id, int $user_id)
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
static _getActiveIdOfUser($user_id="", $test_id="")
static _lookupObjId(int $ref_id)
const ANONYMOUS_USER_ID
Definition: constants.php:27
$valid
global $DIC
Definition: shib_login.php:26

References $DIC, $valid, ilObjTest\_getActiveIdOfUser(), ilObjTest\_getTestIDFromObjectID(), ilObject\_lookupObjId(), ANONYMOUS_USER_ID, and ilObjTestAccess\visibleUserResultExists().

Referenced by ilLOMemberTestResultTableGUI\createTestResultLink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasActiveRun()

static ilLOUtils::hasActiveRun ( int  $a_container_id,
int  $a_test_ref_id,
int  $a_objective_id 
)
static

Definition at line 165 of file class.ilLOUtils.php.

165 : bool
166 {
167 return false;
168 }

Referenced by ilContainerObjectiveGUI\showObjectives(), and ILIAS\Containter\Content\ObjectiveRenderer\showObjectives().

+ Here is the caller graph for this function:

◆ isCompleted()

static ilLOUtils::isCompleted ( int  $a_cont_oid,
int  $a_test_rid,
int  $a_objective_id,
int  $max_points,
int  $reached,
int  $limit_perc 
)
static

Check if objective is completed.

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

36 : bool {
37 $settings = ilLOSettings::getInstanceByObjId($a_cont_oid);
38
39 if (self::lookupRandomTest(ilObject::_lookupObjId($a_test_rid))) {
40 if ($max_points === 0) {
41 return true;
42 } else {
43 return ($reached / $max_points * 100) >= $limit_perc;
44 }
45 } else {
47 $a_cont_oid,
48 $a_objective_id,
49 $a_test_rid,
50 $max_points
51 );
52
53 if ($max_points === 0) {
54 return true;
55 } else {
56 return ($reached / $max_points * 100) >= $required_perc;
57 }
58 }
59 }
static getInstanceByObjId(int $a_obj_id)
static lookupObjectiveRequiredPercentage(int $a_container_id, int $a_objective_id, int $a_test_ref_id, int $a_max_points)

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

+ Here is the caller graph for this function:

◆ lookupMaxAttempts()

static ilLOUtils::lookupMaxAttempts ( int  $a_container_id,
int  $a_objective_id,
int  $a_test_ref_id 
)
static

Definition at line 91 of file class.ilLOUtils.php.

91 : int
92 {
93 global $DIC;
94
95 $ilDB = $DIC->database();
96
97 $assignments = ilLOTestAssignments::getInstance($a_container_id);
98 if (!$assignments->isSeparateTest($a_test_ref_id)) {
99 // no limit of tries for tests assigned to multiple objectives.
100 return 0;
101 }
102
103 $test_obj = new ilObjTest($a_test_ref_id, true);
104 return $test_obj->getNrOfTries();
105 }
static getInstance(int $a_container_id)

References $DIC, $ilDB, and ilLOTestAssignments\getInstance().

Referenced by ilLOTestQuestionAdapter\initUserResult().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupObjectiveRequiredPercentage()

static ilLOUtils::lookupObjectiveRequiredPercentage ( int  $a_container_id,
int  $a_objective_id,
int  $a_test_ref_id,
int  $a_max_points 
)
static

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

66 : int {
67 $settings = ilLOSettings::getInstanceByObjId($a_container_id);
68 $assignments = ilLOTestAssignments::getInstance($a_container_id);
69 $a_test_type = $assignments->getTypeByTest($a_test_ref_id);
70
71 if ($assignments->isSeparateTest($a_test_ref_id)) {
72 $factory = new ilObjectFactory();
73 $tst = $factory->getInstanceByRefId($a_test_ref_id, false);
74 if ($tst instanceof ilObjTest) {
75 $schema = $tst->getMarkSchema();
76 foreach ($schema->getMarkSteps() as $mark) {
77 if ($mark->getPassed()) {
78 return (int) $mark->getMinimumLevel();
79 }
80 }
81 }
82 }
83 $tst_ref_id = $a_test_ref_id;
84 if (self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id))) {
85 return ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
86 } else {
87 return ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
88 }
89 }
static loookupTestLimit(int $a_test_id, int $a_objective_id)
static lookupLimit(int $a_container_id, int $a_objective_id, int $a_test_type)
Class ilObjectFactory This class offers methods to get instances of the type-specific object classes ...

Referenced by ilLOTestQuestionAdapter\initUserResult().

+ Here is the caller graph for this function:

◆ lookupRandomTest()

static ilLOUtils::lookupRandomTest ( int  $a_test_obj_id)
static

Definition at line 107 of file class.ilLOUtils.php.

107 : bool
108 {
109 return ilObjTest::_lookupRandomTest($a_test_obj_id);
110 }
static _lookupRandomTest(int $obj_id)

References ilObjTest\_lookupRandomTest().

Referenced by ilLOEditorStatus\lookupQuestionsAssigned(), and ilCourseObjectivesTableGUI\parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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