1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5/**
6* Class ilGlossaryEditorGUI
7*
8* GUI class for Glossary Editor
9*
10* @author Alex Killing <alex.killing@gmx.de>
11* @version $Id$
12*
13* @ilCtrl_Calls ilGlossaryEditorGUI: ilObjGlossaryGUI
14*
15* @ingroup ModulesGlossary
16*/
17class ilGlossaryEditorGUI
18{
19    /**
20     * @var ilCtrl
21     */
22    protected $ctrl;
23
24    /**
25     * @var ilLanguage
26     */
27    protected $lng;
28
29    /**
30     * @var ilAccessHandler
31     */
32    protected $access;
33
34    /**
35     * @var ilNavigationHistory
36     */
37    protected $nav_history;
38
39    /**
40     * @var ilErrorHandling
41     */
42    protected $error;
43
44    public function __construct()
45    {
46        global $DIC;
47
48        $this->lng = $DIC->language();
49        $this->access = $DIC->access();
50        $this->nav_history = $DIC["ilNavigationHistory"];
51        $this->error = $DIC["ilErr"];
52        $ilCtrl = $DIC->ctrl();
53        $lng = $DIC->language();
54        $ilAccess = $DIC->access();
55        $ilNavigationHistory = $DIC["ilNavigationHistory"];
56        $ilErr = $DIC["ilErr"];
57
58        // initialisation stuff
59        $this->ctrl = $ilCtrl;
60        $lng->loadLanguageModule("content");
61
62        // check write permission
63        if (!$ilAccess->checkAccess("write", "", $_GET["ref_id"]) &&
64            !$ilAccess->checkAccess("edit_content", "", $_GET["ref_id"])) {
65            $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->MESSAGE);
66        }
67
68        $ilNavigationHistory->addItem(
69            $_GET["ref_id"],
70            "ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=" . $_GET["ref_id"],
71            "glo"
72        );
73    }
74
75    /**
76    * execute command
77    */
78    public function executeCommand()
79    {
80        $lng = $this->lng;
81        $ilAccess = $this->access;
82
83        $cmd = $this->ctrl->getCmd();
84        $next_class = $this->ctrl->getNextClass($this);
85        if ($next_class == "") {
86            $this->ctrl->setCmdClass("ilobjglossarygui");
87            $this->ctrl->setCmd("");
88        }
89
90        switch ($next_class) {
91            case 'ilobjglossarygui':
92            default:
93                require_once "./Modules/Glossary/classes/class.ilObjGlossaryGUI.php";
94                $glossary_gui = new ilObjGlossaryGUI("", $_GET["ref_id"], true, false);
95                $this->ctrl->forwardCommand($glossary_gui);
96                break;
97        }
98    }
99}
100