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


PHP tree类代码示例

本文整理汇总了PHP中tree的典型用法代码示例。如果您正苦于以下问题:PHP tree类的具体用法?PHP tree怎么用?PHP tree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init_args

/**
 * create object with all user inputs
 *
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $key2search = array('doAction', 'cfield', 'display_order', 'location', 'hidden_active_cfield', 'active_cfield', 'hidden_required_cfield', 'required_cfield');
    foreach ($key2search as $key) {
        $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : null;
    }
    // Need comments
    if (!$args->cfield) {
        $args->cfield = array();
    }
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id == 0) {
        $args->tproject_id = isset($_SESSION['testprojectID']) ? intval($_SESSION['testprojectID']) : 0;
    }
    if ($args->tproject_id > 0) {
        $mgr = new tree($dbHandler);
        $dummy = $mgr->get_node_hierarchy_info($args->tproject_id, null, array('nodeType' => 'testproject'));
        if (is_null($dummy)) {
            throw new Exception("Unable to get Test Project ID");
        }
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:cfieldsTprojectAssign.php

示例2: load

 public function load($param)
 {
     $key = $this->build_key(__CLASS__, $param);
     $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
     $cate_list = $GLOBALS['fcache']->get($key);
     if ($cate_list === false) {
         $pid = intval($param['pid']);
         $extwhere = $param['extwhere'];
         require_once APP_ROOT_PATH . "system/utils/child.php";
         require_once APP_ROOT_PATH . "system/utils/tree.php";
         $ids_util = new child("deal_cate");
         $ids = $ids_util->getChildIds($pid);
         $ids[] = $pid;
         $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_effect = 1 and is_delete = 0 and id in (" . implode(",", $ids) . ") {$extwhere} order by sort desc");
         foreach ($cate_list as $k => $v) {
             if ($v['uname'] != '') {
                 $curl = url("youhui", "ycate", array("id" => $v['uname']));
             } else {
                 $curl = url("youhui", "ycate", array("id" => $v['id']));
             }
             $cate_list[$k]['url'] = $curl;
             $sub_ids = $ids_util->getChildIds($v['id']);
             $sub_ids[] = $v['id'];
             $cate_list[$k]['count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and is_shop = 2 and cate_id in (" . implode(",", $sub_ids) . ")");
         }
         $tree_util = new tree();
         $cate_list = $tree_util->toFormatTree($cate_list, 'name');
         $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/");
         $GLOBALS['fcache']->set($key, $cate_list);
     }
     return $cate_list;
 }
开发者ID:dalinhuang,项目名称:zsh_business,代码行数:32,代码来源:cache_youhui_cate_tree.auto_cache.php

示例3: init_args

function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->show_help = isset($_REQUEST['level']) && $_REQUEST['level'] == 'testproject';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0;
    $args->tplan_name = '';
    if ($args->tplan_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tplan_id);
        $args->tplan_name = $dummy['name'];
    }
    $args->node_type = isset($_REQUEST['level']) ? $_REQUEST['level'] : OFF;
    $args->node_id = isset($_REQUEST['id']) ? $_REQUEST['id'] : ERROR;
    // Sets urgency for suite
    if (isset($_REQUEST['high_urgency'])) {
        $args->urgency = HIGH;
    } elseif (isset($_REQUEST['medium_urgency'])) {
        $args->urgency = MEDIUM;
    } elseif (isset($_REQUEST['low_urgency'])) {
        $args->urgency = LOW;
    } else {
        $args->urgency = OFF;
    }
    // Sets urgency for every single tc
    if (isset($_REQUEST['urgency'])) {
        $args->urgency_tc = $_REQUEST['urgency'];
    }
    return $args;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:31,代码来源:planUrgency.php

示例4: init_args

/**
 * init_args
 *
 */
