本文整理汇总了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;
}
}