本文整理汇总了PHP中testproject::setSessionProject方法的典型用法代码示例。如果您正苦于以下问题:PHP testproject::setSessionProject方法的具体用法?PHP testproject::setSessionProject怎么用?PHP testproject::setSessionProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testproject
的用法示例。
在下文中一共展示了testproject::setSessionProject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: launch_inner_exec
/**
*
*
*/
function launch_inner_exec(&$dbHandler, &$tplMgr)
{
$itemCode = array('exec' => 'lib/execute/execNavigator.php');
$op = array('status_ok' => true, 'msg' => '');
// First check for keys in _GET that MUST EXIST
// key: key on _GET, value: labelID defined on strings.txt
$mandatoryKeys = array('item' => 'item_not_set', 'build_id' => 'build_id_not_set');
foreach ($mandatoryKeys as $key => $labelID) {
$op['status_ok'] = isset($_GET[$key]);
if (!$op['status_ok']) {
$op['msg'] = lang_get($labelID);
break;
}
}
if ($op['status_ok']) {
$op['status_ok'] = isset($_GET['feature_id']);
if (!$op['status_ok']) {
$keySet = array('tplan_id' => 'testplan_not_set', 'tcversion_id' => 'tcversion_id', 'platform_id' => 'platform_id_not_set');
foreach ($keySet as $key => $labelID) {
$op['status_ok'] = isset($_GET[$key]);
if (!$op['status_ok']) {
$op['msg'] = lang_get($labelID);
break;
}
}
}
}
$args = init_args($dbHandler);
if ($op['status_ok']) {
// Set Environment
$tplan_mgr = new testplan($dbHandler);
$info = $tplan_mgr->get_by_id($args->tplan_id, array('output' => 'minimun'));
if (is_null($info)) {
die('ltx - tplan info does not exist');
}
$tproject_mgr = new testproject($dbHandler);
$tproject_mgr->setSessionProject($info['tproject_id']);
$op['status_ok'] = true;
}
if ($op['status_ok']) {
// Build name of function to call for doing the job.
$pfn = 'process_' . $args->item;
$ctx = array();
$ctx['setting_testplan'] = $args->tplan_id;
$ctx['setting_build'] = $args->build_id;
$ctx['setting_platform'] = $args->platform_id;
$ctx['tcversion_id'] = $args->tcversion_id;
$ctx['tcase_id'] = 0;
$ctx['user_id'] = $args->user_id;
$jump_to = $pfn($dbHandler, $ctx);
$op['status_ok'] = !is_null($jump_to['url']);
$op['msg'] = $jump_to['msg'];
}
if ($op['status_ok']) {
$treeframe = $itemCode[$args->item] . '?loadExecDashboard=0' . '&setting_testplan=' . $args->tplan_id . '&setting_build=' . $args->build_id . '&setting_platform=' . $args->platform_id;
$tplMgr->assign('title', lang_get('main_page_title'));
$tplMgr->assign('treewidth', TL_FRMWORKAREA_LEFT_FRAME_WIDTH);
$tplMgr->assign('workframe', $jump_to['url']);
$tplMgr->assign('treeframe', $treeframe);
$tplMgr->display('frmInner.tpl');
} else {
echo $op['msg'];
ob_end_flush();
exit;
}
}
示例2: array
// First check for keys in _GET that MUST EXIST
// key: key on _GET, value: labelID defined on strings.txt
$mustKeys = array('tprojectPrefix' => 'testproject_not_set', 'item' => 'item_not_set', 'id' => 'id_not_set');
$tprojectPrefix = isset($_GET['tprojectPrefix']) ? $_GET['tprojectPrefix'] : '';
foreach ($mustKeys as $key => $labelID) {
$op['status_ok'] = isset($_GET[$key]);
if (!$op['status_ok']) {
$op['msg'] = lang_get($labelID);
break;
}
}
if ($op['status_ok']) {
$tproject = new testproject($db);
$tproject_data = $tproject->get_by_prefix($tprojectPrefix);
if ($op['status_ok'] = !is_null($tproject_data)) {
$tproject->setSessionProject($tproject_data['id']);
$op['status_ok'] = isset($itemCode[$_GET['item']]);
$op['msg'] = sprintf(lang_get('invalid_item'), $_GET['item']);
} else {
$op['msg'] = sprintf(lang_get('testproject_not_found'), $_GET['tprojectPrefix']);
}
}
if ($op['status_ok']) {
// Build name of function to call for doing the job.
$pfn = 'process_' . $_GET['item'];
$jump_to = $pfn($db, $_GET['id'], $tproject_data['id'], $tprojectPrefix);
$op['status_ok'] = !is_null($jump_to['url']);
$op['msg'] = $jump_to['msg'];
}
if ($op['status_ok']) {
//add anchor
示例3: initProject
/**
* Update Project and Test Plan data on Project change or startup
* Data are stored in $_SESSION array
*
* If we receive TestPlan ID in the _SESSION then do some checks and if everything OK
* Update this value at Session Level, to set it available in other pieces of the application
*
* @param integer $db DB connection identifier
* @param array $hash_user_sel input data for the page ($_REQUEST)
*
* @uses initMenu()
* @internal Revisions:
* 20091111 - havlatm - menu generation added, name changed (from upd_session_tplan_tproject)
* 20090726 - franciscom - getAccessibleTestPlans() now is method on user class
**/
function initProject(&$db, $hash_user_sel)
{
$tproject = new testproject($db);
$user_sel = array("tplan_id" => 0, "tproject_id" => 0);
$user_sel["tproject_id"] = isset($hash_user_sel['testproject']) ? intval($hash_user_sel['testproject']) : 0;
$user_sel["tplan_id"] = isset($hash_user_sel['testplan']) ? intval($hash_user_sel['testplan']) : 0;
$tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
// test project is Test Plan container, then we start checking the container
if ($user_sel["tproject_id"] != 0) {
$tproject_id = $user_sel["tproject_id"];
}
// We need to do checks before updating the SESSION to cover the case that not defined but exists
if (!$tproject_id) {
$all_tprojects = $tproject->get_all();
if ($all_tprojects) {
$tproject_data = $all_tprojects[0];
$tproject_id = $tproject_data['id'];
}
}
$tproject->setSessionProject($tproject_id);
// set a Test Plan
// Refresh test project id after call to setSessionProject
$tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$tplan_id = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : null;
// Now we need to validate the TestPlan
// dolezalz, havlatm: added remember the last selection by cookie
$cookieName = "TL_user{$_SESSION['userID']}_proj{$tproject_id}_testPlanId";
if ($user_sel["tplan_id"] != 0) {
$tplan_id = $user_sel["tplan_id"];
setcookie($cookieName, $tplan_id, time() + 60 * 60 * 24 * 90, '/');
} elseif (isset($_COOKIE[$cookieName])) {
$tplan_id = intval($_COOKIE[$cookieName]);
}
// check if the specific combination of testprojectid and testplanid is valid
$tplan_data = $_SESSION['currentUser']->getAccessibleTestPlans($db, $tproject_id, $tplan_id);
if (is_null($tplan_data)) {
// Need to get first accessible test plan for user, if any exists.
$tplan_data = $_SESSION['currentUser']->getAccessibleTestPlans($db, $tproject_id);
}
if (!is_null($tplan_data)) {
$tplan_data = $tplan_data[0];
setSessionTestPlan($tplan_data);
}
// initialize structure of top menu for the user and the project
initTopMenu($db);
}
示例4: testplan
$op['msg'] = lang_get($labelID);
break;
}
}
}
}
$args = init_args($db);
if ($op['status_ok']) {
// Set Environment
$tplan_mgr = new testplan($db);
$info = $tplan_mgr->get_by_id($args->tplan_id, array('output' => 'minimun'));
if (is_null($info)) {
die('ltx - tplan info does not exist');
}
$tproject_mgr = new testproject($db);
$tproject_mgr->setSessionProject($info['tproject_id']);
$op['status_ok'] = true;
}
if ($op['status_ok']) {
// Build name of function to call for doing the job.
$pfn = 'process_' . $args->item;
$ctx = array();
$ctx['setting_testplan'] = $args->tplan_id;
$ctx['setting_build'] = $args->build_id;
$ctx['setting_platform'] = $args->platform_id;
$ctx['tcversion_id'] = $args->tcversion_id;
$ctx['tcase_id'] = 0;
$jump_to = $pfn($db, $ctx);
$op['status_ok'] = !is_null($jump_to['url']);
$op['msg'] = $jump_to['msg'];
}