3 include_once
"Modules/Chat/classes/class.ilChatRoom.php";
4 include_once
"Modules/Chat/classes/class.ilObjChat.php";
5 include_once
"Modules/Chat/classes/class.ilChatBlockedUsers.php";
9 global $ilUser, $rbacsystem;
14 foreach($rooms as $k => $v) {
15 $titel[$k] = strtolower($v[
'title']);
17 array_multisort($titel, SORT_STRING, $rooms);
19 $readable_rooms = array();
21 for ($i = 0; $i < count($rooms); $i++)
27 $room_obj =
new ilChatRoom($rooms[$i][
"obj_id"]);
28 $priv_rooms = $room_obj->getAllRoomsOfObject();
29 $rooms[$i][
"sub"] = array();
30 foreach($priv_rooms as $room_id => $pr)
32 $room_obj->setRoomId($room_id);
34 $room_obj->isInvited($ilUser->getId()) ||
35 $room_obj->isOwner($ilUser->getId()) ||
36 $rbacsystem->checkAccess(
'moderate', $room_obj->getRoomId())
39 $rooms[$i][
"sub"][] = array(
40 'room_id' => $room_obj->getRoomId(),
41 'title' => $room_obj->getTitle()
47 foreach($rooms[$i][
"sub"] as $k => $v) {
48 $titel[$k] = strtolower($v[
'title']);
51 array_multisort($titel, SORT_STRING, $rooms[$i][
"sub"]);
52 $readable_rooms[] = $rooms[$i];
54 return $readable_rooms;
64 if ($ilUser->getPref(
'chatviewer_last_selected_room'))
66 $parts = split(
",", $ilUser->getPref(
'chatviewer_last_selected_room'));
67 $sel_ref_id = $parts[0];
69 $sel_room_id = $parts[1];
73 $tpl =
new ilTemplate(
"tpl.chat_block_room_select.html",
true,
true,
"Modules/Chat");
74 $tpl->setVariable(
'TXT_SELECT_ROOM', $lng->txt(
'chat_select_room'));
75 foreach($readable as $room)
77 $tpl->setCurrentBlock(
"room_row");
78 $tpl->setVariable(
"ROW_VALUE", $room[
"ref_id"]);
79 $tpl->setVariable(
"ROW_CAPTION", $room[
"title"]);
81 if ($sel_ref_id == $room[
"obj_id"] && !$sel_room_id)
82 $tpl->setVariable(
'ROW_SELECTED',
'selected="selected"');
84 $tpl->parseCurrentBlock(
"select_room_row");
85 foreach($room[
"sub"] as $priv_room)
87 $tpl->setCurrentBlock(
"room_row");
88 $tpl->setVariable(
"ROW_VALUE_PRIV", $room[
"ref_id"].
','.$priv_room[
'room_id']);
89 $tpl->setVariable(
"ROW_CAPTION_PRIV", $priv_room[
"title"]);
90 if ($sel_ref_id == $room[
"obj_id"] && $sel_room_id == $priv_room[
'room_id'])
91 $tpl->setVariable(
'ROW_SELECTED_PRIV',
'selected="selected"');
92 $tpl->parseCurrentBlock(
"select_privroom_row");
99 public function getMessages($obj_id, $room_id, $last_known_id, &$new_last_known_id = -1)
102 $room->setRoomId($room_id);
103 $messages = $room->getNewMessages($last_known_id, $new_last_known_id, time() - 60*60*12);