ILIAS  Release_3_10_x_branch Revision 61812
 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-2001 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  function __construct()
40  {
41  }
42 
46  function &executeCommand()
47  {
48  global $lng, $ilAccess, $tpl, $ilNavigationHistory, $ilCtrl;
49 
50 //echo "*".$ilCtrl->getCmd()."*";
51  $next_class = $ilCtrl->getNextClass($this);
52  $cmd = $ilCtrl->getCmd();
53  if ($next_class == "")
54  {
55  $ilCtrl->setCmdClass("ilobjchatgui");
56  if($cmd == '') $ilCtrl->setCmd("showFrames");
57  $next_class = $ilCtrl->getNextClass($this);
58  }
59 
60  if(strpos(trim(ilUtil::stripSlashes($_POST['invitation'])), '_') !== false)
61  {
62  $param = trim(ilUtil::stripSlashes($_POST['invitation']));
63 
64  $_GET['ref_id'] = (int)substr($param, 0, strpos($param, '_'));
65  $_REQUEST['room_id'] = (int)substr($param, strrpos($param, '_') + 1);
66  }
67 
68  // add entry to navigation history
69  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
70  {
71  $ilNavigationHistory->addItem($_GET["ref_id"],
72  "ilias.php?baseClass=ilChatPresentationGUI&cmd=infoScreen&ref_id=".$_GET["ref_id"], "chat");
73  }
74 
75  switch ($next_class)
76  {
77  case 'ilobjchatgui':
78  include_once("./Modules/Chat/classes/class.ilObjChatGUI.php");
79  $chat_gui = new ilObjChatGUI(array(), $_GET["ref_id"], true, false);
80  $chat_gui->object->chat_room->setRoomId((int) $_REQUEST["room_id"]);
81  $chat_gui->object->chat_room->setUserId($_SESSION["AccountId"]);
82 
83  // check room access
84  if(!$chat_gui->object->chat_room->checkAccess())
85  {
86  unset($_REQUEST["room_id"]);
87  unset($_REQUEST["message"]);
88  ilUtil::sendInfo("You are not entitled to view this room",true);
89  }
90 
91  // check server accessibility
92  if(!$chat_gui->object->server_conf->getActiveStatus())
93  {
94  $tmp_tpl = new ilTemplate('tpl.chat_srv_off_redirect_js.html', true, true, 'Modules/Chat');
95  $tmp_tpl->setVariable('OPENER_LOCATION', 'goto.php?target=chat_'.(int)$_GET['ref_id'].'&client_id='.CLIENT_ID);
96  echo $tmp_tpl->get();
97  exit();
98  }
99 
100  $chat_gui->object->server_comm->setRecipientId((int) $_GET["p_id"]);
101  $ret = $ilCtrl->forwardCommand($chat_gui);
102  break;
103  }
104 
105  $tpl->show();
106  }
107 
108  // PRIVATE
109 /*
110  function __getCommand()
111  {
112  if($_GET["cmd"] == 'gateway')
113  {
114  if(is_array($_POST["cmd"]))
115  {
116  $_GET["cmd"] = key($_POST["cmd"]);
117  }
118  // Workaround for Internet Explorer (IE). If a user presses
119  // the Enter in the message input field, IE does not send a
120  // "cmd" parameter. We fill in the command "input", because
121  // we can safely assume that the user intended to post the
122  // message.
123  else if (! $_POST["cmd"] && $_POST["message"])
124  {
125  $_GET["cmd"] = 'input';
126  }
127  else
128  {
129  $_GET["cmd"] = 'cancel';
130  }
131  }
132 
133  if($_GET["cmd"])
134  {
135  $this->cmd = $_GET["cmd"];
136  }
137  else
138  {
139  $this->cmd = "showFrames";
140  }
141 
142  if($_GET['vcard'] == 1 && (int)$_GET['user'])
143  {
144  $this->cmd = 'deliverVCard';
145  }
146  }
147 */
148 
149 }
150 ?>