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


PHP Tree::setup方法代码示例

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


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

示例1: array

    $result = $tree->remove($_REQUEST['removeId']);
}
if (@$_REQUEST['action_update']) {
    $methodCall = "tree->update( {$_REQUEST['updateId']} , {$_REQUEST['updateData']} )";
    $result = $tree->update($_REQUEST['updateId'], $_REQUEST['updateData']);
}
if (@$_REQUEST['action_move']) {
    $methodCall = "tree->move( {$_REQUEST['move_id']} , {$_REQUEST['move_newParentId']} , {$_REQUEST['move_newPrevId']} )";
    $result = $tree->move($_REQUEST['move_id'], $_REQUEST['move_newParentId'], $_REQUEST['move_newPrevId']);
}
$methodFailed = false;
if (@PEAR::isError($result)) {
    $methodFailed = true;
}
$fid = @$_REQUEST['fid'];
if (!$fid) {
    $fid = $tree->getRootId();
}
$path = $tree->getPath($fid);
$children = $tree->getChildren($fid);
##################################################
#
#       actual tree stuff to show the entire tree using Memory_DBnested
#
require_once 'Tree/Tree.php';
$memTree = Tree::setup('Memory_DBnested', 'mysql://root@localhost/test', array('table' => 'Tree_Nested'));
$memTree->setup();
$entireTree = $memTree->getNode();
$treeDepth = $memTree->getDepth();
$tpl->compile('index.tpl');
include $tpl->compiledTemplate;
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:31,代码来源:index.php

示例2: get_pseudo_packages

/**
 * Fetches pseudo packages from database
 *
 * @param string	$project			define what project pseudo packages are returned
 * @param bool		$return_disabled	whether to return read-only items, defaults to true
 *
 * @return array	array of pseudo packages
 */
function get_pseudo_packages($project, $return_disabled = true)
{
    global $project_types;
    require_once 'Tree/Tree.php';
    $where = '1=1';
    $project = strtolower($project);
    if ($project !== false && in_array($project, $project_types)) {
        $where .= " AND project IN ('',  '" . $project . "')";
    }
    if (!$return_disabled) {
        $where .= " AND disabled = 0";
    }
    $pseudo_pkgs = array();
    $tree = Tree::setup('Memory_MDB2simple', DATABASE_DSN, array('order' => 'disabled, id', 'whereAddOn' => $where, 'table' => 'bugdb_pseudo_packages', 'columnNameMaps' => array('parentId' => 'parent')));
    $tree->setup();
    foreach ($tree->data as $data) {
        if (isset($data['children'])) {
            $pseudo_pkgs[$data['name']] = array($data['long_name'], $data['disabled']);
            $long_names = array();
            foreach ($data['children'] as $k => $v) {
                $long_names[$k] = strtolower($v['long_name']);
            }
            array_multisort($long_names, SORT_ASC, SORT_STRING, $data['children']);
            foreach ($data['children'] as $child) {
                $pseudo_pkgs[$child['name']] = array("    {$child['long_name']}", $child['disabled']);
            }
        } else {
            if (!isset($pseudo_pkgs[$data['name']])) {
                $pseudo_pkgs[$data['name']] = array($data['long_name'], $data['disabled']);
            }
        }
    }
    return $pseudo_pkgs;
}
开发者ID:reeze,项目名称:web-bugs,代码行数:42,代码来源:functions.php

示例3: array

<?php

//
//  $Id: Dynamic_DBnested.php,v 1.2 2003/01/30 17:43:41 cain Exp $
//
//ini_set('include_path',realpath(dirname(__FILE__).'/../../').':'.realpath(dirname(__FILE__).'/../../../includes').':'.ini_get('include_path'));
//ini_set('error_reporting',E_ALL);
require_once 'Tree/Tree.php';
#    $tree = Tree::setupDynamic( 'DBnested' , 'mysql://root@localhost/test' , array('table'=>'nestedTree') );
#   OR
$tree = Tree::setup('Dynamic_DBnested', 'mysql://root@localhost/test', array('table' => 'nestedTree'));
$show[] = '$tree->getRoot()';
$show[] = '$tree->getElement( 1 )';
$show[] = '$tree->getChild( 1 )';
$show[] = '$tree->getPath( 7 )';
$show[] = '$tree->getPath( 2 )';
$show[] = '$tree->add( array("name"=>"c0") , 5 )';
$show[] = '$tree->remove( $res )';
// remove the last element that was added in the line before :-)
$show[] = '$tree->getRight( 5 )';
$show[] = '$tree->getLeft( 5 )';
$show[] = '$tree->getChildren( 1 )';
$show[] = '$tree->getParent( 2 )';
$show[] = '$tree->getNext( 2 )';
$show[] = '$tree->getNext( 4 )';
$show[] = '$tree->getNext( 8 )';
$show[] = '$tree->getPrevious( 2 )';
$show[] = '$tree->getPrevious( 4 )';
$show[] = '$tree->getPrevious( 8 )';
$show[] = '$tree->getPreviousId( 8 )';
$show[] = '$tree->move( 4,3 )';
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:31,代码来源:Dynamic_DBnested.php


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