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


PHP tree::get_available_node_types方法代码示例

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


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

示例1: remote_exec_testcase_set

function remote_exec_testcase_set(&$db, $parent_id, $msg)
{
    $cfield_manager = new cfield_mgr($db);
    $tree_manager = new tree($db);
    $xmlResponse = null;
    $executionResults = array();
    $node_type = $tree_manager->get_available_node_types();
    $subtree_list = $tree_manager->get_subtree($parent_id);
    foreach ($subtree_list as $_key => $_value) {
        if (is_array($_value)) {
            if ($_value['node_type_id'] == $node_type['testcase']) {
                $executionResults[$_value['id']] = executeTestCase($_value['id'], $tree_manager, $cfield_manager);
            } else {
                //Can add some logic here. If required.
                continue;
            }
        }
    }
    if ($executionResults) {
        foreach ($executionResults as $key => $value) {
            $node_info = $tree_manager->get_node_hierarchy_info($key);
            $xmlResponse .= '<tr><th colspan="2">' . lang_get('tcexec_results_for') . $node_info['name'] . "</th></tr>";
            $serverTest = 1;
            foreach ($value as $_key => $_value) {
                if ($_value != -1) {
                    $xmlResponse .= "<tr><td>" . $_key . ":</td><td>" . $_value . "</td></tr>";
                } else {
                    $serverTest = $serverTest + 1;
                }
            }
            if ($serverTest != 1) {
                $xmlResponse .= $xmlResponse .= $msg['check_server_setting'];
            }
        }
    }
    return $xmlResponse;
}
开发者ID:tamtrong,项目名称:testlink,代码行数:37,代码来源:tcExecute.php

示例2: array

 * @version    	CVS: $Id: checkTCaseDuplicateName.php,v 1.3 2010/10/10 13:41:13 franciscom Exp $
 *
 * @internal Revisions:
 * 20101010 - franciscom - added testsuite_id as parameter, needed to do checks when creating test case
 * 20100225 - eloff - initial commit
 *
 **/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
