ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilChatroomBlock Class Reference

ilChatroomBlock More...

+ Collaboration diagram for ilChatroomBlock:

Public Member Functions

 getRoomSelect ()
 
 getMessages (ilChatroom $room)
 

Private Member Functions

 getReadableAreas ()
 

Detailed Description

ilChatroomBlock

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 11 of file class.ilChatroomBlock.php.

Member Function Documentation

◆ getMessages()

ilChatroomBlock::getMessages ( ilChatroom  $room)
Parameters
ilChatroom$room
Returns
array

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

83 {
84 global $DIC;
85
86 include 'Modules/Chatroom/classes/class.ilChatroomUser.php';
88 $room->getSetting('display_past_msgs'),
90 $DIC->user(),
91 $room
92 )
93 );
94
95 $output_messages = array();
96
97 foreach ($messages as $msg) {
98 $output_messages[] = $msg;
99 }
100
101 return $output_messages;
102 }
Class ilChatroomUser.
getSetting($name)
Returns setting from $this->settings array by given name.
getLastMessagesForChatViewer($number, $chatuser=null)
$messages
Definition: en-x-test.php:7
global $DIC
Definition: saml.php:7

References $DIC, $messages, ilChatroom\getLastMessagesForChatViewer(), and ilChatroom\getSetting().

+ Here is the call graph for this function:

◆ getReadableAreas()

ilChatroomBlock::getReadableAreas ( )
private
Returns
array

Definition at line 41 of file class.ilChatroomBlock.php.

42 {
43 global $DIC;
44
45 $readable_rooms = array();
46
47 $chatroom_objects = ilChatroom::getUntrashedChatReferences(array(
48 'last_activity' => strtotime('-5 days', time())
49 ));
50 foreach ($chatroom_objects as $object) {
51 if (isset($readable_rooms[$object['obj_id']])) {
52 continue;
53 }
54
55 if (ilChatroom::checkUserPermissions('read', $object['ref_id'], false)) {
56 $room = ilChatroom::byObjectId($object['obj_id']);
57 if ($room && !$room->isUserBanned($DIC->user()->getId())) {
58 $readable_rooms[$object['obj_id']] = array(
59 'ref_id' => $object['ref_id'],
60 'obj_id' => $object['obj_id'],
61 'room_id' => $room->getRoomId(),
62 'title' => $object['title'],
63 'parent_title' => $object['parent_title']
64 );
65 }
66 }
67 }
68
69 $title = array();
70 foreach ($readable_rooms as $k => $v) {
71 $title[$k] = strtolower($v['title']);
72 }
73 array_multisort($title, SORT_STRING, $readable_rooms);
74
75 return $readable_rooms;
76 }
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static getUntrashedChatReferences($filter=array())

References $DIC, $title, ilChatroom\byObjectId(), ilChatroom\checkUserPermissions(), and ilChatroom\getUntrashedChatReferences().

Referenced by getRoomSelect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoomSelect()

ilChatroomBlock::getRoomSelect ( )
Returns
string

Definition at line 16 of file class.ilChatroomBlock.php.

17 {
18 global $DIC;
19
20 $readable = $this->getReadableAreas();
21 $tpl = new ilTemplate('tpl.chatroom_block_room_select.html', true, true, 'Modules/Chatroom');
22 $tpl->setVariable('TXT_SELECT_ROOM', $DIC->language()->txt('chat_select_room'));
23 foreach ($readable as $room) {
24 $tpl->setCurrentBlock('select_room_row');
25 $tpl->setVariable('ROW_VALUE', $room['ref_id']);
26 $tpl->setVariable('ROW_CAPTION', sprintf($DIC->language()->txt('room_in_container'), $room['title'], $room['parent_title']));
27
28 if ($DIC->user()->getPref('chatviewer_last_selected_room') == $room['ref_id']) {
29 $tpl->setVariable('ROW_SELECTED', 'selected="selected"');
30 }
31
32 $tpl->parseCurrentBlock();
33 }
34
35 return $tpl->get();
36 }
sprintf('%.4f', $callTime)
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR

References $DIC, $tpl, getReadableAreas(), and sprintf.

+ Here is the call graph for this function:

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