ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 lookupMaxAttempts ($a_container_id, $a_objective_id)
 
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 179 of file class.ilLOUtils.php.

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

180  {
181  $title = $def->getPoolTitle();
182  $tax_id = $def->getMappedFilterTaxId();
183  if($tax_id)
184  {
185  $title .= (' -> '. $trans->getTaxonomyTreeLabel($tax_id));
186  }
187  $tax_node = $def->getMappedFilterTaxNodeId();
188  if($tax_node)
189  {
190  $title .= (' -> ' .$trans->getTaxonomyNodeLabel($tax_node));
191  }
192  return $title;
193  }
+ Here is the call graph for this function:

◆ getTestResultLinkForUser()

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

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

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

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

226  {
227  global $ilCtrl, $ilUser, $ilAccess;
228 
229  if($ilUser->getId() == ANONYMOUS_USER_ID)
230  {
231  return;
232  }
233 
234  $valid = $tutor = false;
235  if($a_user_id == $ilUser->getId())
236  {
237  $valid = $ilAccess->checkAccess('read', '', $a_test_ref_id);
238  }
239  if(!$valid)
240  {
241  $valid = $ilAccess->checkAccess('write', '', $a_test_ref_id);
242  $tutor = true;
243  }
244  if($valid)
245  {
246  $testObjId = ilObject::_lookupObjId($a_test_ref_id);
247  if(!$tutor)
248  {
249  require_once 'Modules/Test/classes/class.ilObjTestAccess.php';
250  if(ilObjTestAccess::visibleUserResultExists($testObjId, $a_user_id))
251  {
252  $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', $a_test_ref_id);
253  $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjTestGUI'), 'userResultsGateway');
254  $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', '');
255  return $link;
256  }
257  }
258  else
259  {
260  include_once 'Modules/Test/classes/class.ilObjTest.php';
261  $testId = ilObjTest::_getTestIDFromObjectID($testObjId);
262  if($testId)
263  {
264  $userActiveId = ilObjTest::_getActiveIdOfUser($a_user_id, $testId);
265  if($userActiveId)
266  {
267  $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', $a_test_ref_id);
268  $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', $userActiveId);
269  $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjTestGUI', 'ilTestEvaluationGUI'), 'outParticipantsResultsOverview');
270  $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', '');
271  $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', '');
272  return $link;
273  }
274  }
275  }
276  }
277  }
_getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
$valid
global $ilCtrl
Definition: ilias.php:18
static visibleUserResultExists($testObjId, $userId)
static _lookupObjId($a_id)
global $ilUser
Definition: imgupload.php:15
_getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
+ 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 195 of file class.ilLOUtils.php.

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

Referenced by ilContainerObjectiveGUI\showObjectives().

196  {
197  return FALSE;
198 
199  // check if pass exists
200  include_once './Modules/Test/classes/class.ilObjTest.php';
201  if(
203  $a_test_ref_id,
204  $GLOBALS['ilUser']->getId())
205  )
206  {
207  return false;
208  }
209 
210  // check if multiple pass exists
211  include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
212  $last_objectives = ilLOTestRun::lookupObjectives(
213  $a_container_id,
214  $GLOBALS['ilUser']->getId(),
215  ilObject::_lookupObjId($a_test_ref_id)
216  );
217 
218  if(count((array) $last_objectives) and in_array((int) $a_objective_id, (array) $last_objectives))
219  {
220  return true;
221  }
222  return false;
223  }
static lookupObjectives($a_container_id, $a_user_id, $a_test_id)
static _lookupObjId($a_id)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
static isParticipantsLastPassActive($testRefId, $userId)
+ 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.

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

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

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 _lookupObjId($a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupMaxAttempts()

static ilLOUtils::lookupMaxAttempts (   $a_container_id,
  $a_objective_id 
)
static
Parameters
type$a_container_id
type$a_objective_id
type$a_passes
Returns
boolean

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

References ilLOSettings\getInstanceByObjId(), and ilCourseObjective\lookupMaxPasses().

Referenced by ilLOTestQuestionAdapter\initUserResult().

104  {
105  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
106  $settings = ilLOSettings::getInstanceByObjId($a_container_id);
107  if($settings->isGeneralQualifiedTestVisible())
108  {
109  return 0;
110  }
111  include_once './Modules/Course/classes/class.ilCourseObjective.php';
112  $max_passes = ilCourseObjective::lookupMaxPasses($a_objective_id);
113 
114  return (int) $max_passes;
115  }
static getInstanceByObjId($a_obj_id)
get singleton instance
static lookupMaxPasses($a_objective_id)
+ 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.

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

Referenced by ilLOTestQuestionAdapter\initUserResult().

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 getInstanceByObjId($a_obj_id)
get singleton instance
static loookupTestLimit($a_test_id, $a_objective_id)
static getInstance($a_container_id)
Get instance by container id.
Class ilObjectFactory.
static _lookupObjId($a_id)
static lookupLimit($a_container_id, $a_objective_id, $a_test_type)
+ 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 135 of file class.ilLOUtils.php.

References $GLOBALS, and ilObjectFactory\getInstanceByRefId().

Referenced by ilCourseObjectivesTableGUI\parse().

136  {
137  if(!$a_sequence_id)
138  {
139  return '';
140  }
141  $tst = ilObjectFactory::getInstanceByRefId($a_test_ref_id,false);
142  if(!$tst instanceof ilObjTest)
143  {
144  return '';
145  }
146  include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
147  include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
149  $GLOBALS['ilDB'],
150  $tst,
152  $GLOBALS['ilDB'],
153  $tst
154  )
155  );
156 
157  $list->loadDefinitions();
158 
159  include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
160  $translator = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']);
161  $translator->loadLabels($list);
162 
163  $title = '';
164  foreach ($list as $definition)
165  {
166  if($definition->getId() != $a_sequence_id)
167  {
168  continue;
169  }
170  $title = self::buildQplTitleByDefinition($definition, $translator);
171  }
172  return $title;
173  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
+ 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 123 of file class.ilLOUtils.php.

References ilObjTest\_lookupRandomTest().

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

124  {
125  include_once './Modules/Test/classes/class.ilObjTest.php';
126  return ilObjTest::_lookupRandomTest($a_test_obj_id);
127  }
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not...
+ 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: