ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilChatPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2009 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 require_once "Modules/Chat/classes/class.ilObjChatGUI.php";
24 
33 {
39  public function __construct() {}
40 
44  public function &executeCommand()
45  {
46  global $lng, $ilAccess, $tpl, $ilNavigationHistory, $ilCtrl;
47 
48  $next_class = $ilCtrl->getNextClass($this);
49  $cmd = $ilCtrl->getCmd();
50  if ($next_class == "")
51  {
52  $ilCtrl->setCmdClass("ilobjchatgui");
53  if($cmd == '') $ilCtrl->setCmd("showFrames");
54  $next_class = $ilCtrl->getNextClass($this);
55  }
56 
57  if(strpos(trim(ilUtil::stripSlashes($_POST['invitation'])), '_') !== false)
58  {
59  $param = trim(ilUtil::stripSlashes($_POST['invitation']));
60 
61  $_GET['ref_id'] = (int)substr($param, 0, strpos($param, '_'));
62  $_REQUEST['room_id'] = (int)substr($param, strrpos($param, '_') + 1);
63  }
64 
65  // add entry to navigation history
66  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
67  {
68  $ilNavigationHistory->addItem($_GET["ref_id"],
69  "ilias.php?baseClass=ilChatPresentationGUI&cmd=infoScreen&ref_id=".$_GET["ref_id"], "chat");
70  }
71 
72  switch ($next_class)
73  {
74  case 'ilobjchatgui':
75  include_once("./Modules/Chat/classes/class.ilObjChatGUI.php");
76  $chat_gui = new ilObjChatGUI(array(), $_GET["ref_id"], true, false);
77  $chat_gui->object->chat_room->setRoomId((int) $_REQUEST["room_id"]);
78  $chat_gui->object->chat_room->setUserId($_SESSION["AccountId"]);
79 
80  // check room access
81  if(!$chat_gui->object->chat_room->checkAccess())
82  {
83  unset($_REQUEST["room_id"]);
84  unset($_REQUEST["message"]);
85  ilUtil::sendInfo("You are not entitled to view this room",true);
86  }
87 
88  // check server accessibility
89  if(!$chat_gui->object->server_conf->getActiveStatus())
90  {
91  $tmp_tpl = new ilTemplate('tpl.chat_srv_off_redirect_js.html', true, true, 'Modules/Chat');
92  $tmp_tpl->setVariable('OPENER_LOCATION', 'goto.php?target=chat_'.(int)$_GET['ref_id'].'&client_id='.CLIENT_ID);
93  echo $tmp_tpl->get();
94  exit();
95  }
96 
97  $chat_gui->object->server_comm->setRecipientId((int) $_GET["p_id"]);
98  $ret = $ilCtrl->forwardCommand($chat_gui);
99  break;
100  }
101 
102  $tpl->show();
103  }
104 
105 }
106 ?>