本文整理匯總了PHP中IMP_Mailbox::getSort方法的典型用法代碼示例。如果您正苦於以下問題:PHP IMP_Mailbox::getSort方法的具體用法?PHP IMP_Mailbox::getSort怎麽用?PHP IMP_Mailbox::getSort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IMP_Mailbox
的用法示例。
在下文中一共展示了IMP_Mailbox::getSort方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mailboxStart
/**
* Determines the sequence number of the first message to display, based
* on the user's preferences.
*
* @param integer $total The total number of messages in the mailbox.
*
* @return integer The sequence number in the sorted mailbox.
*/
public function mailboxStart($total)
{
switch ($GLOBALS['prefs']->getValue('mailbox_start')) {
case IMP::MAILBOX_START_FIRSTPAGE:
return 1;
case IMP::MAILBOX_START_LASTPAGE:
return $total;
case IMP::MAILBOX_START_FIRSTUNSEEN:
if (!$this->_mailbox->access_sort) {
return 1;
}
$sortpref = $this->_mailbox->getSort();
/* Optimization: if sorting by sequence then first unseen
* information is returned via a SELECT/EXAMINE call. */
if ($sortpref->sortby == Horde_Imap_Client::SORT_SEQUENCE) {
try {
$res = $this->_mailbox->imp_imap->status($this->_mailbox, Horde_Imap_Client::STATUS_FIRSTUNSEEN | Horde_Imap_Client::STATUS_MESSAGES);
if (!is_null($res['firstunseen'])) {
return $sortpref->sortdir ? $res['messages'] - $res['firstunseen'] + 1 : $res['firstunseen'];
}
} catch (IMP_Imap_Exception $e) {
}
return 1;
}
$unseen_msgs = $this->unseenMessages(Horde_Imap_Client::SEARCH_RESULTS_MIN, array('sort' => array(Horde_Imap_Client::SORT_DATE), 'uids' => true));
return empty($unseen_msgs['min']) ? 1 : $this->getArrayIndex($unseen_msgs['min']) + 1;
case IMP::MAILBOX_START_LASTUNSEEN:
if (!$this->_mailbox->access_sort) {
return 1;
}
$unseen_msgs = $this->unseenMessages(Horde_Imap_Client::SEARCH_RESULTS_MAX, array('sort' => array(Horde_Imap_Client::SORT_DATE), 'uids' => true));
return empty($unseen_msgs['max']) ? 1 : $this->getArrayIndex($unseen_msgs['max']) + 1;
}
}