ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 170 of file class.ilLOUtils.php.

171 {
172 $title = $def->getPoolTitle();
173 // fau: taxFilter/typeFilter - get title for extended filter conditions
174 $filterTitle = array();
175 $filterTitle[] = $trans->getTaxonomyFilterLabel($def->getMappedTaxonomyFilter());
176 $filterTitle[] = $trans->getTypeFilterLabel($def->getTypeFilter());
177 if (!empty($filterTitle)) {
178 $title .= ' -> ' . implode(' / ', $filterTitle);
179 }
180 #$tax_id = $def->getMappedFilterTaxId();
181 #if($tax_id)
182 #{
183 # $title .= (' -> '. $trans->getTaxonomyTreeLabel($tax_id));
184 #}
185 #$tax_node = $def->getMappedFilterTaxNodeId();
186 #if($tax_node)
187 #{
188 # $title .= (' -> ' .$trans->getTaxonomyNodeLabel($tax_node));
189 #}
190 // fau.
191 return $title;
192 }
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 223 of file class.ilLOUtils.php.

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

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

Referenced by ilContainerObjectiveGUI\buildAccordionTitle(), 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 194 of file class.ilLOUtils.php.

195 {
196 return false;
197
198 // check if pass exists
199 include_once './Modules/Test/classes/class.ilObjTest.php';
200 if (
202 $a_test_ref_id,
203 $GLOBALS['DIC']['ilUser']->getId()
204 )
205 ) {
206 return false;
207 }
208
209 // check if multiple pass exists
210 include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
211 $last_objectives = ilLOTestRun::lookupObjectives(
212 $a_container_id,
213 $GLOBALS['DIC']['ilUser']->getId(),
214 ilObject::_lookupObjId($a_test_ref_id)
215 );
216
217 if (count((array) $last_objectives) and in_array((int) $a_objective_id, (array) $last_objectives)) {
218 return true;
219 }
220 return false;
221 }
static lookupObjectives($a_container_id, $a_user_id, $a_test_id)
static isParticipantsLastPassActive($testRefId, $userId)
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

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:43
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, 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 130 of file class.ilLOUtils.php.

131 {
132 if (!$a_sequence_id) {
133 return '';
134 }
135 $tst = ilObjectFactory::getInstanceByRefId($a_test_ref_id, false);
136 if (!$tst instanceof ilObjTest) {
137 return '';
138 }
139 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
140 include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
142 $GLOBALS['DIC']['ilDB'],
143 $tst,
145 $GLOBALS['DIC']['ilDB'],
146 $tst
147 )
148 );
149
150 $list->loadDefinitions();
151
152 include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
154 $translator->loadLabels($list);
155
156 $title = '';
157 foreach ($list as $definition) {
158 if ($definition->getId() != $a_sequence_id) {
159 continue;
160 }
162 }
163 return $title;
164 }
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
Definition: getconsent.php:119
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 118 of file class.ilLOUtils.php.

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