ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilChatBlockGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
31 include_once 'Services/Block/classes/class.ilBlockGUI.php';
33 {
34  static $block_type = "chatviewer";
35 
39  function ilChatBlockGUI()
40  {
41  global $ilCtrl, $lng, $ilUser;
43  $lng->loadLanguageModule("chat");
44  $this->setImage(ilUtil::getImagePath("icon_chat.gif"));
45  $this->setTitle($lng->txt("chat_chatviewer"));
46  $this->setAvailableDetailLevels(1, 0);
47  $this->allow_moving = true;
48  }
49 
55  static function getBlockType()
56  {
57  return self::$block_type;
58  }
59 
65  static function isRepositoryObject()
66  {
67  return false;
68  }
69 
73  static function getScreenMode()
74  {
75  switch($_GET["cmd"])
76  {
77  default:
78  return IL_SCREEN_SIDE;
79  break;
80  }
81  }
82 
86  function &executeCommand()
87  {
88  global $ilCtrl;
89 
90  $next_class = $ilCtrl->getNextClass();
91  $cmd = $ilCtrl->getCmd("getHTML");
92 
93  return $this->$cmd();
94  }
95 
96  function getHTML()
97  {
98  global $tpl;
99  include_once 'Modules/Chat/classes/class.ilChatServerConfig.php';
100  include_once 'Services/YUI/classes/class.ilYuiUtil.php';
101 
103 
104  $serverconfig = new ilChatServerConfig();
105 
106  if ($this->getCurrentDetailLevel() == 0 || !$serverconfig->getActiveStatus() || !$serverconfig->isAlive())
107  return "";
108  else
109  {
110  $tpl->addCss('Modules/Chat/templates/default/chat.css');
111  $html = parent::getHTML();
112  return $html;
113  }
114 
115  }
116 
120  function fillDataSection()
121  {
122  global $tpl, $lng, $ilCtrl;
123 
124  include_once 'Modules/Chat/classes/class.ilChatBlock.php';
125 
126  $tpl->addJavascript("Modules/Chat/js/ChatChatviewerBlock.js");
127  //$tpl->addJavascript("Modules/Chat/js/json.js");
128 
129  $chatblock = new ilChatBlock();
130  $body_tpl = new ilTemplate('tpl.chat_block_message_body.html', true, true, 'Modules/Chat');
131 
132  $height = 120;
133  if ($this->getCurrentDetailLevel() > 0 && $this->getCurrentDetailLevel() <= 3)
134  {
135  $height *= $this->getCurrentDetailLevel();
136  }
137  $body_tpl->setVariable('BLOCK_HEIGHT', $height);
138  $body_tpl->setVariable('TXT_ENABLE_AUTOSCROLL', $lng->txt('chat_enable_autoscroll'));
139  $ilCtrl->setParameter($this, 'ref_id', '#__ref_id');
140  $ilCtrl->setParameter($this, 'room_id', '#__room_id');
141  $body_tpl->setVariable('CHATBLOCK_BASE_URL', 'ilias.php?ref_id=#__ref_id&room_id=#__room_id&cmdClass=ilobjchatgui&cmd=getChatViewerBlockContent&baseClass=ilChatPresentationGUI&cmdMode=asynch');
142  $ilCtrl->clearParameters($this);
143 
144  $content = $body_tpl->get() . $chatblock->getRoomSelect();
145  $this->setDataSection($content);
146 
147  }
148 
152  function fillRow($a_set)
153  {
154  global $ilUser, $ilCtrl, $lng;
155 // $ilCtrl->setParameterByClass("ilfeedbackgui","barometer_id",$a_set["id"]);
156 // $this->tpl->setVariable('LINK_FEEDBACK',
157 // $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", 'ilfeedbackgui'),'voteform'));
158 // $this->tpl->setVariable('TXT_FEEDBACK', $a_set["title"]);
159  }
160 
164  function getOverview()
165  {
166  global $ilUser, $lng, $ilCtrl;
167 
168 // return '<div class="small">'.((int) count($this->feedbacks))." ".$lng->txt("pdesk_feedbacks")."</div>";
169  }
170 }
171 ?>