1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5/**
6 * Class ilTestDashboardGUI
7 *
8 * @author    Björn Heyser <info@bjoernheyser.de>
9 * @version    $Id$
10 *
11 * @package    Modules/Test
12 *
13 * @ilCtrl_Calls ilTestDashboardGUI: ilTestParticipantsGUI
14 * @ilCtrl_Calls ilTestDashboardGUI: ilTestParticipantsTimeExtensionGUI
15 */
16class ilTestDashboardGUI
17{
18    /**
19     * @var ilObjTest
20     */
21    protected $testObj;
22
23    /**
24     * @var ilTestQuestionSetConfig
25     */
26    protected $questionSetConfig;
27
28    /**
29     * @var ilTestAccess
30     */
31    protected $testAccess;
32
33    /**
34     * @var ilTestTabsManager
35     */
36    protected $testTabs;
37
38    /**
39     * @var ilTestObjectiveOrientedContainer
40     */
41    protected $objectiveParent;
42
43    /**
44     * ilTestDashboardGUI constructor.
45     * @param ilObjTest $testObj
46     */
47    public function __construct(ilObjTest $testObj, ilTestQuestionSetConfig $questionSetConfig)
48    {
49        $this->testObj = $testObj;
50        $this->questionSetConfig = $questionSetConfig;
51    }
52
53    /**
54     * @return ilObjTest
55     */
56    public function getTestObj()
57    {
58        return $this->testObj;
59    }
60
61    /**
62     * @param ilObjTest $testObj
63     */
64    public function setTestObj($testObj)
65    {
66        $this->testObj = $testObj;
67    }
68
69    /**
70     * @return ilTestQuestionSetConfig
71     */
72    public function getQuestionSetConfig()
73    {
74        return $this->questionSetConfig;
75    }
76
77    /**
78     * @param ilTestQuestionSetConfig $questionSetConfig
79     */
80    public function setQuestionSetConfig($questionSetConfig)
81    {
82        $this->questionSetConfig = $questionSetConfig;
83    }
84
85    /**
86     * @return ilTestAccess
87     */
88    public function getTestAccess()
89    {
90        return $this->testAccess;
91    }
92
93    /**
94     * @param ilTestAccess $testAccess
95     */
96    public function setTestAccess($testAccess)
97    {
98        $this->testAccess = $testAccess;
99    }
100
101    /**
102     * @return ilTestTabsManager
103     */
104    public function getTestTabs()
105    {
106        return $this->testTabs;
107    }
108
109    /**
110     * @param ilTestTabsManager $testTabs
111     */
112    public function setTestTabs($testTabs)
113    {
114        $this->testTabs = $testTabs;
115    }
116
117    /**
118     * @return ilTestObjectiveOrientedContainer
119     */
120    public function getObjectiveParent() : ilTestObjectiveOrientedContainer
121    {
122        return $this->objectiveParent;
123    }
124
125    /**
126     * @param ilTestObjectiveOrientedContainer $objectiveParent
127     */
128    public function setObjectiveParent(ilTestObjectiveOrientedContainer $objectiveParent)
129    {
130        $this->objectiveParent = $objectiveParent;
131    }
132
133    /**
134     * Execute Command
135     */
136    public function executeCommand()
137    {
138        global $DIC; /* @var ILIAS\DI\Container $DIC */
139
140        if (!$this->getTestAccess()->checkManageParticipantsAccess()) {
141            ilObjTestGUI::accessViolationRedirect();
142        }
143
144        $this->getTestTabs()->activateTab(ilTestTabsManager::TAB_ID_EXAM_DASHBOARD);
145        $this->getTestTabs()->getDashboardSubTabs();
146
147        switch ($DIC->ctrl()->getNextClass()) {
148            case 'iltestparticipantsgui':
149
150                $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_FIXED_PARTICIPANTS);
151
152                require_once 'Modules/Test/classes/class.ilTestParticipantsGUI.php';
153                $gui = new ilTestParticipantsGUI($this->getTestObj(), $this->getQuestionSetConfig());
154                $gui->setTestAccess($this->getTestAccess());
155                $gui->setObjectiveParent($this->getObjectiveParent());
156                $DIC->ctrl()->forwardCommand($gui);
157                break;
158
159            case 'iltestparticipantstimeextensiongui':
160
161                $this->getTestTabs()->activateSubTab(ilTestTabsManager::SUBTAB_ID_TIME_EXTENSION);
162
163                require_once 'Modules/Test/classes/class.ilTestParticipantsTimeExtensionGUI.php';
164                $gui = new ilTestParticipantsTimeExtensionGUI($this->getTestObj());
165                $DIC->ctrl()->forwardCommand($gui);
166                break;
167        }
168    }
169}
170