ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
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, float $max_points, float $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, float $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 25 of file class.ilLOUtils.php.

Member Function Documentation

◆ buildQplTitleByDefinition()

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

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

155 : string {
156 $title = $def->getPoolTitle();
157 $filterTitle = array();
158 $filterTitle[] = $trans->getTaxonomyFilterLabel($def->getMappedTaxonomyFilter());
159 $filterTitle[] = $trans->getTypeFilterLabel($def->getTypeFilter());
160 if (!empty($filterTitle)) {
161 $title .= ' -> ' . implode(' / ', $filterTitle);
162 }
163 return $title;
164 }
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 171 of file class.ilLOUtils.php.

171 : string
172 {
173 global $DIC;
174
175 $ilCtrl = $DIC->ctrl();
176 $ilUser = $DIC->user();
177 $ilAccess = $DIC->access();
178
179 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
180 return '';
181 }
182
183 $valid = $tutor = false;
184 if ($a_user_id == $ilUser->getId()) {
185 $valid = $ilAccess->checkAccess('read', '', $a_test_ref_id);
186 }
187 if (!$valid) {
188 $valid = $ilAccess->checkAccess('write', '', $a_test_ref_id);
189 $tutor = true;
190 }
191 if ($valid) {
192 $testObjId = ilObject::_lookupObjId($a_test_ref_id);
193 if (!$tutor) {
194 if (ilObjTestAccess::visibleUserResultExists($testObjId, $a_user_id)) {
195 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', $a_test_ref_id);
196 $ctrlClasses = array('ilRepositoryGUI', 'ilObjTestGUI', 'ilTestResultsGUI');
197 $link = $ilCtrl->getLinkTargetByClass($ctrlClasses);
198 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', '');
199 return $link;
200 }
201 } else {
202 $testId = ilObjTest::_getTestIDFromObjectID($testObjId);
203 if ($testId) {
204 $userActiveId = ilObjTest::_getActiveIdOfUser($a_user_id, $testId);
205 if ($userActiveId) {
206 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', $a_test_ref_id);
207 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', $userActiveId);
208 $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI',
209 'ilObjTestGUI',
210 'ilTestEvaluationGUI'
211 ), 'outParticipantsResultsOverview');
212 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', '');
213 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', '');
214 return $link;
215 }
216 }
217 }
218 }
219 return '';
220 }
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 166 of file class.ilLOUtils.php.

166 : bool
167 {
168 return false;
169 }

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,
float  $max_points,
float  $reached,
int  $limit_perc 
)
static

Check if objective is completed.

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

37 : bool {
38 $settings = ilLOSettings::getInstanceByObjId($a_cont_oid);
39
40 if (self::lookupRandomTest(ilObject::_lookupObjId($a_test_rid))) {
41 if ($max_points === 0) {
42 return true;
43 } else {
44 return ($reached / $max_points * 100) >= $limit_perc;
45 }
46 } else {
48 $a_cont_oid,
49 $a_objective_id,
50 $a_test_rid,
51 $max_points
52 );
53
54 if ($max_points === 0) {
55 return true;
56 } else {
57 return ($reached / $max_points * 100) >= $required_perc;
58 }
59 }
60 }
static getInstanceByObjId(int $a_obj_id)
static lookupObjectiveRequiredPercentage(int $a_container_id, int $a_objective_id, int $a_test_ref_id, float $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 92 of file class.ilLOUtils.php.

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

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

67 : int {
68 $settings = ilLOSettings::getInstanceByObjId($a_container_id);
69 $assignments = ilLOTestAssignments::getInstance($a_container_id);
70 $a_test_type = $assignments->getTypeByTest($a_test_ref_id);
71
72 if ($assignments->isSeparateTest($a_test_ref_id)) {
73 $factory = new ilObjectFactory();
74 $tst = $factory->getInstanceByRefId($a_test_ref_id, false);
75 if ($tst instanceof ilObjTest) {
76 $schema = $tst->getMarkSchema();
77 foreach ($schema->getMarkSteps() as $mark) {
78 if ($mark->getPassed()) {
79 return (int) $mark->getMinimumLevel();
80 }
81 }
82 }
83 }
84 $tst_ref_id = $a_test_ref_id;
85 if (self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id))) {
86 return ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
87 } else {
88 return ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
89 }
90 }
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 108 of file class.ilLOUtils.php.

108 : bool
109 {
110 return ilObjTest::_lookupRandomTest($a_test_obj_id);
111 }
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: