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


PHP Tree::getTree方法代码示例

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


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

示例1: gettree

 function gettree()
 {
     $model = new Tree();
     $tree = $model->getTree();
     View::$layout = 'empty';
     View::render('fields/parenttree', array('tree' => $tree));
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:7,代码来源:FieldsController.php

示例2: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $this->checkAccess('adminactions.update');
     $model = $this->loadModel($id);
     $allActions = AdminActions::getAllActions($model->parent_id, 'selected');
     // 下拉列表
     $tree = '<option value="0">顶级动作</option>';
     Tree::$arr = $allActions;
     $tree .= Tree::getTree(0, "<option value=\$id \$selected>\$spacer\$name</option>", $model->parent_id - 1, true);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['AdminActions'])) {
         $model->attributes = $_POST['AdminActions'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'tree' => $tree));
 }
开发者ID:conghua1013,项目名称:Yii-Bootstrap-Admin,代码行数:24,代码来源:AdminactionsController.php

示例3: search

 public static function search($node, $main_buss_id)
 {
     if ($node === NULL || $node === "" || $main_buss_id === NULL || $main_buss_id === "") {
         QconfMgrLog::err(__FILE__, __LINE__, "node_id or main_buss_id is NULL");
         return FALSE;
     }
     ArgsUtil::setSQLEscape($node);
     ArgsUtil::setSQLEscape($main_buss_id);
     $query = "select * from qconf_node where main_buss_id = '{$main_buss_id}'" . " and node like '%{$node}%' order by node_whole";
     $res = self::executeQuery($query);
     if ($res === FALSE) {
         return FALSE;
     }
     // not found the node
     $num = mysql_num_rows($res);
     if ($num === 0) {
         return FALSE;
     }
     $tree = new Tree();
     while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
         $tree->insert($row['node_id'], $row['parent_node_id'], $row);
         $p_row = $row;
         while ($p_row['parent_node_id'] != 0) {
             $query = "select * from qconf_node where node_id = '" . $p_row['parent_node_id'] . "'";
             $p_res = self::executeQuery($query);
             if ($p_res === FALSE) {
                 return FALSE;
             }
             $p_row = mysql_fetch_array($p_res, MYSQL_ASSOC);
             $tree->insert($p_row['node_id'], $p_row['parent_node_id'], $p_row);
         }
     }
     return $tree->getTree();
 }
开发者ID:sdgdsffdsfff,项目名称:qconf-inner,代码行数:34,代码来源:NodeServ.php

