Beispiel #1
0
<?php

require_once dirname(__FILE__) . '/class.db.php';
require_once dirname(__FILE__) . '/class.tree.php';
if (isset($_GET['operation'])) {
    $fs = new tree(db::get('mysqli://root@127.0.0.1/test'), array('structure_table' => 'tree_struct', 'data_table' => 'tree_data', 'data' => array('nm')));
    try {
        $rslt = null;
        switch ($_GET['operation']) {
            case 'analyze':
                var_dump($fs->analyze(true));
                die;
                break;
            case 'get_node':
                $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
                $temp = $fs->get_children($node);
                $rslt = array();
                foreach ($temp as $v) {
                    $rslt[] = array('id' => $v['id'], 'text' => $v['nm'], 'children' => $v['rgt'] - $v['lft'] > 1);
                }
                break;
            case "get_content":
                $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : 0;
                $node = explode(':', $node);
                if (count($node) > 1) {
                    $rslt = array('content' => 'Multiple selected');
                } else {
                    $temp = $fs->get_node((int) $node[0], array('with_path' => true));
                    $rslt = array('content' => 'Selected: /' . implode('/', array_map(function ($v) {
                        return $v['nm'];
                    }, $temp['path'])) . '/' . $temp['nm']);
Beispiel #2
0
$path = $tree_mgr->get_path($path_begin_node_id, TREE_ROOT, FORMAT_FULL);
new dBug($path);
echo "<pre> tree - get_path({$path_begin_node_id},TREE_ROOT,FORMAT_SIMPLE) ";
echo "</pre>";
$path = $tree_mgr->get_path($path_begin_node_id, TREE_ROOT, FORMAT_SIMPLE);
new dBug($path);
echo "<pre> tree - get_path({$path_begin_node_id},{$path_end_node_id},FORMAT_FULL) ";
echo "</pre>";
$path = $tree_mgr->get_path($path_begin_node_id, $path_end_node_id, FORMAT_FULL);
new dBug($path);
$node_id = 1;
echo "<pre> tree - get_children(\$node_id)";
echo "</pre>";
echo "<pre> get_children({$node_id})";
echo "</pre>";
$children = $tree_mgr->get_children($node_id);
new dBug($children);
echo "<pre> tree - get_node_hierarchy_info(\$node_id) ";
echo "</pre>";
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);
/*
function tree(&$db) 
function get_available_node_types() 
function new_root_node($name = '') 
function new_node($parent_id,$node_type_id,$name='',$node_order=0,$node_id=0) 
function get_node_hierarchy_info($node_id) 
function get_subtree_list($node_id)
function _get_subtree_list($node_id,&$node_list)
Beispiel #3
0
    // One test case.
    $exporting_just_one_tc = $args->tcase_id && $args->tcversion_id;
    $gui->export_filename = 'testcases.xml';
    if ($exporting_just_one_tc) {
        $node_id = $args->tcase_id;
        $gui->page_title = lang_get('title_tc_export');
    } else {
        $gui->page_title = lang_get('title_tc_export_all');
        $check_children = 1;
        $gui->nothing_todo_msg = lang_get('no_testcases_to_export');
    }
}
$gui->export_filename = is_null($args->export_filename) ? $gui->export_filename : $args->export_filename;
if ($check_children) {
    // Check if there is something to export
    $children = $tree_mgr->get_children($node_id, array("testplan" => "exclude_me", "requirement_spec" => "exclude_me", "requirement" => "exclude_me"));
    $gui->nothing_todo_msg = '';
    if (count($children) == 0) {
        $gui->do_it = 0;
    }
}
$node = $tree_mgr->get_node_hierarchy_info($node_id);
if ($args->doExport) {
    $tcase_mgr = new testcase($db);
    $tsuite_mgr = new testsuite($db);
    $optExport = array('REQS' => $args->exportReqs, 'CFIELDS' => $args->exportCFields, 'KEYWORDS' => $args->exportKeywords, 'RECURSIVE' => $args->useRecursion);
    $pfn = null;
    switch ($args->exportType) {
        case 'XML':
            $pfn = 'exportTestSuiteDataToXML';
            if ($exporting_just_one_tc) {