function getBlockCode_Mailbox() { $sInboxC = _t('_Inbox'); $sSentC = _t('_Sent'); $sWriteC = _t('_Write'); $sTrashC = _t('_Trash'); $sContactsC = _t('_Contacts'); $sLettersC = _t('_letters'); $sUnreadC = strtolower(_t('_Unread')); $sUnopenedC = strtolower(_t('_Unopened')); $sComposeNewLetterC = strtolower(_t('_COMPOSE_H')); $sFriendsC = strtolower(_t('_Friends')); $sFavesC = strtolower(_t('_Faves')); $sContactedC = strtolower(_t('_Contacted')); $sInboxIcon = getTemplateIcon('mailbox_inbox32.png'); $sSentIcon = getTemplateIcon('mailbox_sent32.png'); $sWriteIcon = getTemplateIcon('mailbox_write32.png'); $sTrashIcon = getTemplateIcon('mailbox_trash32.png'); $sContactsIcon = getTemplateIcon('mailbox_contacts32.png'); $iChMemberID = $this->aMemberInfo['ID'] > 0 ? $this->aMemberInfo['ID'] : $this->iMember; bx_import('BxTemplMailBox'); $iInboxAllCnt = BxDolMailBox::getCountInboxMessages($iChMemberID, '0'); $iInboxNewCnt = BxDolMailBox::getCountInboxMessages($iChMemberID, '1'); $iSentAllCnt = BxDolMailBox::getCountSentMessages($iChMemberID, '0'); $iSentNewCnt = BxDolMailBox::getCountSentMessages($iChMemberID, '1'); $iTrashAllCnt = BxDolMailBox::getCountTrashedMessages($iChMemberID, '0'); $iTrashNewCnt = BxDolMailBox::getCountTrashedMessages($iChMemberID, '1'); $aInboxKeys = array('notify_icon' => $sInboxIcon, 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=inbox">' . $sInboxC . '</a>', 'notify_text1' => $iInboxAllCnt . ' ' . $sLettersC, 'notify_text1_class' => 'smallInfoUnit', 'bx_if:allow_2nd_line' => array('condition' => true, 'content' => array('notify_text2' => $iInboxNewCnt . ' ' . $sUnreadC, 'notify_text2_class' => 'smallInfoUnit'))); $sInbox = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aInboxKeys); $aSentKeys = array('notify_icon' => $sSentIcon, 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=outbox">' . $sSentC . '</a>', 'notify_text1' => $iSentAllCnt . ' ' . $sLettersC, 'notify_text1_class' => 'smallInfoUnit', 'bx_if:allow_2nd_line' => array('condition' => true, 'content' => array('notify_text2' => $iSentNewCnt . ' ' . $sUnopenedC, 'notify_text2_class' => 'smallInfoUnit'))); $sSent = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aSentKeys); $aWriteKeys = array('notify_icon' => $sWriteIcon, 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=compose">' . $sWriteC . '</a>', 'notify_text1' => $sComposeNewLetterC, 'notify_text1_class' => 'smallShortInfoUnit', 'bx_if:allow_2nd_line' => array('condition' => false, 'content' => array())); $sWrite = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aWriteKeys); $aTrashKeys = array('notify_icon' => $sTrashIcon, 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?mode=trash">' . $sTrashC . '</a>', 'notify_text1' => $iTrashAllCnt . ' ' . $sLettersC, 'notify_text1_class' => 'smallInfoUnit', 'bx_if:allow_2nd_line' => array('condition' => true, 'content' => array('notify_text2' => $iTrashNewCnt . ' ' . $sUnreadC, 'notify_text2_class' => 'smallInfoUnit'))); $sTrash = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aTrashKeys); $aContactsKeys = array('notify_icon' => $sContactsIcon, 'notify_caption' => '<a href="' . BX_DOL_URL_ROOT . 'communicator.php">' . $sContactsC . '</a>', 'notify_text1' => $sFriendsC . ', ' . $sFavesC . ', ' . $sContactedC, 'notify_text1_class' => 'smallShortInfoUnit', 'bx_if:allow_2nd_line' => array('condition' => false, 'content' => array())); $sContacts = $GLOBALS['oSysTemplate']->parseHtmlByName('member_mail_notify_box.html', $aContactsKeys); $sInboxClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=inbox' . "'"; $sInboxBlock = $GLOBALS['oFunctions']->genNotifyMessage($sInbox, 'none', true, $sInboxClick); $sOutboxClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=outbox' . "'"; $sSentBlock = $GLOBALS['oFunctions']->genNotifyMessage($sSent, 'none', true, $sOutboxClick); $sComposeClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=compose' . "'"; $sWriteBlock = $GLOBALS['oFunctions']->genNotifyMessage($sWrite, 'none', true, $sComposeClick); $sTrashClick = "location.href='" . BX_DOL_URL_ROOT . 'mail.php?mode=trash' . "'"; $sTrashBlock = $GLOBALS['oFunctions']->genNotifyMessage($sTrash, 'none', true, $sTrashClick); $sContactsClick = "location.href='" . BX_DOL_URL_ROOT . 'communicator.php' . "'"; $sContactsBlock = $GLOBALS['oFunctions']->genNotifyMessage($sContacts, 'none', true, $sContactsClick); $sMailboxButtons = '<div class="bx_sys_default_padding">' . $sInboxBlock . $sSentBlock . $sWriteBlock . $sTrashBlock . $sContactsBlock . '<div class="clear_both"></div></div><div class="clear_both"></div>'; return $sMailboxButtons; //return $GLOBALS['oFunctions']->centerContent ($sMailboxButtons, '.notify_message'); }
/** * Function will get messages list for member's extra menu; * * @param : $iMemberId (integer) - member's Id ; * @return : Html presentation data ; */ function get_member_menu_messages_list($iMemberId = 0) { global $oSysTemplate, $oFunctions; $iMemberId = (int) $iMemberId; // define the member's menu position ; $sExtraMenuPosition = isset($_COOKIE['menu_position']) ? $_COOKIE['menu_position'] : getParam('ext_nav_menu_top_position'); $aNewMessages = array(); $aLanguageKeys = array('sent' => _t('_Sent'), 'compose' => _t('_Compose new letter'), 'trash' => _t('_Trash'), 'inbox' => _t('_Inbox')); // ** Get statistics ; // get count of inbox messages; $iInboxCount = BxDolMailBox::getCountInboxMessages($iMemberId); // get count of sent messages ; $iSentCount = BxDolMailBox::getCountSentMessages($iMemberId); // get count of trashed messages ; $iTrashCount = BxDolMailBox::getCountTrashedMessages($iMemberId); // generate member's new messages list ; if ($iMemberId) { // generate list with unread messages list ; $sQuery = "\r\n SELECT \r\n \t\t\t`ID`, `Sender`, `Subject`\r\n \t\tFROM \r\n \t\t\t`sys_messages` \r\n \t\tWHERE \r\n \t\t\t`Recipient`={$iMemberId} \r\n \t\t\t\tAND \r\n \t\t\t`New`='1'\r\n AND\r\n NOT FIND_IN_SET('Recipient', `Trash`)\r\n ORDER BY\r\n `Date` DESC\r\n LIMIT 5 \r\n "; $rResult = db_res($sQuery); while (true == ($aRow = mysql_fetch_assoc($rResult))) { $aMemberInfo = getProfileInfo($aRow['Sender']); $sThumb = $oFunctions->getMemberIcon($aMemberInfo['ID'], 'none'); $sSubject = mb_strlen($aRow['Subject']) > 40 ? mb_substr($aRow['Subject'], 0, 40) . '...' : $aRow['Subject']; $aNewMessages[] = array('sender_link' => getProfileLink($aMemberInfo['ID']), 'sender_nick' => $aMemberInfo['NickName'], 'msg_caption' => $sSubject, 'thumbnail' => $sThumb, 'message_id' => $aRow['ID'], 'site_url' => $GLOBALS['site']['url']); } } $aExtraSection = array('go_inbox' => $aLanguageKeys['inbox'], 'inbox_count' => $iInboxCount, 'go_outbox' => $aLanguageKeys['sent'], 'outbox_count' => $iSentCount, 'go_compose' => $aLanguageKeys['compose'], 'go_trash' => $aLanguageKeys['trash'], 'trash_count' => $iTrashCount); // fill array with needed keys ; $aTemplateKeys = array('bx_if:menu_position_bottom' => array('condition' => $sExtraMenuPosition == 'bottom', 'content' => $aExtraSection), 'bx_if:menu_position_top' => array('condition' => $sExtraMenuPosition == 'top' || $sExtraMenuPosition == 'static', 'content' => $aExtraSection), 'bx_repeat:new_message' => $aNewMessages); $sOutputCode = $oSysTemplate->parseHtmlByName('mail_box_member_menu_messages.html', $aTemplateKeys); return $sOutputCode; }
function getMailsBlock() { global $oAdmTemplate; $iAdminId = isset($_COOKIE['memberID']) ? (int) $_COOKIE['memberID'] : 0; $iInboxCount = BxDolMailBox::getCountInboxMessages($iAdminId); $iSentCount = BxDolMailBox::getCountSentMessages($iAdminId); $iTrashCount = BxDolMailBox::getCountTrashedMessages($iAdminId); return array('icon' => $oAdmTemplate->getIconUrl('dashboard_mails.png'), 'title' => '<a href="#">' . _t('_adm_txt_dashboard_mails') . '</a>', 'url' => '', 'content' => $oAdmTemplate->parseHtmlByName('dashboard_content.html', array('cell_11' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?&mode=inbox">' . _t('_adm_txt_dashboard_mails_inbox') . '</a> (' . $iInboxCount . ')', 'cell_12' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?&mode=outbox">' . _t('_adm_txt_dashboard_mails_sent') . '</a> (' . $iSentCount . ')', 'cell_21' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?&mode=trash">' . _t('_adm_txt_dashboard_mails_trash') . '</a> (' . $iTrashCount . ')', 'cell_22' => '<a href="' . BX_DOL_URL_ROOT . 'mail.php?&mode=compose">' . _t('_adm_txt_dashboard_mails_compose') . '</a>'))); }