ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChatInvitationGUI Class Reference

User Interface Class for Chat Invitation Navigation. More...

+ Collaboration diagram for ilChatInvitationGUI:

Public Member Functions

 __construct ()
 getHTML ()

Private Attributes

 $tpl
 $lng

Detailed Description

User Interface Class for Chat Invitation Navigation.

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

Definition at line 31 of file class.ilChatInvitationGUI.php.

Constructor & Destructor Documentation

ilChatInvitationGUI::__construct ( )

Definition at line 36 of file class.ilChatInvitationGUI.php.

References $lng, and $tpl.

{
global $tpl, $lng;
$this->tpl = $tpl;
$this->lng = $lng;
$this->lng->loadLanguageModule('chat');
}

Member Function Documentation

ilChatInvitationGUI::getHTML ( )

Definition at line 46 of file class.ilChatInvitationGUI.php.

References $_SESSION, $ilSetting, $ref_id, $tpl, ilObject\_getAllReferences(), ilChatInvitations\_getNewInvitations(), formSelect(), ilObjUser\getFullname(), and ilUtil\getImagePath().

{
global $ilUser, $ilObjDataCache, $ilAccess, $ilSetting, $rbacsystem;
// chat invitations
include_once 'Modules/Chat/classes/class.ilChatInvitations.php';
$items = ilChatInvitations::_getNewInvitations($ilUser->getId());
// do not show list, if no item is in list
if(count($items) == 0)
{
return '';
}
$add = ' ('.count($items).')';
$this->tpl->addJavascript('./Modules/Chat/js/ChatInvitationMainMenu.js');
$tpl = new ilTemplate('tpl.chat_invitations_navigation.html', true, true,
'Modules/Chat');
$cnt = 0;
$sel_arr = array();
$user_cache = array();
$invitations = array();
foreach($items as $item)
{
$chat_ref_id = 0;
foreach((array)ilObject::_getAllReferences((int)$item['chat_id']) as $ref_id)
{
if($rbacsystem->checkAccess('read', $ref_id))
{
$chat_ref_id = $ref_id;
break;
}
}
if(!(int)$chat_ref_id) continue;
$beep = false;
$tpl->setCurrentBlock('item');
$css_row = ($css_row != 'tblrow1_mo') ? 'tblrow1_mo' : 'tblrow2_mo';
$tpl->setVariable('CSS_ROW', $css_row);
$room_title = '';
if((int)$item['room_id'])
{
include_once 'Modules/Chat/classes/class.ilChatRoom.php';
$oTmpChatRoom = new ilChatRoom((int)$item['chat_id']);
$oTmpChatRoom->setRoomId((int)$item['room_id']);
$room_title = $oTmpChatRoom->getTitle();
if($room_title != '')
{
$room_title = ', '.$room_title;
if((int)$oTmpChatRoom->getOwnerId())
{
if(!isset($user_cache[$oTmpChatRoom->getOwnerId()]))
{
include_once 'Services/User/classes/class.ilObjUser.php';
$user_cache[$oTmpChatRoom->getOwnerId()] = new ilObjUser($oTmpChatRoom->getOwnerId());
}
$room_title .= ' ('.$user_cache[$oTmpChatRoom->getOwnerId()]->getFullname().')';
}
}
}
$tpl->setVariable('HREF_ITEM', 'ilias.php?baseClass=ilChatPresentationGUI&room_id='.(int)$item['room_id'].'&ref_id='.(int)$chat_ref_id);
$tpl->setVariable('TXT_ITEM', $ilObjDataCache->lookupTitle($item['chat_id']).$room_title);
$sel_arr[(int)$chat_ref_id.'_'.(int)$item['room_id']] = $ilObjDataCache->lookupTitle($item['chat_id']).$room_title;
$tpl->parseCurrentBlock();
$invitations[] = (int)$chat_ref_id.'_'.(int)$item['room_id'];
if((int)$ilSetting->get('chat_sound_status') &&
(int)$ilSetting->get('chat_new_invitation_sound_status'))
{
$beep = true;
}
if($cnt == 0)
{
$sel_arr = array_reverse($sel_arr);
$sel_arr[(int)$chat_ref_id.'__'.(int)$item['room_id']] = '-- '.$this->lng->txt('chat_invitation_subject').$add.' --';
$sel_arr = array_reverse($sel_arr);
}
++$cnt;
}
if($cnt == 0) return '';
$select = ilUtil::formSelect('', 'invitation', $sel_arr, false, true, '0', 'ilEditSelect');
$tpl->setVariable('NAVI_SELECT', $select);
$tpl->setVariable('TXT_CHAT_INVITATIONS', $this->lng->txt('chat_chat_invitation').$add);
$tpl->setVariable('IMG_DOWN', ilUtil::getImagePath('mm_down_arrow.gif'));
$tpl->setVariable('TXT_GO', $this->lng->txt('go'));
$tpl->setVariable('ACTION', 'ilias.php?baseClass=ilChatPresentationGUI');
if((int)$ilSetting->get('chat_sound_status') &&
(int)$ilSetting->get('chat_new_invitation_sound_status'))
{
// beep
if($beep)
{
$tpl->setCurrentBlock('beep');
$tpl->setVariable('BEEP_SRC', './Modules/Chat/sounds/receive.mp3');
$tpl->parseCurrentBlock();
}
foreach((array)$invitations as $id)
{
$_SESSION['chat']['_already_beeped'][$id] = true;
}
}
return $tpl->get();
}

+ Here is the call graph for this function:

Field Documentation

ilChatInvitationGUI::$lng
private

Definition at line 34 of file class.ilChatInvitationGUI.php.

Referenced by __construct().

ilChatInvitationGUI::$tpl
private

Definition at line 33 of file class.ilChatInvitationGUI.php.

Referenced by __construct(), and getHTML().


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