ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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_type, $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 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 160 of file class.ilLOUtils.php.

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

161  {
162  $title = $def->getPoolTitle();
163  $tax_id = $def->getMappedFilterTaxId();
164  if($tax_id)
165  {
166  $title .= (' -> '. $trans->getTaxonomyTreeLabel($tax_id));
167  }
168  $tax_node = $def->getMappedFilterTaxNodeId();
169  if($tax_node)
170  {
171  $title .= (' -> ' .$trans->getTaxonomyNodeLabel($tax_node));
172  }
173  return $title;
174  }
+ Here is the call graph for this function:

◆ hasActiveRun()

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

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

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

Referenced by ilContainerObjectiveGUI\showObjectives().

177  {
178  // check if pass exists
179  include_once './Modules/Test/classes/class.ilObjTest.php';
180  if(
182  $a_test_ref_id,
183  $GLOBALS['ilUser']->getId())
184  )
185  {
186  return false;
187  }
188 
189  // check if multiple pass exists
190  include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
191  $last_objectives = ilLOTestRun::lookupObjectives(
192  $a_container_id,
193  $GLOBALS['ilUser']->getId(),
194  ilObject::_lookupObjId($a_test_ref_id)
195  );
196 
197  if(count((array) $last_objectives) and in_array((int) $a_objective_id, (array) $last_objectives))
198  {
199  return true;
200  }
201  return false;
202  }
static lookupObjectives($a_container_id, $a_user_id, $a_test_id)
$GLOBALS['ct_recipient']
static _lookupObjId($a_id)
static isParticipantsLastPassActive($testObjId, $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  if(!$max_points)
35  {
36  return TRUE;
37  }
38  else
39  {
40  return ($reached / $max_points * 100) >= $limit_perc;
41  }
42  }
43  }
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 84 of file class.ilLOUtils.php.

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

Referenced by ilLOTestQuestionAdapter\initUserResult().

85  {
86  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
87  $settings = ilLOSettings::getInstanceByObjId($a_container_id);
88  if($settings->isGeneralQualifiedTestVisible())
89  {
90  return 0;
91  }
92  include_once './Modules/Course/classes/class.ilCourseObjective.php';
93  $max_passes = ilCourseObjective::lookupMaxPasses($a_objective_id);
94 
95  return (int) $max_passes;
96  }
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_type,
  $a_max_points 
)
static
Parameters
type$a_container_id
type$a_objective_id
type$a_test_type

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

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

Referenced by ilLOTestQuestionAdapter\initUserResult().

52  {
53  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
54  $settings = ilLOSettings::getInstanceByObjId($a_container_id);
55 
56  if($a_test_type == ilLOSettings::TYPE_TEST_QUALIFIED)
57  {
58  $tst_ref_id = $settings->getQualifiedTest();
59  }
60  else
61  {
62  $tst_ref_id = $settings->getInitialTest();
63  }
64  if(self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id)))
65  {
66  include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
67  return (int) ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
68  }
69  else
70  {
71  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
72  $limit = ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
73  return $limit;
74  }
75  }
static getInstanceByObjId($a_obj_id)
get singleton instance
static loookupTestLimit($a_test_id, $a_objective_id)
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 116 of file class.ilLOUtils.php.

References $GLOBALS, and ilObjectFactory\getInstanceByRefId().

Referenced by ilCourseObjectivesTableGUI\parse().

117  {
118  if(!$a_sequence_id)
119  {
120  return '';
121  }
122  $tst = ilObjectFactory::getInstanceByRefId($a_test_ref_id,false);
123  if(!$tst instanceof ilObjTest)
124  {
125  return '';
126  }
127  include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
128  include_once './Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
130  $GLOBALS['ilDB'],
131  $tst,
133  $GLOBALS['ilDB'],
134  $tst
135  )
136  );
137 
138  $list->loadDefinitions();
139 
140  include_once './Modules/Test/classes/class.ilTestTaxonomyFilterLabelTranslater.php';
141  $translator = new ilTestTaxonomyFilterLabelTranslater($GLOBALS['ilDB']);
142  $translator->loadLabels($list);
143 
144  $title = '';
145  foreach ($list as $definition)
146  {
147  if($definition->getId() != $a_sequence_id)
148  {
149  continue;
150  }
151  $title = self::buildQplTitleByDefinition($definition, $translator);
152  }
153  return $title;
154  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$GLOBALS['ct_recipient']
+ 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 104 of file class.ilLOUtils.php.

References ilObjTest\_lookupRandomTest().

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

105  {
106  include_once './Modules/Test/classes/class.ilObjTest.php';
107  return ilObjTest::_lookupRandomTest($a_test_obj_id);
108  }
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: