ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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'], $d['ilDB'], $d['ilPluginAdmin'], $this->getTestOBJ()
89 );
90
91 $this->testPlayerFactory = new ilTestPlayerFactory($this->getTestOBJ());
92 $this->testSessionFactory = new ilTestSessionFactory($this->getTestOBJ());
93
94 $this->testSequenceFactory = new ilTestSequenceFactory(
95 $d['ilDB'], $d['lng'], $d['ilPluginAdmin'], $this->getTestOBJ()
96 );
97 }
98
99 private function ensureTestObjectInitialised()
100 {
101 if( !($this->testOBJ instanceof ilObjTest) )
102 {
103 $this->testOBJ = ilObjectFactory::getInstanceByRefId($this->testRefId);
104 }
105 }
106
107 public function getToolbarInstance()
108 {
109 $this->ensureInitialised();
110
111 $d = $GLOBALS['DIC'];
112
113 $toolbar = new ilTestInfoScreenToolbarGUI($d['ilDB'], $d['ilAccess'], $d['ilCtrl'], $d['lng'], $d['ilPluginAdmin']);
114
115 $toolbar->setTestOBJ($this->getTestOBJ());
116 $toolbar->setTestPlayerGUI($this->testPlayerFactory->getPlayerGUI());
117
118 $testQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
119 $testSession = $this->testSessionFactory->getSession();
120 $testSequence = $this->testSequenceFactory->getSequenceByTestSession($testSession);
121 $testSequence->loadFromDb();
122 $testSequence->loadQuestions($testQuestionSetConfig, new ilTestDynamicQuestionSetFilterSelection());
123
124 $toolbar->setTestQuestionSetConfig($testQuestionSetConfig);
125 $toolbar->setTestSession($testSession);
126 $toolbar->setTestSequence($testSequence);
127
128 return $toolbar;
129 }
130}
for($col=0; $col< 50; $col++) $d
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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.