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

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 
00033 require_once "chat/classes/class.ilObjChatGUI.php";
00034 
00035 class ilChatController
00036 {
00037         var $gui_obj;
00038         
00039         var $ref_id;
00040         var $cmd;
00041 
00047         function ilChatController($a_ref_id)
00048         {
00049                 define("ILIAS_MODULE","chat");
00050 
00051                 $this->ref_id = (int) $a_ref_id;
00052                 $this->gui_obj =& new ilObjChatGUI(array(),$a_ref_id,true,false);
00053                 $this->gui_obj->object->chat_room->setRoomId((int) $_REQUEST["room_id"]);
00054                 $this->gui_obj->object->chat_room->setUserId($_SESSION["AccountId"]);
00055                 
00056                 // CHECK HACK
00057                 if(!$this->gui_obj->object->chat_room->checkAccess())
00058                 {
00059                         unset($_REQUEST["room_id"]);
00060                         unset($_REQUEST["message"]);
00061                         sendInfo("You are not entitled to view this room",true);
00062                 }
00063                 $this->gui_obj->object->server_comm->setRecipientId((int) $_GET["p_id"]);
00064                 $this->__getCommand();
00065         }
00066 
00067         // SET/GET
00068         function setRefId($a_ref_id)
00069         {
00070                 $this->ref_id = $a_ref_id;
00071         }
00072         function getRefId()
00073         {
00074                 return $this->ref_id;
00075         }
00076 
00077         function execute()
00078         {
00079                 $cmd = $this->cmd;
00080                 $this->gui_obj->$cmd();
00081         }
00082 
00083         // PRIVATE
00084         function __getCommand()
00085         {
00086                 if($_GET["cmd"] == 'gateway')
00087                 {
00088                         if(is_array($_POST["cmd"]))
00089                         {
00090                                 $_GET["cmd"] = key($_POST["cmd"]);
00091                         }
00092                         // Workaround for Internet Explorer (IE). If a user presses
00093                         // the Enter in the message input field, IE does not send a
00094                         // "cmd" parameter. We fill in the command "input", because
00095                         // we can safely assume that the user intended to post the 
00096                         // message.
00097                         else if (! $_POST["cmd"] && $_POST["message"])
00098                         {
00099                                 $_GET["cmd"] = 'input';
00100                         }
00101                         else
00102                         {
00103                                 $_GET["cmd"] = 'cancel';
00104                         }
00105                 }
00106 
00107                 if($_GET["cmd"])
00108                 {
00109                         $this->cmd = $_GET["cmd"];
00110                 }
00111                 else
00112                 {
00113                         $this->cmd = "showFrames";
00114                 }
00115         }
00116 } // END class.ilObjTest
00117 ?>

Generated on Fri Dec 13 2013 13:52:06 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1