ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLOUtils Class Reference

Settings for LO courses. More...

+ Collaboration diagram for ilLOUtils:

Static Public Member Functions

static isCompleted (int $a_cont_oid, int $a_test_rid, int $a_objective_id, int $max_points, int $reached, int $limit_perc)
 Check if objective is completed. More...
 
static lookupObjectiveRequiredPercentage (int $a_container_id, int $a_objective_id, int $a_test_ref_id, int $a_max_points)
 
static lookupMaxAttempts (int $a_container_id, int $a_objective_id, int $a_test_ref_id)
 
static lookupRandomTest (int $a_test_obj_id)
 
static hasActiveRun (int $a_container_id, int $a_test_ref_id, int $a_objective_id)
 
static getTestResultLinkForUser (int $a_test_ref_id, int $a_user_id)
 

Static Protected Member Functions

static buildQplTitleByDefinition (ilTestRandomQuestionSetSourcePoolDefinition $def, ilTestQuestionFilterLabelTranslator $trans)
 

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

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

Member Function Documentation

◆ buildQplTitleByDefinition()

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

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

159 : string {
160 $title = $def->getPoolTitle();
161 $filterTitle = array();
162 $filterTitle[] = $trans->getTaxonomyFilterLabel($def->getMappedTaxonomyFilter());
163 $filterTitle[] = $trans->getTypeFilterLabel($def->getTypeFilter());
164 if (!empty($filterTitle)) {
165 $title .= ' -> ' . implode(' / ', $filterTitle);
166 }
167 return $title;
168 }
getTaxonomyFilterLabel(array $filter=[], string $filter_delimiter='+', string $tax_node_delimiter=':', string $nodes_delimiter=', ')

◆ getTestResultLinkForUser()

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

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

175 : string
176 {
177 global $DIC;
178
179 $ilCtrl = $DIC->ctrl();
180 $ilUser = $DIC->user();
181 $ilAccess = $DIC->access();
182
183 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
184 return '';
185 }
186
187 $valid = $tutor = false;
188 if ($a_user_id == $ilUser->getId()) {
189 $valid = $ilAccess->checkAccess('read', '', $a_test_ref_id);
190 }
191 if (!$valid) {
192 $valid = $ilAccess->checkAccess('write', '', $a_test_ref_id);
193 $tutor = true;
194 }
195 if ($valid) {
196 $testObjId = ilObject::_lookupObjId($a_test_ref_id);
197 if (!$tutor) {
198 if (ilObjTestAccess::visibleUserResultExists($testObjId, $a_user_id)) {
199 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', $a_test_ref_id);
200 $ctrlClasses = array('ilRepositoryGUI', 'ilObjTestGUI', 'ilTestResultsGUI');
201 $link = $ilCtrl->getLinkTargetByClass($ctrlClasses);
202 $ilCtrl->setParameterByClass('ilObjTestGUI', 'ref_id', '');
203 return $link;
204 }
205 } else {
206 $testId = ilObjTest::_getTestIDFromObjectID($testObjId);
207 if ($testId) {
208 $userActiveId = ilObjTest::_getActiveIdOfUser($a_user_id, $testId);
209 if ($userActiveId) {
210 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', $a_test_ref_id);
211 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', $userActiveId);
212 $link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI',
213 'ilObjTestGUI',
214 'ilTestEvaluationGUI'
215 ), 'outParticipantsResultsOverview');
216 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'ref_id', '');
217 $ilCtrl->setParameterByClass('ilTestEvaluationGUI', 'active_id', '');
218 return $link;
219 }
220 }
221 }
222 }
223 return '';
224 }
static visibleUserResultExists(int $test_obj_id, int $user_id)
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
static _getActiveIdOfUser($user_id="", $test_id="")
static _lookupObjId(int $ref_id)
const ANONYMOUS_USER_ID
Definition: constants.php:27
$valid
global $DIC
Definition: shib_login.php:26

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

Referenced by ilLOMemberTestResultTableGUI\createTestResultLink().

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

◆ hasActiveRun()

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

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

170 : bool
171 {
172 return false;
173 }

Referenced by ilContainerObjectiveGUI\showObjectives(), and ILIAS\Containter\Content\ObjectiveRenderer\showObjectives().

