ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilChatroomInitialTask.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
14 {
15  private $gui;
16 
26  {
27  $this->gui = $gui;
28  require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
29  require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
30  }
31 
32  public function executeDefault($method)
33  {
34  global $tpl, $ilUser, $ilCtrl, $lng, $rbacsystem;
35 
36  $room = ilChatroom::byObjectId( $this->gui->object->getId() );
37  $chat_user = new ilChatroomUser( $ilUser, $room );
38 
39  $result = new stdClass();
40  $result->users = $room->getConnectedUsers();
41  $result->private_rooms = $room->getActivePrivateRooms($ilUser->getId());
42  $result->userinfo = array(
43  'moderator' => $rbacsystem->checkAccess('moderate', (int)$_GET['ref_id']),
44  'userid' => $chat_user->getUserId()
45  );
46 
47  $smileys = array();
48 
49  include_once('Modules/Chatroom/classes/class.ilChatroomSmilies.php');
50 
51  $smileys_array = ilChatroomSmilies::_getSmilies();
52 
53  foreach( $smileys_array as $smiley_array )
54  {
55  foreach( $smiley_array as $key => $value )
56  {
57  if( $key == 'smiley_keywords' )
58  {
59  $new_keys = explode("\n", $value);
60  }
61 
62  if( $key == 'smiley_fullpath' )
63  {
64  $new_val = $value;
65  }
66  }
67 
68  foreach( $new_keys as $new_key )
69  {
70  $smileys[$new_key] = $new_val;
71  }
72  }
73 
74  $result->smileys = $smileys;
75 
76  echo json_encode($result);
77  exit;
78  }
79 
80 
81 }
82 
83 ?>