ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules 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. More...
 
 isGeneralQualifiedTestVisible ()
 Check if qualified test for all objectives is visible. More...
 
 setGeneralQualifiedTestVisibility ($a_stat)
 Check if qualified test for all objectives is visible. More...
 
 isQualifiedTestPerObjectiveVisible ()
 
 setQualifiedTestPerObjectiveVisibility ($a_stat)
 
 settingsExist ()
 
 getObjId ()
 
 setType ($a_type)
 
 getType ()
 
 getTestByType ($a_type)
 
 getTests ()
 Get assigned tests. More...
 
 isRandomTestType ($a_type)
 Check if test is of type random test. More...
 
 setInitialTest ($a_id)
 set initial test id More...
 
 getInitialTest ()
 
 setQualifiedTest ($a_id)
 
 getQualifiedTest ()
 
 resetResults ($a_status)
 
 isResetResultsEnabled ()
 
 create ()
 Create new entry. More...
 
 update ()
 update settings type $ilDB More...
 
 updateStartObjects (ilContainerStartObjects $start)
 Update start objects Depends on course objective settings. More...
 

Static Public Member Functions

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

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. More...
 
 read ()
 Read. More...
 

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

◆ __construct()

ilLOSettings::__construct (   $a_cont_id)
protected

Constructor.

Parameters
int$a_cont_id

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

References read().

44  {
45  $this->container_id = $a_cont_id;
46  $this->read();
47  }
+ Here is the call graph for this function:

Member Function Documentation

◆ cloneSettings()

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, and ilCopyWizardOptions\_getInstance().

Referenced by ilObjCourse\cloneDependencies().

