本文整理汇总了PHP中testproject::get_all方法的典型用法代码示例。如果您正苦于以下问题:PHP testproject::get_all方法的具体用法?PHP testproject::get_all怎么用?PHP testproject::get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testproject
的用法示例。
在下文中一共展示了testproject::get_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeTestProjectForTestPlan
$template_dir = 'project/';
$can_manage_tprojects = $_SESSION['currentUser']->haRight($db, 'mgt_modify_product');
// make sure the user has rights to manage test projects
if ($can_manage_tprojects) {
if ($_POST) {
foreach ($_POST as $testPlan => $testProject) {
if ($testProject != "none") {
echo "<br />changing test plan {$testPlan} to go with test project {$testProject}";
changeTestProjectForTestPlan($db, $testPlan, $testProject);
}
}
echo "<hr>";
}
$testPlans = getTestPlansWithoutProject($db);
$testPlansCount = count($testPlans);
$tpObj = new testproject($db);
$testProjects = $tpObj->get_all();
$smarty = new TLSmarty();
$smarty->assign('testPlans', $testPlans);
$smarty->assign('testProjects', $testProjects);
$smarty->assign('count', $testPlansCount);
$smarty->display($template_dir . 'fix_tplans.tpl');
} else {
echo "<p>" . lang_get('fix_tplans_no_rights') . "</p>";
}
function changeTestProjectForTestPlan(&$db, $testPlan, $testProject)
{
$query = "UPDATE testplans SET testproject_id={$testProject} WHERE id={$testPlan}";
$db->exec_query($query);
echo "<br />Done changing test project";
}
示例2: 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);
}
示例3: testcase
* @author Francisco Mancardi - francisco.mancardi@gmail.com
*
* utility to align Test Case External ID to Test Case INTERNAL ID
* Use at your risk
*/
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;
}
$tcase_mgr = new testcase($db);
$tproject_mgr = new testproject($db);
$testProjects = $tproject_mgr->get_all();
// $exclude_node_types=array('testplan' => 1,'requirement_spec' => 1 );
// $exclude_children=array('testcase' =>1);
$my['filters'] = array('exclude_node_types' => array('testplan' => 1, 'requirement_spec' => 1), 'exclude_children' => array('testcase' => 1));
foreach ($testProjects as $item) {
$tproject_id = $item['id'];
// $elements = $tproject_mgr->tree_manager->get_subtree($tproject_id,$exclude_node_types,
// $exclude_children,null,null,null);
$elements = $tproject_mgr->tree_manager->get_subtree($tproject_id, $my['filters']);
$tcaseSet = null;
foreach ($elements as $elem) {
//new dBug($elem);
if ($elem['node_table'] == 'testcases') {
$tcaseSet[] = $elem['id'];
}
}