本文整理汇总了PHP中HTML_TreeMenu::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_TreeMenu::addItem方法的具体用法?PHP HTML_TreeMenu::addItem怎么用?PHP HTML_TreeMenu::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_TreeMenu
的用法示例。
在下文中一共展示了HTML_TreeMenu::addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildTree
/**
* A method to return the HTML code needed to display a tree-based
* menu of all the simulations.
*
* @return string A string containing the HTML code needed to display
* the tests in a tree-based menu.
*/
function buildTree()
{
$icon_pkg = "package.png";
// Create the root of the test suite
$menu = new HTML_TreeMenu();
$rootNode = new HTML_TreeNode(array('text' => 'Test Datasets', 'icon' => $icon_pkg, 'link' => 'home.php', 'linkTarget' => 'right'));
// Create the top-level test groups
$aTypes = array('datasets' => 'menu.php');
foreach ($aTypes as $type => $link) {
$nodeName = $type . 'RootNode';
${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type), 'icon' => $icon_pkg, 'link' => $link, 'linkTarget' => "left"));
$list = get_file_list(TD_DATAPATH, '.xml', true);
foreach ($list as $index => $file) {
${$nodeName}->addItem(new HTML_TreeNode(array('text' => $file, 'icon' => $icon_pkg, 'link' => "action.php?&datasetfile={$file}", 'linkTarget' => 'right')));
}
$rootNode->addItem(${$nodeName});
}
$menu->addItem($rootNode);
$tree = new HTML_TreeMenu_DHTML($menu);
$code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css');
$code .= "\n<script>\n";
$code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js');
$code .= "\n</script>";
$code .= $tree->toHTML();
return $code;
}
示例2: array
/**
* draw the Tree-Folder structure
*/
function draw_folders() {
global $c, $lang, $sid;
echo "<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">";
echo "<tr><td >";
echo '<div id="explore" class="sidebar_explore" style="height:400px;">';
// draw the folder here
$icon = 'site_root.gif';
$expandedIcon = 'site_root.gif';
$menu = new HTML_TreeMenu();
$startnode = new HTML_TreeNode(array (
'text' => $lang->get("website", "Website"),
'link' => $this->action . "?sid=$sid&pnode=0",
'icon' => $icon,
'expandedIcon' => $expandedIcon,
isDynamic => true,
'defaultClass' => "treemenu"
));
$this->buildSitemap($startnode, "0");
$menu->addItem($startnode);
$treeMenu = new HTML_TreeMenu_DHTML($menu, array (
'images' => $c["docroot"] . 'api/userinterface/tree/images',
'defaultClass' => "treemenu"
), true);
$treeMenu->printMenu();
echo '</div>';
echo '</td></tr>';
echo "</table>";
}
示例3: array
function list_action()
{
//$this->tree->rebuild_tree(1,1);
$icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif';
$menu = new HTML_TreeMenu();
$this->_last_node = null;
$rnode = $this->_array_recurse($this->tree->tree);
$menu->addItem($rnode);
$treeMenu = new HTML_TreeMenu_DHTML($menu, array('images' => 'images', 'defaultClass' => 'treeMenuDefault'));
$this->assign("tree_html", $treeMenu->toHTML());
return $this->fetch($GLOBALS['template_dir'] . "document_categories/" . $this->template_mod . "_list.html");
}
示例4: buildTree
/**
* A method to return the HTML code needed to display a tree-based
* menu of all the simulations.
*
* @return string A string containing the HTML code needed to display
* the tests in a tree-based menu.
*/
function buildTree()
{
$menu = new HTML_TreeMenu();
$rootNode = new HTML_TreeNode(array('text' => 'OpenX Developer Toolbox', 'icon' => '', 'link' => 'action.php?action=index', 'linkTarget' => 'right'));
$aItems[] = array('title' => 'Plugins', 'action' => 'about&item=plugins', 'children' => array(0 => array('title' => 'New Plugin', 'action' => 'create_plugin')));
$aItems[] = array('title' => 'Schemas', 'action' => 'about&item=schema', 'children' => array(0 => array('title' => 'Schema Editor', 'action' => 'schema_editor'), 1 => array('title' => 'Changeset Archives', 'action' => 'schema_changesets')));
$aItems[] = array('title' => 'Core Schema Utilities', 'action' => 'about&item=core_utils', 'children' => array(0 => array('title' => 'Integrity Check', 'action' => 'schema_integ'), 1 => array('title' => 'Dump Data', 'action' => 'schema_datadump'), 2 => array('title' => 'Load Data', 'action' => 'schema_dataload')));
$aItems[] = array('title' => 'Schema Analysis', 'action' => 'schema_analysis');
// Generate DataObjects
$aDataObjects[] = array('title' => 'OpenX Core', 'action' => 'generate_dataobjects');
$plugins = $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'];
foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) {
$schema = strtolower($name);
$aDataObjects[] = array('title' => $name, 'action' => "generate_dataobjects&schema={$plugins}{$name}/etc/tables_{$schema}.xml&dbopath={$plugins}{$name}/etc/DataObjects");
}
$aItems[] = array('title' => 'Generate DataObjects', 'action' => 'about&item=dataobjects', 'children' => $aDataObjects);
// Upgrade Packages
$aPackages[] = array('title' => 'New Core Upgrade Package', 'action' => 'upgrade_package&name=OpenXCore');
foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) {
$aPackages[] = array('title' => $name, 'action' => 'upgrade_package&name=' . $name);
}
$aItems[] = array('title' => 'Upgrade Packages', 'action' => 'about&item=upgrade_packages', 'children' => $aPackages);
// Upgrade Packages Array
$aUpgrades[] = array('title' => 'OpenX Core', 'action' => 'upgrade_array&read=/etc/changes&write=/etc/changes/openads_upgrade_array.txt');
foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) {
$aUpgrades[] = array('title' => $name, 'action' => "upgrade_array&read={$plugins}{$name}/etc/changes&write={$plugins}{$name}/etc/changes/{$name}_upgrade_array.txt");
}
$aItems[] = array('title' => 'Upgrade Packages Array', 'action' => 'about&item=upgrade_array', 'children' => $aUpgrades);
foreach ($aItems as $aItem) {
$newNode =& $rootNode->addItem(new HTML_TreeNode(array('text' => $aItem['title'], 'icon' => 'package.png', 'link' => 'action.php?action=' . $aItem['action'], 'linkTarget' => 'right')));
if (isset($aItem['children'])) {
foreach ($aItem['children'] as $aChild) {
$newNode->addItem(new HTML_TreeNode(array('text' => $aChild['title'], 'icon' => 'Method.png', 'link' => 'action.php?action=' . $aChild['action'], 'linkTarget' => 'right')));
}
}
}
$menu->addItem($rootNode);
$options = array('images' => 'assets/images');
$tree = new HTML_TreeMenu_DHTML($menu, $options);
$code = file_get_contents(PATH_ASSETS . '/css/menu.css');
$code .= "\n<script>\n";
$code .= file_get_contents(PATH_ASSETS . '/js/TreeMenu.js');
$code .= "\n</script>";
$code .= $tree->toHTML();
return $code;
}
示例5: buildTree
/**
* A method to return the HTML code needed to display a tree-based
* menu of all the OpenX tests.
*
* @return string A string containing the HTML code needed to display
* the tests in a tree-based menu.
*/
function buildTree()
{
preg_match('/^(\\d+\\.\\d+)/', VERSION, $aMatches);
// Create the root of the test suite
$menu = new HTML_TreeMenu();
$rootNode = new HTML_TreeNode(array('text' => PRODUCT_NAME . ' ' . $aMatches[1] . ' Tests', 'icon' => "package.png"));
// Create the top-level test groups
foreach ($GLOBALS['_MAX']['TEST']['groups'] as $type) {
$nodeName = $type . 'RootNode';
${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type) . ' Test Suite', 'icon' => "package.png", 'link' => "run.php?type={$type}&level=all", 'linkTarget' => "right"));
$structure = TestFiles::getAllTestFiles($type);
foreach ($structure as $layerCode => $folders) {
$firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $GLOBALS['_MAX']['TEST'][$type . '_layers'][$layerCode][0], 'icon' => "package.png", 'link' => "run.php?type={$type}&level=layer&layer={$layerCode}", 'linkTarget' => 'right')));
foreach ($folders as $folder => $files) {
if (count($files)) {
$secondNode =& $firstNode->addItem(new HTML_TreeNode(array('text' => $folder, 'icon' => "class_folder.png", 'link' => "run.php?type={$type}&level=folder&layer={$layerCode}&folder={$folder}", 'linkTarget' => 'right')));
}
foreach ($files as $index => $file) {
$secondNode->addItem(new HTML_TreeNode(array('text' => $file, 'icon' => "Method.png", 'link' => "run.php?type={$type}&level=file&layer={$layerCode}&folder={$folder}&file={$file}", 'linkTarget' => 'right')));
}
}
}
$rootNode->addItem(${$nodeName});
}
/**
* @TODO Clean up the following code to ensure that adding new
* PEAR PHPUnit tests to the test suite is easier!
*/
// Create the PEAR PHPUnit tests
$nodeName = 'PearRootNode';
${$nodeName} = new HTML_TreeNode(array('text' => 'PEAR PHPUnit Test Suite', 'icon' => "package.png", 'link' => "", 'linkTarget' => "right"));
$firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => 'PEAR::MDB2', 'icon' => "package.png", 'link' => "run.php?type=phpunit&dir=../lib/pear/MDB2/tests", 'linkTarget' => 'right')));
$firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => 'PEAR::MDB2_Schema', 'icon' => "package.png", 'link' => "run.php?type=phpunit&dir=../lib/pear/MDB2_Schema/tests", 'linkTarget' => 'right')));
$rootNode->addItem(${$nodeName});
// Add the root node to the menu, and return the HTML code
$menu->addItem($rootNode);
$tree = new HTML_TreeMenu_DHTML($menu);
$code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css');
$code .= "\n<script>\n";
$code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js');
$code .= "\n</script>";
$code .= $tree->toHTML();
return $code;
}
示例6: array
<?php
/**
Map a filesystem with HTML TreeMenu
@author Tomas V.V.Cox <cox@idecnet.com>
*/
require_once '../HTML_TreeMenu/TreeMenu.php';
$map_dir = '.';
$menu = new HTML_TreeMenu('menuLayer', 'images', '_self');
$menu->addItem(recurseDir($map_dir));
function &recurseDir($path)
{
if (!($dir = opendir($path))) {
return false;
}
$files = array();
$node = new HTML_TreeNode(basename($path), basename($path), 'folder.gif');
while (($file = readdir($dir)) !== false) {
if ($file != '.' && $file != '..') {
if (@is_dir("{$path}/{$file}")) {
$addnode =& recurseDir("{$path}/{$file}");
} else {
$addnode = new HTML_TreeNode($file, $file, 'document2.png');
}
$node->addItem($addnode);
}
}
closedir($dir);
return $node;
}
?>
示例7: manage_category
function manage_category()
{
global $hesk_settings, $hesklang;
$catid = intval(hesk_GET('catid')) or hesk_error($hesklang['kb_cat_inv']);
$result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'kb_categories` ORDER BY `parent` ASC, `cat_order` ASC');
$kb_cat = array();
while ($cat = hesk_dbFetchAssoc($result)) {
$kb_cat[] = $cat;
if ($cat['id'] == $catid) {
$this_cat = $cat;
}
}
if (isset($_SESSION['manage_cat'])) {
$_SESSION['manage_cat'] = hesk_stripArray($_SESSION['manage_cat']);
$this_cat['type'] = $_SESSION['manage_cat']['type'];
$this_cat['parent'] = $_SESSION['manage_cat']['parent'];
$this_cat['name'] = $_SESSION['manage_cat']['title'];
}
/* Translate main category "Knowledgebase" if needed */
$kb_cat[0]['name'] = $hesklang['kb_text'];
require HESK_PATH . 'inc/treemenu/TreeMenu.php';
$icon = HESK_PATH . 'img/folder.gif';
$expandedIcon = HESK_PATH . 'img/folder-expanded.gif';
$menu = new HTML_TreeMenu();
$thislevel = array('0');
$nextlevel = array();
$i = 1;
$j = 1;
while (count($kb_cat) > 0) {
foreach ($kb_cat as $k => $cat) {
if (in_array($cat['parent'], $thislevel)) {
$up = $cat['parent'];
$my = $cat['id'];
$type = $cat['type'] ? '*' : '';
$text_short = $cat['name'] . $type . ' (' . $cat['articles'] . ', ' . $cat['articles_private'] . ', ' . $cat['articles_draft'] . ')';
if (isset($node[$up])) {
$node[$my] =& $node[$up]->addItem(new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true)));
} else {
$node[$my] = new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true));
}
$nextlevel[] = $cat['id'];
$j++;
unset($kb_cat[$k]);
}
}
$thislevel = $nextlevel;
$nextlevel = array();
/* Break after 20 recursions to avoid hang-ups in case of any problems */
if ($i > 20) {
break;
}
$i++;
}
$menu->addItem($node[1]);
// Create the presentation class
$listBox =& ref_new(new HTML_TreeMenu_Listbox($menu));
/* Print header */
require_once HESK_PATH . 'inc/header.inc.php';
/* Print main manage users page */
require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
?>
<div class="container manage-kb-category-title"><a href="manage_knowledgebase.php" class="smaller"><b><?php
echo $hesklang['kb'];
?>
</b></a> > <?php
echo $hesklang['kb_cat_man'];
?>
</div>
<!-- SUB NAVIGATION -->
<?php
show_subnav('', $catid);
?>
<!-- SUB NAVIGATION -->
<?php
if (!isset($_SESSION['hide']['article_list'])) {
?>
<div class="container category-kb"><?php
echo $hesklang['category'];
?>
: <span class="black"><?php
echo $this_cat['name'];
?>
</span></div>
<br />
<?php
$result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' ORDER BY `sticky` DESC, `art_order` ASC");
$num = hesk_dbNumRows($result);
if ($num == 0) {
echo '<div class="container kb_no_article">' . $hesklang['kb_no_art'] . ' <br/><br/>
<a href="manage_knowledgebase.php?a=add_article&catid=' . $catid . '"><img src="../img/add_article.png" width="16" height="16" alt="' . $hesklang['kb_i_art2'] . '" title="' . $hesklang['kb_i_art2'] . '" border="0" style="border:none;vertical-align:text-bottom" /></a>' . '<a href="manage_knowledgebase.php?a=add_article&catid=' . $catid . '"><b>' . $hesklang['kb_i_art2'] . '</b></a></div>';
} else {
/* Get number of sticky articles */
$res2 = hesk_dbQuery("SELECT COUNT(*) FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' AND `sticky` = '1' ");
//.........这里部分代码省略.........
示例8: displayMenuRecords
function displayMenuRecords()
{
global $_CONF, $_TABLES, $CONF_NEXMENU, $LANG_NEXMENU01, $LANG_NEXMENU02, $menulocation;
global $statusmsg, $imagesdir, $folder_icon, $showdisabled, $idCurrent, $LANG_NEXMENU04;
include $_CONF['path_system'] . 'classes/navbar.class.php';
require_once $_CONF['path_system'] . 'nexpro/classes/TreeMenu.php';
$menu = new HTML_TreeMenu();
$mquery = DB_query("SELECT id,pid,label,menuorder, menutype, is_enabled from {$_TABLES['nexmenu']} WHERE pid='0' AND location='{$menulocation}' ORDER BY menuorder");
$menuOrd = 10;
$stepNumber = 10;
while (list($id, $pid, $label, $order, $menutype, $enabled) = DB_fetchARRAY($mquery)) {
/* Re-order any Offer or Stories that may have just been moved */
if ($order != $menuOrd) {
DB_query("UPDATE {$_TABLES['nexmenu']} SET menuorder = '{$menuOrd}' WHERE id = '{$id}'");
}
$menuOrd += $stepNumber;
if ($enabled == '1' or $showdisabled == '1' and $enabled == '0') {
$icon = $CONF_NEXMENU['icons'][$menutype];
if ($idCurrent == $id) {
$label = '<span class="treeMenuSelected">' . $label . '</span>';
} elseif ($enabled == '0') {
$label = '<span class="treeMenuDisabled">' . $label . '</span>';
}
$node[$id] = new HTML_TreeNode(array('text' => $label, 'link' => $_CONF['site_admin_url'] . "/plugins/nexmenu/index.php?op=display&id={$id}&showdisabled={$showdisabled}&menulocation={$menulocation}", 'icon' => $icon));
recursive_node($node[$id], $id);
$menu->addItem($node[$id]);
}
}
$treeMenu =& new HTML_TreeMenu_DHTML($menu, array('images' => $imagesdir, 'defaultClass' => 'treeMenuDefault', 'usePersistance' => true));
$mainview = new Template($_CONF['path_layout'] . 'nexmenu/admin');
$mainview->set_file(array('mainview' => 'mainview.thtml'));
$mainview->set_var('site_url', $_CONF['site_url']);
if ($statusmsg != '') {
$mainview->set_var('showalert', '');
} else {
$mainview->set_var('showalert', 'none');
}
$mainview->set_var('statusmsg', $statusmsg);
$mainview->set_var('imgset', $_CONF['layout_url'] . '/nexmenu/images/admin');
if ($showdisabled == '1') {
$mainview->set_var('chk_enabled', 'CHECKED');
} else {
$mainview->set_var('chk_disabled', 'CHECKED');
}
if ($statusmsg != '') {
$mainview->set_var('statusmsg', $statusmsg);
}
if ($CONF_NEXMENU['load_HTMLTree']) {
$javascript = "<script language=JavaScript src=\"{$_CONF['site_url']}/nexmenu/javascript/TreeMenu.js\" type=\"text/javascript\"></script>";
$mainview->set_var('include_javascript', $javascript);
}
$scripturl = $_CONF['site_admin_url'] . '/plugins/nexmenu/index.php';
$navbar = new navbar();
$navbar->add_menuitem($LANG_NEXMENU04['1'], $scripturl . "?menulocation=header&showdisabled={$showdisabled}");
$navbar->add_menuitem($LANG_NEXMENU04['2'], $scripturl . "?menulocation=block&showdisabled={$showdisabled}");
$navbar->add_menuitem($LANG_NEXMENU04['3'], $scripturl . "?op=addaction&id={$idCurrent}&menulocation={$menulocation}&showdisabled={$showdisabled}");
$navbar->add_menuitem($LANG_NEXMENU04['6'], $scripturl . "?op=config&menulocation=block&showdisabled={$showdisabled}");
if ($menulocation == 'block') {
$navbar->set_selected($LANG_NEXMENU04['2']);
$mainview->set_var('navbar', $navbar->generate());
$mainview->set_var('location', 'block');
} else {
$navbar->set_selected($LANG_NEXMENU04['1']);
$mainview->set_var('navbar', $navbar->generate());
$mainview->set_var('location', 'header');
}
$mainview->set_var('LANG_OPTIONS', $LANG_NEXMENU01['LANG_OPTIONS']);
$mainview->set_var('LANG_ADD', $LANG_NEXMENU01['LANG_ADD']);
$mainview->set_var('LANG_HEADING1', $LANG_NEXMENU01['LANG_HEADING1']);
$mainview->set_var('treemenu', $treeMenu->toHTML());
$filteroptions = '<option value=\'block\' ';
$filteroptions .= $menulocation == 'block' ? 'SELECTED' : '';
$filteroptions .= '>Block Menu Items</option><option value=\'header\' ';
$filteroptions .= $menulocation == 'header' ? 'SELECTED' : '';
$filteroptions .= '>Header Menu Items</option>';
$mainview->set_var('filteroptions', $filteroptions);
if ($idCurrent == 0 or DB_getItem($_TABLES['nexmenu'], "location", "id='{$idCurrent}'") != $menulocation) {
$mainview->set_var('showdiv', 'none');
$mainview->set_var('LANG_edithelp', $LANG_NEXMENU01['LANG_EditHelp']);
} else {
$mainview->set_var('show_itemhelp', 'none');
$mainview->set_var('LANG_HEADING2', $LANG_NEXMENU01['LANG_HEADING2']);
$query = DB_query("SELECT pid, menutype, menuorder, label, url, grp_access, is_enabled FROM {$_TABLES['nexmenu']} WHERE id={$idCurrent}");
list($pid, $menutype, $order, $label, $url, $grp_id, $is_enabled) = DB_fetchArray($query);
$chk1 = $is_enabled == 1 ? ' checked' : '';
if ($pid == 0) {
$parent = $LANG_NEXMENU01['LANG_TopLevelMenu'];
} else {
$parent = DB_getItem($_TABLES['nexmenu'], "label", "id={$pid}");
}
if (trim($url) == '') {
$url = 'Not Defined';
}
$mainview->set_var('showurl', $menutype == 3 ? 'none' : '');
$mainview->set_var('id', $idCurrent);
$mainview->set_var('location', $menulocation);
$mainview->set_var('label', stripslashes($label));
$mainview->set_var('parent', $parent);
$mainview->set_var('url', substr($url, 0, 40));
$mainview->set_var('full_url', $url);
//.........这里部分代码省略.........
示例9: displaydir
//.........这里部分代码省略.........
if (!empty($repodir->folders)) {
foreach ($repodir->folders as $folder) {
$dirlist[] = $folder;
}
}
if (!empty($repodir->files)) {
foreach ($repodir->files as $file) {
$filelist[] = $file;
}
}
echo '<form action="index.php" method="post" name="reposearch">';
echo '<input type="hidden" name="choose" value="' . $choose . '" />';
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />";
echo "<input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />";
echo "<input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />";
echo "<input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />";
echo "<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" /> ";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />";
echo '<center>';
echo '<input type="text" name="search" size="40" value="' . s($search) . '" /> ';
echo '<input type="submit" value="' . get_string('search') . '" />';
helpbutton('search', get_string('alfrescosearch', 'repository_alfresco'), 'block_repository');
echo '</center><br />';
if ($cats = $repo->category_get_children(0)) {
$baseurl = $CFG->wwwroot . '/file/repository/index.php?choose=' . $choose . '&id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=' . $wdir . '&uuid=' . $uuid;
$catfilter = repository_alfresco_get_category_filter();
$icon = 'folder.gif';
$eicon = 'folder-expanded.gif';
$menu = new HTML_TreeMenu();
$tnodes = array();
if ($cats = $repo->category_get_children(0)) {
if ($nodes = repository_alfresco_make_category_select_tree_browse($cats, $catselect, $baseurl)) {
for ($i = 0; $i < count($nodes); $i++) {
$menu->addItem($nodes[$i]);
}
}
}
$treemenu = new HTML_TreeMenu_DHTML($menu, array('images' => $CFG->wwwroot . '/lib/HTML_TreeMenu-1.2.0/images'));
// Add roll up - roll down code here, similar to Show Advanced in course/modedit
// Advanced Search/Hide Advanced Search
// "category filter" now has help text - so, how to add that too, but use yui library
// for hiding this
echo '<script language="JavaScript" type="text/javascript">';
echo "<!--\n";
include $CFG->libdir . '/HTML_TreeMenu-1.2.0/TreeMenu.js';
echo "\n// -->";
echo '</script>';
print_simple_box_start('center', '75%');
//looks for search.html file and gets text alfrescosearch from repository_alfresco lang file which I guess we use too...
// now hmmm, so where does search.html go? or in our case, categoryfilter.html, I guess repository/alfresco
print_heading(helpbutton('categoryfilter', get_string('alfrescocategoryfilter', 'block_repository'), 'block_repository', true, false, null, true) . get_string('categoryfilter', 'block_repository') . ':', 'center', '3');
$treemenu->printMenu();
echo '<br />';
print_simple_box_end();
}
echo '</form>';
echo '<center>';
print_single_button('index.php', array('id' => $id, 'shared' => $shared, 'oid' => $oid, 'userid' => $userid, 'uuid' => $uuid), get_string('showall'), 'get');
echo '</center>';
if ($canedit) {
echo "<form action=\"index.php\" method=\"post\" name=\"dirform\" id=\"dirform\">";
echo '<input type="hidden" name="choose" value="' . $choose . '" />';
}
echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" class=\"files\">";
echo "<tr>";
示例10: initializate
$pd = substr(PHP_OS, 0, 3) == 'WIN' ? '\\' : '/';
$test = $pd == '/' ? '/' : 'C:\\';
if (empty($filename) || $filename == $test) {
$filename = $pd == '/' ? '/' : 'C:\\';
$node = false;
getDir($filename, $node);
} else {
flush();
// if ($pd != '/') $pd = $pd.$pd;
$anode = false;
switchDirTree($filename, $anode);
// recurseDir($filename,$anode);
$node = new HTML_TreeNode(array('text' => "Click to view " . addslashes($filename), 'link' => "", 'icon' => 'branchtop.gif'));
$node->addItem($anode);
}
$menu->addItem($node);
if ('@WEB-DIR@' != '@' . 'WEB-DIR@') {
$DHTMLmenu =& new HTML_TreeMenu_DHTML($menu, array('images' => '../HTML_TreeMenu-1.1.2/images'));
} else {
$DHTMLmenu =& new HTML_TreeMenu_DHTML($menu, array('images' => str_replace('/docbuilder/file_dialog.php', '', $_SERVER['PHP_SELF']) . '/HTML_TreeMenu-1.1.2/images'));
}
?>
<script type="text/javascript" language="Javascript">
/**
Creates some global variables
*/
function initializate() {
//
//The "platform independent" newLine
//
//Taken from http://developer.netscape.com/docs/manuals/communicator/jsref/brow1.htm#1010426
示例11: elseif
/**
* Creates a DHTML menu of serendipity categories.
*
* The menu is echoed out.
*
* @param string $title (Serves as the top level menu item if present)
* @return void
* @see http://pear.php.net/HTML_TreeMenu PEAR::HTML_TreeMenu
*/
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
// may want to put this in bundled_libs or a sub directory of this directory
$pear = false;
if (@(include_once 'HTML/TreeMenu.php')) {
$pear = true;
} elseif (@(include_once 'HTML_TreeMenu/TreeMenu.php')) {
$pear = true;
}
if ($pear) {
$which_category = $this->get_config('authorid');
// build an accessible array of categories
foreach (serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category) as $cat) {
if (!is_array($cat) || !isset($cat['categoryid'])) {
continue;
}
$categories[$cat['categoryid']] = $cat;
}
// create an array of numbers of entries per category
$cat_count = array();
if (serendipity_db_bool($this->get_config('show_count'))) {
$cat_sql = "SELECT c.categoryid, c.category_name, count(e.id) as postings\n FROM {$serendipity['dbPrefix']}entrycat ec,\n {$serendipity['dbPrefix']}category c,\n {$serendipity['dbPrefix']}entries e\n WHERE ec.categoryid = c.categoryid\n AND ec.entryid = e.id\n AND e.isdraft = 'false'\n " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e.timestamp <= " . serendipity_db_time() : '') . "\n GROUP BY c.categoryid, c.category_name\n ORDER BY postings DESC";
$category_rows = serendipity_db_query($cat_sql);
if (is_array($category_rows)) {
foreach ($category_rows as $cat) {
$cat_count[$cat['categoryid']] = $cat['postings'];
}
}
}
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
$image = $image == "'none'" || $image == 'none' ? '' : $image;
// create nodes
foreach ($categories as $cid => $cat) {
if (function_exists('serendipity_categoryURL')) {
$link = serendipity_categoryURL($cat, 'serendipityHTTPPath');
} else {
$link = serendipity_rewriteURL(PATH_CATEGORIES . '/' . serendipity_makePermalink(PERM_CATEGORIES, array('id' => $cat['categoryid'], 'title' => $cat['category_name'])), 'serendipityHTTPPath');
}
if (!empty($cat_count[$cat['categoryid']])) {
// $categories[$cid]['true_category_name'] = $cat['category_name'];
$cat['category_name'] .= ' (' . $cat_count[$cat['categoryid']] . ')';
// $categories[$cid]['article_count'] = $cat_count[$cat['categoryid']];
}
if (!empty($image)) {
$feedURL = serendipity_feedCategoryURL($cat, 'serendipityHTTPPath');
$feed = '<a class="serendipity_xml_icon" href="' . $feedURL . '"><img src="' . $image . '" alt="XML" style="border: 0px;vertical-align:middle"/></a> ';
$link = '<a href="' . $link . '" target="_self"><span>' . $cat['category_name'] . '</span></a>';
// work around a problem in HTML_TreeNode: when there is a href in 'text', 'link' is not converted to a link.
$cat_nodes[$cat['categoryid']] = new HTML_TreeNode(array('text' => $feed . $link));
} else {
$cat_nodes[$cat['categoryid']] = new HTML_TreeNode(array('text' => $feed . $cat['category_name'], 'link' => $link));
}
}
// create a top level for "all categories"
// this serves as the title
$cat_nodes[0] = new HTML_TreeNode(array('text' => ALL_CATEGORIES, 'link' => $serendipity['baseURL']));
// nest nodes (thanks to PHP references)
foreach ($categories as $category) {
$cat_nodes[$category['parentid']]->addItem($cat_nodes[$category['categoryid']]);
}
// nest the "all categories" category
$menu = new HTML_TreeMenu();
$menu->addItem($cat_nodes[0]);
$tree = new HTML_TreeMenu_DHTML($menu, array('images' => $serendipity['baseURL'] . $this->get_config('image_path')));
// Add heading for block
#$output = '<h2 class="serendipitySideBarTitle" style="font-weight: bold;">'.$title.'</h2><br />';
// Put inside a div with "overflow:hidden" to avoid items of the sidebar plugin running outside the blog
// Maybe we can put a config setting to choose if the block should be displayed with or without overflow setting.
$output .= '<div style="overflow: hidden;">';
$output .= $tree->toHTML();
$output .= '</div>';
echo '<script type="text/javascript" src="' . $serendipity['baseURL'] . $this->get_config('script_path') . '"></script>';
} else {
$output .= "Please install PEAR package HTML_TreeMenu to enable this plugin.";
}
echo $output;
}
示例12: array
/// Get (or create) the array of category IDs that are already selected in the filter.
$catfilter = repository_alfresco_get_category_filter();
print_simple_box_start('center', '75%');
echo '<form method="post" action="' . $CFG->wwwroot . '/file//repository/alfresco/config-categories.php">';
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
echo '<center>';
echo '<input type="submit" name="reset" value="' . get_string('resetcategories', 'repository_alfresco') . '" /><br />' . get_string('resetcategoriesdesc', 'repository_alfresco') . '<br /><br />';
if ($categories = $repo->category_get_children(0)) {
echo '<input type="button" value="' . get_string('selectall') . '" onclick="checkall();" />';
echo ' <input type="button" value="' . get_string('deselectall') . '" onclick="checknone();" /><br />';
echo '<input type="submit" value="' . get_string('savechanges') . '" />';
echo '</center><br />';
if ($nodes = repository_alfresco_make_category_select_tree_choose($categories, $catfilter)) {
$menu = new HTML_TreeMenu();
for ($i = 0; $i < count($nodes); $i++) {
$menu->addItem($nodes[$i]);
}
$treemenu =& new HTML_TreeMenu_DHTML($menu, array('images' => $CFG->wwwroot . '/lib/HTML_TreeMenu-1.2.0/images'));
echo '<script language="JavaScript" type="text/javascript">';
echo "<!--\n";
include $CFG->libdir . '/HTML_TreeMenu-1.2.0/TreeMenu.js';
echo "\n// -->";
echo '</script>';
$treemenu->printMenu();
}
echo '<center><br />';
echo '<input type="button" value="' . get_string('selectall') . '" onclick="checkall();" />';
echo ' <input type="button" value="' . get_string('deselectall') . '" onclick="checknone();" /><br />';
echo '<input type="submit" value="' . get_string('savechanges') . '" /> ' . close_window_button('closewindow', true);
} else {
print_heading(get_string('nocategoriesfound', 'repository_alfresco'));
示例13: displayPages
function displayPages($catid)
{
global $_CONF, $CONF_SE, $_TABLES, $statusmsg, $type, $LANG_SE02;
$menu = new HTML_TreeMenu();
if ($catid != 0) {
$parentCatid = DB_getItem($_TABLES['nexcontent_pages'], 'pid', "id='{$catid}'");
$node[0] = new HTML_TreeNode(array('text' => 'up one level', 'link' => $_CONF['site_admin_url'] . "/plugins/nexcontent/index.php?catid={$parentCatid}", 'icon' => 'folder.gif'));
$menu->addItem($node[0]);
$label = DB_getItem($_TABLES['nexcontent_pages'], 'name', "id='{$catid}'");
$psql = "SELECT id FROM {$_TABLES['nexcontent_pages']} WHERE pid='{$catid}' AND (type='page' OR type='link')";
$psql .= COM_getPermSQL('AND');
$psql .= ' ORDER BY pageorder, id asc';
$pquery = DB_query($psql);
$numpages = DB_numRows($pquery);
if ($numpages > 0) {
$label = $label . ' (' . $numpages . ')';
}
$label = '<span class="treeMenuSelected">' . $label . '</span>';
$node[$catid] = new HTML_TreeNode(array('text' => $label, 'link' => $_CONF['site_admin_url'] . "/plugins/nexcontent/index.php?catid=" . $catid, 'icon' => 'folder.gif'));
nexcontent_recursiveView($node[$catid], $catid);
$menu->addItem($node[$catid]);
} else {
$msql = "SELECT id,pid,name,pageorder from {$_TABLES['nexcontent_pages']} WHERE pid='0' and type='category'";
$msql .= COM_getPermSQL('AND');
$msql .= ' ORDER BY pageorder, id asc';
$mquery = DB_QUERY($msql);
while (list($id, $category, $name, $order) = DB_fetchARRAY($mquery)) {
//echo "<br>id:$id, cat: $category, name:$name, order:$order";
if ($catid != 0 and $catid == $id) {
$name = '<span class="treeMenuSelected">' . $name . '</span>';
}
$pquery = DB_query("SELECT id FROM {$_TABLES['nexcontent_pages']} WHERE pid='{$id}' AND (type='page' OR type='link')");
$numpages = DB_numRows($pquery);
if ($numpages > 0) {
$name = $name . ' (' . $numpages . ')';
}
$node[$id] = new HTML_TreeNode(array('text' => $name, 'link' => $_CONF['site_admin_url'] . "/plugins/nexcontent/index.php?catid=" . $id, 'icon' => 'folder.gif'));
nexcontent_recursiveView($node[$id], $id);
$menu->addItem($node[$id]);
}
}
$treeMenu =& new HTML_TreeMenu_DHTML($menu, array('images' => $_CONF['layout_url'] . '/nexpro/images/treemenu', 'defaultClass' => 'treeMenuDefault'));
$q = DB_query("SELECT id,name from {$_TABLES['nexcontent_pages']} WHERE type='category' ORDER BY id");
$selCategories = '<option value="0">Top Level</option>' . LB;
$selCategories .= nexcontent_getFolderList($catid);
/* Retrieve all the pages for the selected category */
$sql = "SELECT id,sid,pageorder,name,hits,type,menutype,submenu_item,is_draft FROM {$_TABLES['nexcontent_pages']} WHERE pid='{$catid}' or id='{$catid}'";
$sql .= COM_getPermSQL('AND');
//$sql .= ' ORDER by type, pid,pageorder';
$sql .= ' ORDER by pid,pageorder';
$query = DB_query($sql);
$mainview = new Template($_CONF['path_layout'] . 'nexcontent/admin');
$mainview->set_file(array('mainview' => 'pageview.thtml', 'msgline' => 'alertline.thtml', 'records' => 'pagerecords.thtml'));
$mainview->set_var('navbar', nexcontent_showNavbar($LANG_SE02['1']));
$mainview->set_var('type', $type);
$mainview->set_var('catid', $catid);
$mainview->set_var('folderview', $treeMenu->toHTML());
$mainview->set_var('phpself', $_SERVER['PHP_SELF']);
if ($statusmsg != '') {
$mainview->set_var('alertmsg', $statusmsg);
} else {
$mainview->set_var('alertmsg', '');
$mainview->set_var('msgmode', 'none');
}
$mainview->set_var('filteroptions', $selCategories);
$mainview->parse('alertline', 'msgline', true);
$mainview->set_var('HEADING1', 'ID');
$mainview->set_var('HEADING2', 'Name');
$mainview->set_var('HEADING3', 'Hits');
$mainview->set_var('HEADING4', 'Menu Type');
$mainview->set_var('HEADING5', 'Draft');
$mainview->set_var('HEADING6', 'Action');
$mainview->set_var('imgset', $CONF_SE['public_url'] . '/images');
$mainview->set_var('site_url', $_CONF['site_url']);
$mainview->set_var('site_admin_url', $_CONF['site_admin_url']);
$mainview->set_var('layout_url', $_CONF['layout_url']);
$mainview->set_var('nexcontent_url', $CONF_SE['public_url']);
$i = 1;
$currentCategory = '';
$pageOrd = 10;
$stepNumber = 10;
while (list($id, $sid, $order, $name, $hits, $type, $menutype, $submenu, $is_draft) = DB_fetchArray($query)) {
if ($type == 'page' and $currentCategory != $category) {
$pageOrd = 10;
$currentCategory = $category;
}
if ($id != $catid and $order != $pageOrd) {
DB_query("UPDATE {$_TABLES['nexcontent_pages']} SET pageorder = '{$pageOrd}' WHERE id = '{$id}'");
$order = $pageOrd;
}
$pageOrd += $stepNumber;
$check1 = $submenu >= 1 ? ' CHECKED' : '';
$check2 = $is_draft == 1 ? ' CHECKED' : '';
if ($type == 'category') {
$mainview->set_var('pagelink', "{$_CONF['site_admin_url']}/plugins/nexcontent/index.php?catid={$id}");
$mainview->set_var('pageimage', '<img src="' . $_CONF['layout_url'] . '/nexcontent/images/admin/sitecategory.gif">');
$editop = 'editCategory';
} else {
if ($type == 'link') {
$mainview->set_var('pagelink', "{$_CONF['site_admin_url']}/plugins/nexcontent/index.php?op=editLink&pageid={$id}");
//.........这里部分代码省略.........
示例14: array
function list_action($patient_id = "")
{
$this->_last_node = null;
$categories_list = $this->tree->_get_categories_array($patient_id);
//print_r($categories_list);
$menu = new HTML_TreeMenu();
$rnode = $this->_array_recurse($this->tree->tree, $categories_list);
$menu->addItem($rnode);
$treeMenu =& new HTML_TreeMenu_DHTML($menu, array('images' => 'images', 'defaultClass' => 'treeMenuDefault'));
$treeMenu_listbox =& new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self'));
$this->assign("tree_html", $treeMenu->toHTML());
return $this->fetch($GLOBALS['template_dir'] . "documents/" . $this->template_mod . "_list.html");
}
示例15: createFromStructure
/**
* Import method for creating HTML_TreeMenu objects/structures
* out of existing tree objects/structures. Currently supported
* are Wolfram Kriesings' PEAR Tree class, and Richard Heyes' (me!)
* Tree class (available here: http://www.phpguru.org/). This
* method is intended to be used statically, eg:
* $treeMenu = &HTML_TreeMenu::createFromStructure($myTreeStructureObj);
*
* @param array $params An array of parameters that determine
* how the import happens. This can consist of:
* structure => The tree structure
* type => The type of the structure, currently
* can be either 'heyes' or 'kriesing'
* nodeOptions => Default options for each node
*
* @return object The resulting HTML_TreeMenu object
*/
function createFromStructure($params)
{
if (!isset($params['nodeOptions'])) {
$params['nodeOptions'] = array();
}
switch (@$params['type']) {
/**
* Wolfram Kriesings' PEAR Tree class
*/
case 'kriesing':
$className = strtolower(get_class($params['structure']->dataSourceClass));
$isXMLStruct = strpos($className, '_xml') !== false ? true : false;
// Get the entire tree, the $nodes are sorted like in the tree view
// from top to bottom, so we can easily put them in the nodes
$nodes = $params['structure']->getNode();
// Make a new menu and fill it with the values from the tree
$treeMenu = new HTML_TreeMenu();
$curNode[0] =& $treeMenu;
// we need the current node as the reference to the
foreach ($nodes as $aNode) {
$events = array();
$data = array();
// In an XML, all the attributes are saved in an array, but since they might be
// used as the parameters, we simply extract them here if we handle an XML-structure
if ($isXMLStruct && sizeof($aNode['attributes'])) {
foreach ($aNode['attributes'] as $key => $val) {
if (!$aNode[$key]) {
// dont overwrite existing values
$aNode[$key] = $val;
}
}
}
// Process all the data that are saved in $aNode and put them in the data and/or events array
foreach ($aNode as $key => $val) {
if (!is_array($val)) {
// Dont get the recursive data in here! they are always arrays
if (substr($key, 0, 2) == 'on') {
// get the events
$events[$key] = $val;
}
// I put it in data too, so in case an options starts with 'on' its also passed to the node ... not too cool i know
$data[$key] = $val;
}
}
// Normally the text is in 'name' in the Tree class, so we check both but 'text' is used if found
$data['text'] = $aNode['text'] ? $aNode['text'] : $aNode['name'];
// Add the item to the proper node
$thisNode =& $curNode[$aNode['level']]->addItem(new HTML_TreeNode($data, $events));
$curNode[$aNode['level'] + 1] =& $thisNode;
}
break;
/**
* Richard Heyes' (me!) second (array based) Tree class
*/
/**
* Richard Heyes' (me!) second (array based) Tree class
*/
case 'heyes_array':
// Need to create a HTML_TreeMenu object ?
if (!isset($params['treeMenu'])) {
$treeMenu =& new HTML_TreeMenu();
$parentID = 0;
} else {
$treeMenu =& $params['treeMenu'];
$parentID = $params['parentID'];
}
// Loop thru the trees nodes
foreach ($params['structure']->getChildren($parentID) as $nodeID) {
$data = $params['structure']->getData($nodeID);
$parentNode =& $treeMenu->addItem(new HTML_TreeNode(array_merge($params['nodeOptions'], $data)));
// Recurse ?
if ($params['structure']->hasChildren($nodeID)) {
$recurseParams['type'] = 'heyes_array';
$recurseParams['parentID'] = $nodeID;
$recurseParams['nodeOptions'] = $params['nodeOptions'];
$recurseParams['structure'] =& $params['structure'];
$recurseParams['treeMenu'] =& $parentNode;
HTML_TreeMenu::createFromStructure($recurseParams);
}
}
break;
/**
* Richard Heyes' (me!) original OO based Tree class
//.........这里部分代码省略.........