function init_args(&$dbHandler)
{
    // take care of proper escaping when magic_quotes_gpc is enabled
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $iParams = array("requirement_id" => array(tlInputParameter::INT_N), "req_spec_id" => array(tlInputParameter::INT_N), "containerID" => array(tlInputParameter::INT_N), "reqDocId" => array(tlInputParameter::STRING_N, 0, 64), "req_title" => array(tlInputParameter::STRING_N, 0, 100), "scope" => array(tlInputParameter::STRING_N), "reqStatus" => array(tlInputParameter::STRING_N, 0, 1), "reqType" => array(tlInputParameter::STRING_N, 0, 1), "countReq" => array(tlInputParameter::INT_N), "expected_coverage" => array(tlInputParameter::INT_N), "doAction" => array(tlInputParameter::STRING_N, 0, 20), "req_id_cbox" => array(tlInputParameter::ARRAY_INT), "itemSet" => array(tlInputParameter::ARRAY_INT), "testcase_count" => array(tlInputParameter::ARRAY_INT), "req_version_id" => array(tlInputParameter::INT_N), "copy_testcase_assignment" => array(tlInputParameter::CB_BOOL), "relation_id" => array(tlInputParameter::INT_N), "relation_source_req_id" => array(tlInputParameter::INT_N), "relation_type" => array(tlInputParameter::STRING_N), "relation_destination_req_doc_id" => array(tlInputParameter::STRING_N, 0, 64), "relation_destination_testproject_id" => array(tlInputParameter::INT_N), "save_rev" => array(tlInputParameter::INT_N), "do_save" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "log_message" => array(tlInputParameter::STRING_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $args->req_id = $args->requirement_id;
    $args->title = $args->req_title;
    $args->arrReqIds = $args->req_id_cbox;
    $args->basehref = $_SESSION['basehref'];
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->user = $_SESSION['currentUser'];
    // to avoid database errors with null value
    if (!is_numeric($args->expected_coverage)) {
        $args->expected_coverage = 0;
    }
    $uk = 'setting_refresh_tree_on_action';
    $args->refreshTree = testproject::getUserChoice($args->tproject_id, array('reqTreeRefreshOnAction'));
    $args->stay_here = isset($_REQUEST['stay_here']) ? 1 : 0;
    return $args;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:32,代码来源:reqEdit.php

示例5: getAdminMenu

 /**
  * 获取模块菜单
  * @author jry <598821125@qq.com>
  */
 public function getAdminMenu($module_name = MODULE_NAME)
 {
     // 获取模块左侧导航
     $where['name'] = $module_name;
     $module_info = $this->where($where)->find();
     $_side_menu_list = json_decode($module_info['admin_menu'], true);
     // 转换成树结构
     $tree = new tree();
     return $tree->list_to_tree($_side_menu_list);
 }
开发者ID:hujun123qwe,项目名称:plover,代码行数:14,代码来源:ModuleModel.class.php

示例6: _initialize

 protected function _initialize()
 {
     /* 读取站点配置 */
     $config = api('Config/lists');
     C($config);
     //添加配置
     if (!C('WEB_SITE_CLOSE') && $_SESSION[C('USER_AUTH_KEY')] != 1) {
         $this->error('站点已经关闭,请稍后访问~', '', 1000);
     }
     $a = D('Member')->need_login();
     $field = array('uid', 'username', 'nickname', 'name', 'email', 'space_url', 'reg_time', 'last_login_time', 'signature', 'avatar32', 'avatar64', 'avatar128', 'avatar256');
     $userinfo = query_user($field, $_SESSION['cs_home']['user_auth']['uid']);
     $roleauth = getmroleauth();
     checkscore($_SESSION['cs_home']['user_auth']['uid']);
     $mymail['status'] = 1;
     $mymail['is_read'] = 0;
     $mymail['to_uid'] = $_SESSION['cs_home']['user_auth']['uid'];
     $mymailcount = M('Message')->where($mymail)->count();
     $userinfo['mymailcount'] = empty($mymailcount) ? '' : $mymailcount;
     $isadmin = is_admin($_SESSION['cs_home']['user_auth']['uid']);
     $this->assign('isadmin', $isadmin);
     $this->assign('user_auth', session('user_auth'));
     $this->assign('uid', getnowUid());
     $this->assign('userinfo', $userinfo);
     $this->assign('roleauth', $roleauth);
     //得到会员组权限
     $cname = strtolower(CONTROLLER_NAME);
     $aname = strtolower(ACTION_NAME);
     $this->assign('aname', $aname);
     $this->assign('cname', $cname);
     $cate = new CategoryApi();
     $clist = $cate->get_catelist(0);
     $clistnum = $cate->get_editcnum();
     $this->assign('clist', $clist);
     $nosigncate = M('Cate')->where(array('status' => 1, 'type' => 1))->select();
     $m = D('cate');
     $catelist = $m->field('*,CONCAT(spid,id) as path2')->where(array('type' => 1, 'status' => 1))->order('path2')->select();
     $t = new tree();
     $catelistarr = $t->unlimitCategoryFormat($catelist);
     $catehtml = $t->treeFormat($catelistarr);
     $this->assign('catehtml', $catehtml);
     $this->assign('nosigncate', $nosigncate);
     $this->assign('clistnum', $clistnum);
     $nav = D('nav')->where(array('status' => 1))->order('sort desc')->select();
     foreach ($nav as $key => $vo) {
         $nav[$key]['url'] = navurl($vo['id'], $vo['type']);
         $nav[$key]['active'] = navactive($vo['id'], $vo['type']);
         if ($vo['win']) {
             $nav[$key]['target'] = '_blank';
         } else {
             $nav[$key]['target'] = '_self';
         }
     }
     $this->assign('nav', $nav);
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:55,代码来源:HomeController.class.php

示例7: getTree

 /**
  * 获取所有导航
  * @author jry <598821125@qq.com>
  */
 public function getTree()
 {
     $con = array();
     $con['status'] = 1;
     $link_list = $this->where($con)->order('sort asc, id asc')->select();
     foreach ($link_list as $key => &$value) {
         if (!stristr($value['url'], 'http://') && !stristr($value['url'], 'https://')) {
             $value['url'] = U($value['url']);
         }
     }
     $tree = new tree();
     return $tree->list_to_tree($link_list);
 }
开发者ID:lipeng-github,项目名称:corethink,代码行数:17,代码来源:FootnavModel.class.php

示例8: init_args

/**
 * create object with all user inputs
 *
 * @internal revisions
 * 20110417 - franciscom - BUGID 4429: Code refactoring to remove global coupling as much as possible
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:19,代码来源:cfieldsView.php

示例9: init_args

function init_args(&$dbHandler)
{
    $args = new stdClass();
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->basehref = $_SESSION['basehref'];
    return $args;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:13,代码来源:reqSpecListTree.php

示例10: init_args

function init_args(&$dbHandler)
{
    $argsObj = new stdClass();
    $argsObj->tproject_name = '';
    $argsObj->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($argsObj->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($argsObj->tproject_id);
        $argsObj->tproject_name = $dummy['name'];
    }
    // new dbug($argsObj, array('calledFrom' => ' file: ' . basename(__FILE__) . ' -  function: ' . __FUNCTION__));
    return $argsObj;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:13,代码来源:project_req_spec_mgmt.php

示例11: init_args

function init_args(&$dbHandler, $dateFormat)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    // BUGID 3716
    $args->target_date_original = isset($_REQUEST['target_date']) ? $_REQUEST['target_date'] : null;
    $args->start_date_original = isset($_REQUEST['start_date']) ? $_REQUEST['start_date'] : null;
    // convert target date to iso format to write to db
    if (isset($_REQUEST['target_date']) && $_REQUEST['target_date'] != '') {
        $date_array = split_localized_date($_REQUEST['target_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->target_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    // convert start date to iso format to write to db
    if (isset($_REQUEST['start_date']) && $_REQUEST['start_date'] != '') {
        $date_array = split_localized_date($_REQUEST['start_date'], $dateFormat);
        if ($date_array != null) {
            // set date in iso format
            $args->start_date = $date_array['year'] . "-" . $date_array['month'] . "-" . $date_array['day'];
        }
    }
    $key2loop = array('low_priority_tcases', 'medium_priority_tcases', 'high_priority_tcases');
    foreach ($key2loop as $key) {
        $args->{$key} = isset($_REQUEST[$key]) ? intval($_REQUEST[$key]) : 0;
    }
    $args->id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    $args->name = isset($_REQUEST['milestone_name']) ? $_REQUEST['milestone_name'] : null;
    $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null;
    $args->basehref = $_SESSION['basehref'];
    $treeMgr = new tree($dbHandler);
    $tprojectMgr = new testproject($dbHandler);
    $args->tproject_options = new stdClass();
    $args->tproject_options->testPriorityEnabled = 0;
    $args->tproject_name = '';
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;
    if ($args->tproject_id > 0) {
        $info = $tprojectMgr->get_by_id($args->tproject_id);
        $args->tproject_name = $info['name'];
        $args->tproject_options = $info['opt'];
    }
    $args->tplan_name = '';
    $args->tplan_id = isset($_REQUEST['tplan_id']) ? intval($_REQUEST['tplan_id']) : 0;
    if ($args->tplan_id > 0) {
        $info = $treeMgr->get_node_hierarchy_info($args->tplan_id);
        $args->tplan_name = $info['name'];
    }
    return $args;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:50,代码来源:planMilestonesEdit.php

示例12: init_args

function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $iParams = array("doAction" => array(tlInputParameter::STRING_N, 0, 50), "export_filename" => array(tlInputParameter::STRING_N, 0, 255), "exportType" => array(tlInputParameter::STRING_N, 0, 255), "tproject_id" => array(tlInputParameter::INT_N));
    R_PARAMS($iParams, $args);
    $args->tproject_name = '';
    if ($args->tproject_id > 0) {
        $treeMgr = new tree($dbHandler);
        $dummy = $treeMgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    return $args;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:14,代码来源:keywordsExport.php

示例13: init_args

function init_args(&$dbHandler, $cfgObj)
{
    $args = new stdClass();
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $tplan_mgr = new testplan($dbHandler);
    // Settings we put on session to create some sort of persistent scope,
    // because we have had issues when passing this info using GET mode (size limits)
    //
    // we get info about build_id, platform_id, etc ...
    getContextFromGlobalScope($args);
    $args->user = $_SESSION['currentUser'];
    $args->user_id = $args->user->dbID;
    $args->caller = isset($_REQUEST['caller']) ? $_REQUEST['caller'] : 'exec_feature';
    $args->reload_caller = false;
    $args->tplan_id = intval(isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : $_SESSION['testplanID']);
    $args->tproject_id = intval(isset($_REQUEST['tproject_id']) ? $_REQUEST['tproject_id'] : $_SESSION['testprojectID']);
    if ($args->tproject_id <= 0) {
        $tree_mgr = new tree($dbHandler);
        $dm = $tree_mgr->get_node_hierarchy_info($args->tplan_id);
        $args->tproject_id = $dm['parent_id'];
    }
    if (is_null($args->build_id) || $args->build_id == 0) {
        // Go for the build
        // this info can be present in session, then we will try different ways
        // ATTENTION:
        // give a look to tlTestCaseFilterControl.class.php method init_setting_build()
        //
        $key = $args->tplan_id . '_stored_setting_build';
        $args->build_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
        if (is_null($args->build_id)) {
            $args->build_id = $tplan_mgr->get_max_build_id($args->tplan_id, 1, 1);
        }
    }
    if (is_null($args->platform_id) || $args->platform_id <= 0) {
        // Go for the platform (if any exists)
        // this info can be present in session, then we will try different ways
        // ATTENTION:
        // give a look to tlTestCaseFilterControl.class.php method init_setting_platform()
        //
        $itemSet = $tplan_mgr->getPlatforms($args->tplan_id);
        if (!is_null($itemSet)) {
            $key = $args->tplan_id . '_stored_setting_platform';
            $args->platform_id = isset($_SESSION[$key]) ? intval($_SESSION[$key]) : null;
            if (is_null($args->platform_id) || $args->platform_id <= 0) {
                $args->platform_id = $itemSet[0]['id'];
            }
        }
    }
    return array($args, $tplan_mgr);
}
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:50,代码来源:execDashboard.php

示例14: getActionTree

 public function getActionTree()
 {
     $sql = "SELECT id,parent_id,action_name from {$this->_table}";
     $cates = $res = $this->getList($sql);
     $this->load->helper('html_tree');
     $tree = new tree($cates);
     $tree->icon = array('&nbsp;&nbsp;│&nbsp;', '&nbsp;&nbsp;├─&nbsp;', '&nbsp;&nbsp;└─&nbsp;');
     //树形图标
     $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
     //三个空格
     $options = '';
     $tree->init($cates);
     return $tree->get_tree(0, "<option value='\$id'>\$spacer\$action_name</option>\n");
 }
开发者ID:shitfSign,项目名称:conf_system,代码行数:14,代码来源:admin_actions_mod.php

示例15: init_args

/**
 *
 */
function init_args(&$dbHandler)
{
    $iParams = array("item_id" => array(tlInputParameter::INT_N), "showContextInfo" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    $args->tproject_name = null;
    if ($args->tproject_id > 0) {
        $mgr = new tree($dbHandler);
        $dummy = $mgr->get_node_hierarchy_info($args->tproject_id);
        $args->tproject_name = $dummy['name'];
    }
    $args->user = $_SESSION['currentUser'];
    $args->userID = $args->user->dbID;
    return $args;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:18,代码来源:reqSpecViewRevision.php


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