Exemplo n.º 1
0
function initializeGui(&$dbHandler, &$argsObj, &$userObj, &$tprojectMgr)
{
    $tcaseCfg = config_get('testcase_cfg');
    $guiObj = new stdClass();
    $guiObj->can_manage_testplans = $userObj->hasRight($dbHandler, "mgt_testplan_create", $argsObj->tproject_id, $argsObj->tplan_id);
    $guiObj->show_details = 0;
    $guiObj->user_feedback = '';
    $guiObj->tcasePrefix = $tprojectMgr->getTestCasePrefix($argsObj->tproject_id) . $tcaseCfg->glue_character;
    $guiObj->tproject_name = $argsObj->tproject_name;
    $tplanMgr = new testplan($dbHandler);
    $tplan_info = $tplanMgr->get_by_id($argsObj->tplan_id);
    $guiObj->tplan_name = $tplan_info['name'];
    $guiObj->tplan_id = $argsObj->tplan_id;
    $guiObj->tproject_id = $argsObj->tproject_id;
    $guiObj->testcases = $tplanMgr->get_linked_and_newest_tcversions($argsObj->tplan_id);
    $linked_tcases = $tplanMgr->get_linked_items_id($argsObj->tplan_id);
    $guiObj->doIt = count($linked_tcases) > 0;
    $guiObj->tplans = array();
    $tplans = $userObj->getAccessibleTestPlans($dbHandler, $argsObj->tproject_id);
    foreach ($tplans as $key => $value) {
        $guiObj->tplans[$value['id']] = $value['name'];
    }
    return $guiObj;
}
Exemplo n.º 2
0
$tcase_mgr = new testcase($db);
$args = init_args();
$gui = new stdClass();
$gui->can_manage_testplans = $_SESSION['currentUser']->hasRight($db, "mgt_testplan_create");
$gui->tplans = array();
$gui->show_details = 0;
$gui->user_feedback = '';
$gui->tcasePrefix = $tcase_mgr->tproject_mgr->getTestCasePrefix($args->tproject_id) . $testcase_cfg->glue_character;
$tplan_info = $tcase_mgr->get_by_id($args->tplan_id);
$gui->tplan_name = $tplan_info['name'];
$gui->tplan_id = $args->tplan_id;
$gui->tproject_name = $args->tproject_name;
// $linked_tcases = $tplan_mgr->get_linked_tcversions($args->tplan_id);
$linked_tcases = $tplan_mgr->get_linked_items_id($args->tplan_id);
$qty_linked = count($linked_tcases);
$gui->testcases = $tplan_mgr->get_linked_and_newest_tcversions($args->tplan_id);
if ($qty_linked) {
    $qty_newest = count($gui->testcases);
    if ($qty_newest) {
        $gui->show_details = 1;
        // get path
        $tcaseSet = array_keys($gui->testcases);
        $path_info = $tree_mgr->get_full_path_verbose($tcaseSet);
        foreach ($gui->testcases as $tcase_id => $value) {
            $path = $path_info[$tcase_id];
            unset($path[0]);
            $path[] = '';
            $gui->testcases[$tcase_id]['path'] = implode(' / ', $path);
        }
    } else {
        $gui->user_feedback = lang_get('no_newest_version_of_linked_tcversions');