+ Here is the caller graph for this function:

◆ isCompleted()

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

Check if objective is completed.

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

36 : bool {
37 $settings = ilLOSettings::getInstanceByObjId($a_cont_oid);
38
39 if (self::lookupRandomTest(ilObject::_lookupObjId($a_test_rid))) {
40 if ($max_points === 0) {
41 return true;
42 } else {
43 return ($reached / $max_points * 100) >= $limit_perc;
44 }
45 } else {
47 $a_cont_oid,
48 $a_objective_id,
49 $a_test_rid,
50 $max_points
51 );
52
53 if ($max_points === 0) {
54 return true;
55 } else {
56 return ($reached / $max_points * 100) >= $required_perc;
57 }
58 }
59 }
static getInstanceByObjId(int $a_obj_id)
static lookupObjectiveRequiredPercentage(int $a_container_id, int $a_objective_id, int $a_test_ref_id, int $a_max_points)

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

+ Here is the caller graph for this function:

◆ lookupMaxAttempts()

static ilLOUtils::lookupMaxAttempts ( int  $a_container_id,
int  $a_objective_id,
int  $a_test_ref_id 
)
static

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

91 : int
92 {
93 global $DIC;
94
95 $ilDB = $DIC->database();
96
97 $assignments = ilLOTestAssignments::getInstance($a_container_id);
98 if (!$assignments->isSeparateTest($a_test_ref_id)) {
99 // no limit of tries for tests assigned to multiple objectives.
100 return 0;
101 }
102
103 $query = 'SELECT nr_of_tries FROM tst_tests ' .
104 'WHERE obj_fi = ' . $ilDB->quote(ilObject::_lookupObjId($a_test_ref_id), 'integer');
105 $res = $ilDB->query($query);
106 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
107 return (int) $row->nr_of_tries;
108 }
109 return 0;
110 }
static getInstance(int $a_container_id)
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, ilObject\_lookupObjId(), ilDBConstants\FETCHMODE_OBJECT, and ilLOTestAssignments\getInstance().

Referenced by ilLOTestQuestionAdapter\initUserResult().

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

◆ lookupObjectiveRequiredPercentage()

static ilLOUtils::lookupObjectiveRequiredPercentage ( int  $a_container_id,
int  $a_objective_id,
int  $a_test_ref_id,
int  $a_max_points 
)
static

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

66 : int {
67 $settings = ilLOSettings::getInstanceByObjId($a_container_id);
68 $assignments = ilLOTestAssignments::getInstance($a_container_id);
69 $a_test_type = $assignments->getTypeByTest($a_test_ref_id);
70
71 if ($assignments->isSeparateTest($a_test_ref_id)) {
72 $factory = new ilObjectFactory();
73 $tst = $factory->getInstanceByRefId($a_test_ref_id, false);
74 if ($tst instanceof ilObjTest) {
75 $schema = $tst->getMarkSchema();
76 foreach ($schema->getMarkSteps() as $mark) {
77 if ($mark->getPassed()) {
78 return (int) $mark->getMinimumLevel();
79 }
80 }
81 }
82 }
83 $tst_ref_id = $a_test_ref_id;
84 if (self::lookupRandomTest(ilObject::_lookupObjId($tst_ref_id))) {
85 return ilLORandomTestQuestionPools::lookupLimit($a_container_id, $a_objective_id, $a_test_type);
86 } else {
87 return ilCourseObjectiveQuestion::loookupTestLimit(ilObject::_lookupObjId($tst_ref_id), $a_objective_id);
88 }
89 }
static loookupTestLimit(int $a_test_id, int $a_objective_id)
static lookupLimit(int $a_container_id, int $a_objective_id, int $a_test_type)
Class ilObjectFactory This class offers methods to get instances of the type-specific object classes ...

Referenced by ilLOTestQuestionAdapter\initUserResult().

+ Here is the caller graph for this function:

◆ lookupRandomTest()

static ilLOUtils::lookupRandomTest ( int  $a_test_obj_id)
static

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

112 : bool
113 {
114 return ilObjTest::_lookupRandomTest($a_test_obj_id);
115 }
static _lookupRandomTest(int $obj_id)

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: