File: tree_menu.php

package info (click to toggle)
gollem 1.0.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,416 kB
  • ctags: 433
  • sloc: php: 2,088; xml: 359; makefile: 74; sh: 11
file content (50 lines) | stat: -rw-r--r-- 1,603 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
<?php

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

/**
 * Gollem tree block.
 *
 * $Horde: gollem/lib/Block/tree_menu.php,v 1.5.2.1 2006/01/01 21:28:48 jan Exp $
 *
 * Copyright 2005-2006 Michael Slusarz <slusarz@horde.org>
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author  Michael Slusarz <slusarz@horde.org>
 * @package Gollem
 */
class Horde_Block_gollem_tree_menu extends Horde_Block {

    var $_app = 'gollem';

    function _buildTree(&$tree, $indent = 0, $parent = null)
    {
        if (isset($GLOBALS['authentication'])) {
            $old_auth = $GLOBALS['authentication'];
        }
        $GLOBALS['authentication'] = 'none';
        @define('GOLLEM_BASE', dirname(__FILE__) . '/../..');
        require_once GOLLEM_BASE . '/lib/base.php';
        if (isset($old_auth)) {
            $GLOBALS['authentication'] = $old_auth;
        }

        $icondir = $GLOBALS['registry']->getImageDir();
        $login_url = Horde::applicationUrl('login.php');

        foreach ($GLOBALS['gollem_backends'] as $key => $val) {
            $tree->addNode($parent . $key,
                           $parent,
                           $val['name'],
                           $indent + 1,
                           false,
                           array('icon' => 'gollem.png',
                                 'icondir' => $icondir,
                                 'url' => Util::addParameter($login_url, array('backend_key' => $key, 'change_backend' => 1))));
        }
    }

}