53 private $it_type = self::TYPE_INITIAL_PLACEMENT_ALL;
78 $this->logger =
$GLOBALS[
'DIC']->logger()->crs();
80 $this->container_id = $a_cont_id;
91 if (self::$instances[$a_obj_id]) {
92 return self::$instances[$a_obj_id];
94 return self::$instances[$a_obj_id] =
new ilLOSettings($a_obj_id);
202 $query =
'SELECT obj_id FROM loc_settings ' .
203 'WHERE itest = ' . $ilDB->quote($a_trst_ref_id,
'integer') .
' ' .
204 'OR qtest = ' . $ilDB->quote($a_trst_ref_id,
'integer');
210 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
220 public static function cloneSettings($a_copy_id, $a_container_id, $a_new_container_id)
222 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
224 $mappings =
$options->getMappings();
226 $settings = self::getInstanceByObjId($a_container_id);
227 $new_settings = self::getInstanceByObjId($a_new_container_id);
229 $new_settings->setType($settings->getType());
230 $new_settings->setInitialTestType($settings->getInitialTestType());
231 $new_settings->setQualifyingTestType($settings->getQualifyingTestType());
232 $new_settings->resetResults($settings->isResetResultsEnabled());
233 $new_settings->setPassedObjectiveMode($settings->getPassedObjectiveMode());
235 if ($settings->getInitialTest() and array_key_exists($settings->getInitialTest(), $mappings)) {
236 $new_settings->setInitialTest($mappings[$settings->getInitialTest()]);
237 $new_settings->setInitialTestAsStart($new_settings->isInitialTestStart());
240 if ($settings->getQualifiedTest() and array_key_exists($settings->getQualifiedTest(), $mappings)) {
241 $new_settings->setQualifiedTest($mappings[$settings->getQualifiedTest()]);
242 $new_settings->setQualifyingTestAsStart($settings->isQualifyingTestStart());
246 $new_settings->update();
280 $this->qt_visible_all = $a_stat;
291 $this->qt_visible_lo = $a_stat;
296 return $this->passed_objective_mode;
301 $this->passed_objective_mode = $a_mode;
346 case self::TYPE_TEST_INITIAL:
349 case self::TYPE_TEST_QUALIFIED:
380 include_once
'./Modules/Test/classes/class.ilObjTest.php';
391 $this->initial_test = $a_id;
411 $this->qualified_test = $a_id;
430 $this->reset_results = $a_status;
449 $query =
'INSERT INTO loc_settings ' .
450 '(obj_id, it_type,itest,qtest,it_start,qt_type,qt_start,reset_results,passed_obj_mode) VALUES ( ' .
451 $ilDB->quote($this->
getObjId(),
'integer') .
', ' .
461 $ilDB->manipulate(
$query);
463 $this->entry_exists =
true;
475 if (!$this->entry_exists) {
479 $query =
'UPDATE loc_settings ' .
' ' .
481 'itest = ' . $ilDB->quote($this->
getInitialTest(),
'integer') .
', ' .
488 'WHERE obj_id = ' . $ilDB->quote($this->
getObjId(),
'integer');
490 $ilDB->manipulate(
$query);
502 if ($start->
exists($this->getQualifiedTest())) {
508 case self::TYPE_INITIAL_PLACEMENT_ALL:
509 case self::TYPE_INITIAL_QUALIFYING_ALL:
512 if (!$start->
exists($this->getInitialTest())) {
516 if ($start->
exists($this->getInitialTest())) {
522 case self::TYPE_INITIAL_NONE:
524 if ($start->
exists($this->getInitialTest())) {
531 $this->logger->debug(
'Type initial default');
532 if ($start->
exists($this->getInitialTest())) {
533 $this->logger->debug(
'Old start object exists. Trying to delete');
540 case self::TYPE_QUALIFYING_ALL:
543 if (!$start->
exists($this->getQualifiedTest())) {
550 if ($start->
exists($this->getQualifiedTest())) {
566 $query =
'SELECT * FROM loc_settings ' .
567 'WHERE obj_id = ' . $ilDB->quote($this->
getObjId(),
'integer');
570 $this->entry_exists =
true;
577 #$this->setType($row->type); 580 #$this->setGeneralQualifiedTestVisibility($row->qt_vis_all); 581 #$this->setQualifiedTestPerObjectiveVisibility($row->qt_vis_obj);
static getInstanceByObjId($a_obj_id)
get singleton instance
update()
update settings type $ilDB
toXml(ilXmlWriter $writer)
export to xml
worksWithInitialTest()
Check if the loc is configured for initial tests.
getTests()
Get assigned tests.
const TYPE_INITIAL_QUALIFYING_SELECTED
static cloneSettings($a_copy_id, $a_container_id, $a_new_container_id)
Clone settings.
isGeneralQualifiedTestVisible()
Check if qualified test for all objectives is visible.
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not...
setInitialTest($a_id)
set initial test id
isQualifyingTestStart()
Is qt start object.
getInitialTestType()
Get initial test type.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
updateStartObjects(ilContainerStartObjects $start)
Update start objects Depends on course objective settings.
static isObjectiveTest($a_trst_ref_id)
Check if test ref_id is used in an objective course.
const TYPE_QUALIFYING_ALL
setQualifiedTestPerObjectiveVisibility($a_stat)
create()
Create new entry.
setPassedObjectiveMode($a_mode)
isResetResultsEnabled()
check if reset result is enabled
setQualifiedTest($a_id)
set qualified test
const HIDE_PASSED_OBJECTIVE_QST
deleteItem($a_item_ref_id)
Delete item by ref_id.
isGeneralInitialTestVisible()
Check if initial test for all objectives is visible.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
__construct($a_cont_id)
Constructor.
foreach($_POST as $key=> $value) $res
hasSeparateInitialTests()
Check if separate initial test are configured.
setQualifyingTestType($a_type)
Set qualifying test type.
isQualifiedTestPerObjectiveVisible()
static _lookupObjId($a_id)
const MARK_PASSED_OBJECTIVE_QST
isInitialTestQualifying()
Check if initial test is qualifying*.
setInitialTestType($a_type)
Set Initial test type.
setGeneralQualifiedTestVisibility($a_stat)
getQualifiedTest()
get qualified test
Create styles array
The data for the language used.
const QT_VISIBLE_OBJECTIVE
static lookupContainerForTest($a_test_ref_id)
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
getQualifyingTestType()
Get qualifying test type.
getInitialTest()
get initial test
hasSeparateQualifiedTests()
Check if separate qualified tests are configured.
isInitialTestStart()
Get initial test start.
setQualifyingTestAsStart($a_type)
Set qt as start object.
const TYPE_INITIAL_QUALIFYING_ALL
const TYPE_TEST_QUALIFIED
const TYPE_INITIAL_PLACEMENT_ALL
const TYPE_QUALIFYING_SELECTED
worksWithStartObjects()
Check if start objects are enabled.
const TYPE_TEST_UNDEFINED
setInitialTestAsStart($a_type)
isRandomTestType($a_type)
Check if test is of type random test.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
resetResults($a_status)
reset results
const TYPE_INITIAL_PLACEMENT_SELECTED