19declare(strict_types=0);
82 $this->
logger = $DIC->logger()->crs();
83 $this->db =
$DIC->database();
84 $this->tree =
$DIC->repositoryTree();
85 $this->container_id = $a_cont_id;
91 if (isset(self::$instances[$a_obj_id])) {
92 return self::$instances[$a_obj_id];
94 return self::$instances[$a_obj_id] =
new ilLOSettings($a_obj_id);
99 $this->it_type = $a_type;
114 $this->qt_type = $a_type;
119 $this->it_start = $a_type;
129 $this->qt_start = $a_type;
170 $query =
'SELECT obj_id FROM loc_settings ' .
171 'WHERE itest = ' .
$ilDB->quote($a_trst_ref_id,
'integer') .
' ' .
172 'OR qtest = ' .
$ilDB->quote($a_trst_ref_id,
'integer');
180 public static function cloneSettings(
int $a_copy_id,
int $a_container_id,
int $a_new_container_id): void
183 $mappings =
$options->getMappings();
188 $new_settings->setType($settings->getType());
189 $new_settings->setInitialTestType($settings->getInitialTestType());
190 $new_settings->setQualifyingTestType($settings->getQualifyingTestType());
191 $new_settings->resetResults($settings->isResetResultsEnabled());
192 $new_settings->setPassedObjectiveMode($settings->getPassedObjectiveMode());
194 if ($settings->getInitialTest() && array_key_exists($settings->getInitialTest(), $mappings)) {
195 $new_settings->setInitialTest($mappings[$settings->getInitialTest()]);
196 $new_settings->setInitialTestAsStart($new_settings->isInitialTestStart());
199 if ($settings->getQualifiedTest() && array_key_exists($settings->getQualifiedTest(), $mappings)) {
200 $new_settings->setQualifiedTest($mappings[$settings->getQualifiedTest()]);
201 $new_settings->setQualifyingTestAsStart($settings->isQualifyingTestStart());
205 $new_settings->update();
236 $this->passed_objective_mode = $a_mode;
258 $this->type = $a_type;
298 $this->initial_test = $a_id;
308 $this->qualified_test = $a_id;
318 $this->reset_results = $a_status;
328 $query =
'INSERT INTO loc_settings ' .
329 '(obj_id, it_type,itest,qtest,it_start,qt_type,qt_start,reset_results,passed_obj_mode) VALUES ( ' .
330 $this->db->quote($this->
getObjId(),
'integer') .
', ' .
340 $this->db->manipulate($query);
341 $this->entry_exists =
true;
346 if (!$this->entry_exists) {
351 $query =
'UPDATE loc_settings ' .
' ' .
353 'itest = ' . $this->db->quote($this->
getInitialTest(),
'integer') .
', ' .
354 'qtest = ' . $this->db->quote($this->
getQualifiedTest(),
'integer') .
', ' .
360 'WHERE obj_id = ' . $this->db->quote($this->
getObjId(),
'integer');
362 $this->db->manipulate($query);
373 if ($start->
exists($this->getQualifiedTest())) {
383 if (!$start->
exists($this->getInitialTest())) {
387 if ($start->
exists($this->getInitialTest())) {
395 if ($start->
exists($this->getInitialTest())) {
402 $this->
logger->debug(
'Type initial default');
403 if ($start->
exists($this->getInitialTest())) {
404 $this->
logger->debug(
'Old start object exists. Trying to delete');
414 if (!$start->
exists($this->getQualifiedTest())) {
421 if ($start->
exists($this->getQualifiedTest())) {
431 protected function read(): void
433 $query =
'SELECT * FROM loc_settings ' .
434 'WHERE obj_id = ' . $this->db->quote($this->
getObjId(),
'integer');
435 $res = $this->db->query($query);
437 $this->entry_exists =
true;
449 if ($this->tree->isDeleted($this->getInitialTest())) {
452 if ($this->tree->isDeleted($this->getQualifiedTest())) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exists(int $a_item_ref_id)
deleteItem(int $a_item_ref_id)
static _getInstance(int $a_copy_id)
const TYPE_INITIAL_QUALIFYING_ALL
int $passed_objective_mode
const TYPE_TEST_QUALIFIED
const QT_VISIBLE_OBJECTIVE
const TYPE_INITIAL_PLACEMENT_SELECTED
hasSeparateQualifiedTests()
Check if separate qualified tests are configured.
static getInstanceByObjId(int $a_obj_id)
const HIDE_PASSED_OBJECTIVE_QST
isInitialTestQualifying()
Check if initial test is qualifying*.
isRandomTestType(int $a_type)
setQualifyingTestAsStart(bool $a_type)
setQualifyingTestType(int $a_type)
const TYPE_QUALIFYING_ALL
const TYPE_INITIAL_PLACEMENT_ALL
worksWithStartObjects()
Check if start objects are enabled.
getTestByType(int $a_type)
const MARK_PASSED_OBJECTIVE_QST
updateStartObjects(ilContainerStartObjects $start)
Update start objects Depends on course objective settings.
resetResults(bool $a_status)
static cloneSettings(int $a_copy_id, int $a_container_id, int $a_new_container_id)
__construct(int $a_cont_id)
worksWithInitialTest()
Check if the loc is configured for initial tests.
setInitialTest(int $a_id)
setQualifiedTest(int $a_id)
const TYPE_QUALIFYING_SELECTED
const TYPE_TEST_UNDEFINED
const TYPE_INITIAL_QUALIFYING_SELECTED
isGeneralInitialTestVisible()
hasSeparateInitialTests()
Check if separate initial test are configured.
toXml(ilXmlWriter $writer)
isGeneralQualifiedTestVisible()
setInitialTestType(int $a_type)
static isObjectiveTest(int $a_trst_ref_id)
Check if test ref_id is used in an objective course.
setInitialTestAsStart(bool $a_type)
setPassedObjectiveMode(int $a_mode)
static lookupContainerForTest(int $a_test_ref_id)
Component logger with individual log levels by component id.
static _lookupRandomTest(int $obj_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjId(int $ref_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)