89  {
90  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
92  $mappings = $options->getMappings();
93 
94  $settings = self::getInstanceByObjId($a_container_id);
95  $new_settings = self::getInstanceByObjId($a_new_container_id);
96 
97  $new_settings->setType($settings->getType());
98  $new_settings->setGeneralQualifiedTestVisibility($settings->isGeneralQualifiedTestVisible());
99  $new_settings->setQualifiedTestPerObjectiveVisibility($settings->isQualifiedTestPerObjectiveVisible());
100  $new_settings->resetResults($settings->isResetResultsEnabled());
101 
102  if($settings->getInitialTest() and array_key_exists($settings->getInitialTest(), $mappings))
103  {
104  $new_settings->setInitialTest($mappings[$settings->getInitialTest()]);
105  }
106 
107  if($settings->getQualifiedTest() and array_key_exists($settings->getQualifiedTest(), $mappings))
108  {
109  $new_settings->setQualifiedTest($mappings[$settings->getQualifiedTest()]);
110  }
111 
112  $new_settings->create();
113  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

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().

261  {
262  global $ilDB;
263 
264  $query = 'INSERT INTO loc_settings '.
265  '(obj_id, type,itest,qtest,qt_vis_all,qt_vis_obj,reset_results) VALUES ( '.
266  $ilDB->quote($this->getObjId(),'integer').', '.
267  $ilDB->quote($this->getType(),'integer').', '.
268  $ilDB->quote($this->getInitialTest(),'integer').', '.
269  $ilDB->quote($this->getQualifiedTest(),'integer').', '.
270  $ilDB->quote($this->isGeneralQualifiedTestVisible(),'integer').', '.
271  $ilDB->quote($this->isQualifiedTestPerObjectiveVisible(),'integer').', '.
272  $ilDB->quote($this->isResetResultsEnabled(),'integer').' '.
273  ') ';
274  $ilDB->manipulate($query);
275  }
isGeneralQualifiedTestVisible()
Check if qualified test for all objectives is visible.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInitialTest()

ilLOSettings::getInitialTest ( )

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

References $initial_test.

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

233  {
234  return $this->initial_test;
235  }
+ Here is the caller graph for this function:

◆ getInstanceByObjId()

◆ getObjId()

ilLOSettings::getObjId ( )

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

References $container_id.

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

166  {
167  return $this->container_id;
168  }
+ Here is the caller graph for this function:

◆ getQualifiedTest()

ilLOSettings::getQualifiedTest ( )

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

References $qualified_test.

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

243  {
244  return $this->qualified_test;
245  }
+ Here is the caller graph for this function:

◆ getTestByType()

ilLOSettings::getTestByType (   $a_type)

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

References getInitialTest(), and getQualifiedTest().

Referenced by isRandomTestType().

182  {
183  switch($a_type)
184  {
185  case self::TYPE_TEST_INITIAL:
186  return $this->getInitialTest();
187 
188  case self::TYPE_TEST_QUALIFIED:
189  return $this->getQualifiedTest();
190  }
191  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTests()

ilLOSettings::getTests ( )

Get assigned tests.

Returns
type

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

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

198  {
199  $tests = array();
200  if($this->getInitialTest())
201  {
202  $tests[] = $this->getInitialTest();
203  }
204  if($this->getQualifiedTest())
205  {
206  $tests[] = $this->getQualifiedTest();
207  }
208  return $tests;
209  }
+ Here is the call graph for this function:

◆ getType()

ilLOSettings::getType ( )

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

References $type.

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

176  {
177  return $this->type;
178  }
+ Here is the caller graph for this function:

◆ isGeneralQualifiedTestVisible()

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().

132  {
133  return $this->qt_visible_all;
134  }
+ Here is the caller graph for this function:

◆ isObjectiveTest()

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().

68  {
69  global $ilDB;
70 
71  $query = 'SELECT obj_id FROM loc_settings '.
72  'WHERE itest = '.$ilDB->quote($a_trst_ref_id,'integer').' '.
73  'OR qtest = '.$ilDB->quote($a_trst_ref_id,'integer');
74  $res = $ilDB->query($query);
75  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
76  {
77  return $row->obj_id;
78  }
79  return 0;
80  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ isQualifiedTestPerObjectiveVisible()

ilLOSettings::isQualifiedTestPerObjectiveVisible ( )

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

References $qt_visible_lo.

Referenced by create(), and update().

147  {
148  return $this->qt_visible_lo;
149  }
+ Here is the caller graph for this function:

◆ isRandomTestType()

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().

217  {
218  $tst = $this->getTestByType($a_type);
219  include_once './Modules/Test/classes/class.ilObjTest.php';
221  }
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not...
static _lookupObjId($a_id)
+ Here is the call graph for this function:

◆ isResetResultsEnabled()

ilLOSettings::isResetResultsEnabled ( )

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

References $reset_results.

Referenced by create(), and update().

253  {
254  return (bool) $this->reset_results;
255  }
+ Here is the caller graph for this function:

◆ read()

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().

355  {
356  global $ilDB;
357 
358  $query = 'SELECT * FROM loc_settings '.
359  'WHERE obj_id = '.$ilDB->quote($this->getObjId(),'integer');
360  $res = $ilDB->query($query);
361  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
362  {
363  $this->entry_exists = true;
364  $this->setType($row->type);
365  $this->setInitialTest($row->itest);
366  $this->setQualifiedTest($row->qtest);
367  #$this->setGeneralQualifiedTestVisibility($row->qt_vis_all);
368  $this->setQualifiedTestPerObjectiveVisibility($row->qt_vis_obj);
369  $this->resetResults($row->reset_results);
370  }
371 
372 
373  if($GLOBALS['tree']->isDeleted($this->getInitialTest()))
374  {
375  $this->setInitialTest(0);
376  }
377  if($GLOBALS['tree']->isDeleted($this->getQualifiedTest()))
378  {
379  $this->setQualifiedTest(0);
380  }
381  }
setInitialTest($a_id)
set initial test id
setQualifiedTestPerObjectiveVisibility($a_stat)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
$GLOBALS['ct_recipient']
global $ilDB
resetResults($a_status)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetResults()

ilLOSettings::resetResults (   $a_status)

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

Referenced by read().

248  {
249  $this->reset_results = $a_status;
250  }
+ Here is the caller graph for this function:

◆ setGeneralQualifiedTestVisibility()

ilLOSettings::setGeneralQualifiedTestVisibility (   $a_stat)

Check if qualified test for all objectives is visible.

Returns
type

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

141  {
142  $this->qt_visible_all = $a_stat;
143  return true;
144  }

◆ setInitialTest()

ilLOSettings::setInitialTest (   $a_id)

set initial test id

Parameters
type$a_id

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

Referenced by read().

228  {
229  $this->initial_test = $a_id;
230  }
+ Here is the caller graph for this function:

◆ setQualifiedTest()

ilLOSettings::setQualifiedTest (   $a_id)

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

Referenced by read().

238  {
239  $this->qualified_test = $a_id;
240  }
+ Here is the caller graph for this function:

◆ setQualifiedTestPerObjectiveVisibility()

ilLOSettings::setQualifiedTestPerObjectiveVisibility (   $a_stat)

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

Referenced by read().

152  {
153  $this->qt_visible_lo = $a_stat;
154  }
+ Here is the caller graph for this function:

◆ settingsExist()

ilLOSettings::settingsExist ( )
Returns
type

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

References $entry_exists.

161  {
162  return $this->entry_exists;
163  }

◆ setType()

ilLOSettings::setType (   $a_type)

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

Referenced by read().

171  {
172  $this->type = $a_type;
173  }
+ Here is the caller graph for this function:

◆ update()

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().

283  {
284  global $ilDB;
285 
286  if(!$this->entry_exists)
287  {
288  return $this->create();
289  }
290 
291  $query = 'UPDATE loc_settings '.' '.
292  'SET type = '.$ilDB->quote($this->getType(),'integer').', '.
293  'itest = '.$ilDB->quote($this->getInitialTest(),'integer').', '.
294  'qtest = '.$ilDB->quote($this->getQualifiedTest(),'integer').', '.
295  'qt_vis_all = '.$ilDB->quote($this->isGeneralQualifiedTestVisible(),'integer').', '.
296  'qt_vis_obj = '.$ilDB->quote($this->isQualifiedTestPerObjectiveVisible(),'integer').', '.
297  'reset_results = '.$ilDB->quote($this->isResetResultsEnabled(),'integer').' '.
298  'WHERE obj_id = '.$ilDB->quote($this->getObjId(),'integer');
299 
300  $ilDB->manipulate($query);
301  }
isGeneralQualifiedTestVisible()
Check if qualified test for all objectives is visible.
create()
Create new entry.
global $ilDB
+ Here is the call graph for this function:

◆ updateStartObjects()

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().

310  {
311  switch($this->getType())
312  {
313  case self::LOC_INITIAL_ALL:
314  if($start->exists($this->getQualifiedTest()))
315  {
316  $start->deleteItem($this->getQualifiedTest());
317  }
318  if(!$start->exists($this->getInitialTest()))
319  {
320  $start->add($this->getInitialTest());
321  }
322  break;
323 
324  case self::LOC_INITIAL_SEL:
325  case self::LOC_PRACTISE:
326  if($start->exists($this->getQualifiedTest()))
327  {
328  $start->deleteItem($this->getQualifiedTest());
329  }
330  if($start->exists($this->getInitialTest()))
331  {
332  $start->deleteItem($this->getInitialTest());
333  }
334  break;
335 
336  case self::LOC_QUALIFIED:
337  if(!$start->exists($this->getQualifiedTest()))
338  {
339  $start->add($this->getQualifiedTest());
340  }
341  if($start->exists($this->getInitialTest()))
342  {
343  $start->deleteItem($this->getInitialTest());
344  }
345  break;
346  }
347  return true;
348  }
deleteItem($a_item_ref_id)
Delete item by ref_id.
+ Here is the call graph for this function:

◆ worksWithInitialTest()

ilLOSettings::worksWithInitialTest ( )

Check if the loc is configured for initial tests.

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

References getType().

120  {
121  return
122  ($this->getType() == self::LOC_INITIAL_ALL) or
123  ($this->getType() == self::LOC_INITIAL_SEL)
124  ;
125  }
+ Here is the call graph for this function:

Field Documentation

◆ $container_id

ilLOSettings::$container_id = 0
private

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

Referenced by getObjId().

◆ $entry_exists

ilLOSettings::$entry_exists = false
private

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

Referenced by settingsExist().

◆ $initial_test

ilLOSettings::$initial_test = 0
private

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

Referenced by getInitialTest().

◆ $instances

ilLOSettings::$instances = array()
staticprivate

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

◆ $qt_visible_all

ilLOSettings::$qt_visible_all = true
private

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

Referenced by isGeneralQualifiedTestVisible().

◆ $qt_visible_lo

ilLOSettings::$qt_visible_lo = false
private

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

Referenced by isQualifiedTestPerObjectiveVisible().

◆ $qualified_test

ilLOSettings::$qualified_test = 0
private

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

Referenced by getQualifiedTest().

◆ $reset_results

ilLOSettings::$reset_results = true
private

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

Referenced by isResetResultsEnabled().

◆ $type

ilLOSettings::$type = 0
private

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

Referenced by getType().

◆ LOC_INITIAL_ALL

const ilLOSettings::LOC_INITIAL_ALL = 1

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

Referenced by ilLOEditorGUI\initSettingsForm().

◆ LOC_INITIAL_SEL

const ilLOSettings::LOC_INITIAL_SEL = 2

◆ LOC_PRACTISE

const ilLOSettings::LOC_PRACTISE = 4

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

Referenced by ilLOEditorGUI\initSettingsForm().

◆ LOC_QUALIFIED

const ilLOSettings::LOC_QUALIFIED = 3

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

Referenced by ilLOEditorGUI\initSettingsForm().

◆ QT_VISIBLE_ALL

const ilLOSettings::QT_VISIBLE_ALL = 0

◆ QT_VISIBLE_OBJECTIVE

const ilLOSettings::QT_VISIBLE_OBJECTIVE = 1

◆ TYPE_TEST_INITIAL

◆ TYPE_TEST_QUALIFIED


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