Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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
00068
00069
00070 $this->gui_obj->object->server_comm->setRecipientId((int) $_GET["p_id"]);
00071 $this->__getCommand();
00072 }
00073
00074
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
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
00100
00101
00102
00103
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 }
00129 ?>