本文整理汇总了PHP中IMP_Mailbox::getSpecialMailboxesSort方法的典型用法代码示例。如果您正苦于以下问题:PHP IMP_Mailbox::getSpecialMailboxesSort方法的具体用法?PHP IMP_Mailbox::getSpecialMailboxesSort怎么用?PHP IMP_Mailbox::getSpecialMailboxesSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMP_Mailbox
的用法示例。
在下文中一共展示了IMP_Mailbox::getSpecialMailboxesSort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smartmobileFolderTree
/**
* AJAX action: Check access rights for creation of a submailbox.
*
* Variables used:
* - all: (integer) If 1, return all mailboxes. Otherwise, return only
* INBOX, special mailboxes, and polled mailboxes.
*
* @return string HTML to use for the folder tree.
*/
public function smartmobileFolderTree()
{
$ftree = $GLOBALS['injector']->getInstance('IMP_Ftree');
/* Poll all mailboxes on initial display. */
$this->_base->queue->poll($ftree->poll->getPollList(), true);
$iterator = new AppendIterator();
/* Add special mailboxes explicitly. INBOX should appear first. */
$special = new ArrayIterator();
$special->append($ftree['INBOX']);
foreach (IMP_Mailbox::getSpecialMailboxesSort() as $val) {
if (isset($ftree[$val])) {
$special->append($ftree[$val]);
}
}
$iterator->append($special);
/* Now add polled mailboxes. */
$filter = new IMP_Ftree_IteratorFilter($ftree);
$filter->add(array($filter::CONTAINERS, $filter::REMOTE, $filter::SPECIALMBOXES));
if (!$this->vars->all) {
$filter->add($filter::POLLED);
}
$filter->mboxes = array('INBOX');
$iterator->append($filter);
return $ftree->createTree($this->vars->all ? 'smobile_folders_all' : 'smobile_folders', array('iterator' => $iterator, 'render_type' => 'IMP_Tree_Jquerymobile'))->getTree(true);
}
示例2: listMailboxes
/**
* AJAX action: List mailboxes.
*
* Variables used:
* - all: (integer) 1 to show all mailboxes.
* - base: (string) The base mailbox.
* - expall: (boolean) 1 to expand all (requires 'all').
* - initial: (string) 1 to indicate the initial request for mailbox
* list.
* - mboxes: (string) The list of mailboxes to process (JSON encoded
* array; mailboxes are base64url encoded).
* - reload: (integer) 1 to force reload of mailboxes.
* - unsub: (integer) 1 to show unsubscribed mailboxes.
*
* @return boolean True.
*/
public function listMailboxes()
{
global $injector, $prefs, $session;
$ftree = $injector->getInstance('IMP_Ftree');
$iterator = new AppendIterator();
/* This might be a long running operation. */
if ($this->vars->initial) {
$session->close();
$ftree->eltdiff->clear();
/* @todo: Correctly handle unsubscribed mailboxes in ftree. */
if ($ftree->unsubscribed_loaded && !$this->vars->reload) {
$ftree->init();
}
}
if ($this->vars->reload) {
$ftree->init();
}
$filter = new IMP_Ftree_IteratorFilter($ftree);
if ($this->vars->unsub) {
$ftree->loadUnsubscribed();
$filter->remove($filter::UNSUB);
}
if (isset($this->vars->base)) {
$this->_base->queue->setMailboxOpt('base', $this->vars->base);
}
if ($this->vars->all) {
$this->_base->queue->setMailboxOpt('all', 1);
$iterator->append($filter);
if ($this->vars->expall) {
$this->vars->action = 'expand';
$this->_base->callAction('toggleMailboxes');
}
} elseif ($this->vars->initial || $this->vars->reload) {
$special = new ArrayIterator();
$special->append($ftree['INBOX']);
/* Add special mailboxes explicitly to the initial folder list,
* since they are ALWAYS displayed, may appear outside of the
* folder slice requested, and need to be sorted logically. */
$s_elts = array();
foreach (IMP_Mailbox::getSpecialMailboxesSort() as $val) {
if (isset($ftree[$val])) {
$special->append($val);
$s_elts[] = $ftree[$val];
}
}
$iterator->append($special);
/* Go through and find any parent elements that contain only
* special mailbox children - this need to be suppressed in
* display. */
$filter2 = clone $filter;
$filter2->add(array($filter2::CONTAINERS, $filter2::SPECIALMBOXES));
$no_children = array();
foreach (array_unique($s_elts) as $val) {
while (($val = $val->parent) && !$val->base_elt) {
$filter2->iterator = new IMP_Ftree_Iterator($val);
foreach ($filter2 as $val) {
/* If we found at least one viewable mailbox, this
* element needs its children to be displayed. */
break 2;
}
$no_children[] = strval($val);
}
}
if (!empty($no_children)) {
$this->_base->queue->ftreeCallback = function ($id, $ob) use($no_children) {
if (in_array($id, $no_children)) {
unset($ob->ch);
}
};
}
/* Add regular mailboxes. */
$no_mbox = false;
switch ($prefs->getValue('nav_expanded')) {
case IMP_Ftree_Prefs_Expanded::NO:
$filter->add($filter::CHILDREN);
break;
case IMP_Ftree_Prefs_Expanded::YES:
$this->_base->queue->setMailboxOpt('expand', 1);
$no_mbox = true;
break;
case IMP_Ftree_Prefs_Expanded::LAST:
$filter->add($filter::EXPANDED);
$this->_base->queue->setMailboxOpt('expand', 1);
break;
//.........这里部分代码省略.........