ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestInfoScreenToolbarFactory.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
5 require_once 'Modules/Test/classes/class.ilTestPlayerFactory.php';
6 require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
7 require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
8 require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php';
9 require_once 'Modules/Test/classes/toolbars/class.ilTestInfoScreenToolbarGUI.php';
10 
18 {
22  private $testRefId;
23 
27  private $testOBJ;
28 
33 
38 
43 
48 
52  public function getTestRefId()
53  {
54  return $this->testRefId;
55  }
56 
60  public function setTestRefId($testRefId)
61  {
62  $this->testRefId = $testRefId;
63  }
64 
68  public function getTestOBJ()
69  {
70  return $this->testOBJ;
71  }
72 
76  public function setTestOBJ($testOBJ)
77  {
78  $this->testOBJ = $testOBJ;
79  }
80 
81  protected function ensureInitialised()
82  {
84 
85  $d = $GLOBALS['DIC'];
86 
87  $this->testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory(
88  $d['tree'],
89  $d['ilDB'],
90  $d['ilPluginAdmin'],
91  $this->getTestOBJ()
92  );
93 
94  $this->testPlayerFactory = new ilTestPlayerFactory($this->getTestOBJ());
95  $this->testSessionFactory = new ilTestSessionFactory($this->getTestOBJ());
96 
97  $this->testSequenceFactory = new ilTestSequenceFactory(
98  $d['ilDB'],
99  $d['lng'],
100  $d['ilPluginAdmin'],
101  $this->getTestOBJ()
102  );
103  }
104 
105  private function ensureTestObjectInitialised()
106  {
107  if (!($this->testOBJ instanceof ilObjTest)) {
108  $this->testOBJ = ilObjectFactory::getInstanceByRefId($this->testRefId);
109  }
110  }
111 
112  public function getToolbarInstance()
113  {
114  $this->ensureInitialised();
115 
116  $d = $GLOBALS['DIC'];
117 
118  $toolbar = new ilTestInfoScreenToolbarGUI($d['ilDB'], $d['ilAccess'], $d['ilCtrl'], $d['lng'], $d['ilPluginAdmin']);
119 
120  $toolbar->setTestOBJ($this->getTestOBJ());
121  $toolbar->setTestPlayerGUI($this->testPlayerFactory->getPlayerGUI());
122 
123  $testQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
124  $testSession = $this->testSessionFactory->getSession();
125  $testSequence = $this->testSequenceFactory->getSequenceByTestSession($testSession);
126  $testSequence->loadFromDb();
127  $testSequence->loadQuestions($testQuestionSetConfig, new ilTestDynamicQuestionSetFilterSelection());
128 
129  $toolbar->setTestQuestionSetConfig($testQuestionSetConfig);
130  $toolbar->setTestSession($testSession);
131  $toolbar->setTestSequence($testSequence);
132 
133  return $toolbar;
134  }
135 }
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296