Exemplo n.º 1
0
/**
 * return the HTML source for the menu bar (to navigate between message box)
 *
 * @param int $currentUserId user identification (the admin read message box of an other user)
 * @return string HTML source
 */
function getBarMessageBox($currentUserId, $currentSection)
{
    require_once dirname(__FILE__) . '/messagebox/inbox.lib.php';
    $inboxWithoutFilter = new InBox($currentUserId);
    $sectionList = array('inbox' => get_lang(get_lang('Inbox') . '(' . $inboxWithoutFilter->numberOfUnreadMessage() . ')'), 'outbox' => get_lang('Outbox'), 'trashbox' => get_lang('Trashbox'));
    if (!in_array($currentSection, array_keys($sectionList))) {
        $currentSection = 'inbox';
    }
    $parameter = array();
    if (isset($_REQUEST['userId'])) {
        $parameter['userId'] = (int) $_REQUEST['userId'];
    }
    return claro_html_tab_bar($sectionList, $currentSection, $parameter, 'box', get_path('clarolineRepositoryWeb') . "messaging/messagebox.php");
}
Exemplo n.º 2
0
    }
    if ($_REQUEST['cmd'] == 'exDeleteMessage' && !is_null($messageId)) {
        InBox::moveMessageToTrashBox($messageId, $currentUserId);
        $dialogbox = new DialogBox();
        $dialogbox->success(get_lang('The message in now in your trashbox'));
        $content .= $dialogbox->render();
    } elseif ($_REQUEST['cmd'] == 'rqDeleteMessage' && !is_null($messageId)) {
        $displayConfimation = TRUE;
    } elseif ($_REQUEST['cmd'] == 'exMarkUnread' && !is_null($messageId)) {
        InBox::markUnread($messageId, $currentUserId);
    } elseif ($_REQUEST['cmd'] == 'exMarkRead' && !is_null($messageId)) {
        InBox::markRead($messageId, $currentUserId);
    }
}
// create box
$box = new InBox($currentUserId);
// set the order
$messageStrategy = $box->getMessageStrategy();
if (isset($_REQUEST['fieldOrder'])) {
    $link_arg['fieldOrder'] = $_REQUEST['fieldOrder'] == 'sender' ? 'sender' : 'date';
    if ($link_arg['fieldOrder'] == 'sender') {
        $messageStrategy->setFieldOrder(ReceivedMessageStrategy::ORDER_BY_SENDER);
    } else {
        $messageStrategy->setFieldOrder(ReceivedMessageStrategy::ORDER_BY_DATE);
    }
}
if (isset($_REQUEST['order'])) {
    $order = $_REQUEST['order'] == 'asc' ? 'asc' : 'desc';
    $link_arg['order'] = $order;
    if ($order == 'asc') {
        $nextOrder = "desc";