本文整理汇总了PHP中tlObjectWithDB::getDBTables方法的典型用法代码示例。如果您正苦于以下问题:PHP tlObjectWithDB::getDBTables方法的具体用法?PHP tlObjectWithDB::getDBTables怎么用?PHP tlObjectWithDB::getDBTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tlObjectWithDB
的用法示例。
在下文中一共展示了tlObjectWithDB::getDBTables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBareBonesReq
/**
*
*
*/
function getBareBonesReq($dbHandler, $reqID)
{
$debugMsg = ' Function: ' . __FUNCTION__;
$tables = tlObjectWithDB::getDBTables(array('requirements', 'nodes_hierarchy'));
$sql = " /* {$debugMsg} */ SELECT REQ.req_doc_id, NH_REQ.name " . " FROM {$tables['requirements']} REQ " . " JOIN {$tables['nodes_hierarchy']} NH_REQ\tON NH_REQ.id = REQ.id " . " WHERE REQ.id = " . intval($reqID);
$bones = $dbHandler->get_recordset($sql);
return $bones[0];
}
示例2: doExport
function doExport(&$dbHandler, $filename)
{
$tables = tlObjectWithDB::getDBTables(array('custom_fields', 'cfield_node_types'));
$adodbXML = new ADODB_XML("1.0", "ISO-8859-1");
$sql = " SELECT name,label,type,possible_values,default_value,valid_regexp, " . " length_min,length_max,show_on_design,enable_on_design,show_on_execution," . " enable_on_execution,show_on_testplan_design,enable_on_testplan_design, " . " node_type_id,required " . " FROM {$tables['custom_fields']} CF,{$tables['cfield_node_types']} " . " WHERE CF.id=field_id ";
$adodbXML->setRootTagName('custom_fields');
$adodbXML->setRowTagName('custom_field');
$content = $adodbXML->ConvertToXMLString($dbHandler->db, $sql);
downloadContentsToFile($content, $filename);
exit;
}
示例3: doExport
function doExport(&$dbHandler, $filename)
{
$adodbXML = new ADODB_XML("1.0", "ISO-8859-1");
$adodbXML->setRootTagName('users');
$adodbXML->setRowTagName('user');
$tables = tlObjectWithDB::getDBTables(array('users'));
$fieldSet = 'id,login,role_id,email,first,last,locale,default_testproject_id,active';
$sql = " SELECT {$fieldSet} FROM {$tables['users']} ";
$content = $adodbXML->ConvertToXMLString($dbHandler->db, $sql);
downloadContentsToFile($content, $filename);
exit;
}
示例4: doExport
function doExport(&$db, $filename, $testproject_id)
{
$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$tables = tlObjectWithDB::getDBTables(array('platforms'));
$adodbXML = new ADODB_XML("1.0", "UTF-8");
$sql = "/* {$debugMsg} */ SELECT name,notes " . " FROM {$tables['platforms']} PLAT " . " WHERE PLAT.testproject_id=" . intval($testproject_id);
$adodbXML->setRootTagName('platforms');
$adodbXML->setRowTagName('platform');
$content = $adodbXML->ConvertToXMLString($db->db, $sql);
downloadContentsToFile($content, $filename);
exit;
}
示例5: __construct
public function __construct(&$dbHandler)
{
$this->db = $dbHandler;
$this->tprojectMgr = new testproject($dbHandler);
$this->tables = tlObjectWithDB::getDBTables(array('tcversions', 'nodes_hierarchy', 'testplan_tcversions', 'cfield_design_values'));
$this->cfg = new stdClass();
$this->cfg->showTestCaseID = config_get('treemenu_show_testcase_id');
$this->cfg->glueChar = config_get('testcase_cfg')->glue_character;
$this->cfg->nodeTypeCode = $this->tprojectMgr->tree_manager->get_available_node_types();
$this->cfg->nodeCodeType = array_flip($this->cfg->nodeTypeCode);
$this->cfg->results = config_get('results');
$this->cfg->renderTestSpecNode = new stdClass();
$this->cfg->renderTestSpecNode->key2del = array_merge(array_keys($this->cfg->results['status_code']), array('node_type_id', 'parent_id', 'node_order', 'node_table', 'tcversion_id', 'external_id', 'version', 'testcase_count'));
}
示例6: process_req
/**
* process_req
*
*/
function process_req(&$dbHandler, $docID, $tprojectID, $tprojectPrefix)
{
$tables = tlObjectWithDB::getDBTables(array('requirements', 'nodes_hierarchy', 'req_specs', 'tcversions'));
$ret = array();
$ret['url'] = null;
$ret['msg'] = sprintf(lang_get('req_not_found'), $docID, $tprojectPrefix);
$req_mgr = new requirement_mgr($dbHandler);
$req = $req_mgr->getByDocID($docID, $tprojectID);
if (!is_null($req)) {
// link to open in requirement frame
$req = current($req);
$ret['url'] = "lib/requirements/reqView.php?item=requirement&requirement_id={$req['id']}";
$cookie = buildCookie($dbHandler, $req['id'], $tprojectID, 'ys-requirement_spec');
setcookie($cookie['value'], $cookie['path'], TL_COOKIE_KEEPTIME, '/');
}
return $ret;
}
示例7: drop_tables
function drop_tables(&$dbHandler, $dbTablePrefix, $dbType)
{
// From 1.9 and up we have detail of tables.
$schema = tlObjectWithDB::getDBTables();
// tables present on target db
$my_ado = $dbHandler->get_dbmgr_object();
$tablesOnDB = $my_ado->MetaTables('TABLES');
if (count($tablesOnDB) > 0 && isset($tablesOnDB[0])) {
echo "<br />Dropping all TL existent tables:<br />";
foreach ($schema as $tablePlainName => $tableFullName) {
// echo 'DEBUG - $tablePlainName:' . $tablePlainName . '<br>';
// echo 'DEBUG - $tableFullName:' . $tableFullName . '<br>';
// BUGID 3654
$targetTable = $dbTablePrefix . $tablePlainName;
if (in_array($targetTable, $tablesOnDB)) {
// Need to add option (CASCADE ?) to delete dependent object
echo "Droping {$targetTable}" . "<br />";
$sql = "DROP TABLE {$targetTable}";
$sql .= $dbType != 'mssql' ? " CASCADE " : ' ';
$dbHandler->exec_query($sql);
}
}
echo "<span class='ok'>Done!</span>";
}
}
示例8: get_filtered_req_map
/**
* Generate a filtered map with all fitting requirements in it.
*
* @author Andreas Simon
* @param Database $db reference to database handler object
* @param int $testproject_id ID of the project for which the tree shall be generated
* @param testproject $testproject_mgr reference to testproject manager object
* @param array $filters Filter settings which shall be applied to the tree
* @param array $options Further options which shall be applied on generating the tree
* @return array $filtered_map map with all fitting requirements
*/
function get_filtered_req_map(&$db, $testproject_id, &$testproject_mgr, $filters, $options)
{
$filtered_map = null;
$tables = tlObjectWithDB::getDBTables(array('nodes_hierarchy', 'requirements', 'req_specs', 'req_relations', 'req_versions', 'req_coverage', 'tcversions', 'cfield_design_values'));
$sql = " SELECT R.id, R.req_doc_id, NH_R.name AS title, R.srs_id, " . " RS.doc_id AS req_spec_doc_id, NH_RS.name AS req_spec_title, " . " RV.version, RV.id AS version_id, NH_R.node_order, " . " RV.expected_coverage, RV.status, RV.type, RV.active, RV.is_open " . " FROM {$tables['requirements']} R " . " JOIN {$tables['nodes_hierarchy']} NH_R ON NH_R.id = R.id " . " JOIN {$tables['nodes_hierarchy']} NH_RV ON NH_RV.parent_id = NH_R.id " . " JOIN {$tables['req_versions']} RV ON RV.id = NH_RV.id " . " JOIN {$tables['req_specs']} RS ON RS.id = R.srs_id " . " JOIN {$tables['nodes_hierarchy']} NH_RS ON NH_RS.id = RS.id ";
if (isset($filters['filter_relation'])) {
$sql .= " JOIN {$tables['req_relations']} RR " . " ON (RR.destination_id = R.id OR RR.source_id = R.id) ";
}
if (isset($filters['filter_tc_id'])) {
$tc_cfg = config_get('testcase_cfg');
$tc_prefix = $testproject_mgr->getTestCasePrefix($testproject_id);
$tc_prefix .= $tc_cfg->glue_character;
$tc_ext_id = $db->prepare_int(str_replace($tc_prefix, '', $filters['filter_tc_id']));
$sql .= " JOIN {$tables['req_coverage']} RC ON RC.req_id = R.id " . " JOIN {$tables['nodes_hierarchy']} NH_T ON NH_T.id = RC.testcase_id " . " JOIN {$tables['nodes_hierarchy']} NH_TV on NH_TV.parent_id = NH_T.id " . " JOIN {$tables['tcversions']} TV ON TV.id = NH_TV.id " . " AND TV.tc_external_id = {$tc_ext_id} ";
}
if (isset($filters['filter_custom_fields'])) {
$suffix = 1;
foreach ($filters['filter_custom_fields'] as $cf_id => $cf_value) {
$sql .= " JOIN {$tables['cfield_design_values']} CF{$suffix} " . " ON CF{$suffix}.node_id = RV.id " . " AND CF{$suffix}.field_id = {$cf_id} ";
// single value or array?
if (is_array($cf_value)) {
$sql .= " AND ( ";
$count = 1;
foreach ($cf_value as $value) {
if ($count > 1) {
$sql .= " OR ";
}
$sql .= " CF{$suffix}.value LIKE '%{$value}%' ";
$count++;
}
$sql .= " ) ";
} else {
$sql .= " AND CF{$suffix}.value LIKE '%{$cf_value}%' ";
}
$suffix++;
}
}
$sql .= " WHERE RS.testproject_id = {$testproject_id} ";
if (isset($filters['filter_doc_id'])) {
$doc_id = $db->prepare_string($filters['filter_doc_id']);
$sql .= " AND R.req_doc_id LIKE '%{$doc_id}%' OR RS.doc_id LIKE '%{$doc_id}%' ";
}
if (isset($filters['filter_title'])) {
$title = $db->prepare_string($filters['filter_title']);
$sql .= " AND NH_R.name LIKE '%{$title}%' ";
}
if (isset($filters['filter_coverage'])) {
$coverage = $db->prepare_int($filters['filter_coverage']);
$sql .= " AND expected_coverage = {$coverage} ";
}
if (isset($filters['filter_status'])) {
$statuses = (array) $filters['filter_status'];
foreach ($statuses as $key => $status) {
$statuses[$key] = "'" . $db->prepare_string($status) . "'";
}
$statuses = implode(",", $statuses);
$sql .= " AND RV.status IN ({$statuses}) ";
}
if (isset($filters['filter_type'])) {
$types = (array) $filters['filter_type'];
// BUGID 3671
foreach ($types as $key => $type) {
$types[$key] = $db->prepare_string($type);
}
$types = implode("','", $types);
$sql .= " AND RV.type IN ('{$types}') ";
}
if (isset($filters['filter_spec_type'])) {
$spec_types = (array) $filters['filter_spec_type'];
// BUGID 3671
foreach ($spec_types as $key => $type) {
$spec_types[$key] = $db->prepare_string($type);
}
$spec_types = implode("','", $spec_types);
$sql .= " AND RS.type IN ('{$spec_types}') ";
}
if (isset($filters['filter_relation'])) {
$sql .= " AND ( ";
$count = 1;
foreach ($filters['filter_relation'] as $key => $rel_filter) {
$relation_info = explode('_', $rel_filter);
$relation_type = $db->prepare_int($relation_info[0]);
$relation_side = isset($relation_info[1]) ? $relation_info[1] : null;
$sql .= $count == 1 ? " ( " : " OR ( ";
if ($relation_side == "destination") {
$sql .= " RR.destination_id = R.id ";
} else {
if ($relation_side == "source") {
$sql .= " RR.source_id = R.id ";
//.........这里部分代码省略.........
示例9: initEnv
/**
*
*
*/
function initEnv(&$dbHandler)
{
$uaWhiteList = array();
$uaWhiteList['elements'] = array('link', 'create', 'doCreate', 'add_note');
$uaWhiteList['lenght'] = array();
foreach ($uaWhiteList['elements'] as $xmen) {
$uaWhiteList['lenght'][] = strlen($xmen);
}
$user_action['maxLengh'] = max($uaWhiteList['lenght']);
$user_action['minLengh'] = min($uaWhiteList['lenght']);
$iParams = array("exec_id" => array("GET", tlInputParameter::INT_N), "bug_id" => array("REQUEST", tlInputParameter::STRING_N), "tproject_id" => array("REQUEST", tlInputParameter::INT_N), "tplan_id" => array("REQUEST", tlInputParameter::INT_N), "tcversion_id" => array("REQUEST", tlInputParameter::INT_N), "bug_notes" => array("POST", tlInputParameter::STRING_N), "issueType" => array("POST", tlInputParameter::INT_N), "issuePriority" => array("POST", tlInputParameter::INT_N), "artifactComponent" => array("POST", tlInputParameter::ARRAY_INT), "artifactVersion" => array("POST", tlInputParameter::ARRAY_INT), "user_action" => array("REQUEST", tlInputParameter::STRING_N, $user_action['minLengh'], $user_action['maxLengh']));
$args = new stdClass();
I_PARAMS($iParams, $args);
if ($args->exec_id) {
$_SESSION['bugAdd_execID'] = intval($args->exec_id);
} else {
$args->exec_id = intval(isset($_SESSION['bugAdd_execID']) ? $_SESSION['bugAdd_execID'] : 0);
}
$args->user = $_SESSION['currentUser'];
$gui = new stdClass();
switch ($args->user_action) {
case 'create':
case 'doCreate':
$gui->pageTitle = lang_get('create_issue');
break;
case 'add_note':
$gui->pageTitle = lang_get('add_issue_note');
break;
case 'link':
default:
$gui->pageTitle = lang_get('title_bug_add');
break;
}
$gui->msg = '';
$gui->bug_summary = '';
$gui->tproject_id = $args->tproject_id;
$gui->tplan_id = $args->tplan_id;
$gui->tcversion_id = $args->tcversion_id;
$gui->user_action = $args->user_action;
$gui->bug_id = $args->bug_id;
$gui->issueType = $args->issueType;
$gui->issuePriority = $args->issuePriority;
$gui->artifactVersion = $args->artifactVersion;
$gui->artifactComponent = $args->artifactComponent;
// -----------------------------------------------------------------------
// Special processing
list($itObj, $itCfg) = getIssueTracker($dbHandler, $args, $gui);
// Second access to user input
$bug_summary['minLengh'] = 1;
$bug_summary['maxLengh'] = $itObj->getBugSummaryMaxLength();
$inputCfg = array("bug_summary" => array("POST", tlInputParameter::STRING_N, $bug_summary['minLengh'], $bug_summary['maxLengh']));
I_PARAMS($inputCfg, $args);
$args->bug_id = trim($args->bug_id);
switch ($args->user_action) {
case 'create':
if ($args->bug_id == '' && $args->exec_id > 0) {
$map = get_execution($dbHandler, $args->exec_id);
$args->bug_notes = $map[0]['notes'];
}
break;
case 'doCreate':
case 'add_note':
case 'link':
default:
break;
}
$gui->bug_notes = $args->bug_notes = trim($args->bug_notes);
$args->basehref = $_SESSION['basehref'];
$tables = tlObjectWithDB::getDBTables(array('testplans'));
$sql = ' SELECT api_key FROM ' . $tables['testplans'] . ' WHERE id=' . intval($args->tplan_id);
$rs = $dbHandler->get_recordset($sql);
$args->tplan_apikey = $rs[0]['api_key'];
return array($args, $gui, $itObj, $itCfg);
}
示例10: prepareTestSpecNode
/**
* @internal revisions
* 20121010 - asimon - TICKET 4353: added active/inactive filter
*/
function prepareTestSpecNode(&$db, &$tprojectMgr, $tprojectID, &$node, &$map_node_tccount, $filters = null, $options = null)
{
static $status_descr_list;
static $debugMsg;
static $tables;
static $my;
static $filtersApplied;
static $decoding_info;
static $tcFilterByKeywords;
static $doFilterOn;
if (!$tables) {
$debugMsg = 'Class: ' . __CLASS__ . ' - ' . 'Method: ' . __FUNCTION__ . ' - ';
$tables = tlObjectWithDB::getDBTables(array('tcversions', 'nodes_hierarchy', 'testplan_tcversions'));
$decoding_info = array('node_id_descr' => array_flip($tprojectMgr->tree_manager->get_available_node_types()));
$my = array();
$my['options'] = array('hideTestCases' => 0);
$my['filters'] = array('keywords' => null);
$my['options'] = array_merge($my['options'], (array) $options);
$my['filters'] = array_merge($my['filters'], (array) $filters);
if ($doFilterOn['keywords'] = !is_null($my['filters']['keywords'])) {
$tcFilterByKeywords = $tprojectMgr->getTCasesFilteredByKeywords($tprojectID, $my['filters']['keywords'], $my['filters']['keywords_filter_type']);
if (is_null($tcFilterByKeywords)) {
// tree will be empty
$node = null;
$tcase_counters['testcase_count'] = 0;
return $tcase_counters;
}
}
// Critic for logic that prune empty branches
// TICKET 4353: added active/inactive filter
$filtersApplied = $doFilterOn['keywords'] || $my['options']['ignoreInactiveTestCases'] || $my['options']['ignoreActiveTestCases'];
}
$tcase_counters['testcase_count'] = 0;
$node_type = isset($node['node_type_id']) ? $decoding_info['node_id_descr'][$node['node_type_id']] : null;
if ($node_type == 'testcase') {
$remove_node = false;
if ($my['options']['ignoreInactiveTestCases']) {
$sql = " SELECT COUNT(TCV.id) AS count_active_versions " . " FROM {$tables['tcversions']} TCV, {$tables['nodes_hierarchy']} NH " . " WHERE NH.parent_id=" . $node['id'] . " AND NH.id = TCV.id AND TCV.active=1";
$result = $db->exec_query($sql);
$row = $db->fetch_array($result);
if ($row['count_active_versions'] == 0) {
$remove_node = true;
}
} else {
if ($my['options']['ignoreActiveTestCases']) {
$sql = " SELECT COUNT(TCV.id) AS count_active_versions " . " FROM {$tables['tcversions']} TCV, {$tables['nodes_hierarchy']} NH " . " WHERE NH.parent_id=" . $node['id'] . " AND NH.id = TCV.id AND TCV.active=1";
$result = $db->exec_query($sql);
$row = $db->fetch_array($result);
if ($row['count_active_versions'] != 0) {
$remove_node = true;
}
}
}
if ($my['options']['hideTestCases'] || $remove_node || $doFilterOn['keywords'] && !isset($tcFilterByKeywords[$node['id']])) {
$node = null;
} else {
// needed to avoid problems when using json_encode with EXTJS
unset($node['childNodes']);
$node['leaf'] = true;
$tcase_counters['testcase_count'] = 1;
}
}
// if($node_type == 'testcase')
// ================================================================================
if (!is_null($node) && isset($node['childNodes']) && is_array($node['childNodes'])) {
// node has to be a Test Suite ?
$childNodes =& $node['childNodes'];
$childNodesQty = count($childNodes);
//$pos2unset = array();
for ($idx = 0; $idx < $childNodesQty; $idx++) {
$current =& $childNodes[$idx];
// I use set an element to null to filter out leaf menu items
if (is_null($current)) {
continue;
}
$counters_map = prepareTestSpecNode($db, $tprojectMgr, $tprojectID, $current, $map_node_tccount);
// 20120831 - to be analized carefully, because this can be solution
// to null issue with json and ext-js
// if( is_null($current) )
// {
// echo 'TO NULX';
// unset($childNodes[$idx]);
// }
$tcase_counters['testcase_count'] += $counters_map['testcase_count'];
}
//new dBug($pos2unset);
$node['testcase_count'] = $tcase_counters['testcase_count'];
if (isset($node['id'])) {
$map_node_tccount[$node['id']] = array('testcount' => $node['testcase_count'], 'name' => $node['name']);
}
// node must be destroyed if empty had we have using filtering conditions
if ($filtersApplied && !$tcase_counters['testcase_count'] && $node_type != 'testproject') {
$node = null;
}
} else {
if ($node_type == 'testsuite') {
//.........这里部分代码省略.........
示例11: display_children
/**
*
*
*/
function display_children($dbHandler, $root_node, $parent, $filter_node, $tcprefix, $show_tcases = 1, $operation = 'manage', $helpText = array())
{
static $showTestCaseID;
$tables = tlObjectWithDB::getDBTables(array('tcversions', 'nodes_hierarchy', 'node_types'));
$forbidden_parent = array('testproject' => 'none', 'testcase' => 'testproject', 'testsuite' => 'none');
$external = '';
$nodes = null;
$filter_node_type = $show_tcases ? '' : ",'testcase'";
switch ($operation) {
case 'print':
$js_function = array('testproject' => 'TPROJECT_PTP', 'testsuite' => 'TPROJECT_PTS', 'testcase' => 'TPROJECT_PTS');
break;
case 'manage':
default:
$js_function = array('testproject' => 'EP', 'testsuite' => 'ETS', 'testcase' => 'ET');
break;
}
$sql = " SELECT NHA.*, NT.description AS node_type " . " FROM {$tables['nodes_hierarchy']} NHA, {$tables['node_types']} NT " . " WHERE NHA.node_type_id = NT.id " . " AND parent_id = " . intval($parent) . " AND NT.description NOT IN " . " ('testcase_version','testplan','requirement_spec','requirement'{$filter_node_type}) ";
if (!is_null($filter_node) && $filter_node > 0 && $parent == $root_node) {
$sql .= " AND NHA.id = " . intval($filter_node);
}
$sql .= " ORDER BY NHA.node_order ";
// for debug
//file_put_contents('/tmp/sql_display_node.txt', $sql);
$nodeSet = $dbHandler->get_recordset($sql);
if ($show_tcases) {
// Get external id, used on test case nodes
$sql = " SELECT DISTINCT tc_external_id,NHA.parent_id " . " FROM {$tables['tcversions']} TCV " . " JOIN {$tables['nodes_hierarchy']} NHA ON NHA.id = TCV.id " . " JOIN {$tables['nodes_hierarchy']} NHB ON NHA.parent_id = NHB.id " . " WHERE NHB.parent_id = " . intval($parent) . " AND NHA.node_type_id = 4";
$external = $dbHandler->fetchRowsIntoMap($sql, 'parent_id');
}
// print_r(array_values($nodeSet));
//file_put_contents('/tmpsql_display_node.txt', serialize(array_values($nodeSet)));
if (!is_null($nodeSet)) {
$tproject_mgr = new testproject($dbHandler);
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';
// customs key will be accessed using node.attributes.[key name]
$path['testlink_node_type'] = $row['node_type'];
$path['testlink_node_name'] = $path['text'];
// already htmlspecialchars() done
$path['forbidden_parent'] = 'none';
$tcase_qty = null;
switch ($row['node_type']) {
case 'testproject':
// at least on Test Specification seems that we do not execute this piece of code.
$path['href'] = "javascript:EP({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
break;
case 'testsuite':
$tcase_qty = $tproject_mgr->count_testcases($row['id']);
$path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
break;
case 'testcase':
$path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
if (is_null($showTestCaseID)) {
$showTestCaseID = config_get('treemenu_show_testcase_id');
}
if ($showTestCaseID) {
$path['text'] = htmlspecialchars($tcprefix . $external[$row['id']]['tc_external_id'] . ":") . $path['text'];
}
$path['leaf'] = true;
break;
}
if (!is_null($tcase_qty)) {
$path['text'] .= " ({$tcase_qty})";
}
switch ($row['node_type']) {
case 'testproject':
case 'testsuite':
if (isset($helpText[$row['node_type']])) {
$path['text'] = '<span title="' . $helpText[$row['node_type']] . '">' . $path['text'] . '</span>';
}
break;
}
$nodes[] = $path;
}
}
return $nodes;
}
示例12: check_exec_values
function check_exec_values(&$db, &$tcase_mgr, &$user_mgr, $tcaseCfg, $execValues, &$columnDef)
{
$tables = tlObjectWithDB::getDBTables(array('users', 'execution_bugs'));
$checks = array('status_ok' => false, 'tcase_id' => 0, 'tester_id' => 0, 'msg' => array());
$tcase_id = $execValues['tcase_id'];
$tcase_external_id = trim($execValues['tcase_external_id']);
// external_id has precedence over internal id
$using_external_id = $tcase_external_id != "";
if ($using_external_id) {
// need to get internal id
$checks['tcase_id'] = $tcase_mgr->getInternalID($tcase_external_id, $tcaseCfg->glue_character);
$checks['status_ok'] = intval($checks['tcase_id']) > 0 ? true : false;
if (!$checks['status_ok']) {
$checks['msg'][] = sprintf(lang_get('tcase_external_id_do_not_exists'), $tcase_external_id);
}
} else {
// before using internal id, I want to check it's a number
$checks['tcase_id'] = $tcase_id;
$checks['status_ok'] = intval($checks['tcase_id']) > 0 ? true : false;
if (!$checks['status_ok']) {
$checks['msg'][] = sprintf(lang_get('tcase_id_is_not_number'), $tcase_id);
}
}
if ($checks['status_ok']) {
// useful for user feedback
$identity = $using_external_id ? $tcase_external_id : $checks['tcase_id'];
}
if ($checks['status_ok'] && $execValues['timestamp'] != '') {
$checks['status_ok'] = isValidISODateTime($execValues['timestamp']);
if (!$checks['status_ok']) {
$checks['msg'][] = sprintf(lang_get('invalid_execution_timestamp'), $identity, $execValues['timestamp']);
}
}
if ($checks['status_ok'] && $execValues['tester'] != '') {
$sql = "SELECT id,login FROM {$tables['users']} WHERE login ='" . $db->prepare_string($execValues['tester']) . "'";
$userInfo = $db->get_recordset($sql);
if (!is_null($userInfo) && isset($userInfo[0]['id'])) {
$checks['tester_id'] = $userInfo[0]['id'];
} else {
$checks['status_ok'] = false;
$checks['msg'][] = sprintf(lang_get('invalid_tester'), $identity, $execValues['tester']);
}
}
// BUGID 3331
$execValues['bug_id'] = isset($execValues['bug_id']) ? trim((string) $execValues['bug_id']) : '';
if ($checks['status_ok'] && $execValues['bug_id'] != '') {
if (($field_len = strlen($execValues['bug_id'])) > $columnDef['bug_id']->max_length) {
$checks['status_ok'] = false;
$checks['msg'][] = sprintf(lang_get('bug_id_invalid_len'), $field_len, $columnDef['bug_id']->max_length);
}
}
// BUGID 3543
if ($checks['status_ok'] && isset($execValues['execution_type'])) {
$execDomain = $tcase_mgr->get_execution_types();
$checks['status_ok'] = isset($execDomain[$execValues['execution_type']]);
if (!$checks['status_ok']) {
$checks['msg'][] = sprintf(lang_get('invalid_exec_type'), $execValues['execution_type']);
}
}
return $checks;
}
示例13: testproject
$tproject_mgr = new testproject($db);
$req_cfg = config_get('req_cfg');
$charset = config_get('charset');
$args = init_args();
$commandMgr = new reqSpecCommands($db, $args->tprojectID);
$gui = $commandMgr->initGuiBean();
$edit_label = lang_get('requirement_spec');
$edit_icon = TL_THEME_IMG_DIR . "edit_icon.png";
$gui->main_descr = lang_get('caption_search_form_req_spec');
$gui->warning_msg = '';
$gui->path_info = null;
$gui->resultSet = null;
$gui->tableSet = null;
$itemSet = null;
if ($args->tprojectID) {
$tables = tlObjectWithDB::getDBTables(array('cfield_design_values', 'nodes_hierarchy', 'req_specs', 'req_specs_revisions'));
$filter = null;
$join = null;
// we use same approach used on requirements search => search on revisions
if ($args->requirement_document_id) {
$id = $db->prepare_string($args->requirement_document_id);
$filter['by_id'] = " AND RSPECREV.doc_id like '%{$id}%' ";
}
if ($args->name) {
$title = $db->prepare_string($args->name);
$filter['by_name'] = " AND NHRSPEC.name like '%{$title}%' ";
}
if ($args->reqSpecType != "notype") {
$type = $db->prepare_string($args->reqSpecType);
$filter['by_type'] = " AND RSPECREV.type='{$type}' ";
}
示例14: switch
// - test plan api key:
// is needed to get attacments for:
// test case executions
// test specifications ( access to parent data - OK!)
//
// What kind of attachments I've got ?
$doIt = false;
$attContext = $attachmentInfo['fk_table'];
switch ($attContext) {
case 'executions':
// check apikey
// 1. has to be a test plan key
// 2. execution must belong to the test plan.
$item = getEntityByAPIKey($db, $args->apikey, 'testplan');
if (!is_null($item)) {
$tables = tlObjectWithDB::getDBTables(array('executions'));
$sql = "SELECT testplan_id FROM {$tables['executions']} " . "WHERE id = " . intval($attachmentInfo['fk_id']);
$rs = $db->get_recordset($sql);
if (!is_null($rs)) {
if ($rs['0']['testplan_id'] == $item['id']) {
// GOOD !
$doIt = true;
}
}
}
break;
}
break;
case 'GUI':
default:
$doIt = true;
示例15: doUpdate
function doUpdate(&$dbHandler, &$argsObj)
{
$tables = tlObjectWithDB::getDBTables('executions');
$sql = "UPDATE {$tables['executions']} " . " SET notes='" . $dbHandler->prepare_string($argsObj->notes) . "' " . " WHERE id={$argsObj->exec_id} ";
$dbHandler->exec_query($sql);
}