IMP_Ftree
in package
implements
ArrayAccess, Countable, IteratorAggregate, Serializable
IMP_Ftree (folder tree) provides a tree view of the mailboxes on a backend (a/k/a a folder list; in IMP, folders = collection of mailboxes), along with other display elements (Remote Accounts; Virtual Folders).
Tags
Table of Contents
Interfaces
- ArrayAccess
- Countable
- IteratorAggregate
- Serializable
Constants
- BASE_ELT = "base\x00"
- ELT_IS_OPEN = 8
- ELT_IS_POLLED = 64
- ELT_IS_SUBSCRIBED = 16
- ELT_NAMESPACE_OTHER = 2
- ELT_NAMESPACE_SHARED = 4
- ELT_NEED_SORT = 1024
- ELT_NOINFERIORS = 32
- ELT_NONIMAP = 512
- ELT_NOSELECT = 1
- ELT_NOT_POLLED = 128
- ELT_REMOTE = 2048
- ELT_REMOTE_AUTH = 4096
- ELT_REMOTE_MBOX = 8192
- ELT_VFOLDER = 256
Properties
- $changed : bool
- $eltdiff : IMP_Ftree_Eltdiff
- $expanded : IMP_FTree_Prefs_Expanded
- $poll : IMP_Ftree_Prefs_Poll
- $subscriptions : bool
- $unsubscribed_loaded : bool
- $_accounts : array<string|int, mixed>
- Account sources.
- $_changed : bool
- Tree changed flag. Set when something in the tree has been altered.
- $_eltdiff : IMP_Ftree_Eltdiff
- Element diff tracking.
- $_elts : array<string|int, mixed>
- Array containing the mailbox elements.
- $_parent : array<string|int, mixed>
- Parent/child list.
- $_temp : array<string|int, mixed>
- Temporary data that is not saved across serialization.
Methods
- __construct() : mixed
- Constructor.
- __get() : mixed
- __serialize() : array<string|int, mixed>
- __unserialize() : void
- collapse() : mixed
- Collapse an element.
- collapseAll() : mixed
- Collapse all elements.
- count() : int
- Return the number of mailboxes on the server.
- createTree() : Horde_Tree
- Creates a Horde_Tree representation of the current tree.
- delete() : mixed
- Delete an element from the tree.
- expand() : mixed
- Expand an element.
- expandAll() : mixed
- Expand all elements.
- getAccount() : IMP_Ftree_Account
- Get the account object for a given element ID.
- getAttribute() : mixed
- Get an attribute value.
- getChildren() : array<string|int, mixed>
- Return the list of children for a given element ID.
- getIterator() : IMP_Ftree_Iterator
- This returns a RecursiveIterator - a RecursiveIteratorIterator is needed to properly iterate through all elements.
- getParent() : mixed
- Get the parent element for a given element ID.
- init() : mixed
- Initialize the tree.
- insert() : mixed
- Insert an element into the tree.
- loadUnsubscribed() : mixed
- Load unsubscribed mailboxes.
- offsetExists() : bool
- offsetGet() : IMP_Ftree_Element
- offsetSet() : void
- offsetUnset() : void
- rename() : mixed
- Rename a mailbox.
- serialize() : mixed
- setAttribute() : mixed
- Change an attribute value.
- sortList() : mixed
- Sorts a list of mailboxes.
- subscribe() : mixed
- Subscribe an element to the tree.
- unserialize() : mixed
- unsubscribe() : mixed
- Unsubscribe an element from the tree.
- _insertElt() : mixed
- Insert an element into the tree.
- _normalize() : string
- Normalize an element ID to the correct, internal name.
- _sortLevel() : mixed
- Sort a level in the tree.
Constants
BASE_ELT
public
mixed
BASE_ELT
= "base\x00"
ELT_IS_OPEN
public
mixed
ELT_IS_OPEN
= 8
ELT_IS_POLLED
public
mixed
ELT_IS_POLLED
= 64
ELT_IS_SUBSCRIBED
public
mixed
ELT_IS_SUBSCRIBED
= 16
ELT_NAMESPACE_OTHER
public
mixed
ELT_NAMESPACE_OTHER
= 2
ELT_NAMESPACE_SHARED
public
mixed
ELT_NAMESPACE_SHARED
= 4
ELT_NEED_SORT
public
mixed
ELT_NEED_SORT
= 1024
ELT_NOINFERIORS
public
mixed
ELT_NOINFERIORS
= 32
ELT_NONIMAP
public
mixed
ELT_NONIMAP
= 512
ELT_NOSELECT
public
mixed
ELT_NOSELECT
= 1
ELT_NOT_POLLED
public
mixed
ELT_NOT_POLLED
= 128
ELT_REMOTE
public
mixed
ELT_REMOTE
= 2048
ELT_REMOTE_AUTH
public
mixed
ELT_REMOTE_AUTH
= 4096
ELT_REMOTE_MBOX
public
mixed
ELT_REMOTE_MBOX
= 8192
ELT_VFOLDER
public
mixed
ELT_VFOLDER
= 256
Properties
$changed read-only
public
bool
$changed
Has the tree changed?
$eltdiff read-only
public
IMP_Ftree_Eltdiff
$eltdiff
Element diff tracker.
$expanded read-only
public
IMP_FTree_Prefs_Expanded
$expanded
The expanded folders list.
$poll read-only
public
IMP_Ftree_Prefs_Poll
$poll
The poll list.
$subscriptions read-only
public
bool
$subscriptions
Whether IMAP subscriptions are enabled.
$unsubscribed_loaded read-only
public
bool
$unsubscribed_loaded
True if unsubscribed mailboxes have been loaded.
$_accounts
Account sources.
protected
array<string|int, mixed>
$_accounts
$_changed
Tree changed flag. Set when something in the tree has been altered.
protected
bool
$_changed
= \false
$_eltdiff
Element diff tracking.
protected
IMP_Ftree_Eltdiff
$_eltdiff
$_elts
Array containing the mailbox elements.
protected
array<string|int, mixed>
$_elts
$_parent
Parent/child list.
protected
array<string|int, mixed>
$_parent
$_temp
Temporary data that is not saved across serialization.
protected
array<string|int, mixed>
$_temp
= array()
Methods
__construct()
Constructor.
public
__construct() : mixed
__get()
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
collapse()
Collapse an element.
public
collapse(mixed $elts) : mixed
Parameters
- $elts : mixed
-
The element (or an array of elements) to expand.
collapseAll()
Collapse all elements.
public
collapseAll() : mixed
count()
Return the number of mailboxes on the server.
public
count() : int
Return values
intcreateTree()
Creates a Horde_Tree representation of the current tree.
public
createTree(string|Horde_Tree $name[, array<string|int, mixed> $opts = array() ]) : Horde_Tree
Parameters
- $name : string|Horde_Tree
-
Either the tree name, or a Horde_Tree object to add nodes to.
- $opts : array<string|int, mixed> = array()
-
Additional options:
- basename: (boolean) Use raw basename instead of abbreviated label? DEFAULT: false
- checkbox: (boolean) Display checkboxes? DEFAULT: false
- editvfolder: (boolean) Display vfolder edit links? DEFAULT: false
- iterator: (Iterator) Tree iterator to use. DEFAULT: Base iterator.
- open: (boolean) Force child mailboxes to this status. DEFAULT: null
- parent: (string) The parent object of the current level. DEFAULT: null (add to base level)
- poll_info: (boolean) Include poll information in output? DEFAULT: false
- render_params: (array) List of params to pass to renderer if auto-creating. DEFAULT: 'alternate', 'lines', and 'lines_base' are passed in with true values.
- render_type: (string) The renderer name. DEFAULT: Javascript
Return values
Horde_Tree —The tree object.
delete()
Delete an element from the tree.
public
delete(mixed $id) : mixed
Parameters
- $id : mixed
expand()
Expand an element.
public
expand(mixed $elts[, bool $expandall = false ]) : mixed
Parameters
- $elts : mixed
-
The element (or an array of elements) to expand.
- $expandall : bool = false
-
Expand all subelements?
expandAll()
Expand all elements.
public
expandAll() : mixed
getAccount()
Get the account object for a given element ID.
public
getAccount(string $id) : IMP_Ftree_Account
Parameters
- $id : string
-
Element ID.
Return values
IMP_Ftree_Account —Account object.
getAttribute()
Get an attribute value.
public
getAttribute(string $type, string $name) : mixed
Parameters
- $type : string
-
The attribute type.
- $name : string
-
The element name.
Return values
mixed —Boolean attribute result, or null if element or attribute doesn't exist
getChildren()
Return the list of children for a given element ID.
public
getChildren(string $id) : array<string|int, mixed>
Parameters
- $id : string
-
Element ID.
Return values
array<string|int, mixed> —Array of tree elements.
getIterator()
This returns a RecursiveIterator - a RecursiveIteratorIterator is needed to properly iterate through all elements.
public
getIterator() : IMP_Ftree_Iterator
Return values
IMP_Ftree_Iterator —Iterator object.
getParent()
Get the parent element for a given element ID.
public
getParent(string $id) : mixed
Parameters
- $id : string
-
Element ID.
Return values
mixed —IMP_Ftree_Element object, or null if no parent.
init()
Initialize the tree.
public
init() : mixed
insert()
Insert an element into the tree.
public
insert(mixed $id) : mixed
Parameters
- $id : mixed
-
The name of the mailbox (or a list of mailboxes), an IMP_Search_Vfolder object, an IMP_Remote_Account object, or an array containing any mixture of these.
loadUnsubscribed()
Load unsubscribed mailboxes.
public
loadUnsubscribed() : mixed
offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : IMP_Ftree_Element
Parameters
- $offset : mixed
Return values
IMP_Ftree_ElementoffsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
rename()
Rename a mailbox.
public
rename(string $old, string $new) : mixed
Parameters
- $old : string
-
The old mailbox name.
- $new : string
-
The new mailbox name.
serialize()
public
serialize() : mixed
setAttribute()
Change an attribute value.
public
setAttribute(string $type, string $elt, bool $bool) : mixed
Parameters
- $type : string
-
The attribute type.
- $elt : string
-
The element name.
- $bool : bool
-
The boolean value.
sortList()
Sorts a list of mailboxes.
public
sortList(array<string|int, mixed> &$mbox[, IMP_Ftree_Element $base = false ]) : mixed
Parameters
- $mbox : array<string|int, mixed>
-
The list of mailboxes to sort.
- $base : IMP_Ftree_Element = false
-
The base element.
subscribe()
Subscribe an element to the tree.
public
subscribe(mixed $id) : mixed
Parameters
- $id : mixed
-
The element name or an array of element names.
unserialize()
public
unserialize(mixed $data) : mixed
Parameters
- $data : mixed
Tags
unsubscribe()
Unsubscribe an element from the tree.
public
unsubscribe(mixed $id) : mixed
Parameters
- $id : mixed
-
The element name or an array of element names.
_insertElt()
Insert an element into the tree.
protected
_insertElt(array<string|int, mixed> $elt) : mixed
Parameters
- $elt : array<string|int, mixed>
-
Element data. Keys:
- a: (integer) Attributes.
- p: (string) Parent element ID.
- v: (string) Mailbox ID.
_normalize()
Normalize an element ID to the correct, internal name.
protected
_normalize(string $id) : string
Parameters
- $id : string
-
The element ID.
Return values
string —The converted name.
_sortLevel()
Sort a level in the tree.
protected
_sortLevel(string $id) : mixed
Parameters
- $id : string
-
The parent element whose children need to be sorted.