PHP Class IMP_Ftree, horde

Author: Chuck Hagenbuch ([email protected])
Author: Anil Madhavapeddy ([email protected])
Author: Jon Parise ([email protected])
Author: Michael Slusarz ([email protected])
Inheritance: implements ArrayAccess, implements Countable, implements IteratorAggregate, implements Serializable
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_accounts array Account sources.
$_changed boolean Tree changed flag. Set when something in the tree has been altered.
$_eltdiff IMP_Ftree_Eltdiff Element diff tracking.
$_elts array Array containing the mailbox elements.
$_parent array Parent/child list.
$_temp array Temporary data that is not saved across serialization.

Public Methods

Method Description
__construct ( ) Constructor.
__get ( $name )
collapse ( mixed $elts ) Collapse an element.
collapseAll ( ) Collapse all elements.
count ( ) Return the number of mailboxes on the server.
createTree ( string | Horde_Tree $name, array $opts = [] ) : Horde_Tree Creates a Horde_Tree representation of the current tree.
delete ( $id ) Delete an element from the tree.
expand ( mixed $elts, boolean $expandall = false ) Expand an element.
expandAll ( ) Expand all elements.
getAccount ( string $id ) : IMP_Ftree_Account Get the account object for a given element ID.
getAttribute ( string $type, string $name ) : mixed Get an attribute value.
getChildren ( string $id ) : array 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 ( string $id ) : mixed Get the parent element for a given element ID.
init ( ) Initialize the tree.
insert ( mixed $id ) Insert an element into the tree.
loadUnsubscribed ( ) Load unsubscribed mailboxes.
offsetExists ( $offset )
offsetGet ( $offset ) : IMP_Ftree_Element
offsetSet ( $offset, $value )
offsetUnset ( $offset )
rename ( string $old, string $new ) Rename a mailbox.
serialize ( )
setAttribute ( string $type, string $elt, boolean $bool ) Change an attribute value.
sortList ( &$mbox, IMP_Ftree_Element $base = false ) Sorts a list of mailboxes.
subscribe ( mixed $id ) Subscribe an element to the tree.
unserialize ( $data )
unsubscribe ( mixed $id ) Unsubscribe an element from the tree.

Protected Methods

Method Description
_insertElt ( array $elt ) Insert an element into the tree.
_normalize ( string $id ) : string Normalize an element ID to the correct, internal name.
_sortLevel ( string $id ) Sort a level in the tree.

Method Details

__construct() public method

Constructor.
public __construct ( )

__get() public method

public __get ( $name )

_insertElt() protected method

Insert an element into the tree.
protected _insertElt ( array $elt )
$elt array Element data. Keys: - a: (integer) Attributes. - p: (string) Parent element ID. - v: (string) Mailbox ID.

_normalize() protected method

Normalize an element ID to the correct, internal name.
protected _normalize ( string $id ) : string
$id string The element ID.
return string The converted name.

_sortLevel() protected method

Sort a level in the tree.
protected _sortLevel ( string $id )
$id string The parent element whose children need to be sorted.

collapse() public method

Collapse an element.
public collapse ( mixed $elts )
$elts mixed The element (or an array of elements) to expand.

collapseAll() public method

Collapse all elements.
public collapseAll ( )

count() public method

Return the number of mailboxes on the server.
public count ( )

createTree() public method

Creates a Horde_Tree representation of the current tree.
public createTree ( string | Horde_Tree $name, array $opts = [] ) : Horde_Tree
$name string | Horde_Tree Either the tree name, or a Horde_Tree object to add nodes to.
$opts 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 Horde_Tree The tree object.

delete() public method

Delete an element from the tree.
public delete ( $id )

expand() public method

Expand an element.
public expand ( mixed $elts, boolean $expandall = false )
$elts mixed The element (or an array of elements) to expand.
$expandall boolean Expand all subelements?

expandAll() public method

Expand all elements.
public expandAll ( )

getAccount() public method

Get the account object for a given element ID.
public getAccount ( string $id ) : IMP_Ftree_Account
$id string Element ID.
return IMP_Ftree_Account Account object.

getAttribute() public method

Get an attribute value.
public getAttribute ( string $type, string $name ) : mixed
$type string The attribute type.
$name string The element name.
return mixed Boolean attribute result, or null if element or attribute doesn't exist

getChildren() public method

Return the list of children for a given element ID.
public getChildren ( string $id ) : array
$id string Element ID.
return array Array of tree elements.

getIterator() public method

This returns a RecursiveIterator - a RecursiveIteratorIterator is needed to properly iterate through all elements.
public getIterator ( ) : IMP_Ftree_Iterator
return IMP_Ftree_Iterator Iterator object.

getParent() public method

Get the parent element for a given element ID.
public getParent ( string $id ) : mixed
$id string Element ID.
return mixed IMP_Ftree_Element object, or null if no parent.

init() public method

Initialize the tree.
public init ( )

insert() public method

Insert an element into the tree.
public insert ( mixed $id )
$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() public method

Load unsubscribed mailboxes.
public loadUnsubscribed ( )

offsetExists() public method

public offsetExists ( $offset )

offsetGet() public method

public offsetGet ( $offset ) : IMP_Ftree_Element
return IMP_Ftree_Element

offsetSet() public method

public offsetSet ( $offset, $value )

offsetUnset() public method

public offsetUnset ( $offset )

rename() public method

Rename a mailbox.
public rename ( string $old, string $new )
$old string The old mailbox name.
$new string The new mailbox name.

serialize() public method

public serialize ( )

setAttribute() public method

Change an attribute value.
public setAttribute ( string $type, string $elt, boolean $bool )
$type string The attribute type.
$elt string The element name.
$bool boolean The boolean value.

sortList() public method

Sorts a list of mailboxes.
public sortList ( &$mbox, IMP_Ftree_Element $base = false )
$base IMP_Ftree_Element The base element.

subscribe() public method

Subscribe an element to the tree.
public subscribe ( mixed $id )
$id mixed The element name or an array of element names.

unserialize() public method

public unserialize ( $data )

unsubscribe() public method

Unsubscribe an element from the tree.
public unsubscribe ( mixed $id )
$id mixed The element name or an array of element names.

Property Details

$_accounts protected property

Account sources.
protected array $_accounts
return array

$_changed protected property

Tree changed flag. Set when something in the tree has been altered.
protected bool $_changed
return boolean

$_eltdiff protected property

Element diff tracking.
protected IMP_Ftree_Eltdiff $_eltdiff
return IMP_Ftree_Eltdiff

$_elts protected property

Array containing the mailbox elements.
protected array $_elts
return array

$_parent protected property

Parent/child list.
protected array $_parent
return array

$_temp protected property

Temporary data that is not saved across serialization.
protected array $_temp
return array