$data = array('success' => true, 'message' => '');
$iParams = array("name" => array(tlInputParameter::STRING_N, 0, 100), "testcase_id" => array(tlInputParameter::INT), "testsuite_id" => array(tlInputParameter::INT));
$args = G_PARAMS($iParams);
if (has_rights($db, 'mgt_view_tc')) {
    $tree_manager = new tree($db);
    $node_types_descr_id = $tree_manager->get_available_node_types();
    // To allow name check when creating a NEW test case => we do not have test case id
    $args['testcase_id'] = $args['testcase_id'] > 0 ? $args['testcase_id'] : null;
    $args['testsuite_id'] = $args['testsuite_id'] > 0 ? $args['testsuite_id'] : null;
    // for debug -
    // $xx = "\$args['testcase_id']:{$args['testcase_id']} - \$args['name']:{$args['name']}" .
    //       " - \$args['testsuite_id']:{$args['testsuite_id']}";
    // file_put_contents('c:\checkTCaseDuplicateName.php.ajax', $xx);
    $check = $tree_manager->nodeNameExists($args['name'], $node_types_descr_id['testcase'], $args['testcase_id'], $args['testsuite_id']);
    $data['success'] = !$check['status'];
    $data['message'] = $check['msg'];
} else {
    tLog('User has not right needed to do requested action - checkTCaseDuplicateName.php', 'ERROR');
    $data['success'] = false;
    $data['message'] = lang_get('user_has_no_right_for_action');
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:31,代码来源:checkTCaseDuplicateName.php

示例3: dBug

 *
 * 
 *
 * rev :
*/
require_once '../../../config.inc.php';
require_once 'common.php';
require_once 'tree.class.php';
testlinkInitPage($db);
echo "<pre> tree - constructor - tree(&\$db)";
echo "</pre>";
$tree_mgr = new tree($db);
new dBug($tree_mgr);
echo "<pre> tree - get_available_node_types()";
echo "</pre>";
$available_node_types = $tree_mgr->get_available_node_types();
new dBug($available_node_types);
echo "<pre> tree - get_node_hierarchy_info(\$node_id)";
echo "</pre>";
$node_id = 1;
echo "<pre> get_node_hierarchy_info({$node_id})";
echo "</pre>";
$node_hierachy_info = $tree_mgr->get_node_hierarchy_info($node_id);
new dBug($node_hierachy_info);
echo "<pre> tree - get_subtree(\$node_id)";
echo "</pre>";
echo "<pre> get_subtree({$node_id})";
echo "</pre>";
$subtree = $tree_mgr->get_subtree($node_id);
new dBug($subtree);
echo "<pre> tree - get_subtree(\$node_id,\$exclude_node_types=null," . "<br>" . "                              \$exclude_children_of=null,\$exclude_branches=null," . "<br>" . "                              \$and_not_in_clause='',\$bRecursive = false)";
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:tree.class.test.php

示例4: 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

示例5: migrate_cfield_links

/**
 * Migrate custom field values AT DESIGN TIME, for test cases and requirements,
 * to point to item version instead of item:
 * test case version instead of test case
 * requirement version instead of requirement
 * 
 * @author Francisco Mancardi 
 * @param database $dbHandler
 * @param array $tableSet
 */
function migrate_cfield_links(&$dbHandler, $tableSet)
{
    $treeMgr = new tree($dbHandler);
    $nodeTypes = $treeMgr->get_available_node_types();
    unset($treeMgr);
    $sql = " SELECT CFDV.*, NHITEM.node_type_id, NHVERSION.id AS version_node_id" . " FROM {$tableSet['cfield_design_values']} CFDV " . " JOIN {$tableSet['nodes_hierarchy']} NHITEM ON NHITEM.id = CFDV.node_id " . " JOIN {$tableSet['nodes_hierarchy']} NHVERSION ON NHVERSION.parent_id = NHITEM.id " . " WHERE NHITEM.node_type_id IN ({$nodeTypes['testcase']},{$nodeTypes['requirement']}) ";
    $workingSet = $dbHandler->get_recordset($sql);
    echo 'Step - Custom Fields (DESIGN TIME) Migration - STARTED <br> ';
    if (!is_null($workingSet)) {
        echo "Working - Custom Fields Migration - Records to process:" . count($workingSet) . "<br>";
        foreach ($workingSet as $target) {
            // $values[] = "( {$target['field_id']}, {$target['version_node_id']}, '{$target['value']}' )";
            $victims[$target['node_id']] = $target['node_type_id'];
            // Ay!, I've forgot to escape target value
            $sql = " INSERT INTO {$tableSet['cfield_design_values']} (field_id,node_id,value) VALUES " . "( {$target['field_id']}, {$target['version_node_id']}," . "'" . $dbHandler->prepare_string($target['value']) . "' )";
            $dbHandler->exec_query($sql);
        }
        // depending amount of data on db this can create an statement with too many characters
        // and can fail.
        // change to slower but safer strategy: one by one insert
        // $sql = " INSERT INTO {$tableSet['cfield_design_values']} (field_id,node_id,value) VALUES ";
        // $vSet = implode(',',$values);
        // $sql .= $vSet;
        // $dbHandler->exec_query($sql);
        foreach ($victims as $node_id => $node_type_id) {
            $sql = " DELETE FROM {$tableSet['cfield_design_values']} WHERE node_id = {$node_id} ";
            $dbHandler->exec_query($sql);
        }
    }
    echo 'Step - Custom Fields (DESIGN TIME) Migration - Finished !! <br><br> ';
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:41,代码来源:migrate_18_to_19.php

示例6: tree

 * @version $Revision: 1.4 $
 * @modified $Date: 2010/09/17 18:26:09 $  $Author: franciscom $
 * @author Francisco Mancardi - francisco.mancardi@gmail.com
 *
 * Migrate Custom field data from item to item version (1.9 RC1 and up)
*/
require_once "../../config.inc.php";
require_once "common.php";
testlinkInitPage($db);
// Check if user has right role to execute
if (!($_SESSION['currentUser']->globalRole->name == 'admin')) {
    echo 'You need to have admin role in order to use this page <b> ';
    die;
}
$treeMgr = new tree($db);
$nodeTypes = $treeMgr->get_available_node_types();
unset($treeMgr);
$tprojectMgr = new testproject($db);
$tables = $tprojectMgr->getDBTables(array('nodes_hierarchy', 'cfield_design_values'));
unset($tprojectSet);
$sql = " SELECT CFDV.*, NHITEM.node_type_id, NHVERSION.id AS version_node_id" . " FROM {$tables['cfield_design_values']} CFDV " . " JOIN {$tables['nodes_hierarchy']} NHITEM ON NHITEM.id = CFDV.node_id " . " JOIN {$tables['nodes_hierarchy']} NHVERSION ON NHVERSION.parent_id = NHITEM.id " . " WHERE NHITEM.node_type_id IN ({$nodeTypes['testcase']},{$nodeTypes['requirement']}) ";
$workingSet = $db->get_recordset($sql);
echo 'Records to process: ' . count($workingSet) . '<br>';
if (!is_null($workingSet)) {
    foreach ($workingSet as $target) {
        $values[] = "( {$target['field_id']}, {$target['version_node_id']}, '{$target['value']}' )";
        $victims[$target['node_id']] = $target['node_type_id'];
    }
    $sql = " INSERT INTO {$tables['cfield_design_values']} (field_id,node_id,value) VALUES ";
    $vSet = implode(',', $values);
    $sql .= $vSet;
开发者ID:atisne,项目名称:testlink-code,代码行数:31,代码来源:migrate_cf_links.php

示例7: migrate_cfield_links

/**
 * Migrate custom field values AT DESIGN TIME, for test cases and requirements,
 * to point to item version instead of item:
 * test case version instead of test case
 * requirement version instead of requirement
 * 
 * @author Francisco Mancardi 
 * @param database $dbHandler
 * @param array $tableSet
 */
function migrate_cfield_links(&$dbHandler, $tableSet)
{
    $treeMgr = new tree($dbHandler);
    $nodeTypes = $treeMgr->get_available_node_types();
    echo $nodesTypes['testcase'];
    unset($treeMgr);
    $sql = " SELECT CFDV.*, NHITEM.node_type_id, NHVERSION.id AS version_node_id" . " FROM {$tableSet['cfield_design_values']} CFDV " . " JOIN {$tableSet['nodes_hierarchy']} NHITEM ON NHITEM.id = CFDV.node_id " . " JOIN {$tableSet['nodes_hierarchy']} NHVERSION ON NHVERSION.parent_id = NHITEM.id " . " WHERE NHITEM.node_type_id IN ({$nodeTypes['testcase']},{$nodeTypes['requirement']}) ";
    $workingSet = $dbHandler->get_recordset($sql);
    echo 'Records to process: count($workingSet)<br>';
    if (!is_null($workingSet)) {
        foreach ($workingSet as $target) {
            $values[] = "( {$target['field_id']}, {$target['version_node_id']}, '{$target['value']}' )";
            $victims[$target['node_id']] = $target['node_type_id'];
        }
        $sql = " INSERT INTO {$tableSet['cfield_design_values']} (field_id,node_id,value) VALUES ";
        $vSet = implode(',', $values);
        $sql .= $vSet;
        $dbHandler->exec_query($sql);
        foreach ($victims as $node_id => $node_type_id) {
            $sql = " DELETE FROM {$tableSet['cfield_design_values']} WHERE node_id = {$node_id} ";
            $dbHandler->exec_query($sql);
        }
    }
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:34,代码来源:migrate_18_to_19.php

示例8: migrate_testcases

/**
 * migrate_testcases
 */
function migrate_testcases(&$dbHandler, $tableSet)
{
    // TL 1.8
    // --
    // -- Table structure for table "tcversions"
    // --
    // CREATE TABLE "tcversions" (
    //   "id" BIGINT NOT NULL DEFAULT '0' REFERENCES nodes_hierarchy (id),
    //   "tc_external_id" INT NULL,
    //   "version" INTEGER NOT NULL DEFAULT '1',
    //   "summary" TEXT NULL DEFAULT NULL,
    //   "steps" TEXT NULL DEFAULT NULL,
    //   "expected_results" TEXT NULL DEFAULT NULL,
    //   "importance" INT2 NOT NULL DEFAULT '2',
    //   "author_id" BIGINT NULL DEFAULT NULL REFERENCES users (id),
    //   "creation_ts" TIMESTAMP NOT NULL DEFAULT now(),
    //   "updater_id" BIGINT NULL DEFAULT NULL REFERENCES users (id),
    //   "modification_ts" TIMESTAMP NULL,
    //   "active" INT2 NOT NULL DEFAULT '1',
    //   "is_open" INT2 NOT NULL DEFAULT '1',
    //   "execution_type" INT2 NOT NULL DEFAULT '1',
    //   PRIMARY KEY ("id")
    // );
    // TL 1.9
    // --
    // -- Table structure for table "tcversions"
    // --
    // CREATE TABLE /*prefix*/tcversions(
    //   "id" BIGINT NOT NULL DEFAULT '0' REFERENCES  /*prefix*/nodes_hierarchy (id),
    //   "tc_external_id" INT NULL,
    //   "version" INTEGER NOT NULL DEFAULT '1',
    //   "layout" INTEGER NOT NULL DEFAULT '1',
    //   "summary" TEXT NULL DEFAULT NULL,
    //   "preconditions" TEXT NULL DEFAULT NULL,
    //   "importance" INT2 NOT NULL DEFAULT '2',
    //   "author_id" BIGINT NULL DEFAULT NULL REFERENCES  /*prefix*/users (id),
    //   "creation_ts" TIMESTAMP NOT NULL DEFAULT now(),
    //   "updater_id" BIGINT NULL DEFAULT NULL REFERENCES  /*prefix*/users (id),
    //   "modification_ts" TIMESTAMP NULL,
    //   "active" INT2 NOT NULL DEFAULT '1',
    //   "is_open" INT2 NOT NULL DEFAULT '1',
    //   "execution_type" INT2 NOT NULL DEFAULT '1',
    //   PRIMARY KEY ("id")
    // );
    //
    //
    // --
    // -- Table structure for table "tcsteps"
    // --
    // CREATE TABLE /*prefix*/tcsteps (
    //   "id" BIGINT NOT NULL DEFAULT '0' REFERENCES /*prefix*/nodes_hierarchy (id),
    //   "step_number" INT NOT NULL DEFAULT '1',
    //   "actions" TEXT NULL DEFAULT NULL,
    //   "expected_results" TEXT NULL DEFAULT NULL,
    //   "active" INT2 NOT NULL DEFAULT '1',
    //   "execution_type" INT2 NOT NULL DEFAULT '1',
    //   PRIMARY KEY ("id")
    // );
    echo __FUNCTION__;
    // do test cases exist?
    $sql = "SELECT id FROM {$tableSet['tcversions']}";
    $itemSet = $dbHandler->get_recordset($sql);
    if (!is_null($itemSet) && count($itemSet) > 0) {
        $tree_mgr = new tree($dbHandler);
        $node_types_descr_id = $tree_mgr->get_available_node_types();
        $node_types_id_descr = array_flip($node_types_descr_id);
        // STEP 1 - Populate in bulk mode tcsteps table.
        //
        // ALL FIELDS - tcversions 1.8
        // 1.8 id,tc_external_id,version,summary,steps,expected_results,importance,author_id,creation_ts,updater_id,modification_ts,active,is_open,execution_type,
        // 1.9 id,tc_external_id,version,summary,importance,author_id,creation_ts,updater_id,modification_ts,active,is_open,execution_type,
        //
        // 1.9 tcsteps
        // id,step_number,actions,expected_results,active,execution_type
        //
        // NEEDED FIELDS
        $sql = " INSERT INTO {$tableSet['tcsteps']} " . " (id,actions,expected_results,active,execution_type) " . " SELECT id,steps,expected_results,active,execution_type " . " FROM {$tableSet['tcversions']}";
        $dbHandler->exec_query($sql);
        // STEP 2 - Create nodes for tcsteps on nodes_hierarchy table
        foreach ($itemSet as $dummy => $item_info) {
            $item_id = $tree_mgr->new_node($item_info['id'], $node_types_descr_id['testcase_step']);
            $sql = " UPDATE {$tableSet['tcsteps']} " . " SET id = {$item_id} WHERE id={$item_info['id']}";
            $dbHandler->exec_query($sql);
        }
        // STEP 3 - Remove fields from tcversions
        $sql = "ALTER TABLE {$tableSet['tcversions']} " . "DROP steps, DROP expected_results ";
        $dbHandler->exec_query($sql);
    }
}
开发者ID:tamtrong,项目名称:testlink,代码行数:92,代码来源:migrate_18_to_19.php


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