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

chat/classes/class.ilObjChatServerGUI.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 
00024 
00035 require_once "classes/class.ilObjectGUI.php";
00036 
00037 class ilObjChatServerGUI extends ilObjectGUI
00038 {
00043         function ilObjChatServerGUI($a_data,$a_id,$a_call_by_reference = true, $a_prepare_output = true)
00044         {
00045                 define("ILIAS_MODULE","chat");
00046 
00047                 $this->type = "chac";
00048                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, $a_prepare_output);
00049 
00050                 $this->lng->loadLanguageModule("chat");
00051         }
00052 
00053         function editObject()
00054         {
00055                 global $rbacsystem;
00056 
00057                 if (!$rbacsystem->checkAccess("read", $this->ref_id))
00058                 {
00059                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00060                 }
00061                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.chac_edit.html",true);
00062 
00063         $internal_ip = $_SESSION["error_post_vars"]["chat_internal_ip"] ? 
00064             $_SESSION["error_post_vars"]["chat_internal_ip"] :
00065             $this->object->server_conf->getInternalIp();
00066 
00067         $external_ip = $_SESSION["error_post_vars"]["chat_external_ip"] ? 
00068             $_SESSION["error_post_vars"]["chat_external_ip"] :
00069             $this->object->server_conf->getExternalIp();
00070 
00071                 $port = $_SESSION["error_post_vars"]["chat_port"] ? 
00072                         $_SESSION["error_post_vars"]["chat_port"] :
00073                         $this->object->server_conf->getPort();
00074 
00075                 $moderator = $_SESSION["error_post_vars"]["chat_moderator"] ? 
00076                         $_SESSION["error_post_vars"]["chat_moderator"] :
00077                         $this->object->server_conf->getModeratorPassword();
00078 
00079                 $logfile = $_SESSION["error_post_vars"]["chat_logfile"] ? 
00080                         $_SESSION["error_post_vars"]["chat_logfile"] :
00081                         $this->object->server_conf->getLogfile();
00082 
00083                 $loglevel = $_SESSION["error_post_vars"]["chat_loglevel"] ? 
00084                         $_SESSION["error_post_vars"]["chat_loglevel"] :
00085                         $this->object->server_conf->getLogLevel();
00086 
00087         $allowed = $_SESSION["error_post_vars"]["chat_allowed"] ? 
00088             $_SESSION["error_post_vars"]["chat_internal_ip"] :
00089             $this->object->server_conf->getAllowedHosts();
00090 
00091                 $active = $_SESSION["error_post_vars"]["chat_active"] ?
00092                         $_SESSION["error_post_vars"]["chat_active"] :
00093                         $this->object->server_conf->getActiveStatus();
00094 
00095                 
00096                 if($this->object->server_conf->isAlive() or $this->object->server_conf->getActiveStatus())
00097                 {
00098                         $this->tpl->setCurrentBlock("chat_active");
00099                         $this->tpl->setVariable("TXT_ACT_CHAT",$this->lng->txt("chat_ilias"));
00100                         $this->tpl->setVariable("TXT_ACT_STATUS",$this->lng->txt("chat_status"));
00101                         $this->tpl->setVariable("TXT_ACT_SUBMIT",$this->lng->txt("change"));
00102                         $this->tpl->setVariable("SELECT_ACT_STATUS",$this->__getStatusSelect($active));
00103                 }
00104                         
00105 
00106 
00107                 // SET TEXT VARIABLES
00108                 $this->tpl->setVariable("FORMACTION", 
00109                                                                 $this->getFormAction("gateway","adm_object.php?ref_id=".$this->ref_id."&cmd=gateway"));
00110                 $this->tpl->setVariable("TXT_CHAT_SERVER_SETTINGS",$this->lng->txt("chat_server_settings"));
00111         $this->tpl->setVariable("TXT_CHAT_SERVER_INTERNAL_IP",$this->lng->txt("chat_server_internal_ip"));
00112         $this->tpl->setVariable("TXT_CHAT_SERVER_EXTERNAL_IP",$this->lng->txt("chat_server_external_ip"));
00113                 $this->tpl->setVariable("TXT_CHAT_SERVER_MODERATOR",$this->lng->txt("chat_moderator_password"));
00114                 $this->tpl->setVariable("TXT_CHAT_SERVER_PORT",$this->lng->txt("chat_server_port"));
00115                 $this->tpl->setVariable("TXT_CHAT_SERVER_LOGFILE",$this->lng->txt("chat_server_logfile"));
00116                 $this->tpl->setVariable("TXT_CHAT_SERVER_LEVEL",$this->lng->txt("chat_server_loglevel"));
00117                 $this->tpl->setVariable("TXT_CHAT_SERVER_ALLOWED",$this->lng->txt("chat_server_allowed"));
00118                 $this->tpl->setVariable("TXT_CHAT_SERVER_ALLOWED_B",$this->lng->txt("chat_server_allowed_b"));
00119                 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00120                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt("cancel"));
00121                 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt("save"));
00122 
00123                 // SET SETTING VARS
00124         $this->tpl->setVariable("CHAT_SERVER_INTERNAL",$internal_ip);
00125         $this->tpl->setVariable("CHAT_SERVER_EXTERNAL",$external_ip);
00126                 $this->tpl->setVariable("CHAT_PORT",$port);
00127                 $this->tpl->setVariable("CHAT_MODERATOR",$moderator);
00128                 $this->tpl->setVariable("CHAT_LOGFILE",$logfile);
00129                 $this->tpl->setVariable("CHAT_ALLOWED",$allowed);
00130                 $this->tpl->setVariable("SELECT_LEVEL",$this->__getLogLevelSelect($loglevel));
00131                 $this->tpl->parseCurrentBlock();
00132                 
00133                 return true;
00134         }
00135 
00136         function updateObject()
00137         {
00138         $this->object->server_conf->setInternalIp($_POST["chat_internal_ip"]);
00139         $this->object->server_conf->setExternalIp($_POST["chat_external_ip"]);
00140                 $this->object->server_conf->setPort($_POST["chat_port"]);
00141                 $this->object->server_conf->setModeratorPassword($_POST["chat_moderator"]);
00142                 $this->object->server_conf->setLogfile($_POST["chat_logfile"]);
00143                 $this->object->server_conf->setLogLevel($_POST["chat_loglevel"]);
00144                 $this->object->server_conf->setAllowedHosts($_POST["chat_allowed"]);
00145 
00146                 if(!$this->object->server_conf->validate())
00147                 {
00148                         $this->ilias->raiseError($this->object->server_conf->getErrorMessage(),$this->ilias->error_obj->MESSAGE);
00149                 }
00150                 else
00151                 {
00152                         if(!$this->object->server_conf->update())
00153                         {
00154                                 $this->ilias->raiseError($this->object->server_conf->getErrorMessage(),$this->ilias->error_obj->MESSAGE);
00155                         }
00156                 }
00157                 sendInfo($this->lng->txt("chat_settings_saved"),true);
00158                 header("location: ".$this->getReturnLocation("update","adm_object.php?ref_id=$_GET[ref_id]"));
00159                 exit;
00160         }
00161 
00162         function activateObject()
00163         {
00164                 $this->object->server_conf->setActiveStatus((bool) $_POST["chat_active"]);
00165                 $this->object->server_conf->updateStatus();
00166 
00167                 sendInfo($this->lng->txt("chat_status_saved"),true);
00168                 header("location: ".$this->getReturnLocation("update","adm_object.php?ref_id=$_GET[ref_id]"));
00169                 exit;
00170         }
00171 
00172         // PRIVATE
00173         function __getLogLevelSelect($a_level)
00174         {
00175                 $levels = array(1 => $this->lng->txt("chat_level_fatal"),
00176                                                 2 => $this->lng->txt("chat_level_error"),
00177                                                 3 => $this->lng->txt("chat_level_info"),
00178                                                 5 => $this->lng->txt("chat_level_debug"),
00179                                                 6 => $this->lng->txt("chat_level_all"));
00180 
00181                 return ilUtil::formSelect($a_level,"chat_loglevel",$levels,false,true);
00182         }
00183         function __getStatusSelect($a_status)
00184         {
00185                 $stati = array(1 => $this->lng->txt("chat_active"),
00186                                            0 => $this->lng->txt("chat_inactive"));
00187 
00188                 return ilUtil::formSelect($a_status,"chat_active",$stati,false,true);
00189         }
00190 
00191 } // END class.ilObjChatServerGUI
00192 
00193 ?>

Generated on Fri Dec 13 2013 09:06:33 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1