ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilWikiHandlerGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
36 {
40  protected $ctrl;
41 
45  protected $lng;
46 
50  protected $access;
51 
55  protected $tpl;
56 
60  protected $nav_history;
61 
62  public function __construct()
63  {
64  global $DIC;
65 
66  $this->lng = $DIC->language();
67  $this->access = $DIC->access();
68  $this->tpl = $DIC["tpl"];
69  $this->nav_history = $DIC["ilNavigationHistory"];
70  $ilCtrl = $DIC->ctrl();
71 
72  // initialisation stuff
73  $this->ctrl = $ilCtrl;
74  }
75 
79  public function executeCommand()
80  {
81  $lng = $this->lng;
82  $ilAccess = $this->access;
83  $tpl = $this->tpl;
84  $ilNavigationHistory = $this->nav_history;
85 
86  $cmd = $this->ctrl->getCmd();
87  $next_class = $this->ctrl->getNextClass($this);
88  if ($next_class == "") {
89  $this->ctrl->setCmdClass("ilobjwikigui");
90  $next_class = $this->ctrl->getNextClass($this);
91  }
92 
93  // add entry to navigation history
94  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
95  $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
96  $title = ilObject::_lookupTitle($obj_id);
97 
98  if ($_GET["page"] != "") {
99  $page = $_GET["page"];
100  } else {
101  include_once("./Modules/Wiki/classes/class.ilObjWiki.php");
102  $page = ilObjWiki::_lookupStartPage($obj_id);
103  }
104 
105  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
106  if (ilWikiPage::exists($obj_id, $page)) {
107  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
108 
109  $add = "_" . rawurlencode($page);
110 
111  $page_id = ilWikiPage::getPageIdForTitle($obj_id, $page);
112  $ptitle = ilWikiPage::lookupTitle($page_id);
113 
114  $title .= ": " . $ptitle;
115 
116  $append = ($_GET["page"] != "")
117  ? "_" . ilWikiUtil::makeUrlTitle($page)
118  : "";
119  include_once('./Services/Link/classes/class.ilLink.php');
120  $goto = ilLink::_getStaticLink(
121  $_GET["ref_id"],
122  "wiki",
123  true,
124  $append
125  );
126  //var_dump($goto);
127  $ilNavigationHistory->addItem(
128  $_GET["ref_id"],
129  "./goto.php?target=wiki_" . $_GET["ref_id"] . $add,
130  "wiki",
131  $title,
132  $page_id,
133  $goto
134  );
135  }
136  }
137 
138  switch ($next_class) {
139  case 'ilobjwikigui':
140  require_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
141  $mc_gui = new ilObjWikiGUI("", (int) $_GET["ref_id"], true, false);
142  $this->ctrl->forwardCommand($mc_gui);
143  break;
144  }
145 
146  $tpl->show();
147  }
148 }
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
executeCommand()
execute command
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _lookupStartPage($a_wiki_id)
Lookup start page.
static _lookupTitle($a_id)
lookup object title
static getPageIdForTitle($a_wiki_id, $a_title)
Get wiki page object for id and title.
global $ilCtrl
Definition: ilias.php:18
static makeUrlTitle($a_par)
Set page parameter for Url Embedding.
static _lookupObjId($a_id)
static exists($a_wiki_id, $a_title)
Checks whether a page with given title exists.
Handles user interface for wikis.
Class ilObjWikiGUI.