ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
5require_once 'Modules/Test/classes/class.ilTestPlayerFactory.php';
6require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
7require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
8require_once 'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php';
9require_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
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}
An exception for terminatinating execution or to throw for unit testing.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$GLOBALS['loaded']
Global hash that tracks already loaded includes.