File: tree_menu.php

package info (click to toggle)
turba2 2.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,332 kB
  • ctags: 2,927
  • sloc: php: 11,046; xml: 1,690; sql: 507; makefile: 62; perl: 17; sh: 1
file content (66 lines) | stat: -rw-r--r-- 2,369 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php

$block_name = _("Menu List");
$block_type = 'tree';

/**
 * $Horde: turba/lib/Block/tree_menu.php,v 1.5.2.4 2008/06/11 17:45:54 mrubinsk Exp $
 *
 * @package Horde_Block
 */
class Horde_Block_turba_tree_menu extends Horde_Block {

    var $_app = 'turba';

    function _buildTree(&$tree, $indent = 0, $parent = null)
    {
        global $registry;

        require_once dirname(__FILE__) . '/../base.php';

        $browse = Horde::applicationUrl('browse.php');
        $add = Horde::applicationUrl('add.php');
        $icondir = $registry->getImageDir() . '/menu';

        $tree->addNode($parent . '__new',
                       $parent,
                       _("New Contact"),
                       $indent + 1,
                       false,
                       array('icon' => 'new.png',
                             'icondir' => $icondir,
                             'url' => $add));

        foreach (Turba::getAddressBooks(PERMS_EDIT) as $addressbook => $config) {
            $tree->addNode($parent . $addressbook . '__new',
                           $parent . '__new',
                           sprintf(_("in %s"), $config['title']),
                           $indent + 2,
                           false,
                           array('icon' => 'new.png',
                                 'icondir' => $icondir,
                                 'url' => Util::addParameter($add, array('source' => $addressbook))));

            if (!empty($config['browse'])) {
                $tree->addNode($parent . $addressbook,
                               $parent,
                               $config['title'],
                               $indent + 1,
                               false,
                               array('icon' => 'browse.png',
                                     'icondir' => $icondir,
                                     'url' => Util::addParameter($browse, array('source' => $addressbook))));
            }
        }

        $tree->addNode($parent . '__search',
                       $parent,
                       _("Search"),
                       $indent + 1,
                       false,
                       array('icon' => 'search.png',
                             'icondir' => $registry->getImageDir('horde'),
                             'url' => Horde::applicationUrl('search.php')));
    }

}