1: <?php
2: /**
3: * Copyright 2013-2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2013-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * Iterator that returns all the ancestors (and their siblings) for an
16: * element.
17: *
18: * @author Michael Slusarz <slusarz@horde.org>
19: * @category Horde
20: * @copyright 2013-2014 Horde LLC
21: * @license http://www.horde.org/licenses/gpl GPL
22: * @package IMP
23: */
24: class IMP_Ftree_Iterator_Ancestors extends IMP_Ftree_Iterator
25: {
26: /**
27: */
28: public function __construct($elt)
29: {
30: $elts = array();
31:
32: while ($elt && ($elt = $elt->parent)) {
33: $elts = array_merge($elt->child_list, $elts);
34: }
35:
36: parent::__construct($elts);
37: }
38:
39: /**
40: */
41: public function getChildren()
42: {
43: return new self(array());
44: }
45:
46: /**
47: */
48: public function hasChildren()
49: {
50: return false;
51: }
52:
53: }
54: