当前位置: 首页>>代码示例>>PHP>>正文


PHP Tree::getValue方法代码示例

本文整理汇总了PHP中Tree::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::getValue方法的具体用法?PHP Tree::getValue怎么用?PHP Tree::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tree的用法示例。


在下文中一共展示了Tree::getValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _addTo

 private function _addTo(Tree $tree = null, $number)
 {
     if ($tree === null) {
         $tree = new Tree($number);
         return $tree;
     }
     if ($number < $tree->getValue()) {
         $tree->setLeft($this->_addTo($tree->getLeft(), $number));
     } else {
         $tree->setRight($this->_addTo($tree->getRight(), $number));
     }
     return $tree;
 }
开发者ID:nhachey,项目名称:Assignment-6,代码行数:13,代码来源:index.php

示例2: getAppListByRole

 /**
  * Get application list by role
  * For getting menus for whole application
  * @param int $role_id
  * @return array
  */
 public function getAppListByRole($role_id)
 {
     $sql = $this->select()->from($this->t1, array("{$this->t1}.*", "group_concat({$this->t2}.name) as role"))->joinLeft($this->rsh, "{$this->t1}.id = {$this->rsh}.app_id", null)->joinLeft($this->t2, "{$this->t2}.id = {$this->rsh}.role_id", null);
     if ($role_id) {
         if (is_array($role_id)) {
             $sql->where("{$this->rsh}.role_id in (?)", $role_id);
         } else {
             $sql->where("{$this->rsh}.role_id = ?", $role_id);
         }
     }
     $sql->group("{$this->t1}.id")->order(array("{$this->t1}.is_app desc", "{$this->t1}.pid", "{$this->t1}.order", "{$this->t1}.id"));
     $rawAppList = $this->dbr()->fetchAll($sql);
     // build app tree
     require_once 'Hush/Tree.php';
     $tree = new Tree();
     foreach ($rawAppList as $app) {
         $tree->setNode($app['id'], $app['pid'], $app);
     }
     // get top list
     $topAppList = array();
     $topAppListIds = $tree->getChild(0);
     foreach ($topAppListIds as $id) {
         $topAppList[$id] = $tree->getValue($id);
     }
     // get all list
     $allAppList = $topAppList;
     foreach ($topAppListIds as $tid) {
         $groupList = array();
         // group list
         $groupListIds = $tree->getChild($tid);
         foreach ($groupListIds as $gid) {
             $groupAppList = array();
             // group app list
             $groupList[$gid] = $tree->getValue($gid);
             $appListIds = $tree->getChild($gid);
             foreach ($appListIds as $aid) {
                 $groupAppList[$aid] = $tree->getValue($aid);
             }
             $groupList[$gid]['list'] = $groupAppList;
         }
         $allAppList[$tid]['list'] = $groupList;
     }
     //		Hush_Util::dump($allAppList);
     return $allAppList;
 }
开发者ID:zhuxd1983,项目名称:hush,代码行数:51,代码来源:App.php

示例3: getmodelcachecategory

/**
 * 从缓存中获得模型分类
 */
function getmodelcachecategory($categoryarr, $space = '|----', $delbase = 0)
{
    include_once S_ROOT . './class/tree.class.php';
    $tree = new Tree('');
    $miniupid = 0;
    $delid = array();
    if ($delbase) {
        $delid[] = $delbase;
    }
    $listarr = array();
    if (!empty($categoryarr)) {
        foreach ($categoryarr as $value) {
            $tree->setNode($value['catid'], $value['upid'], $value);
        }
        //根目录
        $carr = $tree->getChilds($miniupid);
        foreach ($carr as $key => $catid) {
            $cat = $tree->getValue($catid);
            $cat['pre'] = $tree->getLayer($catid, $space);
            if (!empty($delid) && (in_array($cat['upid'], $delid) || $cat['catid'] == $delbase)) {
                $delid[] = $cat['catid'];
            } else {
                $listarr[$cat['catid']] = $cat;
            }
        }
    }
    return $listarr;
}
开发者ID:superman1982,项目名称:ng-cms,代码行数:31,代码来源:model.func.php

示例4: empty

$menu = $tree->getLayer($cate);
if (basename(__FILE__, '.php') == 'menu') {
    if ($act == 'save') {
        $sort_order = empty($sort_order) ? 0 : intval($sort_order);
        $name = addslashes(trim($name));
        $content = addslashes(trim($content));
        if ($do == 'add') {
            $tree->addNode($cid, $name, $content, $sort_order);
        } else {
            $sql = "UPDATE `" . $tree->tablepre . $tree->table . "` SET name='{$name}',content='{$content}',sort_order='{$sort_order}'" . " WHERE cid={$cid}";
            $db->query($sql);
        }
        updateMenu();
        header("Location: menu.php");
    } elseif ($act == 'edit') {
        $row = $tree->getValue($cid);
        EXTRACT($row);
        unset($row);
    } elseif ($act == 'del') {
        $tree->delNode($cid) && header("Location: menu.php");
    }
}
//$tree->addnode(9,rand());
//$tree->delNode(4);
//print_r($tree->getparents(11));
//print_r( array_map("aa",$tree->getChilds(6)));
//$tree->moveNode(15,3);
$tpl = new template(basename(__FILE__, '.php') . '.html');
$tpl->tpl_dir = 'templates/default/';
$tpl->imgDir = array('images');
$tpl->debug = true;
开发者ID:haseok86,项目名称:millkencode,代码行数:31,代码来源:menu.php

示例5: getmodelcategory

function getmodelcategory($name, $space = '|----')
{
    global $_SGLOBAL;
    include_once S_ROOT . './class/tree.class.php';
    $tree = new Tree($name);
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('categories') . ' WHERE `type`=\'' . $name . '\' ORDER BY upid, displayorder');
    $miniupid = '';
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($miniupid == '') {
            $miniupid = $value['upid'];
        }
        $tree->setNode($value['catid'], $value['upid'], $value);
    }
    //¸ùĿ¼
    $listarr = array();
    if ($_SGLOBAL['db']->num_rows($query) > 0) {
        $categoryarr = $tree->getChilds($miniupid);
        foreach ($categoryarr as $key => $catid) {
            $cat = $tree->getValue($catid);
            $cat['pre'] = $tree->getLayer($catid, $space);
            $listarr[$cat['catid']] = $cat;
        }
    }
    return $listarr;
}
开发者ID:hongz1125,项目名称:devil,代码行数:25,代码来源:common.func.php

示例6: getbbsforum

function getbbsforum($isblog = 0, $space = '|----')
{
    global $_SGLOBAL;
    dbconnect(1);
    $forumarr = array();
    if ($isblog) {
        $wheresql = ' AND (type=\'group\' || allowshare=\'1\')';
    } else {
        $wheresql = '';
    }
    include_once S_ROOT . './class/tree.class.php';
    $tree = new Tree('blog');
    $minfup = '';
    $query = $_SGLOBAL['db_bbs']->query('SELECT * FROM ' . tname('forums', 1) . ' WHERE status>0' . $wheresql . ' ORDER BY fup, displayorder');
    while ($forum = $_SGLOBAL['db_bbs']->fetch_array($query)) {
        if ($minfup == '') {
            $minfup = $forum['fup'];
        }
        $tree->setNode($forum['fid'], $forum['fup'], $forum);
    }
    //根目录
    $listarr = array();
    $categoryarr = $tree->getChilds($minfup);
    foreach ($categoryarr as $key => $catid) {
        $cat = $tree->getValue($catid);
        $cat['pre'] = $tree->getLayer($catid, $space);
        $listarr[$cat['fid']] = $cat;
    }
    return $listarr;
}
开发者ID:hongz1125,项目名称:devil,代码行数:30,代码来源:admin.func.php

示例7: TableClass

<?php

include "common.inc.php";
InitGP(array("action", "tid", "gid", "ps", "page"));
//初始化变量全局返回
$goodsobj = new TableClass('shop_goods', 'gid');
$typeobj = new TableClass('shop_gtype', 'typeid');
//读取分类信息
$typearray = $typeobj->getdata('', '', 'typeid asc');
include_once INC_PATH . '/tree.class.php';
$tree = new Tree($typearray, 'typeid', 'node');
//分类处理
$categoryarr = $tree->getChilds(0);
$space = '|----';
foreach ($categoryarr as $key => $catid) {
    $cat = $tree->getValue($catid);
    $cat['pre'] = $tree->getLayer($catid, $space);
    $listarr[$cat['typeid']] = $cat;
}
//读取分类结束
if ($action == 'list') {
    $tid = GetNum($tid);
    $gtype = $tree->getValue($tid);
    if ($gtype['node'] == 0) {
        $position = "<span>&gt;</span><a href='shop.php?action=list&tid=" . $gtype['typeid'] . "'>" . $gtype['typename'] . "</a>";
        $typename = $gtype['typename'];
    } else {
        $cgtype = $tree->getValue($gtype['node']);
        $typename = $cgtype['typename'];
        $position = "<span>&gt;</span><a href='shop.php?action=list&tid=" . $cgtype['typeid'] . "'>" . $cgtype['typename'] . "</a>";
        $position .= "<span>&gt;</span><a href='shop.php?action=list&tid=" . $gtype['typeid'] . "'>" . $gtype['typename'] . "</a>";
开发者ID:dalinhuang,项目名称:c2my,代码行数:31,代码来源:shop.php

示例8: Tree

            $cats[$res['catid']] = $res;
        }
        include_once B_ROOT . './source/class/tree.class.php';
        $tree = new Tree($type);
        $miniupid = '';
        $space = '|----';
        foreach ($cats as $catid => $category) {
            if ($miniupid === '') {
                $miniupid = $category['upid'];
            }
            $tree->setNode($category['catid'], $category['upid'], $category);
        }
        if (count($cats) > 0) {
            $categoryarr = $tree->getChilds($miniupid);
            foreach ($categoryarr as $key => $catid) {
                $cat = $tree->getValue($catid);
                $cat['pre'] = $tree->getLayer($catid, $space);
                $cat['havechild'] = $tree->getChild($catid) ? 1 : 0;
                $listarr[$cat['catid']] = $cat;
            }
        }
        echo '<option value="0" selected="selected">' . lang('please_select') . "</option>\n";
        foreach ($listarr as $catinfo) {
            echo '<option value="' . $catinfo['catid'] . '">' . $catinfo['pre'] . $catinfo['name'] . '</option>';
        }
    }
} elseif ($opt == 'search') {
    //關聯信息中搜索該商舖下的關聯對像
    $shopid = intval($_GET['shopid']);
    $itemid = !empty($_GET['itemid']) ? intval($_GET['itemid']) : '';
    $keyword = trim($_GET['keyword']);
开发者ID:pan289091315,项目名称:Discuz,代码行数:31,代码来源:ajax.inc.php


注:本文中的Tree::getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。