1: <?php
2: /**
3: * Extends Core's Simplehtml class to allow us to catch expand/collapse
4: * requests so that the 'expanded_folders' pref can be updated.
5: *
6: * Copyright 2012-2014 Horde LLC (http://www.horde.org/)
7: *
8: * See the enclosed file COPYING for license information (GPL). If you
9: * did not receive this file, see http://www.horde.org/licenses/gpl.
10: *
11: * @author Michael Slusarz <slusarz@horde.org>
12: * @category Horde
13: * @license http://www.horde.org/licenses/gpl GPL
14: * @package IMP
15: */
16: class IMP_Tree_Simplehtml extends Horde_Core_Tree_Renderer_Simplehtml
17: {
18: /**
19: * Should this element be toggled?
20: *
21: * @param string $id The node ID.
22: *
23: * @return boolean True of the element should be toggled.
24: */
25: public function shouldToggle($id)
26: {
27: return ($this->_tree->nodeId($id) == $GLOBALS['injector']->getInstance('Horde_Variables')->get(Horde_Tree::TOGGLE . $this->_tree->instance));
28: }
29:
30: /**
31: * Generate a link URL tag.
32: *
33: * @param string $node_id The node ID.
34: *
35: * @return string The link tag.
36: */
37: protected function _generateUrlTag($node_id)
38: {
39: return IMP_Minimal_Folders::url()
40: ->add(Horde_Tree::TOGGLE . $this->_tree->instance, $node_id)
41: ->link();
42: }
43:
44: }
45: