/**
  * @see TreeMenu::loadCache()
  */
 protected function loadCache()
 {
     parent::loadCache();
     WCF::getCache()->addResource('userProfileMenu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.userProfileMenu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderUserProfileMenu.class.php');
     $this->menuItems = WCF::getCache()->get('userProfileMenu-' . PACKAGE_ID);
     EventHandler::fireAction($this, 'loadedCache');
 }
Example #2
0
 /**
  * @see TreeMenu::loadCache()
  */
 protected function loadCache()
 {
     parent::loadCache();
     if (PACKAGE_ID == 0) {
         return;
     }
     WCF::getCache()->addResource('menu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.menu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderACPMenu.class.php');
     $this->menuItems = WCF::getCache()->get('menu-' . PACKAGE_ID);
 }
Example #3
0
 function action()
 {
     require_once $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/class/layersmenu.class.php';
     require_once $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/class/PHPLIB.php';
     $mid = new TreeMenu();
     $mid->dirroot = $this->RootDir;
     $mid->imgdir = $this->ImgDir . 'menu/';
     $mid->imgwww = $this->WebDir . 'img/menu/';
     $mid->icondir = $this->ImgDir . 'menu/';
     $mid->iconwww = $this->WebDir . 'img/menu/';
     $strMenuStructure = '';
     // define the base menu item
     $strMenuStructure .= implode('', file($this->RootDir . '/web/base/server/aa_server/menu.txt'));
     if ($strMenuStructure != '') {
         $mid->setMenuStructureString($strMenuStructure);
     }
     $mid->setIconsize(18, 18);
     $mid->parseStructureForMenu('menu1_');
     //		$mid->replaceStringInUrls('menu1_', '&', '&');
     //		var_dump($_SERVER['QUERY_STRING']);
     $mid->setSelectedItemByUrl('menu1_', $_SERVER['QUERY_STRING']);
     $mid->newTreeMenu('menu1_');
     $mid2 = new TreeMenu();
     $mid2->dirroot = $this->RootDir;
     $mid2->imgdir = $this->ImgDir . 'menu/';
     $mid2->imgwww = $this->WebDir . 'img/menu/';
     $mid2->icondir = $this->ImgDir . 'menu/';
     $mid2->iconwww = $this->WebDir . 'img/menu/';
     $strMenuStructure = '';
     // define the plugin manager menu item
     $strMenuStructure .= implode('', file($this->PluginsDir . '/aa_plugins/menu.txt'));
     // define the base plugin sections
     $strMenuStructure .= $this->parse_subsection("Cloud", "cloud");
     $strMenuStructure .= $this->parse_subsection("Deployment", "deployment");
     $strMenuStructure .= $this->parse_subsection("Highavailability", "HA");
     $strMenuStructure .= $this->parse_subsection("Management", "management");
     $strMenuStructure .= $this->parse_subsection("Monitoring", "monitoring");
     $strMenuStructure .= $this->parse_subsection("Network", "network");
     $strMenuStructure .= $this->parse_subsection("Storage", "storage");
     $strMenuStructure .= $this->parse_subsection("Virtualization", "virtualization");
     $strMenuStructure .= $this->parse_subsection("Misc", "misc");
     if ($strMenuStructure != '') {
         $mid2->setMenuStructureString($strMenuStructure);
     }
     $mid2->setIconsize(18, 18);
     $mid2->parseStructureForMenu('menu2_');
     $mid2->setSelectedItemByUrl('menu2_', $_SERVER['QUERY_STRING']);
     $mid2->newTreeMenu('menu2_');
     $t = $this->response->html->template($this->tpldir . '/index_menu.tpl.php');
     $t->add("time()", 'timestamp');
     $t->add($mid->getTreeMenu('menu1_'), 'menu_1');
     $t->add($mid2->getTreeMenu('menu2_'), 'menu_2');
     return $t;
 }
</div>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" valign="top">
<div style="height: 3px"></div>
<?php 
$mid->printMenu('vermenu1');
?>
<div class="normalbox">
<div class="normal">
A Tree Menu
</div>
<?php 
require_once 'lib/treemenu.inc.php';
$treemid = new TreeMenu();
$treemid->setMenuStructureFile('layersmenu-vertical-3.txt');
$mid->setIconsize(16, 16);
$treemid->parseStructureForMenu('treemenu1');
//$treemid->setSelectedItemByCount('treemenu1', 5);
$treemid->setSelectedItemByUrl('treemenu1', basename(__FILE__));
print $treemid->newTreeMenu('treemenu1');
?>
</div>
<div class="normalbox">
<div class="normal">
Another Tree Menu
</div>
<?php 
$treemid->setMenuStructureFile('layersmenu-horizontal-1.txt');
$treemid->parseStructureForMenu('treemenu2');
 - a file-based example with two JavaScript Tree Menus</b>
</div>
</div>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" valign="top">
<div class="normalbox">
<div class="normal">
A JS Tree Menu
</div>
<?php 
require_once 'lib/PHPLIB.php';
require_once 'lib/layersmenu-common.inc.php';
require_once 'lib/treemenu.inc.php';
$mid = new TreeMenu();
//$mid->setDirroot('./');
////$mid->setLibjsdir('./libjs/');
////$mid->setImgdir('./menuimages/');
//$mid->setImgwww('menuimages/');
////$mid->setIcondir('./menuicons/');
//$mid->setIconwww('menuicons/');
$mid->setMenuStructureFile('layersmenu-vertical-1.txt');
$mid->setIconsize(16, 16);
$mid->parseStructureForMenu('treemenu1');
//$mid->setSelectedItemByCount('treemenu1', 8);
$mid->setSelectedItemByUrl('treemenu1', basename(__FILE__));
print $mid->newTreeMenu('treemenu1');
?>
</div>
<div class="normalbox">
<title>The PHP Layers Menu System</title>
<script language="JavaScript" type="text/javascript">
<!--
<?php 
require_once 'libjs/layersmenu-browser_detection.js';
?>
// -->
</script>
<script language="JavaScript" type="text/javascript" src="libjs/layerstreemenu-cookies.js"></script>
<base target="bodyframe"></base>
</head>
<body style="background-color: #ffffff; margin: 3px;">

<div class="normal">
Tree Menu
</div>
<?php 
require_once 'lib/PHPLIB.php';
require_once 'lib/layersmenu-common.inc.php';
require_once 'lib/treemenu.inc.php';
$mid = new TreeMenu();
$mid->setMenuStructureFile('layersmenu-vertical-1.txt');
$mid->setIconsize(16, 16);
$mid->parseStructureForMenu('treemenu1');
$mid->newTreeMenu('treemenu1');
$mid->printTreeMenu('treemenu1');
?>

</body>
</html>
</div>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" valign="top">
<div class="normalbox">
<div class="normal">
JavaScript Tree Menu
</div>
<?php 
require_once 'lib/PHPLIB.php';
require_once 'PEAR.php';
require_once 'DB.php';
require_once 'lib/layersmenu-common.inc.php';
require_once 'lib/treemenu.inc.php';
$mid = new TreeMenu();
$mid->setDBConnParms('pgsql://*****:*****@localhost/phplayersmenu');
//$mid->setDBConnParms('mysql://*****:*****@localhost/phplayersmenu');
$mid->setIconsize(16, 16);
$mid->scanTableForMenu('treemenu1', 'it');
$mid->setSelectedItemById('treemenu1', 10);
print $mid->newTreeMenu('treemenu1');
/* alternatively:
$mid->newTreeMenu('treemenu1');
$mid->printTreeMenu('treemenu1');
*/
/* alternatively:
$mid->newTreeMenu('treemenu1');
$tree_menu1 = $mid->getTreeMenu('treemenu1');
print $tree_menu1;
*/
Example #8
0
    /**
     * Draws side block with categories links
     * 		@param $draw
     **/
    public static function DrawSideBlock($draw = true)
    {
        global $objLogin;
        $listings_count_field = !$objLogin->IsLoggedIn() ? 'listings_count_public' : 'listings_count';
        $lang = Application::Get('lang');
        ob_start();
        $sql = 'SELECT ' . TABLE_CATEGORIES . '.id,
					' . TABLE_CATEGORIES . '.icon,
					' . TABLE_CATEGORIES . '.listings_count,
					' . TABLE_CATEGORIES . '.listings_count_public,
					' . TABLE_CATEGORIES . '.priority_order,
					' . TABLE_CATEGORIES_DESCRIPTION . '.language_id,
					' . TABLE_CATEGORIES_DESCRIPTION . '.name,									
					' . TABLE_CATEGORIES_DESCRIPTION . '.description
				FROM ' . TABLE_CATEGORIES . '
					LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' ON ' . TABLE_CATEGORIES . '.id = ' . TABLE_CATEGORIES_DESCRIPTION . '.category_id
				WHERE
					' . TABLE_CATEGORIES . '.parent_id = _CID_ AND
					' . TABLE_CATEGORIES_DESCRIPTION . '.language_id = \'' . $lang . '\'
				ORDER BY ' . TABLE_CATEGORIES . '.priority_order ASC';
        $sql_1 = str_replace('_CID_', '0', $sql);
        $result = database_query($sql_1, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
        draw_block_top(_CATEGORIES);
        ## +---------------------------------------------------------------------------+
        ## | 1. Creating & Calling:                                                    |
        ## +---------------------------------------------------------------------------+
        ## *** define a relative (virtual) path to treemenu.class.php file
        define('TREEMENU_DIR', 'modules/treemenu/');
        /* Ex.: 'treemenu/' */
        ## *** include TreeMenu class
        require_once TREEMENU_DIR . 'treemenu.class.php';
        ## *** create TreeMenu object
        $treeMenu = new TreeMenu();
        $treeMenu->SetDirection(Application::Get('lang_dir'));
        ## +---------------------------------------------------------------------------+
        ## | 2. General Settings:                                                      |
        ## +---------------------------------------------------------------------------+
        ## *** set unique numeric (integer-valued) identifier for TreeMenu
        ## *** (if you want to use several independently configured TreeMenu objects on single page)
        $treeMenu->SetId(1);
        ## *** set style for TreeMenu
        $treeMenu->SetStyle('vista');
        ## *** set TreeMenu caption
        //$treeMenu->SetCaption('ApPHP TreeMenu v'.$treeMenu->Version());
        ## *** show debug info - false|true
        $treeMenu->Debug(false);
        ## *** specifies whether to show node(folder) icons
        $treeMenu->UseDefaultFolderIcons(false);
        ## *** set postback method: 'get', 'post' or 'ajax'
        $treeMenu->SetPostBackMethod('post');
        ## *** set variables that used to get access to the page (like: my_page.php?act=34&id=56 etc.)
        /// $treeMenu->SetHttpVars(array('id'));
        ## *** show number of subnodes to the left of every node - false|true
        $treeMenu->ShowNumSubNodes(false);
        ## +---------------------------------------------------------------------------+
        ## | 3. Adding nodes:                                                          |
        ## +---------------------------------------------------------------------------+
        ## *** add nodes
        ## arguments:
        ## arg #1 - node's caption
        ## arg #2 - file associated with this node (optional)
        ## arg #3 - icon associated with this node (optional)
        ## Example: $treeMenu->AddNode('Title', 'text.txt', 'icon.gif');
        $node = array();
        for ($i = 0; $i < $result[1]; $i++) {
            $node = $treeMenu->AddNode($result[0][$i]['name'] . ' (' . $result[0][$i][$listings_count_field] . ')', prepare_link('category', 'cid', $result[0][$i]['id'], '', $result[0][$i]['name'], '', '', true));
            $node->OpenNewWindow(true);
            $sql_2 = str_replace('_CID_', $result[0][$i]['id'], $sql);
            $result_2 = database_query($sql_2, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
            for ($j = 0; $j < $result_2[1]; $j++) {
                $sub_node = $node->AddNode($result_2[0][$j]['name'] . ' (' . $result_2[0][$j][$listings_count_field] . ')', prepare_link('category', 'cid', $result_2[0][$j]['id'], '', $result_2[0][$j]['name'], '', '', true));
                $sub_node->OpenNewWindow(true);
                $sql_3 = str_replace('_CID_', $result_2[0][$j]['id'], $sql);
                $result_3 = database_query($sql_3, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
                for ($k = 0; $k < $result_3[1]; $k++) {
                    $sub_sub_node = $sub_node->AddNode($result_3[0][$k]['name'] . ' (' . $result_3[0][$k][$listings_count_field] . ')', prepare_link('category', 'cid', $result_3[0][$k]['id'], '', $result_3[0][$k]['name'], '', '', true));
                    $sub_sub_node->OpenNewWindow(true);
                }
            }
        }
        ## +---------------------------------------------------------------------------+
        ## | 5. Draw TreeMenu:                                                         |
        ## +---------------------------------------------------------------------------+
        $treeMenu->ShowTree();
        echo '<ul><li>' . prepare_link('categories', '', '', 'all', _SEE_ALL . ' &raquo;', 'main_menu_link main_menu_last', _SEE_ALL) . '</li></ul>';
        draw_block_bottom();
        // save the contents of output buffer to the string
        $output = ob_get_contents();
        ob_end_clean();
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
function auth_generate_admin_menu($menu_obj)
{
    $menu_obj->auth_update();
    global $C_translate, $smarty, $C_list;
    $i = 1;
    $js = '';
    $arr = $menu_obj->module;
    $arr2 = $menu_obj->module;
    // loop through the modules
    while (list($module, $val) = each($arr)) {
        if (!empty($val[2])) {
            if ($val[1] == $val[0] || empty($val[0]) || empty($val[1])) {
                $module_name = $C_translate->translate('menu', $module, '');
                $parent = $val[0];
                $module_id = $val[0];
                $module_arr[$i]["name"] = $module_name;
                $module_arr[$i]["module"] = $module;
                // loop through the methods
                while (list($method, $meth_arr) = each($arr[$module])) {
                    if (gettype($meth_arr) == 'array' && !empty($meth_arr[1])) {
                        $method_name = $C_translate->translate('menu_' . $method, $module, '');
                        if (empty($meth_arr[2])) {
                            $page = $module . ':' . $method;
                        } else {
                            $page = eregi_replace('%%', $module, $meth_arr[2]);
                        }
                        $module_arr[$i]["methods"][] = array('name' => $method_name, 'page' => $page);
                    }
                }
                // Loop through the sub-modules:
                reset($arr2);
                $ii = 0;
                while (list($module, $val) = each($arr2)) {
                    if (!empty($val[2])) {
                        if ($val[1] == $parent && $module_id != $val[0]) {
                            $module_name = $C_translate->translate('menu', $module, '');
                            $module_arr[$i]["sub_name"][$ii] = $module_name;
                            // loop through the methods
                            while (list($method, $meth_arr) = each($arr2[$module])) {
                                if (gettype($meth_arr) == 'array' && !empty($meth_arr[1])) {
                                    $method_name = $C_translate->translate('menu_' . $method, $module, '');
                                    if (empty($meth_arr[2])) {
                                        $page = $module . ':' . $method;
                                    } else {
                                        $page = eregi_replace('%%', $module, $meth_arr[2]);
                                    }
                                    $module_arr[$i]["sub_methods"][$ii][] = array('name' => $method_name, 'page' => $page);
                                }
                            }
                            $ii++;
                        }
                    }
                }
                $i++;
            }
        }
    }
    // Generate the main modules:
    $js = '';
    $js .= ".|Overview|javascript:openUrl('?_page=core:admin');\n";
    $js .= ".|Exit Administration|javascript:exitAdmin();\n";
    $js .= ".|Misc\n";
    $js .= "..|Documentation|http://agilebill.com/documentation|||mainFrame\n";
    $js .= "..|Agileco News|http://forum.agileco.com/forumdisplay.php?f=26|||mainFrame\n";
    $js .= "..|Version Check|?_page=module:upgrade|||mainFrame\n";
    for ($i = 1; $i <= count($module_arr); $i++) {
        $name = $module_arr[$i]['name'];
        $js .= ".|{$name}\n";
        // Generate the main methods:
        for ($ii = 0; $ii < count($module_arr[$i]['methods']); $ii++) {
            $name = $module_arr[$i]['methods'][$ii]['name'];
            $page = $module_arr[$i]['methods'][$ii]['page'];
            $js .= "..|{$name}|javascript:openUrl('?_page={$page}')\n";
        }
        // Generate the sub modules:
        for ($ii = 0; $ii < count(@$module_arr[$i]['sub_name']); $ii++) {
            $name = $module_arr[$i]['sub_name'][$ii];
            $js .= "..|{$name}|#\n";
            // Generate the sub methods:
            for ($iii = 0; $iii < count($module_arr[$i]['sub_methods'][$ii]); $iii++) {
                $name = $module_arr[$i]['sub_methods'][$ii][$iii]['name'];
                $page = $module_arr[$i]['sub_methods'][$ii][$iii]['page'];
                $js .= "...|{$name}|javascript:openUrl('?_page={$page}')\n";
            }
        }
    }
    # set the dates for the quicksearch
    $smarty->assign('today_start', $C_list->date(mktime(0, 0, 0, date("m"), date("d"), date("Y"))));
    $smarty->assign('week_start', $C_list->date(mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"))));
    $smarty->assign('month_start', $C_list->date(mktime(0, 0, 0, date("m"), 1, date("Y"))));
    # Generate the menu
    require_once PATH_INCLUDES . "phplayers/PHPLIB.php";
    require_once PATH_INCLUDES . "phplayers/layersmenu-common.inc.php";
    require_once PATH_INCLUDES . "phplayers/treemenu.inc.php";
    // unstoppable agileco logo ;)
    echo '<img src="http://www.agileco.com/images/poweredby.gif" border="0" style="position: absolute; top: 8px; left: 45px;"/>';
    $mnu = new TreeMenu();
    $mnu->setMenuStructureString($js);
    $mnu->setIconsize(16, 16);
    $mnu->parseStructureForMenu('treemenu1');
    $mnu->setTreemenuTheme("kde_");
    return $mnu->newTreeMenu('treemenu1');
    return $js;
}
/**
 * This function displays the LDAP tree for all the servers that you have
 * in config.php. We read the session variable 'tree' to know which
 * dns are expanded or collapsed. No query string parameters are expected,
 * however, you can use a '#' offset to scroll to a given dn. The syntax is
 * tree.php#<server_id>_<rawurlencoded dn>, so if I wanted to scroll to
 * dc=example,dc=com for server 3, the URL would be:
 *	tree.php#3_dc%3Dexample%2Cdc%3Dcom
 */
function draw_server_tree()
{
    if (DEBUG_ENABLED) {
        debug_log('draw_server_tree(): Entered with ()', 33);
    }
    global $ldapserver;
    global $recently_timed_out_servers;
    global $config;
    static $tm = null;
    $server_id = $ldapserver->server_id;
    $tree = get_cached_item($ldapserver->server_id, 'tree');
    # Does this server want mass deletion available?
    if ($ldapserver->isMassDeleteEnabled()) {
        echo '<form name="mass_delete" action="mass_delete.php" method="post" target="right_frame">';
        printf('<input type="hidden" name="server_id" value="%s" />', $ldapserver->server_id);
        echo "\n\n";
    }
    echo '<table class="tree" cellspacing="0">';
    echo '<tr class="server">';
    printf('<td class="icon"><img src="images/server.png" alt="%s" /></td>', _('Server'));
    printf('<td colspan="99"><a name="%s"></a>', $ldapserver->server_id);
    printf('<nobr>%s ', htmlspecialchars($ldapserver->name));
    if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') {
        printf('<acronym title="%s"><img width=14 height=14 src="images/timeout.png" alt="timeout" /></acronym>', sprintf(_('Inactivity will log you off at %s'), strftime('%H:%M', time() + $ldapserver->session_timeout * 60)));
    }
    echo '</nobr></td></tr>';
    /* do we have what it takes to authenticate here, or do we need to
       present the user with a login link (for 'cookie' and 'session' auth_types)? */
    if ($ldapserver->haveAuthInfo()) {
        if ($ldapserver->connect(false)) {
            $schema_href = sprintf('schema.php?server_id=%s" target="right_frame', $ldapserver->server_id);
            $search_href = sprintf('search.php?server_id=%s" target="right_frame', $ldapserver->server_id);
            $refresh_href = sprintf('refresh.php?server_id=%s', $ldapserver->server_id);
            $logout_href = get_custom_file($ldapserver->server_id, 'logout.php', '') . '?server_id=' . $ldapserver->server_id;
            $info_href = sprintf('server_info.php?server_id=%s', $ldapserver->server_id);
            $import_href = sprintf('ldif_import_form.php?server_id=%s', $ldapserver->server_id);
            $export_href = sprintf('export_form.php?server_id=%s', $ldapserver->server_id);
            # Draw the quick-links below the server name:
            echo '<tr><td colspan="100" class="links">';
            echo '<nobr>';
            echo '( ';
            printf('<a title="%s %s" href="%s">%s</a> | ', _('View schema for'), $ldapserver->name, $schema_href, _('schema'));
            printf('<a title="%s %s" href="%s">%s</a> | ', _('search'), $ldapserver->name, $search_href, _('search'));
            printf('<a title="%s %s" href="%s">%s</a> | ', _('Refresh all expanded containers for'), $ldapserver->name, $refresh_href, _('refresh'));
            printf('<a title="%s" target="right_frame" href="%s">%s</a> | ', _('View server-supplied information'), $info_href, _('info'));
            printf('<a title="%s" target="right_frame" href="%s">%s</a> | ', _('Import entries from an LDIF file'), $import_href, _('import'));
            printf('<a href="%s" target="right_frame">%s</a>', $export_href, _('export'));
            if ($ldapserver->auth_type != 'config') {
                printf(' | <a title="%s" href="%s" target="right_frame">%s</a>', _('Logout of this server'), $logout_href, _('logout'));
            }
            echo ' )</nobr></td></tr>';
            if ($ldapserver->auth_type != 'config') {
                $logged_in_dn = $ldapserver->getLoggedInDN();
                echo '<tr><td class="links" colspan="100"><nobr>' . _('Logged in as: ');
                if ($ldapserver->getDNBase($logged_in_dn) == $logged_in_dn) {
                    $logged_in_branch = '';
                    $logged_in_dn_array = array();
                } else {
                    $logged_in_branch = preg_replace('/,' . $ldapserver->getDNBase($logged_in_dn) . '$/', '', $logged_in_dn);
                    $logged_in_dn_array = explode(',', $logged_in_branch);
                }
                $logged_in_dn_array[] = $ldapserver->getDNBase($logged_in_dn);
                $rdn = $logged_in_dn;
                if (strcasecmp('anonymous', $logged_in_dn)) {
                    foreach ($logged_in_dn_array as $rdn_piece) {
                        printf('<a class="logged_in_dn" href="template_engine.php?server_id=%s&amp;dn=%s" target="right_frame">%s</a>', $server_id, rawurlencode($rdn), pretty_print_dn($rdn_piece));
                        if ($rdn_piece != end($logged_in_dn_array)) {
                            echo ',';
                        }
                        $rdn = substr($rdn, 1 + strpos($rdn, ','));
                    }
                } else {
                    echo 'Anonymous';
                }
                echo '</nobr></td></tr>';
            }
            if ($ldapserver->isReadOnly()) {
                printf('<tr><td class="links" colspan="100"><nobr>(%s)</nobr></td></tr>', _('read only'));
            }
            $javascript_forms = '';
            $javascript_id = 0;
            $tree_plm = '';
            if ($config->GetValue('appearance', 'tree_plm') && !isset($tm)) {
                $tm = new TreeMenu();
                $tm->setDirroot(JSDIR . 'phplayersmenu/');
                $tm->setIcondir(HTDOCDIR . '/images/');
                $tm->setIconwww('images/');
                $tm->setImgwww(JSDIR . 'phplayersmenu/menuimages/');
            }
            foreach ($ldapserver->getBaseDN() as $base_dn) {
                # Did we get a base_dn for this server somehow?
                if ($base_dn) {
                    # is the root of the tree expanded already?
                    if (isset($tree['browser'][$base_dn]['open']) && $tree['browser'][$base_dn]['open']) {
                        $expand_href = sprintf('collapse.php?server_id=%s&amp;dn=%s', $ldapserver->server_id, rawurlencode($base_dn));
                        $expand_img = 'images/minus.png';
                        $expand_alt = '-';
                        $child_count = number_format(count($tree['browser'][$base_dn]['children']));
                    } else {
                        /* Check if the LDAP server is not yet initialized
                           (ie, the base DN configured in config.php does not exist) */
                        if (!$ldapserver->dnExists($base_dn)) {
                            $javascript_id++;
                            printf('<tr><td class="spacer"></td><td><img src="images/unknown.png" /></td><td colspan="98">%s</td></tr>', pretty_print_dn($base_dn));
                            /* Move this form and add it to the end of the html - otherwise the javascript
                               doesnt work when isMassDeleteEnabled returning true. */
                            $javascript_forms .= sprintf('<form name="create_base_form_%s" method="post" action="template_engine.php" target="right_frame">', $javascript_id);
                            $javascript_forms .= sprintf('<input type="hidden" name="template" value="custom" />');
                            $javascript_forms .= sprintf('<input type="hidden" name="server_id" value="%s" />', $ldapserver->server_id);
                            $javascript_forms .= sprintf('<input type="hidden" name="container" value="%s" />', htmlspecialchars($rdn));
                            $javascript_forms .= sprintf('<input type="hidden" name="rdn" value="%s" />', get_rdn($base_dn));
                            $javascript_forms .= sprintf('</form>');
                            printf('<tr><td class="spacer"></td><td colspan="98"><small>%s<a href="javascript:document.create_base_form_%s.submit()">%s</a></small></td></tr>', _('This base entry does not exist.'), $javascript_id, _('Create it?'));
                            continue;
                        } else {
                            $expand_href = sprintf('expand.php?server_id=%s&amp;dn=%s', $ldapserver->server_id, rawurlencode($base_dn));
                            $expand_img = 'images/plus.png';
                            $expand_alt = '+';
                            # $size_limit = $config->GetValue('search','size_limit');
                            $size_limit = -1;
                            if ($ldapserver->isLowBandwidth()) {
                                $child_count = null;
                            } else {
                                $children = $ldapserver->getContainerContents($base_dn, $size_limit + 1, '(objectClass=*)', $config->GetValue('deref', 'tree'));
                                $child_count = count($children);
                                #								if ($child_count > $size_limit)
                                #									$child_count = $size_limit.'+';
                            }
                        }
                    }
                    $create_href = sprintf('create_form.php?server_id=%s&amp;container=%s', $ldapserver->server_id, rawurlencode($base_dn));
                    $edit_href = sprintf('template_engine.php?server_id=%s&amp;dn=%s', $ldapserver->server_id, rawurlencode($base_dn));
                    $icon = isset($tree['browser'][$base_dn]['icon']) ? $tree['browser'][$base_dn]['icon'] : get_icon($ldapserver, $base_dn);
                    # Shall we draw the "mass-delete" checkbox?
                    if ($ldapserver->isMassDeleteEnabled()) {
                        printf('<td><input type="checkbox" name="mass_delete[%s]" /></td>', htmlspecialchars($base_dn));
                    }
                    if ($config->GetValue('appearance', 'tree_plm')) {
                        $tree_plm .= sprintf(".|%s|%s|%s|%s|%s|%s\n", pretty_print_dn($base_dn) . ($child_count ? ' (' . $child_count . ')' : ''), $edit_href, $base_dn, $icon, 'right_frame', 0);
                    } else {
                        echo '<tr>';
                        printf('<td class="expander"><a href="%s"><img src="%s" alt="%s" /></a></td>', $expand_href, $expand_img, $expand_alt);
                        printf('<td class="icon"><a href="%s" target="right_frame"><img src="images/%s" alt="img" /></a></td>', $edit_href, $icon);
                        printf('<td class="rdn" colspan="98"><nobr><a href="%s" target="right_frame">%s</a>', $edit_href, pretty_print_dn($base_dn));
                        if ($child_count) {
                            printf(' <span class="count">(%s)</span>', $child_count);
                        }
                        echo '</nobr></td>';
                        echo '</tr>';
                    }
                } else {
                    // end if( $base_dn )
                    # The server refuses to give out the base dn
                    printf('<tr><td class="spacer"></td><td colspan="98"><small>%s<br />%s<br /><b>%s</b></small></td></tr>', _('Could not determine the root of your LDAP tree.'), _('It appears that the LDAP server has been configured to not reveal its root.'), _('Please specify it in config.php'));
                    # Proceed to the next server. We cannot draw anything else for this server.
                    continue;
                }
                flush();
                if ($config->GetValue('appearance', 'tree_plm')) {
                    foreach ($children as $child_dn) {
                        $tree_plm .= draw_tree_plm($child_dn, $ldapserver);
                    }
                } else {
                    # Is the root of the tree expanded already?
                    if (isset($tree['browser'][$base_dn]['open']) && $tree['browser'][$base_dn]['open']) {
                        if ($ldapserver->isShowCreateEnabled() && count($tree['browser'][$base_dn]['children']) > 10) {
                            draw_create_link($ldapserver->server_id, $base_dn, -1, urlencode($base_dn));
                        }
                        foreach ($tree['browser'][$base_dn]['children'] as $child_dn) {
                            draw_tree_html($child_dn, $ldapserver, 0);
                        }
                        if (!$ldapserver->isReadOnly()) {
                            echo '<tr><td class="spacer"></td></tr>';
                            if ($ldapserver->isShowCreateEnabled()) {
                                draw_create_link($ldapserver->server_id, $base_dn, -1, urlencode($base_dn));
                            }
                        }
                    }
                }
            }
            // foreeach
            if ($config->GetValue('appearance', 'tree_plm')) {
                $tm->setMenuStructureString($tree_plm);
                $tm->parseStructureForMenu('pla_tree_' . $ldapserver->server_id);
                $tm->setTreeMenuTheme('');
                $tm->newTreeMenu('pla_tree_' . $ldapserver->server_id);
                echo '<tr><td colspan=99>' . $tm->getTreeMenu('pla_tree_' . $ldapserver->server_id) . '</td></tr>';
            }
        } else {
            // end if( $ldapserver->connect(false) )
            # could not connect to LDAP server
            printf('<tr><td class="spacer"></td><td><img src="images/warning_small.png" alt="%s" /></td><td colspan="99"><small><span style="color:red">%s</span></small></td></tr>', _('warning'), _('Could not connect to LDAP server.'));
            if ($ldapserver->auth_type != 'config') {
                $logout_href = sprintf('%s?server_id=%s', get_custom_file($ldapserver->server_id, 'logout.php', ''), $ldapserver->server_id);
                printf('<tr><td class="spacer"></td><td class="spacer"></td><td colspan="99"><small><a target="right_frame" href="%s">%s</a></small></td></tr>', $logout_href, _('logout'));
            }
            # Proceed to the next server in the list. We cannot do anything mroe here.
            return;
        }
    } else {
        // end if $ldapserver->haveAuthInfo()
        /* We don't have enough information to login to this server
           Draw the "login..." link */
        $login_href = sprintf('%s?server_id=%s', get_custom_file($ldapserver->server_id, 'login_form.php', ''), $ldapserver->server_id);
        printf('<tr class="login"><td class="spacer"></td><td><a href="%s" target="right_frame"><img src="images/uid.png" align="top" alt="%s" /></a></td><td colspan="99"><a href="%s" target="right_frame">%s</a></td></tr>', $login_href, _('login'), $login_href, _('Login...'));
        # If the server recently timed out display the message
        if (in_array($ldapserver->server_id, $recently_timed_out_servers)) {
            printf('<tr><td class="spacer"></td><td colspan="100" class="links">%s</td></tr>', _('(Session timed out. Automatically logged out.)'));
        }
    }
    if ($ldapserver->isMassDeleteEnabled() && !$config->GetValue('appearance', 'tree_plm')) {
        printf('<tr><td colspan="99"><input type="submit" value="%s" /></td></tr>', _('Delete Checked Entries'));
        echo '<!-- The end of the mass deletion form -->';
        echo '</table>';
        echo '</form>';
    } else {
        echo '</table>';
    }
    echo "\n\n";
    if (isset($javascript_forms) && $javascript_forms) {
        echo "<!-- Forms for javascript submit to call to create base_dns -->\n";
        echo $javascript_forms;
        echo "<!-- The end of the forms for javascript submit to call to create base_dns -->\n";
    }
}
                foreach ($kids as $k) {
                    $back .= $indent . "|" . $k['name'] . "|tiki-browse_categories.php?parentId=" . $k['categId'] . "&amp;type=" . urlencode($type) . "&amp;deep={$deep}\n";
                    $back .= mktree($k['categId'], ".{$indent}", "");
                }
                return $back;
            } else {
                return "";
            }
        }
    }
    $itall = mktree(0, ".", "");
    include_once "lib/phplayers/lib/PHPLIB.php";
    include_once "lib/phplayers_tiki/lib/layersmenu-common.inc.php";
    // include Tiki's modified version of that file to keep original intact (luci)
    include_once "lib/phplayers/lib/treemenu.inc.php";
    $phplayers = new TreeMenu();
    $phplayers->setDirrootCommon("lib/phplayers");
    $phplayers->setLibjsdir("lib/phplayers/libjs/");
    $phplayers->setImgdir("lib/phplayers/images/");
    $phplayers->setImgwww("lib/phplayers/images/");
    $phplayers->setTpldirCommon("lib/phplayers/templates/");
    if ($itall) {
        $phplayers->setMenuStructureString($itall);
    }
    $phplayers->parseStructureForMenu("treemenu1");
    $phpitall = $phplayers->newTreeMenu("treemenu1");
    $smarty->assign('tree', $phpitall);
} else {
    $tree_nodes = array();
    foreach ($ctall as $c) {
        $tree_nodes[] = array("id" => $c["categId"], "parent" => $c["parentId"], "data" => '<a class="catname" href="tiki-browse_categories.php?parentId=' . $c["categId"] . '&amp;deep=' . $deep . '&amp;type=' . urlencode($type) . '">' . $c["name"] . '</a><br />');
Example #12
0
     //area
     while ($arearow = $arearesult->Fetchrow()) {
         $menustring = $menustring . "..|" . htmlspecialchars(inet_ntoa($arearow["areaaddr"]) . " (" . $arearow["descrip"] . ")") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=" . $arearow["areaindex"] . "||||\n";
         $rangeresult = $ds->GetRangeInArea($custrow["customer"], $arearow["areaindex"]);
         //range
         while ($rangerow = $rangeresult->Fetchrow()) {
             $menustring = $menustring . "...|" . htmlspecialchars(inet_ntoa($rangerow["rangeaddr"]) . " (" . $rangerow["descrip"] . ")") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=" . $arearow["areaindex"] . "&rangeindex=" . $rangerow["rangeindex"] . "&descrip=&sortby=Base+Address" . "||||\n";
             $baseresult = $ds->GetBase($rangerow["rangeaddr"], $rangerow["rangeaddr"] + $rangerow["rangesize"] - 1, "", $custrow["customer"]);
             //subnet (base)
             while ($baserow = $baseresult->Fetchrow()) {
                 $menustring = $menustring . "....|" . htmlspecialchars(inet_ntoa($baserow["baseaddr"]) . " /" . inet_bits($baserow["subnetsize"]) . " (" . $baserow["descrip"] . ")") . "|displaysubnet.php?baseindex=" . $baserow["baseindex"] . "||||\n";
             }
         }
     }
 }
 $mid = new TreeMenu();
 $mid->setDirroot('../menus');
 $mid->setLibjsdir('../menus/libjs/');
 $mid->setImgdir('../menus/menuimages/');
 $mid->setImgwww('../menus/menuimages/');
 $mid->setIcondir('../menus/menuicons/');
 $mid->setIconwww('../menus/menuicons/');
 if (!$menustring) {
     myError($w, $p, my_("No customers"));
 }
 $mid->setMenuStructureString($menustring);
 $mid->setIconsize(16, 16);
 $mid->parseStructureForMenu('treemenu1');
 $mid->newTreeMenu('treemenu1');
 insert($leftmenu, block('<br><br>'));
 insert($leftmenu, block($mid->getTreeMenu('treemenu1')));
Example #13
0
?>
	<!--
		@import url('includes/menu/phplm320/layerstreemenu-hidden.css');
	//-->
	</style>
	<script language='JavaScript' type='text/javascript'>
	<?php 
require_once $phplmDirPath . 'libjs/layersmenu-browser_detection.js';
?>
	</script>
	<script language='JavaScript' type='text/javascript' src='includes/menu/phplm320/libjs/layerstreemenu-cookies.js'></script>
	<?php 
require_once $phplmDirPath . 'lib/PHPLIB.php';
require_once $phplmDirPath . 'lib/layersmenu-common.inc.php';
require_once $phplmDirPath . 'lib/treemenu.inc.php';
$mid = new TreeMenu();
//$mid->setDirroot($myDirPath);
$mid->setLibjsdir($phplmDirPath . 'libjs/');
$mid->setImgdir($phplmDirPath . 'menuimages/');
$mid->setImgwww($phplmDirPath . 'menuimages/');
$mid->setIcondir($phplmDirPath . 'menuicons/');
$mid->setIconwww($phplmDirPath . 'menuicons/');
$menuInvmon = ".|" . TRANS('MNL_INICIO') . "|" . $invDirPath . "abertura.php|" . TRANS('MNL_INICIO_HNT') . "|" . $iconsPath . "gohome.png|centro\n.|" . TRANS('MNL_CAD') . "\n..|" . TRANS('MNL_CAD_EQUIP') . "|" . $invDirPath . "incluir_computador.php||" . $iconsPath . "computador.png|centro\n..|" . TRANS('MNL_CAD_DOC') . "|" . $invDirPath . "documentos.php?action=incluir&cellStyle=true||" . $iconsPath . "contents.png|centro\n..|" . TRANS('MNL_CAD_ESTOQUE') . "|" . $invDirPath . "estoque.php?action=incluir&cellStyle=true||" . $iconsPath . "mouse.png|centro\n.|" . TRANS('MNL_VIS') . "\n..|" . TRANS('MNL_VIS_EQUIP') . "|" . $invDirPath . "mostra_consulta_comp.php||" . $iconsPath . "computador.png|centro\n..|" . TRANS('MNL_VIS_DOC') . "|" . $invDirPath . "documentos.php||" . $iconsPath . "contents.png|centro\n..|" . TRANS('MNL_VIS_ESTOQUE') . "|" . $invDirPath . "estoque.php||" . $iconsPath . "mouse.png|centro\n.|" . TRANS('MNL_CON') . "\n..|" . TRANS('MNL_CON_RAP') . "|" . $invDirPath . "consulta_inv.php||" . $iconsPath . "search.png|centro\n..|" . TRANS('MNL_CON_ESP') . "|" . $invDirPath . "consulta_comp.php||" . $iconsPath . "consulta.png|centro\n..|" . TRANS('MNL_VIS_ESTOQUE') . "|" . $invDirPath . "estoque.php?action=search&cellStyle=true||" . $iconsPath . "mouse.png|centro\n..|" . TRANS('MNL_CON_HIST') . "|\n...|" . TRANS('MNL_CON_HIST_TAG') . "|" . $invDirPath . "consulta_hist_inv.php?from_menu=1||" . $iconsPath . "tag.png|centro\n...|" . TRANS('MNL_CON_HIST_LOCAL') . "|" . $invDirPath . "consulta_hist_local.php|||centro\n.|" . TRANS('MNL_STAT_RELAT') . "|" . $invDirPath . "relatorios.php||" . $iconsPath . "reports.png|centro";
//.|".TRANS('MNL_SENHA']."|".$invDirPath."altera_senha.php||".$iconsPath."password.png|centro";
$mid->setMenuStructureString($menuInvmon);
$mid->setIconsize(16, 16);
$mid->parseStructureForMenu('treemenu1');
//$mid->setTpldir('../../includes/menu/phplm320/templates/');
//$mid->setSelectedItemByUrl('treemenu1', basename(__FILE__));
$menuOcomon = ".|" . TRANS('MNL_INICIO') . "|" . $ocoDirPath . "abertura.php|" . TRANS('MNL_INICIO_HNT') . "|" . $iconsPath . "gohome.png|centro\n.|" . TRANS('MNL_ABRIR') . "|" . $ocoDirPath . "incluir.php||" . $iconsPath . "fone.png|centro\n.|" . TRANS('MNL_CONSULTAR') . "|" . $ocoDirPath . "consultar.php||" . $iconsPath . "consulta.png|centro\n.|" . TRANS('MNL_BUSCA_RAP') . "|" . $ocoDirPath . "alterar.php||" . $iconsPath . "search.png|centro\n.|" . TRANS('MNL_SOLUCOES') . "|" . $ocoDirPath . "consulta_solucoes.php||" . $iconsPath . "solucoes2.png|centro\n.|" . TRANS('MNL_EMPRESTIMOS') . "|" . $ocoDirPath . "emprestimos.php||" . $iconsPath . "emprestimos.png|centro\n.|" . TRANS('MNL_MURAL') . "|" . $ocoDirPath . "avisos.php||" . $iconsPath . "mural.png|centro\n.|" . TRANS('MNL_RELATORIOS') . "|" . $ocoDirPath . "relatorios.php|||centro\n..|SLAs|" . $ocoDirPath . "relatorio_slas_2.php||" . $iconsPath . "sla.png|centro";
//.|".TRANS('MNL_SENHA']."|".$invDirPath."altera_senha.php||".$iconsPath."password.png|centro
 /**
  * @see TreeMenu::loadCache()
  */
 protected function loadCache()
 {
     parent::loadCache();
     WCF::getCache()->addResource('userCPMenu-' . PACKAGE_ID, WCF_DIR . 'cache/cache.userCPMenu-' . PACKAGE_ID . '.php', WCF_DIR . 'lib/system/cache/CacheBuilderUserCPMenu.class.php');
     $this->menuItems = WCF::getCache()->get('userCPMenu-' . PACKAGE_ID);
 }
 - a file-based example with a JavaScript Tree Menu</b>
</div>
</div>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" valign="top">
<div class="normalbox">
<div class="normal">
JavaScript Tree Menu
</div>
<?php 
require_once 'phplm320/lib/PHPLIB.php';
require_once 'phplm320/lib/layersmenu-common.inc.php';
require_once 'phplm320/lib/treemenu.inc.php';
$mid = new TreeMenu();
//$mid->setDirroot('./');
$mid->setLibjsdir('./phplm320/libjs/');
$mid->setImgdir('./phplm320/menuimages/');
$mid->setImgwww('phplm320/menuimages/');
$mid->setIcondir('./phplm320/menuicons/');
$mid->setIconwww('phplm320/menuicons/');
$mid->setMenuStructureFile('phplm320/layersmenu-vertical-1.txt');
$mid->setIconsize(16, 16);
$mid->parseStructureForMenu('treemenu1');
//$mid->setSelectedItemByCount('treemenu1', 7);
$mid->setSelectedItemByUrl('treemenu1', basename(__FILE__));
print $mid->newTreeMenu('treemenu1');
/* alternatively:
$mid->newTreeMenu('treemenu1');
$mid->printTreeMenu('treemenu1');
Example #16
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>TreeMenu</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../piwidata/css/default.css" type="text/css" />
<link rel="stylesheet" href="DynamicTree.css" type="text/css" />
</head>
<body>
<?php 
define('PIWI_URL', '../');
include_once '../Piwi.php';
$menu = new TreeMenu('/');
$menu->add('Archivo');
$menu->add('Archivo/Abrir", "http://google.com');
$menu->add('Archivo/Cerrar');
$menu->add('Archivo/Guardar');
$menu->add('Archivo/Guardar/Guardar como archivo');
$menu->add('Archivo/Guardar/Guardar como PDF');
$menu->add('Editar');
$menu->add('Editar/Copiar');
$menu->add('Editar/Cortar');
$menu->add('Editar/Pegar');
$menu->add('Editar/Pegar/Especial');
$menu->add('Editar/Pegar/Normal');
$menu->add('Ayuda');
$menu->add('Ayuda/Acerca de...');
$menu->show();
?>
</body>
</html>
<b>A file-based example with two JavaScript Tree Menus</b>
</div>
</div>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" valign="top">
<div class="normalbox">
<div class="normal">
A JS Tree Menu
</div>
<?php 
include "lib/PHPLIB.php";
include "lib/layersmenu-common.inc.php";
include "lib/treemenu.inc.php";
$mid = new TreeMenu();
//$mid->setDirroot("./");
////$mid->setLibjsdir("./libjs/");
////$mid->setImgdir("./images/");
//$mid->setImgwww("images/");
$mid->setMenuStructureFile("layersmenu-vertical-1.txt");
$mid->parseStructureForMenu("treemenu1");
print $mid->newTreeMenu("treemenu1");
?>
</div>
<div class="normalbox">
<div class="normal">
Another JS Tree Menu
</div>
<?php 
$mid->setMenuStructureFile("layersmenu-horizontal-1.txt");
 /**
  * @see TreeMenu::loadCache()
  */
 protected function loadCache()
 {
     parent::loadCache();
     WCF::getCache()->addResource('contestMenu', WCF_DIR . 'cache/cache.contestMenu.php', WCF_DIR . 'lib/system/cache/CacheBuilderContestMenu.class.php');
     $this->menuItems = WCF::getCache()->get('contestMenu');
 }