43 $this->lng->loadLanguageModule(
'chat');
48 global $ilUser, $ilObjDataCache, $ilAccess,
$ilSetting, $rbacsystem;
51 include_once
'Modules/Chat/classes/class.ilChatInvitations.php';
55 if(count($items) == 0)
60 $add =
' ('.count($items).
')';
62 $this->tpl->addJavascript(
'./Modules/Chat/js/ChatInvitationMainMenu.js');
64 $tpl =
new ilTemplate(
'tpl.chat_invitations_navigation.html',
true,
true,
69 $user_cache = array();
70 $invitations = array();
71 foreach($items as $item)
76 if($rbacsystem->checkAccess(
'read', $ref_id))
82 if(!(
int)$chat_ref_id)
continue;
86 $tpl->setCurrentBlock(
'item');
87 $css_row = ($css_row !=
'tblrow1_mo') ?
'tblrow1_mo' :
'tblrow2_mo';
88 $tpl->setVariable(
'CSS_ROW', $css_row);
90 if((
int)$item[
'room_id'])
92 include_once
'Modules/Chat/classes/class.ilChatRoom.php';
93 $oTmpChatRoom =
new ilChatRoom((
int)$item[
'chat_id']);
94 $oTmpChatRoom->setRoomId((
int)$item[
'room_id']);
95 $room_title = $oTmpChatRoom->getTitle();
98 $room_title =
', '.$room_title;
100 if((
int)$oTmpChatRoom->getOwnerId())
102 if(!isset($user_cache[$oTmpChatRoom->getOwnerId()]))
104 include_once
'Services/User/classes/class.ilObjUser.php';
105 $user_cache[$oTmpChatRoom->getOwnerId()] =
new ilObjUser($oTmpChatRoom->getOwnerId());
108 $room_title .=
' ('.$user_cache[$oTmpChatRoom->getOwnerId()]->
getFullname().
')';
112 $tpl->setVariable(
'HREF_ITEM',
'ilias.php?baseClass=ilChatPresentationGUI&room_id='.(
int)$item[
'room_id'].
'&ref_id='.(
int)$chat_ref_id);
113 $tpl->setVariable(
'TXT_ITEM', $ilObjDataCache->lookupTitle($item[
'chat_id']).$room_title);
114 $sel_arr[(int)$chat_ref_id.
'_'.(
int)$item[
'room_id']] = $ilObjDataCache->lookupTitle($item[
'chat_id']).$room_title;
115 $tpl->parseCurrentBlock();
117 $invitations[] = (int)$chat_ref_id.
'_'.(
int)$item[
'room_id'];
118 if((
int)$ilSetting->get(
'chat_sound_status') &&
119 (int)$ilSetting->get(
'chat_new_invitation_sound_status'))
126 $sel_arr = array_reverse($sel_arr);
127 $sel_arr[(int)$chat_ref_id.
'__'.(
int)$item[
'room_id']] =
'-- '.$this->lng->txt(
'chat_invitation_subject').$add.
' --';
128 $sel_arr = array_reverse($sel_arr);
134 if($cnt == 0)
return '';
136 $select =
ilUtil::formSelect(
'',
'invitation', $sel_arr,
false,
true,
'0',
'ilEditSelect');
137 $tpl->setVariable(
'NAVI_SELECT', $select);
138 $tpl->setVariable(
'TXT_CHAT_INVITATIONS', $this->lng->txt(
'chat_chat_invitation').$add);
140 $tpl->setVariable(
'TXT_GO', $this->lng->txt(
'go'));
141 $tpl->setVariable(
'ACTION',
'ilias.php?baseClass=ilChatPresentationGUI');
144 if((
int)$ilSetting->get(
'chat_sound_status') &&
145 (int)$ilSetting->get(
'chat_new_invitation_sound_status'))
150 $tpl->setCurrentBlock(
'beep');
151 $tpl->setVariable(
'BEEP_SRC',
'./Modules/Chat/sounds/receive.mp3');
152 $tpl->parseCurrentBlock();
155 foreach((array)$invitations as $id)
157 $_SESSION[
'chat'][
'_already_beeped'][$id] =
true;