Public Member Functions | Data Fields

ilObjChatGUI Class Reference

Inheritance diagram for ilObjChatGUI:
Collaboration diagram for ilObjChatGUI:

Public Member Functions

 ilObjChatGUI ($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 setTargetScript ($a_script)
 getTargetScript ($a_params)
 setInModule ($in_module)
 inModule ()
 saveObject ()
 save object
 cancelObject ()
 viewObject ()
 list childs of current object
 adminRoomsObject ()
 confirmedDeleteRoomObject ()
 addRoomObject ()
 renameRoomObject ()
 adminAddRoomObject ()
 showFrames ()
 showUserFrame ()
 showTopFrame ()
 showInputFrame ()
 showRightFrame ()
 cancel ()
 input ()
 invite ()
 drop ()
 closeFrame ()
 export ()
 __showOnlineUsers ()
 __showActiveUsers ()
 __showAdminAddRoomSelect ()
 __showAdminRoomSelect ()
 __showRooms ()
 __loadStylesheet ($expires=false)
 __getColorSelect ()
 __getFontType ()
 __getFontFace ()
 __formatMessage ()
 __exportRooms ()

Data Fields

 $target_script = "adm_object.php"
 $in_module = false

Detailed Description

Definition at line 37 of file class.ilObjChatGUI.php.


Member Function Documentation

ilObjChatGUI::__exportRooms (  ) 

Definition at line 907 of file class.ilObjChatGUI.php.

References $_POST, $file_obj, $id, ilUtil::deliverFile(), and export().

Referenced by adminRoomsObject().

        {
                include_once "chat/classes/class.ilFileDataChat.php";

                if(count($_POST["del_id"]) == 1)
                {
                        $this->object->chat_room->setRoomId($_POST["del_id"][0]);
                        $this->export();
                }

                $file_obj =& new ilFileDataChat($this->object);

                foreach($_POST["del_id"] as $id)
                {
                        $this->object->chat_room->setRoomId((int) $id);

                        $tmp_tpl =& new ilTemplate("tpl.chat_export.html",true,true,true);
                        
                        if($id)
                        {
                                $tmp_tpl->setVariable("CHAT_NAME",$this->object->chat_room->getTitle());
                        }
                        else
                        {
                                $tmp_tpl->setVariable("CHAT_NAME",$this->object->getTitle());
                        }
                        $tmp_tpl->setVariable("CHAT_DATE",strftime("%c",time()));
                        $tmp_tpl->setVariable("CONTENT",$this->object->chat_room->getAllMessages());

                        $file_obj->addFile("chat_".$this->object->chat_room->getRoomId().".html",$tmp_tpl->get());
                }
                $fname = $file_obj->zip();
                ilUtil::deliverFile($fname,"ilias_chat.zip");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::__formatMessage (  ) 

Definition at line 829 of file class.ilObjChatGUI.php.

References $_GET, $_POST, $_SESSION, and ilObjectGUI::$tpl.

Referenced by input().

        {
                $tpl = new ilTemplate("tpl.chat_message.html",true,true,true);

                $_POST['message'] = htmlentities(trim($_POST['message']),ENT_COMPAT,'utf-8');

                $tpl->setVariable("MESSAGE",$_POST["message"]);
                $tpl->setVariable("FONT_COLOR",$_POST["color"]);
                $tpl->setVariable("FONT_FACE",$_POST["type"]);

                if($_GET["p_id"])
                {
                        $user_obj =& new ilObjUser((int) $_SESSION["AccountId"]);
                        $user_obj->read();

                        $tpl->setCurrentBlock("private");
                        $tpl->setVariable("PRIVATE_U_COLOR","red");
                        $tpl->setVariable("PRIVATE_FROM",$user_obj->getLogin());

                        $user_obj =& new ilObjUser((int) $_GET["p_id"]);
                        $user_obj->read();
                        $tpl->setVariable("PRIVATE_TO",$user_obj->getLogin());
                        $tpl->parseCurrentBlock();
                }
                else
                {
                        $tpl->setCurrentBlock("normal");
                        $tpl->setVariable("NORMAL_U_COLOR","navy");
                        $tpl->setVariable("NORMAL_UNAME",$this->object->chat_user->getLogin());
                        $tpl->parseCurrentBlock();
                }
                // OPEN TAGS
                if($_POST["face"])
                {
                        foreach($_POST["face"] as $face)
                        {
                                $tpl->setCurrentBlock("type_open");
                                switch($face)
                                {
                                        case "bold":
                                                $tpl->setVariable("TYPE_TYPE_O","b");
                                                break;
                                        case "italic":
                                                $tpl->setVariable("TYPE_TYPE_O","i");
                                                break;

                                        case "underlined":
                                                $tpl->setVariable("TYPE_TYPE_O","u");
                                                break;
                                }
                                $tpl->parseCurrentBlock();
                        }
                        $_POST["face"] = array_reverse($_POST["face"]);
                        foreach($_POST["face"] as $face)
                        {
                                $tpl->setCurrentBlock("type_close");
                                switch($face)
                                {
                                        case "bold":
                                                $tpl->setVariable("TYPE_TYPE_C","b");
                                                break;
                                        case "italic":
                                                $tpl->setVariable("TYPE_TYPE_C","i");
                                                break;

                                        case "underlined":
                                                $tpl->setVariable("TYPE_TYPE_C","u");
                                                break;
                                }
                                $tpl->parseCurrentBlock();
                        }
                }

                $message = preg_replace("/\r/","",$tpl->get());
                $message = preg_replace("/\n/","",$message);

                return $message;
        }

Here is the caller graph for this function:

ilObjChatGUI::__getColorSelect (  ) 

Definition at line 763 of file class.ilObjChatGUI.php.

References $_POST, and formSelect().

Referenced by showInputFrame().

        {
                $colors = array("black" => $this->lng->txt("chat_black"),
                                                "red" => $this->lng->txt("chat_red"),
                                                "green" => $this->lng->txt("chat_green"),
                                                "maroon" => $this->lng->txt("chat_maroon"),
                                                "olive" => $this->lng->txt("chat_olive"),
                                                "navy" => $this->lng->txt("chat_navy"),
                                                "purple" => $this->lng->txt("chat_purple"),
                                                "teal" => $this->lng->txt("chat_teal"),
                                                "silver" => $this->lng->txt("chat_silver"),
                                                "gray" => $this->lng->txt("chat_gray"),
                                                "lime" => $this->lng->txt("chat_lime"),
                                                "yellow" => $this->lng->txt("chat_yellow"),
                                                "fuchsia" => $this->lng->txt("chat_fuchsia"),
                                                "aqua" => $this->lng->txt("chat_aqua"),
                                                "blue" => $this->lng->txt("chat_blue"));

                return ilUtil::formSelect($_POST["color"],"color",$colors,false,true);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::__getFontFace (  ) 

Definition at line 802 of file class.ilObjChatGUI.php.

References $_POST.

Referenced by showInputFrame().

        {
                $_POST["face"] = is_array($_POST["face"]) ? $_POST["face"] : array();

                $types = array("bold" => $this->lng->txt("chat_bold"),
                                           "italic" => $this->lng->txt("chat_italic"),
                                           "underlined" => $this->lng->txt("chat_underlined"));

                $this->tpl->setCurrentBlock("FONT_FACES");
                $this->tpl->setVariable("BL_TXT_FACE","<b>".$this->lng->txt("chat_bold")."</b>");
                $this->tpl->setVariable("FONT_FACE","bold");
                $this->tpl->setVariable("FACE_CHECKED",in_array("bold",$_POST["face"]) ? "checked=\"checked\"" : "");
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("FONT_FACES");
                $this->tpl->setVariable("BL_TXT_FACE","<i>".$this->lng->txt("chat_italic")."</i>");
                $this->tpl->setVariable("FONT_FACE","italic");
                $this->tpl->setVariable("FACE_CHECKED",in_array("italic",$_POST["face"]) ? "checked=\"checked\"" : "");
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("FONT_FACES");
                $this->tpl->setVariable("BL_TXT_FACE","<u>".$this->lng->txt("chat_underlined")."</u>");
                $this->tpl->setVariable("FONT_FACE","underlined");
                $this->tpl->setVariable("FACE_CHECKED",in_array("underlined",$_POST["face"]) ? "checked=\"checked\"" : "");
                $this->tpl->parseCurrentBlock();
        }

Here is the caller graph for this function:

ilObjChatGUI::__getFontType (  ) 

Definition at line 784 of file class.ilObjChatGUI.php.

References $_POST, and $type.

Referenced by showInputFrame().

        {
                $types = array("times" => $this->lng->txt("chat_times"),
                                           "tahoma" => $this->lng->txt("chat_tahoma"),
                                           "arial" => $this->lng->txt("chat_arial"));

                $_POST["type"] = $_POST["type"] ? $_POST["type"] : "times";

                foreach($types as $name => $type)
                {
                        $this->tpl->setCurrentBlock("FONT_TYPES");
                        $this->tpl->setVariable("BL_TXT_TYPE",$type);
                        $this->tpl->setVariable("FONT_TYPE",$name);
                        $this->tpl->setVariable("TYPE_CHECKED",$_POST["type"] == $name ? "checked=\"checked\"" : "");
                        $this->tpl->parseCurrentBlock();
                }
        }

Here is the caller graph for this function:

ilObjChatGUI::__loadStylesheet ( expires = false  ) 

Definition at line 751 of file class.ilObjChatGUI.php.

References ilUtil::getStyleSheetLocation().

Referenced by closeFrame(), showInputFrame(), showRightFrame(), showTopFrame(), and showUserFrame().

        {
                $this->tpl->setCurrentBlock("ChatStyle");
                $this->tpl->setVariable("LOCATION_CHAT_STYLESHEET",ilUtil::getStyleSheetLocation());
                if($expires)
                {
                        $this->tpl->setVariable("EXPIRES","<meta http-equiv=\"expires\" content=\"now\">".
                                                                        "<meta http-equiv=\"refresh\" content=\"30\">");
                }
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::__showActiveUsers (  ) 

Definition at line 598 of file class.ilObjChatGUI.php.

References $_GET, $_REQUEST, $_SESSION, $counter, $user, and $users.

Referenced by showUserFrame().

        {
                if(isset($_GET["a_users"]))
                {
                        if($_GET["a_users"])
                        {
                                $_SESSION["a_users"] = true;
                        }
                        else
                        {
                                $_SESSION["a_users"] = 0;
                                unset($_SESSION["a_users"]);
                        }
                }

                $hide = $_SESSION["a_users"] ? true : false;

                $this->tpl->setVariable("ACTIVE_USERS",$this->lng->txt("chat_active_users"));
                $this->tpl->setVariable("DETAILS_B_TXT",$hide ? $this->lng->txt("chat_show_details") : $this->lng->txt("chat_hide_details"));
                $this->tpl->setVariable("DETAILS_B","chat.php?ref_id=".$this->object->getRefId().
                                                                "&room_id=".$this->object->chat_room->getRoomId().
                                                                "&a_users=".($hide ? 0 : 1)."&cmd=showUserFrame");

                if($hide)
                {
                        return true;
                }
                $users = $this->object->chat_room->getActiveUsers();
                if(count($users) <= 1)
                {
                        $this->tpl->setCurrentBlock("no_actice");
                        $this->tpl->setVariable("NO_ACTIVE_USERS",$this->lng->txt("chat_no_active_users"));
                        $this->tpl->parseCurrentBlock();
                }
                else
                {
                        $user_obj =& new ilObjUser();
                        $counter = 0;
                        foreach($users as $user)
                        {
                                if($user == $_SESSION["AccountId"])
                                {
                                        continue;
                                }
                                if(!($counter%2))
                                {
                                        $this->tpl->touchBlock("active_row_start");
                                }
                                else
                                {
                                        $this->tpl->touchBlock("active_row_end");
                                }
                                $user_obj->setId($user);
                                $user_obj->read();

                                $this->tpl->setCurrentBlock("active");
                                $this->tpl->setVariable("ACTIVE_FONT_A",$_GET["p_id"] == $user ? "smallred" : "small");
                                $this->tpl->setVariable("ACTIVE_LINK_A","chat.php?cmd=showInputFrame&".
                                                                                "ref_id=".$this->ref_id."&room_id=".
                                                                                $_REQUEST["room_id"]."&p_id=".$user);
                                $this->tpl->setVariable("ACTIVE_USER_NAME_A",$user_obj->getLogin());
                                $this->tpl->parseCurrentBlock();
                                $counter++;
                        }
                }
        }

Here is the caller graph for this function:

ilObjChatGUI::__showAdminAddRoomSelect (  ) 

Definition at line 664 of file class.ilObjChatGUI.php.

References formSelect().

Referenced by viewObject().

        {
                $opt = array("createRoom" => $this->lng->txt("chat_room_select"));

                return ilUtil::formSelect("","action_b",$opt,false,true);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::__showAdminRoomSelect (  ) 

Definition at line 671 of file class.ilObjChatGUI.php.

References $_SESSION, and formSelect().

Referenced by viewObject().

        {
                if(count($this->object->chat_room->getRoomsOfObject()))
                {
                        $opt = array("renameRoom" => $this->lng->txt("rename"),
                                                 "refreshRoom" => $this->lng->txt("chat_refresh"),
                                                 "exportRoom" => $this->lng->txt("chat_html_export"),
                                                 "deleteRoom" => $this->lng->txt("delete"));
                }
                else
                {
                        $opt = array("exportRoom" => $this->lng->txt("chat_html_export"));
                }
                if(!$this->object->server_comm->isAlive() or !$this->ilias->getSetting("chat_active"))
                {
                        unset($opt["refreshRoom"]);
                }
                return ilUtil::formSelect(isset($_SESSION["room_id_delete"]) ? "deleteRoom" : "",
                                                                  "action",
                                                                  $opt,
                                                                  false,
                                                                  true);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::__showOnlineUsers (  ) 

Definition at line 542 of file class.ilObjChatGUI.php.

References $_GET, $_REQUEST, $_SESSION, $cmd, $counter, $user, $users, and ilUtil::getImagePath().

Referenced by showUserFrame().

        {
                $users = $this->object->chat_room->getOnlineUsers();
                if(count($users) <= 1)
                {
                        $this->tpl->setCurrentBlock("no_actice");
                        $this->tpl->setVariable("NO_ONLINE_USERS",$this->lng->txt("chat_no_active_users"));
                        $this->tpl->parseCurrentBlock();
                }
                else
                {
                        $counter = 0;
                        foreach($users as $user)
                        {
                                if($user["user_id"] == $_SESSION["AccountId"])
                                {
                                        continue;
                                }
                                if(!($counter%2))
                                {
                                        $this->tpl->touchBlock("online_row_start");
                                }
                                else
                                {
                                        $this->tpl->touchBlock("online_row_end");
                                }

                                $this->tpl->setCurrentBlock("online");
                                $this->tpl->setVariable("ONLINE_FONT_A",$_GET["p_id"] == $user["user_id"] ? "smallred" : "small");
                                
                                if($this->object->chat_room->isInvited($user["user_id"]))
                                {
                                        $img = "minus.gif";
                                        $cmd = "drop";
                                }
                                else
                                {
                                        $img = "plus.gif";
                                        $cmd = "invite";
                                }
                                $this->tpl->setVariable("ONLINE_LINK_A","chat.php?cmd=".$cmd.
                                                                                "&ref_id=".$this->ref_id."&room_id=".
                                                                                $_REQUEST["room_id"]."&i_id=".$user["user_id"]);
                                $this->tpl->setVariable("TXT_INVITE_USER",$cmd == "invite" ? $this->lng->txt("chat_invite_user") :
                                        $this->lng->txt("chat_drop_user"));
                                $this->tpl->setVariable("ONLINE_USER_NAME_A",$user["login"]);
                                $this->tpl->setVariable("INVITE_IMG_SRC",ilUtil::getImagePath($img,true));
                                
                                $this->tpl->parseCurrentBlock();
                                $counter++;
                        }
                }
                $this->tpl->setCurrentBlock("show_online");
                $this->tpl->setVariable("ONLINE_USERS",$this->lng->txt("chat_online_users"));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::__showRooms (  ) 

Definition at line 695 of file class.ilObjChatGUI.php.

References $_GET, $_SESSION, and $counter.

Referenced by showUserFrame().

        {
                $public_rooms = $this->object->chat_room->getAllRooms();
                $private_rooms = $this->object->chat_room->getRooms();

                if(isset($_GET["h_rooms"]))
                {
                        if($_GET["h_rooms"])
                        {
                                $_SESSION["h_rooms"] = true;
                        }
                        else
                        {
                                $_SESSION["h_rooms"] = 0;
                                unset($_SESSION["h_rooms"]);
                        }
                }
                $hide = $_SESSION["h_rooms"] ? true : false;

                $this->tpl->setVariable("ROOMS_ROOMS",$this->lng->txt("chat_rooms"));
                $this->tpl->setVariable("DETAILS_TXT",$hide ? $this->lng->txt("chat_show_details") : $this->lng->txt("chat_hide_details"));
                $this->tpl->setVariable("ROOMS_COUNT",count($public_rooms) + count($private_rooms));
                $this->tpl->setVariable("DETAILS_A","chat.php?ref_id=".$this->object->getRefId().
                                                                "&room_id=".$this->object->chat_room->getRoomId().
                                                                "&h_rooms=".($hide ? 0 : 1)."&cmd=showUserFrame");

                if($hide)
                {
                        return true;
                }

                $counter = 0;
                foreach($public_rooms as $room)
                {
                        $this->tpl->setCurrentBlock("room_row");
                        $this->tpl->setVariable("ROOM_ROW_CSS",++$counter%2 ? "tblrow1" : "tblrow2");
                        $this->tpl->setVariable("ROOM_LINK","chat.php?ref_id=".$room["child"]);
                        $this->tpl->setVariable("ROOM_TARGET","_top");
                        $this->tpl->setVariable("ROOM_NAME",$room["title"]);
                        $this->tpl->setVariable("ROOM_ONLINE",$this->object->chat_room->getCountActiveUser($room["child"],0));
                        $this->tpl->parseCurrentBlock();
                }

                foreach($private_rooms as $room)
                {
                        $this->tpl->setCurrentBlock("room_row");
                        $this->tpl->setVariable("ROOM_ROW_CSS",++$counter%2 ? "tblrow1" : "tblrow2");
                        $this->tpl->setVariable("ROOM_LINK","chat.php?ref_id=".$room["chat_id"].
                                                                                                                                                 "&room_id=".$room["room_id"]);
                        $this->tpl->setVariable("ROOM_TARGET","_top");
                        $this->tpl->setVariable("ROOM_NAME",$room["title"]);
                        $this->tpl->setVariable("ROOM_ONLINE",$this->object->chat_room->getCountActiveUser($room["chat_id"],$room["room_id"]));
                        $this->tpl->parseCurrentBlock();
                }

        }

Here is the caller graph for this function:

ilObjChatGUI::addRoomObject (  ) 

Definition at line 285 of file class.ilObjChatGUI.php.

References $_POST, $_SESSION, $rbacsystem, exit, getTargetScript(), sendInfo(), and ilUtil::stripSlashes().

        {
                global $rbacsystem;

                if (!$rbacsystem->checkAccess("read", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }
                $room =& new ilChatRoom($this->ref_id);
                $room->setTitle(ilUtil::stripSlashes($_POST["room_name"]));
                $room->setOwnerId($_SESSION["AccountId"]);

                if(!$room->validate())
                {
                        $this->ilias->raiseError($room->getErrorMessage(),$this->ilias->error_obj->MESSAGE);
                }
                $room->add();

                sendInfo("chat_room_added");
                header("location: ".$this->getTargetScript("cmd=gateway&ref_id=".$this->ref_id));
                exit;
        }

Here is the call graph for this function:

ilObjChatGUI::adminAddRoomObject (  ) 

Definition at line 334 of file class.ilObjChatGUI.php.

References $rbacsystem, and getTargetScript().

        {
                global $rbacsystem;

                if (!$rbacsystem->checkAccess("read", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.chat_edit_room.html",true);
                $this->tpl->setVariable("FORMACTION",$this->getTargetScript("cmd=gateway&ref_id=".$this->ref_id));
                $this->tpl->setVariable("TXT_ROOM_NAME",$this->lng->txt("chat_room_name"));
                $this->tpl->setVariable("ROOM_CANCEL",$this->lng->txt("cancel"));
        
                $this->tpl->setVariable("TXT_EDIT_CHATROOMS",$this->lng->txt("chat_chatroom_rename"));
                $this->tpl->setVariable("ROOM_NAME","");
                $this->tpl->setVariable("CMD","addRoom");
                $this->tpl->setVariable("ROOM_EDIT",$this->lng->txt("add"));

        }       

Here is the call graph for this function:

ilObjChatGUI::adminRoomsObject (  ) 

Definition at line 187 of file class.ilObjChatGUI.php.

References $_POST, $_SESSION, $rbacsystem, __exportRooms(), exit, getTargetScript(), and sendInfo().

        {
                global $rbacsystem;

                if (!$rbacsystem->checkAccess("read", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }
                
                if(!isset($_POST["del_id"]))
                {
                        $this->ilias->raiseError($this->lng->txt("chat_select_one_room"),$this->ilias->error_obj->MESSAGE);
                }

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.chat_edit_room.html",true);
                $this->tpl->setVariable("FORMACTION",$this->getTargetScript("cmd=gateway&ref_id=".$this->ref_id));
                $this->tpl->setVariable("TXT_ROOM_NAME",$this->lng->txt("chat_room_name"));
                $this->tpl->setVariable("ROOM_CANCEL",$this->lng->txt("cancel"));
        
                switch($_POST["action"])
                {
                        case "renameRoom":
                                if(count($_POST["del_id"]) > 1)
                                {
                                        $this->ilias->raiseError($this->lng->txt("chat_select_one_room"),$this->ilias->error_obj->MESSAGE);
                                }
                                if(in_array(0,$_POST["del_id"]))
                                {
                                        $this->ilias->raiseError($this->lng->txt("chat_no_rename_public"),$this->ilias->error_obj->MESSAGE);
                                }

                                // STORE ID IN SESSION
                                $_SESSION["room_id_rename"] = (int) $_POST["del_id"][0];

                                $room =& new ilChatRoom($this->ref_id);
                                $room->setRoomId($_SESSION["room_id_rename"]);

                                $this->tpl->setVariable("TXT_EDIT_CHATROOMS",$this->lng->txt("chat_chatroom_rename"));
                                $this->tpl->setVariable("ROOM_NAME",$room->getTitle());
                                $this->tpl->setVariable("CMD","renameRoom");
                                $this->tpl->setVariable("ROOM_EDIT",$this->lng->txt("rename"));
                                break;

                        case "deleteRoom":
                                if(in_array(0,$_POST["del_id"]))
                                {
                                        $this->ilias->raiseError($this->lng->txt("chat_no_delete_public"),$this->ilias->error_obj->MESSAGE);
                                }
                                $_SESSION["room_id_delete"] = $_POST["del_id"];
                                header("location: ".$this->getTargetScript("cmd=gateway&ref_id=".$this->ref_id));
                                exit;

                        case "exportRoom":
                                $this->__exportRooms();
                                break;

                        case "refreshRoom":
                                if(in_array(0,$_POST["del_id"]))
                                {
                                        $this->ilias->raiseError($this->lng->txt("chat_no_refresh_public"),$this->ilias->error_obj->MESSAGE);
                                }
                                foreach($_POST["del_id"] as $room_id)
                                {
                                        $this->object->chat_room->setRoomId($room_id);
                                        $this->object->server_comm->setType("delete");
                                        $this->object->server_comm->send();
                                        $this->object->chat_room->deleteAllMessages();
                                }
                                sendInfo($this->lng->txt("chat_messages_deleted"),true);
                                header("location: ".$this->getTargetScript("cmd=gateway&ref_id=".$this->ref_id));
                                exit;
                }       
                
        }

Here is the call graph for this function:

ilObjChatGUI::cancel (  ) 

Definition at line 458 of file class.ilObjChatGUI.php.

References $_GET, and showInputFrame().

        {
                unset($_GET["p_id"]);

                $this->showInputFrame();
        }

Here is the call graph for this function:

ilObjChatGUI::cancelObject (  ) 

Definition at line 82 of file class.ilObjChatGUI.php.

References $_SESSION.

        {
                unset($_SESSION["room_id_rename"]);
                unset($_SESSION["room_id_delete"]);
                parent::cancelObject();
        }

ilObjChatGUI::closeFrame (  ) 

Definition at line 515 of file class.ilObjChatGUI.php.

References __loadStylesheet(), and sendInfo().

        {
                $this->__loadStylesheet(true);
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.chat_close.html",true);
                sendInfo("Your session is expired please login to ILIAS.");
                $this->tpl->touchBlock("content");
        }

Here is the call graph for this function:

ilObjChatGUI::confirmedDeleteRoomObject (  ) 

Definition at line 261 of file class.ilObjChatGUI.php.

References $_SESSION, $rbacsystem, exit, getTargetScript(), and sendInfo().

        {
                global $rbacsystem;

                if (!$rbacsystem->checkAccess("read", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }
                if(!$_SESSION["room_id_delete"])
                {
                        $this->ilias->raiseError($this->lng->txt("chat_select_one_room"),$this->ilias->error_obj->MESSAGE);
                }
                $this->object->chat_room->setOwnerId($_SESSION["AccountId"]);
                if(!$this->object->chat_room->deleteRooms($_SESSION["room_id_delete"]))
                {
                        $this->ilias->raiseError($this->object->chat_room->getErrorMessage(),$this->ilias->error_obj->MESSAGE);
                }
                unset($_SESSION["room_id_delete"]);
                sendInfo($this->lng->txt("chat_rooms_deleted"),true);

                header("location: ".$this->getTargetScript("cmd=gateway&ref_id=".$this->ref_id));
                exit;
        }

Here is the call graph for this function:

ilObjChatGUI::drop (  ) 

Definition at line 501 of file class.ilObjChatGUI.php.

References $_GET, $tmp_user, sendInfo(), and showFrames().

        {
                if($_GET["i_id"])
                {
                        $this->object->chat_room->drop((int) $_GET["i_id"]);

                        $tmp_user =& new ilObjUser($_GET["i_id"]);
                        $this->object->server_comm->setKickedUser($tmp_user->getLogin());
                        $this->object->server_comm->setType("kick");
                        $this->object->server_comm->send();
                        sendInfo($this->lng->txt("chat_user_dropped"),true);
                        $this->showFrames();
                }
        }

Here is the call graph for this function:

ilObjChatGUI::export (  ) 

Definition at line 523 of file class.ilObjChatGUI.php.

References ilUtil::deliverData(), and exit.

Referenced by __exportRooms().

        {
                $tmp_tpl =& new ilTemplate("tpl.chat_export.html",true,true,true);

                if($this->object->chat_room->getRoomId())
                {
                        $tmp_tpl->setVariable("CHAT_NAME",$this->object->chat_room->getTitle());
                }
                else
                {
                        $tmp_tpl->setVariable("CHAT_NAME",$this->object->getTitle());
                }
                $tmp_tpl->setVariable("CHAT_DATE",strftime("%c",time()));
                $tmp_tpl->setVariable("CONTENT",$this->object->chat_room->getAllMessages());
                ilUtil::deliverData($tmp_tpl->get(),"1.html");
                exit;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::getTargetScript ( a_params  ) 

Definition at line 62 of file class.ilObjChatGUI.php.

Referenced by addRoomObject(), adminAddRoomObject(), adminRoomsObject(), confirmedDeleteRoomObject(), renameRoomObject(), and viewObject().

        {
                return $this->target_script."?".$a_params;
        }

Here is the caller graph for this function:

ilObjChatGUI::ilObjChatGUI ( a_data,
a_id,
a_call_by_reference = true,
a_prepare_output = true 
)

Constructor public.

Definition at line 46 of file class.ilObjChatGUI.php.

References $_SESSION, and ilObjectGUI::ilObjectGUI().

        {
                define("ILIAS_MODULE","chat");
                
                $this->type = "chat";
                $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, $a_prepare_output);

                if(is_object($this->object->chat_user))
                {
                        $this->object->chat_user->setUserId($_SESSION["AccountId"]);
                }
        }

Here is the call graph for this function:

ilObjChatGUI::inModule (  ) 

Definition at line 70 of file class.ilObjChatGUI.php.

Referenced by viewObject().

        {
                return $this->in_module;
        }

Here is the caller graph for this function:

ilObjChatGUI::input (  ) 

Definition at line 466 of file class.ilObjChatGUI.php.

References $_GET, $_POST, __formatMessage(), sendInfo(), and showInputFrame().

        {
                if(!$_POST["message"])
                {
                        sendInfo($this->lng->txt("chat_insert_message"),true);
                }
                if($_POST["message"] and $this->object->chat_room->checkWriteAccess())
                {
                        // FORMAT MESSAGE
                        $message = $this->__formatMessage();
                        
                        // SET MESSAGE AND SEND IT
                        $this->object->server_comm->setMessage($message);
                        if((int) $_GET["p_id"])
                        {
                                $this->object->server_comm->setType('private');
                        }
                        if(!$this->object->server_comm->send())
                        {
                                $this->error = $this->lng->txt("chat_no_connection");
                        }
                }
                $this->showInputFrame();
        }

Here is the call graph for this function:

ilObjChatGUI::invite (  ) 

Definition at line 491 of file class.ilObjChatGUI.php.

References $_GET, sendInfo(), and showFrames().

        {
                if($_GET["i_id"])
                {
                        $this->object->chat_room->invite((int) $_GET["i_id"]);
                        $this->object->sendMessage((int) $_GET["i_id"]);
                        sendInfo($this->lng->txt("chat_user_invited"),true);
                        $this->showFrames();
                }
        }

Here is the call graph for this function:

ilObjChatGUI::renameRoomObject (  ) 

Definition at line 308 of file class.ilObjChatGUI.php.

References $_POST, $_SESSION, $rbacsystem, exit, getTargetScript(), sendInfo(), and ilUtil::stripSlashes().

        {
                global $rbacsystem;

                if (!$rbacsystem->checkAccess("read", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }
                
                $room =& new ilChatRoom($this->ref_id);
                $room->setRoomId($_SESSION["room_id_rename"]);
                $room->setTitle(ilUtil::stripSlashes($_POST["room_name"]));
                if(!$room->validate())
                {
                        $this->ilias->raiseError($room->getErrorMessage(),$this->ilias->error_obj->MESSAGE);
                }
                $room->rename();

                unset($_SESSION["room_id_rename"]);
                sendInfo("chat_room_renamed");
                header("location: ".$this->getTargetScript("cmd=gateway&ref_id=".$this->ref_id));
                exit;
        }               

Here is the call graph for this function:

ilObjChatGUI::saveObject (  ) 

save object

public

Reimplemented from ilObjectGUI.

Definition at line 75 of file class.ilObjChatGUI.php.

References ilObjectGUI::getReturnLocation(), and ilUtil::redirect().

        {
                $new_obj =& parent::saveObject();

                ilUtil::redirect($this->getReturnLocation("save","adm_object.php?ref_id=".$new_obj->getRefId()));
        }

Here is the call graph for this function:

ilObjChatGUI::setInModule ( in_module  ) 

Definition at line 66 of file class.ilObjChatGUI.php.

References $in_module.

        {
                $this->in_module = $in_module;
        }

ilObjChatGUI::setTargetScript ( a_script  ) 

Definition at line 58 of file class.ilObjChatGUI.php.

        {
                $this->target_script = $a_script;
        }

ilObjChatGUI::showFrames (  ) 

Definition at line 354 of file class.ilObjChatGUI.php.

References $_GET, $_REQUEST, and $rbacsystem.

Referenced by drop(), and invite().

        {
                global $rbacsystem;

                if (!$rbacsystem->checkAccess("read", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }

                // LOAD FRAMESET
                $this->tpl = new ilTemplate("tpl.chat_start.html",false,false,true);
                $this->tpl->setVariable("USER_TARGET","chat.php?cmd=showUserFrame&ref_id=".
                                                                $this->object->getRefId()."&room_id=".
                                                                $_REQUEST["room_id"]."&p_id=".$_GET["p_id"]);
                $this->tpl->setVariable("TOP_TARGET","chat.php?cmd=showTopFrame&ref_id=".
                                                                $this->object->getRefId()."&room_id=".
                                                                $_REQUEST["room_id"]."&p_id=".$_GET["p_id"]);
                $this->tpl->setVariable("SERVER_TARGET",$this->object->server_comm->getServerFrameSource());
                $this->tpl->setVariable("INPUT_TARGET","chat.php?cmd=showInputFrame&ref_id=".
                                                                $this->object->getRefId()."&room_id=".
                                                                $_REQUEST["room_id"]."&p_id=".$_GET["p_id"]);
                $this->tpl->setVariable("RIGHT_TARGET","chat.php?cmd=showRightFrame&ref_id=".
                                                                $this->object->getRefId()."&room_id=".
                                                                $_REQUEST["room_id"]."&p_id=".$_GET["p_id"]);
        }

Here is the caller graph for this function:

ilObjChatGUI::showInputFrame (  ) 

Definition at line 409 of file class.ilObjChatGUI.php.

References $_GET, $_REQUEST, __getColorSelect(), __getFontFace(), __getFontType(), __loadStylesheet(), and sendInfo().

Referenced by cancel(), and input().

        {
                $this->__loadStylesheet();
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.chat_input_frame.html",true);

                if($this->error)
                {
                        sendInfo($this->error);
                }
                if($_GET["p_id"])
                {
                        $user_obj =& new ilObjUser((int) $_GET["p_id"]);
                        $message = $this->lng->txt("chat_private_message")." ";
                        $message .= $this->object->chat_user->getLogin()." -> ".$user_obj->getLogin();
                        sendInfo($message);
                }
                
                $this->tpl->setVariable("FORMACTION","chat.php?cmd=gateway&ref_id=".
                                                                $this->object->getRefId()."&room_id=".
                                                                $_REQUEST["room_id"]."&p_id=".$_GET["p_id"]);

                $this->tpl->setVariable("TXT_COLOR",$this->lng->txt("chat_color"));
                $this->tpl->setVariable("TXT_TYPE",$this->lng->txt("chat_type"));
                $this->tpl->setVariable("TXT_FACE",$this->lng->txt("chat_face"));
                $this->tpl->setVariable("TXT_INPUT",$this->lng->txt("chat_input"));

                if($_GET["p_id"])
                {
                        $this->tpl->setCurrentBlock("whisper");
                        $this->tpl->setVariable("TXT_SUBMIT_CANCEL",$this->lng->txt("cancel"));
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setVariable("TXT_SUBMIT_OK",$this->lng->txt("ok"));
                }
                else
                {
                        $this->tpl->setVariable("TXT_SUBMIT_OK",$this->lng->txt("ok"));
                }
                $this->tpl->setVariable("SELECT_COLOR",$this->__getColorSelect());
                $this->tpl->setVariable("RADIO_TYPE",$this->__getFontType());
                $this->tpl->setVariable("CHECK_FACE",$this->__getFontFace());


        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjChatGUI::showRightFrame (  ) 

Definition at line 452 of file class.ilObjChatGUI.php.

References __loadStylesheet().

        {
                $this->__loadStylesheet();
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.chat_right_frame.html",true);
        }

Here is the call graph for this function:

ilObjChatGUI::showTopFrame (  ) 

Definition at line 404 of file class.ilObjChatGUI.php.

References __loadStylesheet().

        {
                $this->__loadStylesheet();
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.chat_top_frame.html",true);
        }

Here is the call graph for this function:

ilObjChatGUI::showUserFrame (  ) 

Definition at line 379 of file class.ilObjChatGUI.php.

References $_REQUEST, $_SESSION, __loadStylesheet(), __showActiveUsers(), __showOnlineUsers(), and __showRooms().

        {
                $this->object->chat_room->setUserId($_SESSION["AccountId"]);
                $this->object->chat_room->updateLastVisit();

                $this->__loadStylesheet(true);
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.chat_user_frame.html",true);

                if($_REQUEST["room_id"])
                {
                        $this->tpl->setVariable("TITLE",$this->object->chat_room->getTitle());
                }
                else
                {
                        $this->tpl->setVariable("TITLE",$this->object->getTitle());
                }

                $this->__showRooms();
                $this->__showActiveUsers();
                if($this->object->chat_room->isOwner())
                {
                        $this->__showOnlineUsers();
                }
                
        }

Here is the call graph for this function:

ilObjChatGUI::viewObject (  ) 

list childs of current object

public

Reimplemented from ilObjectGUI.

Definition at line 90 of file class.ilObjChatGUI.php.

References $_SESSION, $counter, $rbacsystem, $script, __showAdminAddRoomSelect(), __showAdminRoomSelect(), ilUtil::formCheckbox(), ilUtil::getImagePath(), getTargetScript(), inModule(), and sendInfo().

        {

                global $rbacsystem;

                if (!$rbacsystem->checkAccess("read", $this->ref_id))
                {
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
                }
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.chat_view.html",true);

                // CHAT SERVER NOT ACTIVE
                if(!$this->object->server_comm->isAlive() or !$this->ilias->getSetting("chat_active"))
                {
                        sendInfo($this->lng->txt("chat_server_not_active"));
                }

                // DELETE ROOMS CONFIRM
                $checked = array();
                if($_SESSION["room_id_delete"])
                {
                        $checked = $_SESSION["room_id_delete"];
                        sendInfo($this->lng->txt("chat_delete_sure"));
                        $this->tpl->setVariable("TXT_DELETE_CANCEL",$this->lng->txt("cancel"));
                        $this->tpl->setVariable("TXT_DELETE_CONFIRM",$this->lng->txt("delete"));
                }

                // SHOW ROOMS TABLE
                $this->tpl->setVariable("FORMACTION",$this->getTargetScript("cmd=gateway&ref_id=".
                                                                                                                                        $this->ref_id));
                $this->tpl->setVariable("TXT_CHATROOMS",$this->lng->txt("chat_chatrooms"));

                $counter = 0;
                $this->object->chat_room->setOwnerId($_SESSION["AccountId"]);
                $rooms = $this->object->chat_room->getRoomsOfObject();
                $script = $this->inModule() ? "./chat.php" : "./chat/chat.php";

                // ADD PUBLIC ROOM
                // CHAT SERVER  ACTIVE
                if($this->object->server_comm->isAlive() and $this->ilias->getSetting("chat_active"))
                {
                        $this->tpl->setCurrentBlock("active");
                        $this->tpl->setVariable("ROOM_LINK",$script."?ref_id=".$this->ref_id."&room_id=0");
                        $this->tpl->setVariable("ROOM_TARGET","_blank");
                        $this->tpl->setVariable("ROOM_TXT_LINK",$this->lng->txt("show"));
                        $this->tpl->parseCurrentBlock();
                }
                else
                {
                        $this->tpl->touchBlock("not_active");
                }
                $this->tpl->setCurrentBlock("tbl_rooms_row");
                $this->tpl->setVariable("ROWCOL",++$counter % 2 ? "tblrow1" : "tblrow2");
                $this->tpl->setVariable("ROOM_CHECK",
                                                                ilUtil::formCheckbox(in_array(0,$checked) ? 1 : 0,
                                                                                                         "del_id[]",
                                                                                                         0));
                $this->tpl->setVariable("ROOM_NAME",$this->object->getTitle()." ".$this->lng->txt("chat_public_room"));
                $this->tpl->parseCurrentBlock();

                $script = $this->inModule() ? "./chat.php" : "./chat/chat.php";



                foreach($rooms as $room)
                {
                        // CHAT SERVER  ACTIVE
                        if($this->object->server_comm->isAlive() and $this->ilias->getSetting("chat_active"))
                        {
                                $this->tpl->setCurrentBlock("active");
                                $this->tpl->setVariable("ROOM_LINK",$script."?ref_id=".$this->ref_id."&room_id=".$room["room_id"]);
                                $this->tpl->setVariable("ROOM_TARGET","_blank");
                                $this->tpl->setVariable("ROOM_TXT_LINK",$this->lng->txt("show"));
                                $this->tpl->parseCurrentBlock();
                        }
                        else
                        {
                                $this->tpl->touchBlock("not_active");
                        }
                        $this->tpl->setCurrentBlock("tbl_rooms_row");
                        $this->tpl->setVariable("ROWCOL",++$counter % 2 ? "tblrow1" : "tblrow2");
                        $this->tpl->setVariable("ROOM_CHECK",
                                                                        ilUtil::formCheckbox(in_array($room["room_id"],$checked) ? 1 : 0,
                                                                        "del_id[]",
                                                                        $room["room_id"]));

                        $this->tpl->setVariable("ROOM_NAME",$room["title"]);
                        $this->tpl->parseCurrentBlock();
                }
                $this->tpl->setCurrentBlock("has_rooms");
                $this->tpl->setVariable("TBL_FOOTER_IMG_SRC", ilUtil::getImagePath("arrow_downright.gif"));
                $this->tpl->setVariable("TBL_FOOTER_SELECT",$this->__showAdminRoomSelect(count($rooms)));
                $this->tpl->setVariable("FOOTER_HAS_ROOMS_OK",$this->lng->txt("ok"));
                $this->tpl->parseCurrentBlock();
                $this->tpl->setVariable("TBL_FOOTER_ADD_SELECT",$this->__showAdminAddRoomSelect());
                $this->tpl->setVariable("FOOTER_OK",$this->lng->txt("add"));
        }

Here is the call graph for this function:


Field Documentation

ilObjChatGUI::$in_module = false

Definition at line 40 of file class.ilObjChatGUI.php.

Referenced by setInModule().

ilObjChatGUI::$target_script = "adm_object.php"

Definition at line 39 of file class.ilObjChatGUI.php.


The documentation for this class was generated from the following file: