ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLOSettings Class Reference

Settings for LO courses. More...

+ Collaboration diagram for ilLOSettings:

Public Member Functions

 worksWithInitialTest ()
 Check if the loc is configured for initial tests.
 isGeneralQualifiedTestVisible ()
 Check if qualified test for all objectives is visible.
 setGeneralQualifiedTestVisibility ($a_stat)
 Check if qualified test for all objectives is visible.
 isQualifiedTestPerObjectiveVisible ()
 setQualifiedTestPerObjectiveVisibility ($a_stat)
 settingsExist ()
 getObjId ()
 setType ($a_type)
 getType ()
 getTestByType ($a_type)
 getTests ()
 Get assigned tests.
 isRandomTestType ($a_type)
 Check if test is of type random test.
 setInitialTest ($a_id)
 set initial test id
 getInitialTest ()
 setQualifiedTest ($a_id)
 getQualifiedTest ()
 resetResults ($a_status)
 isResetResultsEnabled ()
 create ()
 Create new entry.
 update ()
 update settings type $ilDB
 updateStartObjects (ilContainerStartObjects $start)
 Update start objects Depends on course objective settings.

Static Public Member Functions

static getInstanceByObjId ($a_obj_id)
 get singleton instance
static isObjectiveTest ($a_trst_ref_id)
 Check if test ref_id is used in an objective course.
static cloneSettings ($a_copy_id, $a_container_id, $a_new_container_id)
 Clone settings.

Data Fields

const TYPE_TEST_INITIAL = 1
const TYPE_TEST_QUALIFIED = 2
const QT_VISIBLE_ALL = 0
const QT_VISIBLE_OBJECTIVE = 1
const LOC_INITIAL_ALL = 1
const LOC_INITIAL_SEL = 2
const LOC_QUALIFIED = 3
const LOC_PRACTISE = 4

Protected Member Functions

 __construct ($a_cont_id)
 Constructor.
 read ()
 Read.

Private Attributes

 $container_id = 0
 $type = 0
 $initial_test = 0
 $qualified_test = 0
 $qt_visible_all = true
 $qt_visible_lo = false
 $reset_results = true
 $entry_exists = false

Static Private Attributes

static $instances = array()

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.ilLOSettings.php.

Constructor & Destructor Documentation

ilLOSettings::__construct (   $a_cont_id)
protected

Constructor.

Parameters
int$a_cont_id

Definition at line 43 of file class.ilLOSettings.php.

References read().

{
$this->container_id = $a_cont_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilLOSettings::cloneSettings (   $a_copy_id,
  $a_container_id,
  $a_new_container_id 
)
static

Clone settings.

Parameters
type$a_copy_id
type$a_container_id
type$a_new_container_id

Definition at line 88 of file class.ilLOSettings.php.

References $options, ilCopyWizardOptions\_getInstance(), and getInstanceByObjId().

{
include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
$mappings = $options->getMappings();
$settings = self::getInstanceByObjId($a_container_id);
$new_settings = self::getInstanceByObjId($a_new_container_id);
$new_settings->setType($settings->getType());
$new_settings->setGeneralQualifiedTestVisibility($settings->isGeneralQualifiedTestVisible());
$new_settings->setQualifiedTestPerObjectiveVisibility($settings->isQualifiedTestPerObjectiveVisible());
$new_settings->resetResults($settings->isResetResultsEnabled());
if($settings->getInitialTest() and array_key_exists($settings->getInitialTest(), $mappings))
{
$new_settings->setInitialTest($mappings[$settings->getInitialTest()]);
}
if($settings->getQualifiedTest() and array_key_exists($settings->getQualifiedTest(), $mappings))
{
$new_settings->setQualifiedTest($mappings[$settings->getQualifiedTest()]);
}
$new_settings->create();
}

+ Here is the call graph for this function:

ilLOSettings::create ( )

Create new entry.

Definition at line 260 of file class.ilLOSettings.php.

References $ilDB, $query, getInitialTest(), getObjId(), getQualifiedTest(), getType(), isGeneralQualifiedTestVisible(), isQualifiedTestPerObjectiveVisible(), and isResetResultsEnabled().

Referenced by update().

{
global $ilDB;
$query = 'INSERT INTO loc_settings '.
'(obj_id, type,itest,qtest,qt_vis_all,qt_vis_obj,reset_results) VALUES ( '.
$ilDB->quote($this->getObjId(),'integer').', '.
$ilDB->quote($this->getType(),'integer').', '.
$ilDB->quote($this->getInitialTest(),'integer').', '.
$ilDB->quote($this->getQualifiedTest(),'integer').', '.
$ilDB->quote($this->isGeneralQualifiedTestVisible(),'integer').', '.
$ilDB->quote($this->isQualifiedTestPerObjectiveVisible(),'integer').', '.
$ilDB->quote($this->isResetResultsEnabled(),'integer').' '.
') ';
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOSettings::getInitialTest ( )

Definition at line 232 of file class.ilLOSettings.php.

References $initial_test.

Referenced by create(), getTestByType(), getTests(), read(), update(), and updateStartObjects().

{
}

+ Here is the caller graph for this function:

ilLOSettings::getObjId ( )

Definition at line 165 of file class.ilLOSettings.php.

References $container_id.

Referenced by create(), read(), and update().

{
}

+ Here is the caller graph for this function:

ilLOSettings::getQualifiedTest ( )

Definition at line 242 of file class.ilLOSettings.php.

References $qualified_test.

Referenced by create(), getTestByType(), getTests(), read(), update(), and updateStartObjects().

{
}

+ Here is the caller graph for this function:

ilLOSettings::getTestByType (   $a_type)

Definition at line 181 of file class.ilLOSettings.php.

References getInitialTest(), and getQualifiedTest().

Referenced by isRandomTestType().

{
switch($a_type)
{
case self::TYPE_TEST_INITIAL:
return $this->getInitialTest();
case self::TYPE_TEST_QUALIFIED:
return $this->getQualifiedTest();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOSettings::getTests ( )

Get assigned tests.

Returns
type

Definition at line 197 of file class.ilLOSettings.php.

References $tests, getInitialTest(), and getQualifiedTest().

{
$tests = array();
if($this->getInitialTest())
{
$tests[] = $this->getInitialTest();
}
if($this->getQualifiedTest())
{
$tests[] = $this->getQualifiedTest();
}
return $tests;
}

+ Here is the call graph for this function:

ilLOSettings::getType ( )

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

References $type.

Referenced by create(), update(), updateStartObjects(), and worksWithInitialTest().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilLOSettings::isGeneralQualifiedTestVisible ( )

Check if qualified test for all objectives is visible.

Returns
type

Definition at line 131 of file class.ilLOSettings.php.

References $qt_visible_all.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

static ilLOSettings::isObjectiveTest (   $a_trst_ref_id)
static

Check if test ref_id is used in an objective course.

Parameters
intref_id

Definition at line 67 of file class.ilLOSettings.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilTestOutputGUI\getObjectiveOrientedContainerId(), ilObjTestListGUI\modifyTitleLink(), and ilTestLP\resetCustomLPDataForUserIds().

{
global $ilDB;
$query = 'SELECT obj_id FROM loc_settings '.
'WHERE itest = '.$ilDB->quote($a_trst_ref_id,'integer').' '.
'OR qtest = '.$ilDB->quote($a_trst_ref_id,'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->obj_id;
}
return 0;
}

+ Here is the caller graph for this function:

ilLOSettings::isQualifiedTestPerObjectiveVisible ( )

Definition at line 146 of file class.ilLOSettings.php.

References $qt_visible_lo.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilLOSettings::isRandomTestType (   $a_type)

Check if test is of type random test.

Parameters
type$a_type
Returns
type

Definition at line 216 of file class.ilLOSettings.php.

References ilObject\_lookupObjId(), ilObjTest\_lookupRandomTest(), and getTestByType().

{
$tst = $this->getTestByType($a_type);
include_once './Modules/Test/classes/class.ilObjTest.php';
}

+ Here is the call graph for this function:

ilLOSettings::isResetResultsEnabled ( )

Definition at line 252 of file class.ilLOSettings.php.

References $reset_results.

Referenced by create(), and update().

{
return (bool) $this->reset_results;
}

+ Here is the caller graph for this function:

ilLOSettings::read ( )
protected

Read.

Definition at line 354 of file class.ilLOSettings.php.

References $GLOBALS, $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getInitialTest(), getObjId(), getQualifiedTest(), resetResults(), setInitialTest(), setQualifiedTest(), setQualifiedTestPerObjectiveVisibility(), and setType().

Referenced by __construct().

{
global $ilDB;
$query = 'SELECT * FROM loc_settings '.
'WHERE obj_id = '.$ilDB->quote($this->getObjId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->entry_exists = true;
$this->setType($row->type);
$this->setInitialTest($row->itest);
$this->setQualifiedTest($row->qtest);
#$this->setGeneralQualifiedTestVisibility($row->qt_vis_all);
$this->resetResults($row->reset_results);
}
if($GLOBALS['tree']->isDeleted($this->getInitialTest()))
{
$this->setInitialTest(0);
}
if($GLOBALS['tree']->isDeleted($this->getQualifiedTest()))
{
$this->setQualifiedTest(0);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLOSettings::resetResults (   $a_status)

Definition at line 247 of file class.ilLOSettings.php.

Referenced by read().

{
$this->reset_results = $a_status;
}

+ Here is the caller graph for this function:

ilLOSettings::setGeneralQualifiedTestVisibility (   $a_stat)

Check if qualified test for all objectives is visible.

Returns
type

Definition at line 140 of file class.ilLOSettings.php.

{
$this->qt_visible_all = $a_stat;
return true;
}
ilLOSettings::setInitialTest (   $a_id)

set initial test id

Parameters
type$a_id

Definition at line 227 of file class.ilLOSettings.php.

Referenced by read().

{
$this->initial_test = $a_id;
}

+ Here is the caller graph for this function:

ilLOSettings::setQualifiedTest (   $a_id)

Definition at line 237 of file class.ilLOSettings.php.

Referenced by read().

{
$this->qualified_test = $a_id;
}

+ Here is the caller graph for this function:

ilLOSettings::setQualifiedTestPerObjectiveVisibility (   $a_stat)

Definition at line 151 of file class.ilLOSettings.php.

Referenced by read().

{
$this->qt_visible_lo = $a_stat;
}

+ Here is the caller graph for this function:

ilLOSettings::settingsExist ( )
Returns
type

Definition at line 160 of file class.ilLOSettings.php.

References $entry_exists.

{
}
ilLOSettings::setType (   $a_type)

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

Referenced by read().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

ilLOSettings::update ( )

update settings type $ilDB

Definition at line 282 of file class.ilLOSettings.php.

References $ilDB, $query, create(), getInitialTest(), getObjId(), getQualifiedTest(), getType(), isGeneralQualifiedTestVisible(), isQualifiedTestPerObjectiveVisible(), and isResetResultsEnabled().

{
global $ilDB;
if(!$this->entry_exists)
{
return $this->create();
}
$query = 'UPDATE loc_settings '.' '.
'SET type = '.$ilDB->quote($this->getType(),'integer').', '.
'itest = '.$ilDB->quote($this->getInitialTest(),'integer').', '.
'qtest = '.$ilDB->quote($this->getQualifiedTest(),'integer').', '.
'qt_vis_all = '.$ilDB->quote($this->isGeneralQualifiedTestVisible(),'integer').', '.
'qt_vis_obj = '.$ilDB->quote($this->isQualifiedTestPerObjectiveVisible(),'integer').', '.
'reset_results = '.$ilDB->quote($this->isResetResultsEnabled(),'integer').' '.
'WHERE obj_id = '.$ilDB->quote($this->getObjId(),'integer');
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

ilLOSettings::updateStartObjects ( ilContainerStartObjects  $start)

Update start objects Depends on course objective settings.

Parameters
ilContainerStartObjects

Definition at line 309 of file class.ilLOSettings.php.

References ilContainerStartObjects\add(), ilContainerStartObjects\deleteItem(), ilContainerStartObjects\exists(), getInitialTest(), getQualifiedTest(), and getType().

{
switch($this->getType())
{
case self::LOC_INITIAL_ALL:
if($start->exists($this->getQualifiedTest()))
{
$start->deleteItem($this->getQualifiedTest());
}
if(!$start->exists($this->getInitialTest()))
{
$start->add($this->getInitialTest());
}
break;
case self::LOC_INITIAL_SEL:
case self::LOC_PRACTISE:
if($start->exists($this->getQualifiedTest()))
{
$start->deleteItem($this->getQualifiedTest());
}
if($start->exists($this->getInitialTest()))
{
$start->deleteItem($this->getInitialTest());
}
break;
case self::LOC_QUALIFIED:
if(!$start->exists($this->getQualifiedTest()))
{
$start->add($this->getQualifiedTest());
}
if($start->exists($this->getInitialTest()))
{
$start->deleteItem($this->getInitialTest());
}
break;
}
return true;
}

+ Here is the call graph for this function:

ilLOSettings::worksWithInitialTest ( )

Check if the loc is configured for initial tests.

Definition at line 119 of file class.ilLOSettings.php.

References getType().

{
return
($this->getType() == self::LOC_INITIAL_ALL) or
($this->getType() == self::LOC_INITIAL_SEL)
;
}

+ Here is the call graph for this function:

Field Documentation

ilLOSettings::$container_id = 0
private

Definition at line 27 of file class.ilLOSettings.php.

Referenced by getObjId().

ilLOSettings::$entry_exists = false
private

Definition at line 36 of file class.ilLOSettings.php.

Referenced by settingsExist().

ilLOSettings::$initial_test = 0
private

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

Referenced by getInitialTest().

ilLOSettings::$instances = array()
staticprivate

Definition at line 25 of file class.ilLOSettings.php.

ilLOSettings::$qt_visible_all = true
private

Definition at line 31 of file class.ilLOSettings.php.

Referenced by isGeneralQualifiedTestVisible().

ilLOSettings::$qt_visible_lo = false
private

Definition at line 32 of file class.ilLOSettings.php.

Referenced by isQualifiedTestPerObjectiveVisible().

ilLOSettings::$qualified_test = 0
private

Definition at line 30 of file class.ilLOSettings.php.

Referenced by getQualifiedTest().

ilLOSettings::$reset_results = true
private

Definition at line 33 of file class.ilLOSettings.php.

Referenced by isResetResultsEnabled().

ilLOSettings::$type = 0
private

Definition at line 28 of file class.ilLOSettings.php.

Referenced by getType().

const ilLOSettings::LOC_INITIAL_ALL = 1

Definition at line 19 of file class.ilLOSettings.php.

Referenced by ilLOEditorGUI\initSettingsForm().

const ilLOSettings::LOC_INITIAL_SEL = 2
const ilLOSettings::LOC_PRACTISE = 4

Definition at line 22 of file class.ilLOSettings.php.

Referenced by ilLOEditorGUI\initSettingsForm().

const ilLOSettings::LOC_QUALIFIED = 3

Definition at line 21 of file class.ilLOSettings.php.

Referenced by ilLOEditorGUI\initSettingsForm().

const ilLOSettings::QT_VISIBLE_ALL = 0
const ilLOSettings::QT_VISIBLE_OBJECTIVE = 1

The documentation for this class was generated from the following file: