本文整理汇总了PHP中tlObjectWithDB类的典型用法代码示例。如果您正苦于以下问题:PHP tlObjectWithDB类的具体用法?PHP tlObjectWithDB怎么用?PHP tlObjectWithDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了tlObjectWithDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* class constructor
*
* @param resource &$db reference to database handler
* @param integer $tplanId
**/
public function __construct(&$db, &$tplanId = null)
{
$this->db = $db;
$this->testPlanID = $tplanId;
// tlObjectWithDB::__construct($db);
parent::__construct($this->db);
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:13,代码来源:reports.class.php
示例2: 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];
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:12,代码来源:reqCompareVersions.php
示例3: __construct
/**
* class constructor
*
* @param $db [ref] resource the database connection
*/
function __construct(&$db)
{
tlObjectWithDB::__construct($db);
$this->repositoryType = self::getType();
$this->repositoryCompressionType = self::getCompression();
$this->repositoryPath = self::getPathToRepository();
$this->attachmentCfg = config_get('attachments');
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:13,代码来源:tlAttachmentRepository.class.php
示例4: __construct
/**
* class constructor
*
* @param $db [ref] resource the database connection
*/
function __construct(&$db)
{
tlObjectWithDB::__construct($db);
$this->attachmentCfg = config_get('attachments');
$prop2init = array('type', 'compressionType', 'path');
foreach ($prop2init as $prop) {
$this->{$prop} = $this->attachmentCfg->repository->{$prop};
}
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:14,代码来源:tlAttachmentRepository.class.php
示例5: 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;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:11,代码来源:cfieldsExport.php
示例6: 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;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:12,代码来源:usersExport.php
示例7: 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;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:12,代码来源:platformsExport.php
示例8: __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'));
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:14,代码来源:tlTreeMenu.class.php
示例9: 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') {
//.........这里部分代码省略.........
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:101,代码来源:treeMenu.inc.php
示例10: req_link_replace
/**
* replace BBCode-link tagged links in req/reqspec scope with actual links
*
* @internal revisions:
* 20110525 - Julian - BUGID 4487 - allow to specify requirement version for internal links
* 20100301 - asimon - added anchor and tproj parameters to tags
*
* @param resource $dbHandler database handle
* @param string $scope text in which to replace tags with links
* @param integer $tprojectID ID of testproject to which req/reqspec belongs
* @return string $scope text with generated links
*/
function req_link_replace($dbHandler, $scope, $tprojectID)
{
// Use this to improve performance when is called in loops
static $tree_mgr;
static $tproject_mgr;
static $req_mgr;
static $cfg;
static $l18n;
static $title;
static $tables;
if (!$tproject_mgr) {
$tproject_mgr = new testproject($dbHandler);
$tree_mgr = new tree($dbHandler);
$req_mgr = new requirement_mgr($dbHandler);
$tables = tlObjectWithDB::getDBTables(array('requirements', 'req_specs'));
$cfg = config_get('internal_links');
$l18n['version'] = lang_get('tcversion_indicator');
$prop2loop = array('req' => array('prop' => 'req_link_title', 'default_lbl' => 'requirement'), 'req_spec' => array('prop' => 'req_spec_link_title', 'default_lbl' => 'req_spec_short'));
// configure link title (first part of the generated link)
$title = array();
foreach ($prop2loop as $key => $elem) {
$prop = $elem['prop'];
if ($cfg->{$prop}->type == 'string' && $cfg->{$prop}->value != '') {
$title[$key] = lang_get($cfg->{$prop}->value);
} else {
if ($cfg->{$prop}->type == 'none') {
$title[$key] = '';
} else {
$title[$key] = lang_get($elem['default_lbl']) . ": ";
}
}
}
}
$prefix = $tproject_mgr->getTestCasePrefix($tprojectID);
$string2replace = array();
// configure target in which link shall open
// use a reasonable default value if nothing is set in config
$cfg->target = isset($cfg->target) ? $cfg->target : 'popup';
switch ($cfg->target) {
case 'popup':
// use javascript to open popup window
$string2replace['req'] = '<a href="javascript:openLinkedReqVersionWindow(%s,%s,\'%s\')">%s%s%s</a>';
$string2replace['req_spec'] = '<a href="javascript:openLinkedReqSpecWindow(%s,\'%s\')">%s%s</a>';
break;
case 'window':
case 'frame':
// open in same frame
$target = $cfg->target == 'window' ? 'target="_blank"' : 'target="_self"';
$string2replace['req'] = '<a ' . $target . ' href="lib/requirements/reqView.php?' . 'item=requirement&requirement_id=%s&req_version_id=%s#%s">%s%s%s</a>';
$string2replace['req_spec'] = '<a ' . $target . ' href="lib/requirements/reqSpecView.php?' . 'item=req_spec&req_spec_id=%s#%s">%s%s</a>';
break;
}
// now the actual replacing
$patterns2search = array();
$patterns2search['req'] = "#\\[req(.*)\\](.*)\\[/req\\]#iU";
$patterns2search['req_spec'] = "#\\[req_spec(.*)\\](.*)\\[/req_spec\\]#iU";
$patternPositions = array('complete_string' => 0, 'attributes' => 1, 'doc_id' => 2);
$items2search['req'] = array('tproj', 'anchor', 'version');
$items2search['req_spec'] = array('tproj', 'anchor');
$itemPositions = array('item' => 0, 'item_value' => 1);
$sql2exec = array();
$sql2exec['req'] = " SELECT id, req_doc_id AS doc_id " . " FROM {$tables['requirements']} WHERE req_doc_id=";
$sql2exec['req_spec'] = " SELECT id, doc_id FROM {$tables['req_specs']} " . " WHERE doc_id=";
foreach ($patterns2search as $accessKey => $pattern) {
$matches = array();
preg_match_all($pattern, $scope, $matches);
// if no req_doc_id is set skip loop
if (count($matches[$patternPositions['doc_id']]) == 0) {
continue;
}
foreach ($matches[$patternPositions['complete_string']] as $key => $matched_string) {
$matched = array();
$matched['tproj'] = '';
$matched['anchor'] = '';
$matched['version'] = '';
// only look for attributes if any found
if ($matches[$patternPositions['attributes']][$key] != '') {
foreach ($items2search[$accessKey] as $item) {
$matched_item = array();
preg_match('/' . $item . '=([\\w]+)/', $matched_string, $matched_item);
$matched[$item] = isset($matched_item[$itemPositions['item_value']]) ? $matched_item[$itemPositions['item_value']] : '';
}
}
// set tproj to current project if tproj is not specified in attributes
if (!isset($matched['tproj']) || $matched['tproj'] == '') {
$matched['tproj'] = $prefix;
}
// get all reqs / req specs with the specified doc_id
//.........这里部分代码省略.........
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:101,代码来源:requirements.inc.php
示例11: __construct
/**
*
* @param database $dbHandler reference to database object
*/
public function __construct(&$dbHandler)
{
// call to constructor of parent class tlObjectWithDB
parent::__construct($dbHandler);
// Here comes all initializing work: First read the config, then user input.
// According to these inputs all filters which are not needed will not be used.
// Then initialize and use only the remaining filters.
$this->read_config();
$this->init_args();
// set filter mode to advanced or simple
$this->advanced_filter_mode = $this->filter_mode_choice_enabled && $this->args->advanced_filter_mode && !$this->args->simple_filter_mode;
// init button labels
if ($this->advanced_filter_mode) {
$label = self::SIMPLE_FILTER_BUTTON_LABEL;
$qty = self::ADVANCED_FILTER_ITEM_QUANTITY;
} else {
$label = self::ADVANCED_FILTER_BUTTON_LABEL;
$qty = self::SIMPLE_FILTER_ITEM_QUANTITY;
}
$this->filter_mode_button_label = lang_get($label);
$this->filter_mode_button_name = $label;
$this->filter_item_quantity = $qty;
$this->init_settings();
$this->init_filters();
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:29,代码来源:tlFilterControl.class.php
示例12: templateConfiguration
$templateCfg = templateConfiguration();
$smarty = new TLSmarty();
$tpl = 'tcSearchResults.tpl';
$tproject_mgr = new testproject($db);
$tcase_mgr = new testcase($db);
$tcase_cfg = config_get('testcase_cfg');
$charset = config_get('charset');
$filter = null;
list($args, $filter) = init_args($tproject_mgr);
$ga = initializeGui($args, $tproject_mgr);
$gx = $tcase_mgr->getTcSearchSkeleton($args);
$gui = (object) array_merge((array) $ga, (array) $gx);
initSearch($gui, $args, $tproject_mgr);
$map = null;
if ($args->tprojectID && $args->doAction == 'doSearch') {
$tables = tlObjectWithDB::getDBTables(array('cfield_design_values', 'nodes_hierarchy', 'requirements', 'req_coverage', 'tcsteps', 'testcase_keywords', 'tcversions', 'users'));
$gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($args->tprojectID);
$gui->tcasePrefix .= $tcase_cfg->glue_character;
$from = array('by_keyword_id' => ' ', 'by_custom_field' => ' ', 'by_requirement_doc_id' => '', 'users' => '');
$tcaseID = null;
$emptyTestProject = false;
if ($args->targetTestCase != "" && strcmp($args->targetTestCase, $gui->tcasePrefix) != 0) {
if (strpos($args->targetTestCase, $tcase_cfg->glue_character) === false) {
$args->targetTestCase = $gui->tcasePrefix . $args->targetTestCase;
}
$tcaseID = $tcase_mgr->getInternalID($args->targetTestCase);
$filter['by_tc_id'] = " AND NH_TCV.parent_id = " . intval($tcaseID);
} else {
$tproject_mgr->get_all_testcases_id($args->tprojectID, $a_tcid);
if (!is_null($a_tcid)) {
$filter['by_tc_id'] = " AND NH_TCV.parent_id IN (" . implode(",", $a_tcid) . ") ";
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:31,代码来源:tcSearch.php
示例13: testlinkInitPage
*/
require_once "../../config.inc.php";
require_once "common.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$tproject_mgr = new testproject($db);
$req_cfg = config_get('req_cfg');
$gui = new stdClass();
$gui->main_descr = lang_get('caption_search_form_req_spec');
$gui->warning_msg = '';
$gui->path_info = null;
$gui->resultSet = null;
$map = null;
$args = init_args();
if ($args->tprojectID) {
$tables = tlObjectWithDB::getDBTables(array("cfield_design_values", 'nodes_hierarchy', 'req_specs'));
$filter = null;
$from = null;
if ($args->requirement_document_id) {
//search by id
$id = $db->prepare_string($args->requirement_document_id);
$filter['by_id'] = " AND RS.doc_id like '%{$id}%' ";
}
if ($args->name) {
//search by name/title
$title = $db->prepare_string($args->name);
$filter['by_name'] = " AND NH.name like '%{$title}%' ";
}
if ($args->reqSpecType != "notype") {
//search by type
$type = $db->prepare_string($args->reqSpecType);
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:reqSpecSearch.php
示例14: doesKeywordExist
/**
* checks if a keyword for a certain testproject already exists in the database
*
* @param resource $db [ref] the database connection
* @param string $name the name of the keyword
* @param integer $tprojectID the testprojectID
* @param integer $kwID an additional keyword id which is excluded in the search
* @return integer return tl::OK if the keyword is found, else tlKeyword::E_NAMEALREADYEXISTS
*/
public static function doesKeywordExist(&$db, $name, $tprojectID, $kwID = null)
{
$result = tl::OK;
$tables = tlObjectWithDB::getDBTables("keywords");
$name = $db->prepare_string(strtoupper($name));
$query = " SELECT id FROM {$tables['keywords']} " . " WHERE UPPER(keyword) ='" . $name . "' AND testproject_id = " . $tprojectID;
if ($kwID) {
$query .= " AND id <> " . $kwID;
}
if ($db->fetchFirstRow($query)) {
$result = self::E_NAMEALREADYEXISTS;
}
return $result;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:23,代码来源:tlKeyword.class.php
示例15: display_children
function display_children($dbHandler, $root_node, $parent, $filter_node, $show_children = ON, $operation = 'manage', $mode = 'reqspec')
{
$tables = tlObjectWithDB::getDBTables(array('requirements', 'nodes_hierarchy', 'node_types', 'req_specs'));
$cfg = config_get('req_cfg');
$forbidden_parent['testproject'] = 'none';
$forbidden_parent['requirement'] = 'testproject';
$forbidden_parent['requirement_spec'] = 'requirement_spec';
if ($cfg->child_requirements_mgmt) {
$forbidden_parent['requirement_spec'] = 'none';
}
$fn = array();
$fn['print']['reqspec'] = array('testproject' => 'TPROJECT_PTP_RS', 'requirement_spec' => 'TPROJECT_PRS', 'requirement' => 'openLinkedReqWindow');
$fn['manage']['reqspec'] = array('testproject' => 'TPROJECT_REQ_SPEC_MGMT', 'requirement_spec' => 'REQ_SPEC_MGMT', 'requirement' => 'REQ_MGMT');
$fn['print']['addtc'] = array('testproject' => 'TPROJECT_PTP', 'requirement_spec' => 'TPROJECT_PRS', 'requirement' => 'TPROJECT_PRS');
$fn['manage']['addtc'] = array('testproject' => 'EP', 'requirement_spec' => 'ERS', 'requirement' => 'ER');
switch ($operation) {
case 'print':
case 'manage':
$js_function = $fn[$operation][$mode];
break;
default:
$js_function = $fn['manage'][$mode];
break;
}
$nodes = null;
$filter_node_type = $show_children ? '' : ",'requirement'";
$sql = " SELECT NHA.*, NT.description AS node_type, RSPEC.doc_id " . " FROM {$tables['nodes_hierarchy']} NHA JOIN {$tables['node_types']} NT " . " ON NHA.node_type_id=NT.id " . " AND NT.description NOT IN " . " ('testcase','testsuite','testcase_version','testplan','requirement_spec_revision' {$filter_node_type}) " . " LEFT OUTER JOIN {$tables['req_specs']} RSPEC " . " ON RSPEC.id = NHA.id " . " WHERE NHA.parent_id = " . intval($parent);
if (!is_null($filter_node) && $filter_node > 0 && $parent == $root_node) {
$sql .= " AND NHA.id = " . intval($filter_node);
}
$sql .= " ORDER BY NHA.node_order ";
$nodeSet = $dbHandler->get_recordset($sql);
if (!is_null($nodeSet)) {
$sql = " SELECT DISTINCT req_doc_id AS doc_id,NHA.id" . " FROM {$tables['requirements']} REQ JOIN {$tables['nodes_hierarchy']} NHA ON NHA.id = REQ.id " . " JOIN {$tables['nodes_hierarchy']} NHB ON NHA.parent_id = NHB.id " . " JOIN {$tables['node_types']} NT ON NT.id = NHA.node_type_id " . " WHERE NHB.id = " . intval($parent) . " AND NT.description = 'requirement'";
$requirements = $dbHandler->fetchRowsIntoMap($sql, 'id');
$treeMgr = new tree($dbHandler);
$ntypes = $treeMgr->get_available_node_types();
$peerTypes = array('target' => $ntypes['requirement'], 'container' => $ntypes['requirement_spec']);
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';
// Important:
// We can add custom keys, and will be able to access it using
// public property 'attributes' of object of Class Ext.tree.TreeNode
//
$path['testlink_node_type'] = $row['node_type'];
$path['testlink_node_name'] = $path['text'];
// already htmlspecialchars() done
$path['forbidden_parent'] = 'none';
switch ($row['node_type']) {
case 'testproject':
$path['href'] = "javascript:EP({$path['id']})";
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
break;
case 'requirement_spec':
$req_list = array();
$treeMgr->getAllItemsID($row['id'], $req_list, $peerTypes);
$path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
$path['text'] = htmlspecialchars($row['doc_id'] . ":") . $path['text'];
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
if (!is_null($req_list)) {
$item_qty = count($req_list);
$path['text'] .= " ({$item_qty})";
}
break;
case 'requirement':
$path['href'] = "javascript:" . $js_function[$row['node_type']] . "({$path['id']})";
$path['text'] = htmlspecialchars($requirements[$row['id']]['doc_id'] . ":") . $path['text'];
$path['leaf'] = true;
$path['forbidden_parent'] = $forbidden_parent[$row['node_type']];
break;
}
$nodes[] = $path;
}
// foreach
}
return $nodes;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:82,代码来源:getrequirementnodes.php
示例16: testlinkInitPage
*
* @version $Id: getreqlog.php,v 1.1.2.5 2010/12/15 21:48:13 mx-julian Exp $
* @author Francisco Mancardi
*
* Used on Add/Remove test case to test plan feature, to display summary via ExtJS tooltip
*
* @internal Revisions:
*/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
$reqMgr = new requirement_mgr($db);
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
$info = '';
if (!is_null($item_id)) {
$tables = tlObjectWithDB::getDBTables(array('req_versions', 'req_revisions'));
// get item type
$node_types = $reqMgr->tree_mgr->get_available_node_types();
$dummy = $reqMgr->tree_mgr->get_node_hierarchy_info($item_id);
$target_table = 'req_revisions';
if ($dummy['node_type_id'] == $node_types['requirement_version']) {
$target_table = 'req_versions';
}
$sql = "SELECT log_message FROM {$tables[$target_table]} WHERE id=" . intval($item_id);
$info = $db->get_recordset($sql);
$info = nl2br($info[0]['log_message']);
// <p> and </p> tag at the beginning and the end of summary cause visualization
// errors -> remove them and add <br> to get a similar effect
$info = str_replace("<p>", "", $info);
$info = str_replace("</p>", "<br>", $info);
// if log message is empty show this information
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:getreqlog.php
示例17: getEntityByAPIKey
/**
*
*/
function getEntityByAPIKey(&$dbHandler, $apiKey, $type)
{
$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$tables = tlObjectWithDB::getDBTables(array('testprojects', 'testplans'));
switch ($type) {
case 'testproject':
$target = $tables['testprojects'];
break;
case 'testplan':
$target = $tables['testplans'];
break;
}
$sql = "/* {$debugMsg} */ " . " SELECT id FROM {$target} " . " WHERE api_key = '" . $dbHandler->prepare_string($apiKey) . "'";
$rs = $dbHandler->get_recordset($sql);
return $rs ? $rs[0] : null;
}
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:19,代码来源:common.php
示例18: 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);
}
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:78,代码来源:bugAdd.php
示例19: 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']);
$using_external_id = $tcase_external_id != "";
// external_id has precedence over internal id
if ($using_external_id) {
// need to get internal id
$checks['tcase_id'] = $tcase_mgr->getInternalID($tcase_external_id);
$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']);
}
}
$execValues['bug_id'] = isset($execValues['bug_id']) ? $execValues['bug_id'] : null;
if ($checks['status_ok'] && !is_null($execValues['bug_id']) && is_array($execValues['bug_id'])) {
foreach ($execValues['bug_id'] as $bug_id) {
if (($field_len = strlen(trim($bug_id))) > $columnDef['bug_id']->max_length) {
$checks['msg'][] = sprintf(lang_get('bug_id_invalid_len'), $field_len, $columnDef['bug_id']->max_length);
$checks['status_ok'] = false;
break;
}
}
}
if ($checks['status_ok'] && isset($execValues['execution_type'])) {
$execValues['execution_type'] = intval($execValues['execution_type']);
$execDomain = $tcase_mgr->get_execution_types();
if ($execValues['execution_type'] == 0) {
$execValues['execution_type'] = TESTCASE_EXECUTION_TYPE_MANUAL;
// right now this is useless, but may be in future can be used, then I choose to leave it.
$checks['msg'][] = sprintf(lang_get('missing_exec_type'), $execValues['execution_type'], $execDomain[$execValues['execution_type']]);
} else {
$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;
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:69,代码来源:resultsImport.php
示例20: 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' =&
|
请发表评论