ILIAS  release_7 Revision v7.30-3-g800a261c036
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['refinery'],
101 $d['ilPluginAdmin'],
102 $this->getTestOBJ()
103 );
104 }
105
107 {
108 if (!($this->testOBJ instanceof ilObjTest)) {
109 $this->testOBJ = ilObjectFactory::getInstanceByRefId($this->testRefId);
110 }
111 }
112
113 public function getToolbarInstance()
114 {
115 $this->ensureInitialised();
116
117 $d = $GLOBALS['DIC'];
118
119 $toolbar = new ilTestInfoScreenToolbarGUI($d['ilDB'], $d['ilAccess'], $d['ilCtrl'], $d['lng'], $d['ilPluginAdmin']);
120
121 $toolbar->setTestOBJ($this->getTestOBJ());
122 $toolbar->setTestPlayerGUI($this->testPlayerFactory->getPlayerGUI());
123
124 $testQuestionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
125 $testSession = $this->testSessionFactory->getSession();
126 $testSequence = $this->testSequenceFactory->getSequenceByTestSession($testSession);
127 $testSequence->loadFromDb();
128 $testSequence->loadQuestions($testQuestionSetConfig, new ilTestDynamicQuestionSetFilterSelection());
129
130 $toolbar->setTestQuestionSetConfig($testQuestionSetConfig);
131 $toolbar->setTestSession($testSession);
132 $toolbar->setTestSequence($testSequence);
133
134 return $toolbar;
135 }
136}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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