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


PHP tree::getAllItemsID方法代码示例

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


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

示例1: display_children

function display_children($dbHandler, $root_node, $parent, $filter_node, $show_children = ON, $operation = 'manage', $mode = 'reqspec')
{
    $tables = tlObjectWithDB::getDBTables(array('requirements', 'nodes_hierarchy', 'node_types', 'req_specs'));
    $cfg = config_get('req_cfg');
    $forbidden_parent['testproject'] = 'none';
    $forbidden_parent['requirement'] = 'testproject';
    $forbidden_parent['requirement_spec'] = 'requirement_spec';
    if ($cfg->child_requirements_mgmt) {
        $forbidden_parent['requirement_spec'] = 'none';
    }
    $fn = array();
    $fn['print']['reqspec'] = array('testproject' => 'TPROJECT_PTP_RS', 'requirement_spec' => 'TPROJECT_PRS', 'requirement' => 'openLinkedReqWindow');
    $fn['manage']['reqspec'] = array('testproject' => 'TPROJECT_REQ_SPEC_MGMT', 'requirement_spec' => 'REQ_SPEC_MGMT', 'requirement' => 'REQ_MGMT');
    $fn['print']['addtc'] = array('testproject' => 'TPROJECT_PTP', 'requirement_spec' => 'TPROJECT_PRS', 'requirement' => 'TPROJECT_PRS');
    $fn['manage']['addtc'] = array('testproject' => 'EP', 'requirement_spec' => 'ERS', 'requirement' => 'ER');
    switch ($operation) {
        case 'print':
        case 'manage':
            $js_function = $fn[$operation][$mode];
            break;
        default:
            $js_function = $fn['manage'][$mode];
            break;
    }
    $nodes = null;
    $filter_node_type = $show_children ? '' : ",'requirement'";
    $sql = " SELECT NHA.*, NT.description AS node_type, RSPEC.doc_id " . " FROM {$tables['nodes_hierarchy']} NHA JOIN {$tables['node_types']}  NT " . " ON NHA.node_type_id=NT.id " . " AND NT.description NOT IN " . " ('testcase','testsuite','testcase_version','testplan','requirement_spec_revision' {$filter_node_type}) " . " LEFT OUTER JOIN {$tables['req_specs']} RSPEC " . " ON RSPEC.id = NHA.id " . " WHERE NHA.parent_id = " . intval($parent);
    if (!is_null($filter_node) && $filter_node > 0 && $parent == $root_node) {
        $sql .= " AND NHA.id = " . intval($filter_node);
    }
    $sql .= " ORDER BY NHA.node_order ";
    $nodeSet = $dbHandler->get_recordset($sql);
    if (!is_null($nodeSet)) {
        $sql = " SELECT DISTINCT req_doc_id AS doc_id,NHA.id" . " FROM {$tables['requirements']} REQ JOIN {$tables['nodes_hierarchy']} NHA ON NHA.id = REQ.id  " . " JOIN {$tables['nodes_hierarchy']}  NHB ON NHA.parent_id = NHB.id " . " JOIN {$tables['node_types']} NT ON NT.id = NHA.node_type_id " . " WHERE NHB.id = " . intval($parent) . " AND NT.description = 'requirement'";
        $requirements = $dbHandler->fetchRowsIntoMap($sql, 'id');
        $treeMgr = new tree($dbHandler);
        $ntypes = $treeMgr->get_available_node_types();
        $peerTypes = array('target' => $ntypes['requirement'], 'container' => $ntypes['requirement_spec']);
        foreach ($nodeSet as $key => $row) {
            $path['text'] = htmlspecialchars($row['name']);
            $path['id'] = $row['id'];
            // this attribute/property is used on custom code on drag and drop
            $path['position'] = $row['node_order'];
            $path['leaf'] = false;
            $path['cls'] = 'folder';
            // Important:
            // We can add custom keys, and will be able to access it using
            // public property 'attributes' of object of Class Ext.tree.TreeNode
            //
            $path['testlink_node_type'] = $row['node_type'];
            $path['testlink_node_name'] = $path['text'];
            // already htmlspecialchars() done
            $path['forbidden_parent'] = 'none';
            switch ($row['node_type']) {
                case 'testproject':
                    $path['href'] = "javascript:EP({$path['id']})";
                    $path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
                    break;
                case 'requirement_spec':
                    $req_list = array();
                    $treeMgr->getAllItemsID($row['id'], $req_list, $peerTypes);
                    $path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
                    $path['text'] = htmlspecialchars($row['doc_id'] . ":") . $path['text'];
                    $path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
                    if (!is_null($req_list)) {
                        $item_qty = count($req_list);
                        $path['text'] .= " ({$item_qty})";
                    }
                    break;
                case 'requirement':
                    $path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
                    $path['text'] = htmlspecialchars($requirements[$row['id']]['doc_id'] . ":") . $path['text'];
                    $path['leaf'] = true;
                    $path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
                    break;
            }
            $nodes[] = $path;
        }
        // foreach
    }
    return $nodes;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:82,代码来源:getrequirementnodes.php


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