本文整理汇总了PHP中display_tree函数的典型用法代码示例。如果您正苦于以下问题:PHP display_tree函数的具体用法?PHP display_tree怎么用?PHP display_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了display_tree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_tree
function display_tree($tree, $acl, $curr_id = 0)
{
foreach ($tree as $node) {
if ($curr_id == $node['id']) {
echo '<li class="active"><strong>';
} else {
echo '<li>';
}
echo '<i class="fa-li fa fa-user"></i>';
if ($acl->is_allowed('acl/role/edit')) {
echo '<a href="' . site_url('acl/role/edit/' . $node['id']) . '" class="users">';
echo '<span>' . $node['name'] . '</span>';
echo '</a>';
} else {
echo '<span>' . $node['name'] . '</span>';
}
if (isset($node['children'])) {
echo '<ul class="fa-ul">';
display_tree($node['children'], $acl);
echo '</ul>';
}
if ($curr_id == $node['id']) {
echo '</strong>';
}
echo '</li>';
}
}
示例2: display_tree
function display_tree($tree, $curr_id = 0, $acl)
{
foreach ($tree as $node) {
echo '<li>';
if (isset($node['children'])) {
echo '<span class="toggle"></span>';
}
$class = $node['type'];
if ($node['id'] == $curr_id) {
$class .= ' current';
}
if ($acl->is_allowed('acl/resource/edit')) {
echo '<a href="' . site_url('acl/resource/edit') . '/' . $node['id'] . '?redirect=' . urlencode(site_url('acl/resource')) . '" class="' . $class . '">';
echo '<span>' . $node['name'] . '</span>';
echo '</a>';
} else {
echo '<span>' . $node['name'] . '</span>';
}
if (isset($node['children'])) {
echo '<ul>';
display_tree($node['children'], $curr_id, $acl);
echo '</ul>';
}
echo '</li>';
}
}
示例3: display_tree
function display_tree($nodes, $indent = 0)
{
if ($indent >= 20) {
return;
}
// Stop at 20 sub levels
foreach ($nodes as $node) {
print str_repeat(' ', $indent * 4);
print $node['name'];
print '<br/>';
if (isset($node['children'])) {
display_tree($node['children'], $indent + 1);
}
}
}
示例4: display_tree
function display_tree($children, $parent_id)
{
$root = NULL;
foreach ($children as $child) {
$no_nest = isset($child['nested']) && $child['nested'] == 0 ? "no-nest" : false;
$root = $child['id'] == 1 ? "ignore" : false;
$folder = isset($child['children']) && $child['type'] != "blog" ? "ofolder" : "folder";
$delete = anchor('admin/content/delete/' . $parent_id . '/' . $child['id'], ' ', 'class="delete"');
echo "<li class=\"{$root} {$no_nest}\" id=\"" . $child['id'] . "\">\n";
echo "<div class=\"item\">" . $delete . "<img src='" . base_url() . "css/images/img-page-" . $folder . ".png' class='folder' />" . anchor('admin/content/edit/' . $child['type'] . '/' . $child['parent_id'] . '/' . $child['id'], $child['title']) . "</div>";
if (isset($child['children']) && $child['type'] != "blog") {
echo "<ul class=\"pagetree\">\n";
display_tree($child['children']);
echo "</ul>\n";
}
echo "\t</li>\n";
}
}
示例5: display_tree
function display_tree($tree, $acl, $curr_id = 0)
{
foreach ($tree as $node) {
if ($curr_id == $node['id']) {
echo '<li class="active"><strong>';
} else {
echo '<li>';
}
$class = 'fa ';
switch ($node['type']) {
case 'module':
$class .= 'fa-folder-open-o ';
break;
case 'controller':
$class .= 'fa-file-text-o';
break;
case 'action':
$class .= 'fa-gear';
break;
default:
$class .= 'fa-question';
break;
}
echo '<i class="fa-li ' . $class . '"></i>';
if ($acl->is_allowed('acl/resource/edit')) {
echo '<a href="' . site_url('acl/resource/edit/' . $node['id']) . '">';
echo $node['name'];
echo '</a>';
} else {
echo $node['name'];
}
if (isset($node['children'])) {
echo '<ul class="fa-ul">';
display_tree($node['children'], $acl, $curr_id);
echo '</ul>';
}
if ($curr_id == $node['id']) {
echo '</strong>';
}
echo '</li>';
}
}
示例6: display_tree
function display_tree($tree, $acl)
{
foreach ($tree as $node) {
echo '<li>';
if (isset($node['children'])) {
echo '<span class="toggle"></span>';
}
if ($acl->is_allowed('acl/rule/edit')) {
echo '<a href="' . site_url('acl/rule/edit') . '/' . $node['id'] . '?redirect=' . urlencode(current_url_params()) . '" class="users">';
echo '<span>' . $node['name'] . '</span>';
echo '</a>';
} else {
echo '<span>' . $node['name'] . '</span>';
}
if (isset($node['children'])) {
echo '<ul>';
display_tree($node['children'], $acl);
echo '</ul>';
}
echo '</li>';
}
}
示例7: mysql_connect
<style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
</head>
<body>
ENDHTML;
echo $html;
$dbh = mysql_connect($host_name, $db_username, $db_password) or die('I cannot connect to the database because: ' . mysql_error());
mysql_select_db($db_name);
display_tree(0);
function display_tree($root)
{
// retrieve the left and right value of the $root node
$result = mysql_query('SELECT lft, rgt FROM ModifiedPreorderTreeTraversalCategories ' . 'WHERE CategoryID=' . $root . ';');
$row = mysql_fetch_array($result);
// start with an empty $right stack
$right = array();
// now, retrieve all descendants of the $root node
$result = mysql_query('SELECT CategoryID, CategoryName, lft, rgt FROM ModifiedPreorderTreeTraversalCategories ' . 'WHERE lft BETWEEN ' . $row['lft'] . ' AND ' . $row['rgt'] . ' ORDER BY lft ASC;');
// display each row
while ($row = mysql_fetch_array($result)) {
// only check stack if there is one
if (count($right) > 0) {
// check if we should remove a node from the stack
while ($right[count($right) - 1] < $row['rgt']) {
示例8: session_start
session_start();
// check if we have created our session variable
if (!isset($HTTP_SESSION_VARS['expanded'])) {
$HTTP_SESSION_VARS['expanded'] = array();
}
// check if an expand button was pressed
// expand might equal 'all' or a postid or not be set
if (isset($HTTP_GET_VARS['expand'])) {
if ($HTTP_GET_VARS['expand'] == 'all') {
expand_all($HTTP_SESSION_VARS['expanded']);
} else {
$HTTP_SESSION_VARS['expanded'][$HTTP_GET_VARS['expand']] = true;
}
}
// check if a collapse button was pressed
// collapse might equal all or a postid or not be set
if (isset($HTTP_GET_VARS['collapse'])) {
if ($HTTP_GET_VARS['collapse'] == 'all') {
$HTTP_SESSION_VARS['expanded'] = array();
} else {
unset($HTTP_SESSION_VARS['expanded'][$HTTP_GET_VARS['collapse']]);
}
}
do_html_header('Discussion Posts');
display_index_toolbar();
// display the tree view of conversations
display_tree($HTTP_SESSION_VARS['expanded']);
do_html_footer();
?>
示例9: display_the_tree
function display_the_tree()
{
display_tree(0, table_categories);
}
示例10: session_start
session_start();
// check if we have created our session variable
if (!isset($_SESSION['expanded'])) {
$_SESSION['expanded'] = array();
}
// check if an expand button was pressed
// expand might equal 'all' or a postid or not be set
if (isset($_GET['expand'])) {
if ($_GET['expand'] == 'all') {
expand_all($_SESSION['expanded']);
} else {
$_SESSION['expanded'][$_GET['expand']] = true;
}
}
// check if a collapse button was pressed
// collapse might equal all or a postid or not be set
if (isset($_GET['collapse'])) {
if ($_GET['collapse'] == 'all') {
$_SESSION['expanded'] = array();
} else {
unset($_SESSION['expanded'][$_GET['collapse']]);
}
}
do_html_header('Discussion Posts');
display_index_toolbar();
// display the tree view of conversations
display_tree($_SESSION['expanded']);
do_html_footer();
?>
示例11: expand_all
if ($_GET['expand'] == 'all') {
expand_all($_SESSION['expanded']);
} else {
$_SESSION['expanded'][$_GET['expand']] = true;
}
}
// check if a collapse button was pressed
// collapse might equal all or a postid or not be set
if (isset($_GET['collapse'])) {
if ($_GET['collapse'] == 'all') {
$_SESSION['expanded'] = array();
} else {
unset($_SESSION['expanded'][$_GET['collapse']]);
}
}
// global $CHAPTERID;
// echo $CHAPTERID;
display_index_toolbar();
// echo $USER;
// echo $CHAPTERID;
// display the tree view of conversations
display_tree($COURSEID, $_SESSION['expanded'], $USER);
display_new_post_form($COURSEID, $USER);
//}
?>
<table width="100%">
<tr>
<td height="80" style="text-align:center;font-family:微软雅黑;font-size:20px;">© 版权所有 | 设计者 烫烫烫烫的130</td>
</tr>
</table>
示例12: display_tree
?>
">»</a></li>
</ul>
</div>
<!-- end:pagination -->
<!-- begin:comment -->
<div class="row">
<div class="col-md-12">
<?php
echo $not_found_comment;
?>
<div class="comment">
<?php
display_tree($comm);
?>
</div>
</div>
</div>
<!-- end:comment -->
<!-- begin:comment-form -->
<div id="commentForm" class="row">
<div class="col-md-12">
<h3 class="blog-single-title">Задать вопрос</h3>
<p id="comment-answer-name"></p>
示例13: quotes
<?php
$table = $cpos["table"];
$id = quotes($_GET["id"]);
//-本資料
$mode = quotes($_GET["mode"]);
//-母樹
$max = 0;
//明細
if ($id != "") {
//--母類資料
$main_data = $conn->GetRow("select * from " . $table . " where id='" . $mode . "'");
$max = $main_data["max_count"];
//--分類樹資料
$tree_data_type = display_tree($mode, $conn, $table, 0, 0, " and lang='" . LANG . "'");
//-分類資料
if ($tree_data_type) {
foreach ($tree_data_type as $k => $v) {
if ($id != $v["id"] && $v["depth"] * 1 < $max) {
$spce = '';
for ($i = 0; $i <= $v["depth"]; $i++) {
$spce .= ' ';
}
$tree_array[$v['id']] = $spce . $v['name'];
}
}
}
//-資料送出處理
if ($_POST) {
//--更動資料時依照排序寫入
$cpos["listorderby"] = "sort";
示例14: display_tree
function display_tree($nodes, $indent = 0)
{
if ($indent >= 10) {
return;
}
?>
<ul <?php
if ($indent != 0) {
?>
class="comment-reply"<?php
}
?>
>
<?php
foreach ($nodes as $node) {
?>
<li>
<div class="comment-container <?php
if ($node['unread'] == 0) {
echo 'unread';
}
?>
">
<div class="comment-text">
<span class="comment-reply-link"><a href="/admin/delComment/<?php
echo $node['id'];
?>
/"> Удалить</a></span>
<span data-id="<?php
echo $node['id'];
?>
" class="comment-reply-link"><a href="#commentForm"><i class="fa fa-sign-in"></i> Ответить </a>___</span>
<h4><?php
echo $node['name'];
?>
</h4>
<span class="comment-meta"><?php
echo $node['date'];
?>
</span>
<p>
<?php
if ($node['deleted'] == 0) {
echo $node['text'];
} else {
echo "Комментарий был удален";
}
?>
</p>
</div>
</div>
<!-- break -->
<?php
if (isset($node['childs'])) {
display_tree($node['childs'], $indent + 1);
}
?>
</li>
<?php
}
?>
</ul>
<?php
}
示例15: expand_all
if ($_GET['expand'] == 'all') {
expand_all($_SESSION['expanded']);
} else {
$_SESSION['expanded'][$_GET['expand']] = true;
}
}
// check if a collapse button was pressed
// collapse might equal all or a postid or not be set
if (isset($_GET['collapse'])) {
if ($_GET['collapse'] == 'all') {
$_SESSION['expanded'] = array();
} else {
unset($_SESSION['expanded'][$_GET['collapse']]);
}
}
// global $CHAPTERID;
// echo $CHAPTERID;
display_index_toolbar();
// echo $USER;
// echo $CHAPTERID;
// display the tree view of conversations
display_tree($CHAPTERID, $_SESSION['expanded'], $USER);
display_new_post_form($CHAPTERID, $USER);
//}
?>
<table width="100%">
<tr>
<td height="80" style="text-align:center;font-family:微软雅黑;font-size:20px;">© 版权所有 | 设计者 烫烫烫烫的130</td>
</tr>
</table>