示例4: run

    public function run()
    {
        $fields = Module::getFieldList(6, 1);
        $tree = Tree::getTree();
        $x = 0;
        foreach ($tree[0]['sub'] as $i => $item) {
            if ($item['path'] == 'catalog') {
                $x = $i;
            }
        }
        $tree = $tree[0]['sub'][$x]['sub'];
        foreach ($tree as $items) {
            foreach ($items['sub'] as $item) {
                $info = Tree::getInfo($item['id']);
                if ($info['type'] == 'cat') {
                    Prepare::$tree[] = $item;
                }
                Prepare::getBranch($item['sub']);
            }
        }
        //print '<pre>';print_r(Prepare::$tree);die;
        //print '<pre>';
        foreach (Prepare::$tree as $item) {
            $sql = '
				SELECT {{reference}}.path FROM {{data}} INNER JOIN {{reference}} ON {{data}}.value_text={{reference}}.id
				WHERE {{data}}.path=\'refsizes\' AND {{data}}.tree=\'' . $item['parent'] . '\'
			';
            //print DB::prefix($sql);die;
            $ref = DB::getOne($sql);
            $refArr = Prepare::getSizesReference($ref);
            foreach ($item['sub'] as $Csize) {
                foreach ($refArr as $Rkey => $Rsize) {
                    if ($Csize['path'] == $Rsize['path']) {
                        unset($refArr[$Rkey]);
                    }
                }
            }
            $num = 10;
            if (!empty($refArr)) {
                foreach ($refArr as $row) {
                    $add = array();
                    $add['tree']['site'] = 1;
                    $add['tree']['parent'] = $item['id'];
                    $add['tree']['name'] = $row['name'];
                    $add['tree']['path'] = $row['path'];
                    $add['tree']['seo_title'] = $row['name'];
                    $add['tree']['seo_keywords'] = $row['name'];
                    $add['tree']['seo_description'] = $row['name'];
                    $add['tree']['num'] = $num;
                    $add['tree']['udate'] = date('Y-m-d H:i:m');
                    $add['tree']['visible'] = 1;
                    $add['tree']['cdate'] = date('Y-m-d H:i:m');
                    $add['tree']['mdate'] = date('Y-m-d H:i:m');
                    foreach ($fields as $field) {
                        $add['data'][$field['path']] = array('value' => 0, 'field' => Fields::$types[$field['type']]['type'], 'type' => $field['type'], 'path' => $field['path'], 'num' => $field['num']);
                    }
                    //print_r($add);print '<br><br><br>';
                    Prepare::setPage($add);
                    $num += 10;
                }
            }
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:63,代码来源:PrepareModel.php

示例5: SQLTool

<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/7/9
 * Time: 16:56
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
require_once "../../model/DepartTree.class.php";
$sqltool = new SQLTool();
$tree = new Tree();
$sql = "select depart_id id,depart_name name,depart_parent_id parent_id from t_depart";
$depart = $sqltool->dbQuery($sql);
$html_tree = $tree->DepartprocHtml($tree->getTree($depart, ''));
$smarty->assign("tree", $html_tree);
$smarty->display("admin/config_depart.html");
开发者ID:huzhiming12,项目名称:itil,代码行数:18,代码来源:config_depart.php

示例6: getTree

 public static function getTree()
 {
     $data = array();
     $model = new Tree();
     $tree = $model->getTree();
     foreach ($tree as $item) {
         $sub = array();
         foreach ($item['sub'] as $item2) {
             $sub2 = array();
             foreach ($item2['sub'] as $item3) {
                 $sub2[] = array('id' => $item3['id'], 'parent' => $item3['parent'], 'name' => $item3['name']);
             }
             $sub[] = array('id' => $item2['id'], 'parent' => $item2['parent'], 'name' => $item2['name'], 'sub' => $sub2);
         }
         $data[] = array('id' => $item['id'], 'parent' => $item['parent'], 'name' => $item['name'], 'sub' => $sub);
     }
     return $data;
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:18,代码来源:IuserModel.php

示例7: foreach

            foreach ($view->names as $username => $names) {
                $usernameraw = rawurlencode($username);
                $user = $tree->addFolder($views, $username . "&nbsp;(" . count($names) . ")", "view_main.php?Server={$Server}&User={$usernameraw}&" . SID);
                if (is_array($names)) {
                    foreach ($names as $name) {
                        $tree->addDocument($user, $name, "view_detail.php?Server={$Server}&Viewname={$name}&User={$usernameraw}&" . SID);
                    }
                }
            }
            $view->destruct();
        } else {
            // insert one object
            $tree->addFolder($views, 0, 0);
        }
    }
}
// end foreach
$tree->closeTree();
$page = new Page("phpOracleAdmin");
$page->setHead();
if ($jswarning) {
    $page->setHead($jswarning);
}
$page->setBody("<BODY BGCOLOR=\"#D0DCE0\">");
$page->setBody($tree->getTree());
$page->Display(FALSE);
?>



开发者ID:BackupTheBerlios,项目名称:phporacleadmin,代码行数:27,代码来源:left.php

示例8: run

 function run()
 {
     $model = new Tree();
     View::$layout = 'empty';
     View::render('tree/tree', array('tree' => $model->getTree()));
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:6,代码来源:TreeWidget.php

示例9: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $this->checkAccess('adminrole.update');
     $model = $this->loadModel($id);
     if ($id == 1 || $model->title == '超级管理员' || $model->actions == '*') {
         $this->redirect(array('admin'));
     }
     $array = explode(',', $model->actions);
     $allActions = AdminActions::getAllActions();
     foreach ($allActions as $k => $action) {
         foreach ($array as $item) {
             if ($action['action'] == $item) {
                 $allActions[$k]['selected'] = "checked";
             }
         }
     }
     // 下拉列表
     Tree::$arr = $allActions;
     $tree = Tree::getTree(0, "<label class='checkbox'><input type='checkbox' name='AdminRole[actions][]' id='AdminRole_actions_\$id' data-id='\$id' data-parent-id='\$parent_id' value='\$action' \$selected><label for='AdminRole_actions_\$id'>\$spacer\$name</label></label>", -1, true);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['AdminRole'])) {
         $model->attributes = $_POST['AdminRole'];
         $model->actions = implode(',', $model->actions);
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'tree' => $tree));
 }
开发者ID:conghua1013,项目名称:Yii-Bootstrap-Admin,代码行数:35,代码来源:AdminroleController.php


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