• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Modules/Chat/classes/class.ilChatController.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 require_once "Modules/Chat/classes/class.ilObjChatGUI.php";
00024 
00032 class ilChatController
00033 {
00034         var $gui_obj;
00035         
00036         var $ref_id;
00037         var $cmd;
00038 
00044         function ilChatController($a_ref_id)
00045         {
00046 
00047                 $this->ref_id = (int) $a_ref_id;
00048                 $this->gui_obj =& new ilObjChatGUI(array(),$a_ref_id,true,false);
00049                 $this->gui_obj->object->chat_room->setRoomId((int) $_REQUEST["room_id"]);
00050                 $this->gui_obj->object->chat_room->setUserId($_SESSION["AccountId"]);
00051                 
00052                 // CHECK HACK
00053                 if(!$this->gui_obj->object->chat_room->checkAccess())
00054                 {
00055                         unset($_REQUEST["room_id"]);
00056                         unset($_REQUEST["message"]);
00057                         ilUtil::sendInfo("You are not entitled to view this room",true);
00058                 }
00059                 if(!$this->gui_obj->object->server_conf->getActiveStatus())
00060                 {
00061                         $tmp_tpl = new ilTemplate('tpl.chat_srv_off_redirect_js.html', true, true, 'Modules/Chat');
00062                         $tmp_tpl->setVariable('OPENER_LOCATION', 'goto.php?target=chat_'.(int)$_GET['ref_id'].'&client_id='.CLIENT_ID);
00063                         echo $tmp_tpl->get();
00064                         exit();
00065                 }
00066                 
00067                 //$this->gui_obj->object->server_conf->setActiveStatus(
00068                 
00069                 
00070                 $this->gui_obj->object->server_comm->setRecipientId((int) $_GET["p_id"]);
00071                 $this->__getCommand();
00072         }
00073 
00074         // SET/GET
00075         function setRefId($a_ref_id)
00076         {
00077                 $this->ref_id = $a_ref_id;
00078         }
00079         function getRefId()
00080         {
00081                 return $this->ref_id;
00082         }
00083 
00084         function execute()
00085         {
00086                 $cmd = $this->cmd;
00087                 $this->gui_obj->$cmd();
00088         }
00089 
00090         // PRIVATE
00091         function __getCommand()
00092         {
00093                 if($_GET["cmd"] == 'gateway')
00094                 {
00095                         if(is_array($_POST["cmd"]))
00096                         {
00097                                 $_GET["cmd"] = key($_POST["cmd"]);
00098                         }
00099                         // Workaround for Internet Explorer (IE). If a user presses
00100                         // the Enter in the message input field, IE does not send a
00101                         // "cmd" parameter. We fill in the command "input", because
00102                         // we can safely assume that the user intended to post the 
00103                         // message.
00104                         else if (! $_POST["cmd"] && $_POST["message"])
00105                         {
00106                                 $_GET["cmd"] = 'input';
00107                         }
00108                         else
00109                         {
00110                                 $_GET["cmd"] = 'cancel';
00111                         }
00112                 }
00113 
00114                 if($_GET["cmd"])
00115                 {
00116                         $this->cmd = $_GET["cmd"];
00117                 }
00118                 else
00119                 {
00120                         $this->cmd = "showFrames";
00121                 }
00122                 
00123                 if($_GET['vcard'] == 1 && (int)$_GET['user'])
00124                 {
00125                         $this->cmd = 'deliverVCard';
00126                 }
00127         }
00128 } // END class.ilObjTest
00129 ?>

Generated on Fri Dec 13 2013 17:56:49 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1