42 $this->lng->loadLanguageModule(
'chat');
47 global $ilUser, $ilObjDataCache, $ilAccess,
$ilSetting, $rbacsystem;
50 include_once
'Modules/Chat/classes/class.ilChatInvitations.php';
54 if(count($items) == 0)
59 $add =
' ('.count($items).
')';
61 $this->tpl->addJavascript(
'./Modules/Chat/js/ChatInvitationMainMenu.js');
62 $tpl =
new ilTemplate(
'tpl.chat_invitations_navigation.html',
true,
true,
67 $user_cache = array();
68 $invitations = array();
69 foreach($items as $item)
74 if($rbacsystem->checkAccess(
'read', $ref_id))
80 if(!(
int)$chat_ref_id)
continue;
84 $tpl->setCurrentBlock(
'item');
85 $css_row = ($css_row !=
'tblrow1_mo') ?
'tblrow1_mo' :
'tblrow2_mo';
86 $tpl->setVariable(
'CSS_ROW', $css_row);
88 if((
int)$item[
'room_id'])
90 include_once
'Modules/Chat/classes/class.ilChatRoom.php';
91 $oTmpChatRoom =
new ilChatRoom((
int)$item[
'chat_id']);
92 $oTmpChatRoom->setRoomId((
int)$item[
'room_id']);
93 $room_title = $oTmpChatRoom->getTitle();
96 $room_title =
', '.$room_title;
98 if((
int)$oTmpChatRoom->getOwnerId())
100 if(!isset($user_cache[$oTmpChatRoom->getOwnerId()]))
102 include_once
'Services/User/classes/class.ilObjUser.php';
103 $user_cache[$oTmpChatRoom->getOwnerId()] =
new ilObjUser($oTmpChatRoom->getOwnerId());
105 $room_title .=
' ('.$user_cache[$oTmpChatRoom->getOwnerId()]->
getFullname().
')';
109 $tpl->setVariable(
'HREF_ITEM',
'ilias.php?baseClass=ilChatPresentationGUI&room_id='.(
int)$item[
'room_id'].
'&ref_id='.(
int)$chat_ref_id);
110 $tpl->setVariable(
'TXT_ITEM', $ilObjDataCache->lookupTitle($item[
'chat_id']).$room_title);
111 $sel_arr[(int)$chat_ref_id.
'_'.(
int)$item[
'room_id']] = $ilObjDataCache->lookupTitle($item[
'chat_id']).$room_title;
112 $tpl->parseCurrentBlock();
114 $invitations[] = (int)$chat_ref_id.
'_'.(
int)$item[
'room_id'];
119 $sel_arr = array_reverse($sel_arr);
120 $sel_arr[(int)$chat_ref_id.
'__'.(
int)$item[
'room_id']] =
'-- '.$this->lng->txt(
'chat_invitation_subject').$add.
' --';
121 $sel_arr = array_reverse($sel_arr);
127 if($cnt == 0)
return '';
129 $select =
ilUtil::formSelect(
'',
'invitation', $sel_arr,
false,
true,
'0',
'ilEditSelect');
130 $tpl->setVariable(
'NAVI_SELECT', $select);
131 $tpl->setVariable(
'TXT_CHAT_INVITATIONS', $this->lng->txt(
'chat_chat_invitation').$add);
133 $tpl->setVariable(
'TXT_GO', $this->lng->txt(
'go'));
134 $tpl->setVariable(
'ACTION',
'ilias.php?baseClass=ilChatPresentationGUI');
136 if((
int)$ilSetting->get(
'chat_sound_status') &&
137 (int)$ilSetting->get(
'chat_new_invitation_sound_status') &&
138 (int)$ilUser->getPref(
'chat_sound_status') &&
139 (int)$ilUser->getPref(
'chat_new_invitation_sound_status')
145 $tpl->setCurrentBlock(
'beep');
146 $tpl->setVariable(
'BEEP_SRC',
'./Modules/Chat/sounds/receive.mp3');
147 $tpl->parseCurrentBlock();
150 foreach((array)$invitations as $id)
152 $_SESSION[
'chat'][
'_already_beeped'][$id] =
true;