1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4/**
5* Handles user interface for exercises
6*
7* @author Alex Killing <alex.killing@gmx.de>
8* @version $Id$
9*
10* @ilCtrl_Calls ilExerciseHandlerGUI: ilObjExerciseGUI
11*
12* @ingroup ModulesExercise
13*/
14class ilExerciseHandlerGUI
15{
16    /**
17     * @var ilCtrl
18     */
19    protected $ctrl;
20
21    /**
22     * @var ilLanguage
23     */
24    protected $lng;
25
26    /**
27     * @var ilAccessHandler
28     */
29    protected $access;
30
31    /**
32     * @var ilTemplate
33     */
34    protected $tpl;
35
36    /**
37     * @var ilNavigationHistory
38     */
39    protected $nav_history;
40
41    public function __construct()
42    {
43        global $DIC;
44
45        $this->lng = $DIC->language();
46        $this->access = $DIC->access();
47        $this->tpl = $DIC["tpl"];
48        $this->nav_history = $DIC["ilNavigationHistory"];
49        $ilCtrl = $DIC->ctrl();
50
51        // initialisation stuff
52        $this->ctrl = $ilCtrl;
53
54        //$ilNavigationHistory->addItem($_GET["ref_id"],
55        //	"ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$_GET["ref_id"]);
56    }
57
58    /**
59    * execute command
60    */
61    public function executeCommand()
62    {
63        $lng = $this->lng;
64        $ilAccess = $this->access;
65        $tpl = $this->tpl;
66        $ilNavigationHistory = $this->nav_history;
67
68        $cmd = $this->ctrl->getCmd();
69        $next_class = $this->ctrl->getNextClass($this);
70        if ($next_class == "") {
71            $this->ctrl->setCmdClass("ilobjexercisegui");
72            $next_class = $this->ctrl->getNextClass($this);
73        }
74
75        // add entry to navigation history
76        if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
77            $ilNavigationHistory->addItem(
78                $_GET["ref_id"],
79                "ilias.php?baseClass=ilExerciseHandlerGUI&cmd=showOverview&ref_id=" . $_GET["ref_id"],
80                "exc"
81            );
82        }
83
84        switch ($next_class) {
85            case 'ilobjexercisegui':
86                require_once "./Modules/Exercise/classes/class.ilObjExerciseGUI.php";
87                $ex_gui = new ilObjExerciseGUI("", (int) $_GET["ref_id"], true, false);
88                $this->ctrl->forwardCommand($ex_gui);
89                break;
90        }
91
92        $tpl->show();
93    }
94}
95