ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLOUtils Class Reference

Settings for LO courses. More...

+ Collaboration diagram for ilLOUtils:

Static Public Member Functions

static isCompleted ($a_cont_oid, $a_test_rid, $a_objective_id, $max_points, $reached, $limit_perc)
 Check if objective is completed. More...
 
static lookupObjectiveRequiredPercentage ($a_container_id, $a_objective_id, $a_test_ref_id, $a_max_points)
 
static lookupRandomTest ($a_test_obj_id)
 Check if test is a random test. More...
 
static lookupQplBySequence ($a_test_ref_id, $a_sequence_id)
 Lookup assigned qpl name (including taxonomy) by sequence. More...
 
static hasActiveRun ($a_container_id, $a_test_ref_id, $a_objective_id)
 
static getTestResultLinkForUser ($a_test_ref_id, $a_user_id)
 

Static Protected Member Functions

static buildQplTitleByDefinition (ilTestRandomQuestionSetSourcePoolDefinition $def, ilTestTaxonomyFilterLabelTranslater $trans)
 build title by definition More...
 

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
Version
$Id$

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

Member Function Documentation

◆ buildQplTitleByDefinition()

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

build title by definition

Parameters
ilTestRandomQuestionSetSourcePoolDefinition$def

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

191 {
192 $title = $def->getPoolTitle();
193 $tax_id = $def->getMappedFilterTaxId();
194 if($tax_id)
195 {
196 $title .= (' -> '. $trans->getTaxonomyTreeLabel($tax_id));
197 }
198 $tax_node = $def->getMappedFilterTaxNodeId();
199 if($tax_node)
200 {
201 $title .= (' -> ' .$trans->getTaxonomyNodeLabel($tax_node));
202 }
203 return $title;
204 }

References $title, ilTestRandomQuestionSetSourcePoolDefinition\getMappedFilterTaxId(), ilTestRandomQuestionSetSourcePoolDefinition\getMappedFilterTaxNodeId(), ilTestRandomQuestionSetSourcePoolDefinition\getPoolTitle(), and ilTestTaxonomyFilterLabelTranslater\getTaxonomyTreeLabel().

Referenced by lookupQplBySequence().

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

◆ getTestResultLinkForUser()

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

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

237 {
238 global $ilCtrl, $ilUser, $ilAccess;
239
240 if($ilUser->getId() == ANONYMOUS_USER_ID)
241 {
242 return;
243 }
244
245 $valid = $tutor = false;
246 if($a_user_id == $ilUser->getId())
247 {
248 $valid = $ilAccess->checkAccess('read', '', $a_test_ref_id);
249 }
250 if(!$valid)
251 {
252 $valid = $ilAccess->checkAccess('write', '', $a_test_ref_id);
253 $tutor = true;
254 }
255 if($valid)
256 {
257 $testObjId = ilObject::_lookupObjId($a_test_ref_id);
258 if(!$tutor)
259 {
260 require_once 'Modules/Test/classes/class.ilObjTestAccess.php';
261 if(ilObjTestAccess::visibleUserResultExists($testObjId, $a_user_id))
262 {
263 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', $a_test_ref_id);
264 $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjTestGUI'), 'userResultsGateway');
265 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', '');
266 return $link;
267 }
268 }
269 else
270 {
271 include_once 'Modules/Test/classes/class.ilObjTest.php';
272 $testId = ilObjTest::_getTestIDFromObjectID($testObjId);
273 if($testId)
274 {
275 $userActiveId = ilObjTest::_getActiveIdOfUser($a_user_id, $testId);
276 if($userActiveId)
277 {
278 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', $a_test_ref_id);
279 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', $userActiveId);
280 $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjTestGUI', 'ilTestEvaluationGUI'), 'outParticipantsResultsOverview');
281 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', '');
282 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', '');
283 return $link;
284 }
285 }
286 }
287 }
288 }
static visibleUserResultExists($testObjId, $userId)
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
static _getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
static _lookupObjId($a_id)
$valid
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

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

Referenced by ilContainerObjectiveGUI\buildObjectiveProgressBar(), and ilLOMemberTestResultTableGUI\createTestResultLink().

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

◆ hasActiveRun()

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

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

207 {
208 return FALSE;
209
210 // check if pass exists
211 include_once './Modules/Test/classes/class.ilObjTest.php';
212 if(
214 $a_test_ref_id,
215 $GLOBALS['ilUser']->getId())
216 )
217 {
218 return false;
219 }
220
221 // check if multiple pass exists
222 include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
223 $last_objectives = ilLOTestRun::lookupObjectives(
224 $a_container_id,
225 $GLOBALS['ilUser']->getId(),
226 ilObject::_lookupObjId($a_test_ref_id)
227 );
228
229 if(count((array) $last_objectives) and in_array((int) $a_objective_id, (array) $last_objectives))
230 {
231 return true;
232 }
233 return false;
234 }
static lookupObjectives($a_container_id, $a_user_id, $a_test_id)
static isParticipantsLastPassActive($testRefId, $userId)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, ilObject\_lookupObjId(), ilObjTest\isParticipantsLastPassActive(), and ilLOTestRun\lookupObjectives().

Referenced by ilContainerObjectiveGUI\showObjectives().

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

◆ isCompleted()

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

Check if objective is completed.

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

17 {
18 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
19 $settings = ilLOSettings::getInstanceByObjId($a_cont_oid);
20
21 if(self::lookupRandomTest(ilObject::_lookupObjId($a_test_rid)))
22 {
23 if(!$max_points)
24 {
25 return true;
26 }
27 else
28 {
29 return ($reached / $max_points * 100) >= $limit_perc;
30 }
31 }
32 else
33 {
34 $required_perc = self::lookupObjectiveRequiredPercentage($a_cont_oid, $a_objective_id, $a_test_rid, $max_points);
35
36 if(!$max_points)
37 {
38 return TRUE;
39 }
40 else
41 {
42 return ($reached / $max_points * 100) >= $required_perc;
43 }
44 }
45 }
static getInstanceByObjId($a_obj_id)
get singleton instance
static lookupObjectiveRequiredPercentage($a_container_id, $a_objective_id, $a_test_ref_id, $a_max_points)

References ilObject\_lookupObjId(), ilLOSettings\getInstanceByObjId(), and lookupObjectiveRequiredPercentage().

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

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

◆ lookupObjectiveRequiredPercentage()

static ilLOUtils::lookupObjectiveRequiredPercentage (   $a_container_id,
  $a_objective_id,
  $a_test_ref_id,
  $a_max_points 
)
static
Parameters
type$a_container_id
type$a_objective_id
type$a_test_type

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

54 {
55 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
56 $settings = ilLOSettings::getInstanceByObjId($a_container_id);
57
58 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
59 $assignments = ilLOTestAssignments::getInstance($a_container_id);
60 $a_test_type = $assignments->getTypeByTest($a_test_ref_id);
61
62 if($assignments->isSeparateTest($a_test_ref_id))
63 {
64 include_once './Services/Object/classes/class.ilObjectFactory.php';
65 $factory = new ilObjectFactory();
66 $tst = $factory->getInstanceByRefId($a_test_ref_id, FALSE);
67 if($tst instanceof ilObjTest)
68 {
69 $schema = $tst->getMarkSchema();
70 foreach($schema->getMarkSteps() as $mark)
71 {
72 if($mark->getPassed())
73 {
74 return (int) $mark->getMinimumLevel();
75 }
76 }
77 }
78 }
79
80
81
82 $tst_ref_id = $a_test_ref_id;
83 if(self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id)))
84 {
85 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
86 return (int) ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
87 }
88 else
89 {
90 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
91 $limit = ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
92 return $limit;
93 }
94 }
static loookupTestLimit($a_test_id, $a_objective_id)
static lookupLimit($a_container_id, $a_objective_id, $a_test_type)
static getInstance($a_container_id)
Get instance by container id.
Class ilObjectFactory.

References $schema, ilObject\_lookupObjId(), ilLOTestAssignments\getInstance(), ilLOSettings\getInstanceByObjId(), ilLORandomTestQuestionPools\lookupLimit(), and ilCourseObjectiveQuestion\loookupTestLimit().

Referenced by ilLOTestQuestionAdapter\initUserResult(), and isCompleted().

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

◆ lookupQplBySequence()

static ilLOUtils::lookupQplBySequence (   $a_test_ref_id,
  $a_sequence_id 
)
static

Lookup assigned qpl name (including taxonomy) by sequence.

Parameters
type$a_test_ref_id
type$a_sequence_id
Returns
string

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

147 {
148 if(!$a_sequence_id)
149 {
150 return '';
151 }
152 $tst = ilObjectFactory::getInstanceByRefId($a_test_ref_id,false);
153 if(!$tst instanceof ilObjTest)
154 {
155 return '';
156 }
157 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
158 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
160 $GLOBALS['ilDB'],
161 $tst,
163 $GLOBALS['ilDB'],
164 $tst
165 )
166 );
167
168 $list->loadDefinitions();
169
170 include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
171 $translator = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']);
172 $translator->loadLabels($list);
173
174 $title = '';
175 foreach ($list as $definition)
176 {
177 if($definition->getId() != $a_sequence_id)
178 {
179 continue;
180 }
181 $title = self::buildQplTitleByDefinition($definition, $translator);
182 }
183 return $title;
184 }
static buildQplTitleByDefinition(ilTestRandomQuestionSetSourcePoolDefinition $def, ilTestTaxonomyFilterLabelTranslater $trans)
build title by definition
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id

References $GLOBALS, $title, buildQplTitleByDefinition(), and ilObjectFactory\getInstanceByRefId().

Referenced by ilCourseObjectivesTableGUI\parse().

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

◆ lookupRandomTest()

static ilLOUtils::lookupRandomTest (   $a_test_obj_id)
static

Check if test is a random test.

Parameters
type$a_test_obj_id
Returns
bool

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

135 {
136 include_once './Modules/Test/classes/class.ilObjTest.php';
137 return ilObjTest::_lookupRandomTest($a_test_obj_id);
138 }
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not.

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: