ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 168 of file class.ilLOUtils.php.

169 {
170 $title = $def->getPoolTitle();
171 // fau: taxFilter/typeFilter - get title for extended filter conditions
172 $filterTitle = array();
173 $filterTitle[] = $trans->getTaxonomyFilterLabel($def->getMappedTaxonomyFilter());
174 $filterTitle[] = $trans->getTypeFilterLabel($def->getTypeFilter());
175 if (!empty($filterTitle)) {
176 $title .= ' -> ' . implode(' / ', $filterTitle);
177 }
178 #$tax_id = $def->getMappedFilterTaxId();
179 #if($tax_id)
180 #{
181 # $title .= (' -> '. $trans->getTaxonomyTreeLabel($tax_id));
182 #}
183 #$tax_node = $def->getMappedFilterTaxNodeId();
184 #if($tax_node)
185 #{
186 # $title .= (' -> ' .$trans->getTaxonomyNodeLabel($tax_node));
187 #}
188 // fau.
189 return $title;
190 }
getTaxonomyFilterLabel($filter=array(), $filterDelimiter='+', $taxNodeDelimiter=':', $nodesDelimiter=', ')
Get the label for a taxonomy filter.
getTypeFilterLabel($filter=array())
Get the label for a type filter.
$def
Definition: croninfo.php:21

References $def, $title, ilTestTaxonomyFilterLabelTranslater\getTaxonomyFilterLabel(), and ilTestTaxonomyFilterLabelTranslater\getTypeFilterLabel().

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 221 of file class.ilLOUtils.php.

222 {
223 global $ilCtrl, $ilUser, $ilAccess;
224
225 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
226 return;
227 }
228
229 $valid = $tutor = false;
230 if ($a_user_id == $ilUser->getId()) {
231 $valid = $ilAccess->checkAccess('read', '', $a_test_ref_id);
232 }
233 if (!$valid) {
234 $valid = $ilAccess->checkAccess('write', '', $a_test_ref_id);
235 $tutor = true;
236 }
237 if ($valid) {
238 $testObjId = ilObject::_lookupObjId($a_test_ref_id);
239 if (!$tutor) {
240 require_once 'Modules/Test/classes/class.ilObjTestAccess.php';
241 if (ilObjTestAccess::visibleUserResultExists($testObjId, $a_user_id)) {
242 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', $a_test_ref_id);
243 $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjTestGUI'), 'userResultsGateway');
244 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', '');
245 return $link;
246 }
247 } else {
248 include_once 'Modules/Test/classes/class.ilObjTest.php';
249 $testId = ilObjTest::_getTestIDFromObjectID($testObjId);
250 if ($testId) {
251 $userActiveId = ilObjTest::_getActiveIdOfUser($a_user_id, $testId);
252 if ($userActiveId) {
253 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', $a_test_ref_id);
254 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', $userActiveId);
255 $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjTestGUI', 'ilTestEvaluationGUI'), 'outParticipantsResultsOverview');
256 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', '');
257 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', '');
258 return $link;
259 }
260 }
261 }
262 }
263 }
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 192 of file class.ilLOUtils.php.

193 {
194 return false;
195
196 // check if pass exists
197 include_once './Modules/Test/classes/class.ilObjTest.php';
198 if (
200 $a_test_ref_id,
201 $GLOBALS['ilUser']->getId()
202 )
203 ) {
204 return false;
205 }
206
207 // check if multiple pass exists
208 include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
209 $last_objectives = ilLOTestRun::lookupObjectives(
210 $a_container_id,
211 $GLOBALS['ilUser']->getId(),
212 ilObject::_lookupObjId($a_test_ref_id)
213 );
214
215 if (count((array) $last_objectives) and in_array((int) $a_objective_id, (array) $last_objectives)) {
216 return true;
217 }
218 return false;
219 }
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 if (!$max_points) {
23 return true;
24 } else {
25 return ($reached / $max_points * 100) >= $limit_perc;
26 }
27 } else {
28 $required_perc = self::lookupObjectiveRequiredPercentage($a_cont_oid, $a_objective_id, $a_test_rid, $max_points);
29
30 if (!$max_points) {
31 return true;
32 } else {
33 return ($reached / $max_points * 100) >= $required_perc;
34 }
35 }
36 }
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 44 of file class.ilLOUtils.php.

45 {
46 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
47 $settings = ilLOSettings::getInstanceByObjId($a_container_id);
48
49 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
50 $assignments = ilLOTestAssignments::getInstance($a_container_id);
51 $a_test_type = $assignments->getTypeByTest($a_test_ref_id);
52
53 if ($assignments->isSeparateTest($a_test_ref_id)) {
54 include_once './Services/Object/classes/class.ilObjectFactory.php';
56 $tst = $factory->getInstanceByRefId($a_test_ref_id, false);
57 if ($tst instanceof ilObjTest) {
58 $schema = $tst->getMarkSchema();
59 foreach ($schema->getMarkSteps() as $mark) {
60 if ($mark->getPassed()) {
61 return (int) $mark->getMinimumLevel();
62 }
63 }
64 }
65 }
66
67
68
69 $tst_ref_id = $a_test_ref_id;
70 if (self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id))) {
71 include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
72 return (int) ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
73 } else {
74 include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
75 $limit = ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
76 return $limit;
77 }
78 }
$factory
Definition: metadata.php:47
static loookupTestLimit($a_test_id, $a_objective_id)
static lookupLimit($a_container_id, $a_objective_id, $a_test_type)
lookup limit @global type $ilDB
static getInstance($a_container_id)
Get instance by container id.
Class ilObjectFactory.

References $factory, $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 128 of file class.ilLOUtils.php.

129 {
130 if (!$a_sequence_id) {
131 return '';
132 }
133 $tst = ilObjectFactory::getInstanceByRefId($a_test_ref_id, false);
134 if (!$tst instanceof ilObjTest) {
135 return '';
136 }
137 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
138 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
140 $GLOBALS['ilDB'],
141 $tst,
143 $GLOBALS['ilDB'],
144 $tst
145 )
146 );
147
148 $list->loadDefinitions();
149
150 include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
152 $translator->loadLabels($list);
153
154 $title = '';
155 foreach ($list as $definition) {
156 if ($definition->getId() != $a_sequence_id) {
157 continue;
158 }
160 }
161 return $title;
162 }
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
$translator
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41

References $GLOBALS, $list, $title, $translator, 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 116 of file class.ilLOUtils.php.

117 {
118 include_once './Modules/Test/classes/class.ilObjTest.php';
119 return ilObjTest::_lookupRandomTest($a_test_obj_id);
120 }
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: