本文整理汇总了PHP中tlStringLen函数的典型用法代码示例。如果您正苦于以下问题:PHP tlStringLen函数的具体用法?PHP tlStringLen怎么用?PHP tlStringLen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tlStringLen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: write_execution
/**
* write execution result to DB
*
* @param resource &$db reference to database handler
* @param obj &$exec_signature object with tproject_id,tplan_id,build_id,platform_id,user_id
*
* @internal Revisions:
*
*
* 20100522 - BUGID 3479 - Bulk Execution - Custom Fields Bulk Assignment
*/
function write_execution(&$db, &$exec_signature, &$exec_data, $map_last_exec)
{
$executions_table = DB_TABLE_PREFIX . 'executions';
$resultsCfg = config_get('results');
// $bugInterfaceOn = config_get('bugInterfaceOn');
$db_now = $db->db_now();
$cfield_mgr = new cfield_mgr($db);
$cf_prefix = $cfield_mgr->get_name_prefix();
$len_cfp = tlStringLen($cf_prefix);
$cf_nodeid_pos = 4;
$bulk_notes = '';
$ENABLED = 1;
$cf_map = $cfield_mgr->get_linked_cfields_at_execution($exec_signature->tproject_id, $ENABLED, 'testcase');
$has_custom_fields = is_null($cf_map) ? 0 : 1;
// extract custom fields id.
$map_nodeid_array_cfnames = null;
foreach ($exec_data as $input_name => $value) {
if (strncmp($input_name, $cf_prefix, $len_cfp) == 0) {
$dummy = explode('_', $input_name);
$map_nodeid_array_cfnames[$dummy[$cf_nodeid_pos]][] = $input_name;
}
}
if (isset($exec_data['do_bulk_save'])) {
// create structure to use common algoritm
$item2loop = $exec_data['status'];
$is_bulk_save = 1;
$bulk_notes = $db->prepare_string(trim($exec_data['bulk_exec_notes']));
} else {
$item2loop = $exec_data['save_results'];
$is_bulk_save = 0;
}
foreach ($item2loop as $tcversion_id => $val) {
$tcase_id = $exec_data['tc_version'][$tcversion_id];
$current_status = $exec_data['status'][$tcversion_id];
$version_number = $exec_data['version_number'][$tcversion_id];
$has_been_executed = $current_status != $resultsCfg['status_code']['not_run'] ? TRUE : FALSE;
if ($has_been_executed) {
$my_notes = $is_bulk_save ? $bulk_notes : $db->prepare_string(trim($exec_data['notes'][$tcversion_id]));
$sql = "INSERT INTO {$executions_table} " . "(build_id,tester_id,status,testplan_id,tcversion_id," . " execution_ts,notes,tcversion_number,platform_id)" . " VALUES ( {$exec_signature->build_id}, {$exec_signature->user_id}, '{$exec_data['status'][$tcversion_id]}'," . "{$exec_signature->tplan_id}, {$tcversion_id},{$db_now},'{$my_notes}'," . "{$version_number},{$exec_signature->platform_id}" . ")";
$db->exec_query($sql);
// at least for Postgres DBMS table name is needed.
$execution_id = $db->insert_id($executions_table);
if ($has_custom_fields) {
// test useful when doing bulk update, because some type of custom fields
// like checkbox can not exist on exec_data. => why ??
//
$hash_cf = null;
$access_key = $is_bulk_save ? 0 : $tcase_id;
if (isset($map_nodeid_array_cfnames[$access_key])) {
foreach ($map_nodeid_array_cfnames[$access_key] as $cf_v) {
$hash_cf[$cf_v] = $exec_data[$cf_v];
}
}
$cfield_mgr->execution_values_to_db($hash_cf, $tcversion_id, $execution_id, $exec_signature->tplan_id, $cf_map);
}
}
}
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:69,代码来源:exec.inc.php
示例2: testplan_design_values_to_db
function testplan_design_values_to_db($hash, $node_id, $link_id, $cf_map = null, $hash_type = null)
{
if (is_null($hash) && is_null($cf_map)) {
return;
}
$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$cfield = is_null($hash_type) ? $this->_build_cfield($hash, $cf_map) : $hash;
if (!is_null($cfield)) {
foreach ($cfield as $field_id => $type_and_value) {
// echo "DEBUG: \$field_id:$field_id - \$link_id:$link_id<br>";
$value = $type_and_value['cf_value'];
// do I need to update or insert this value?
$sql = "SELECT value FROM {$this->tables['cfield_testplan_design_values']} " . " WHERE field_id={$field_id} AND\tlink_id={$link_id}";
$result = $this->db->exec_query($sql);
// max_length_value = 0 => no limit
if ($this->max_length_value > 0 && tlStringLen($value) > $this->max_length_value) {
$value = substr($value, 0, $this->max_length_value);
}
$safe_value = $this->db->prepare_string($value);
// BUGID 3989
if ($this->db->num_rows($result) > 0 && $value != "") {
$sql = "UPDATE {$this->tables['cfield_testplan_design_values']} " . " SET value='{$safe_value}' " . " WHERE field_id={$field_id} AND\tlink_id={$link_id}";
$this->db->exec_query($sql);
} else {
if ($this->db->num_rows($result) == 0 && $value != "") {
# Remark got from Mantis code:
# Always store the value, even if it's the dafault value
# This is important, as the definitions might change but the
# values stored with a bug must not change
$sql = "INSERT INTO {$this->tables['cfield_testplan_design_values']} " . " ( field_id, link_id, value ) " . " VALUES\t( {$field_id}, {$link_id}, '{$safe_value}' )";
$this->db->exec_query($sql);
// BUGID 3989
} else {
if ($this->db->num_rows($result) > 0 && $value == "") {
$sql = "/* {$debugMsg} */ DELETE FROM {$this->tables['cfield_testplan_design_values']} " . " WHERE field_id={$field_id} AND\tlink_id={$link_id}";
$this->db->exec_query($sql);
}
}
}
}
//foreach($cfield
}
//if( !is_null($cfield) )
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:44,代码来源:cfield_mgr.class.php
示例3: formatTcPrefix
/** @TODO add description */
function formatTcPrefix($str)
{
$fstr = trim($str);
if (tlStringLen($fstr) == 0) {
throw new Exception('Empty prefix is not allowed');
}
// limit tcasePrefix len.
if (tlStringLen($fstr) > self::TESTCASE_PREFIX_MAXLEN) {
$fstr = substr($fstr, self::TESTCASE_PREFIX_MAXLEN);
}
return $fstr;
}
开发者ID:JacekKarwas,项目名称:smutek,代码行数:13,代码来源:testproject.class.php
示例4: checkLogin
public function checkLogin($login)
{
$result = tl::OK;
$login = trim($login);
if ($login == "" || tlStringLen($login) > $this->maxLoginLength) {
$result = self::E_LOGINLENGTH;
} else {
if (!preg_match($this->loginRegExp, $login)) {
//Only allow a basic set of characters
$result = self::E_NOTALLOWED;
}
}
return $result;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:14,代码来源:tlUser.class.php
示例5: getBugSummaryString
/**
* Returns the bug summary in a human readable format, cut down to 45 chars
*
* @return string returns the summary (in readable form) of the given bug
*
* @version 1.2
* @author Raphael Bosshard
* @author Arjen van Summeren
* @author John Wanke
* updated $query value to be GForge-specific.
* updated to use associative index ['summary'] instead of [0].
* @since 23.10.2008, 16:29:00
**/
function getBugSummaryString($id)
{
if (!$this->isConnected()) {
return null;
}
$status = null;
$summary = null;
$query = "SELECT summary FROM tracker_item WHERE tracker_item_id='" . $id . "'";
$result = $this->dbConnection->exec_query($query);
if ($result) {
$summary = $this->dbConnection->fetch_array($result);
if ($summary) {
$summary = $summary['summary'];
if (tlStringLen($summary) > 45) {
$summary = tlSubStr($summary, 0, 42) . "...";
}
} else {
$summary = null;
}
}
return $summary;
}
开发者ID:tamtrong,项目名称:testlink,代码行数:35,代码来源:int_gforge.php
示例6: request2cf
function request2cf($hash)
{
// design and execution has sense for node types regarding testing
// testplan,testsuite,testcase, but no sense for requirements.
//
// Missing keys are combos that will be disabled and not show at UI.
// For req spec and req, no combo is showed.
// To avoid problems (need to be checked), my choice is set to 1
// *_on_design keys, that right now will not present only for
// req spec and requirements.
//
$missing_keys = array('show_on_design' => 0, 'enable_on_design' => 0, 'show_on_execution' => 0, 'enable_on_execution' => 0, 'show_on_testplan_design' => 0, 'enable_on_testplan_design' => 0, 'possible_values' => ' ');
$cf_prefix = 'cf_';
$len_cfp = tlStringLen($cf_prefix);
$start_pos = $len_cfp;
$cf = array();
foreach ($hash as $key => $value) {
if (strncmp($key, $cf_prefix, $len_cfp) == 0) {
$dummy = substr($key, $start_pos);
$cf[$dummy] = $value;
}
}
foreach ($missing_keys as $key => $value) {
if (!isset($cf[$key])) {
$cf[$key] = $value;
}
}
// After logic refactoring
// if ENABLE_ON_[area] == 1
// DISPLAY_ON_[area] = 1
//
//
// IMPORTANT/CRITIC:
// this KEY MUST BE ALIGNED WITH name on User Inteface
// then if is changed on UI must be changed HERE
$setter = array('design' => 0, 'execution' => 0, 'testplan_design' => 0);
switch ($cf['enable_on']) {
case 'design':
case 'execution':
case 'testplan_design':
$setter[$cf['enable_on']] = 1;
break;
default:
$setter['design'] = 1;
break;
}
foreach ($setter as $key => $value) {
$cf['enable_on_' . $key] = $value;
if ($cf['enable_on_' . $key]) {
$cf['show_on_' . $key] = 1;
}
}
return $cf;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:54,代码来源:cfieldsEdit.php
示例7: throwIfEmptyName
/**
* @return
*
*/
public function throwIfEmptyName($name)
{
$safeName = trim($name);
if (tlStringLen($safeName) == 0) {
$msg = "Class: " . __CLASS__ . " - " . "Method: " . __FUNCTION__;
$msg .= " Empty name ";
throw new Exception($msg);
}
return $safeName;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:14,代码来源:tlPlatform.class.php
示例8: trim_and_limit
/**
* Trim string and limit to N chars
*
* @param string
* @param int [len]: how many chars return
*
* @return string trimmed string
*
* @author Francisco Mancardi - 20050905 - refactoring
*/
function trim_and_limit($s, $len = 100)
{
$s = trim($s);
if (tlStringLen($s) > $len) {
$s = tlSubStr($s, 0, $len);
}
return $s;
}
开发者ID:tamtrong,项目名称:testlink,代码行数:18,代码来源:common.php
示例9: write_execution
/**
* write execution result to DB
*
* @param resource &$db reference to database handler
* @param obj &$exec_signature object with tproject_id,tplan_id,build_id,platform_id,user_id
*
* @internal revisions
*
*/
function write_execution(&$db, &$exec_signature, &$exec_data)
{
$executions_table = DB_TABLE_PREFIX . 'executions';
$resultsCfg = config_get('results');
$execCfg = config_get('exec_cfg');
$db_now = $db->db_now();
$cfield_mgr = new cfield_mgr($db);
$cf_prefix = $cfield_mgr->get_name_prefix();
$len_cfp = tlStringLen($cf_prefix);
$cf_nodeid_pos = 4;
$bulk_notes = '';
$ENABLED = 1;
$cf_map = $cfield_mgr->get_linked_cfields_at_execution($exec_signature->tproject_id, $ENABLED, 'testcase');
$has_custom_fields = is_null($cf_map) ? 0 : 1;
// extract custom fields id.
$map_nodeid_array_cfnames = null;
foreach ($exec_data as $input_name => $value) {
if (strncmp($input_name, $cf_prefix, $len_cfp) == 0) {
$dummy = explode('_', $input_name);
$map_nodeid_array_cfnames[$dummy[$cf_nodeid_pos]][] = $input_name;
}
}
if (isset($exec_data['do_bulk_save'])) {
// create structure to use common algoritm
$item2loop = $exec_data['status'];
$is_bulk_save = 1;
$bulk_notes = $db->prepare_string(trim($exec_data['bulk_exec_notes']));
} else {
$item2loop = $exec_data['save_results'];
$is_bulk_save = 0;
}
foreach ($item2loop as $tcversion_id => $val) {
$tcase_id = $exec_data['tc_version'][$tcversion_id];
$current_status = $exec_data['status'][$tcversion_id];
$version_number = $exec_data['version_number'][$tcversion_id];
$has_been_executed = $current_status != $resultsCfg['status_code']['not_run'] ? TRUE : FALSE;
if ($has_been_executed) {
$my_notes = $is_bulk_save ? $bulk_notes : $db->prepare_string(trim($exec_data['notes'][$tcversion_id]));
$sql = "INSERT INTO {$executions_table} " . "(build_id,tester_id,status,testplan_id,tcversion_id," . " execution_ts,notes,tcversion_number,platform_id,execution_duration)" . " VALUES ( {$exec_signature->build_id}, {$exec_signature->user_id}, '{$exec_data['status'][$tcversion_id]}'," . "{$exec_signature->tplan_id}, {$tcversion_id},{$db_now},'{$my_notes}'," . "{$version_number},{$exec_signature->platform_id}";
if (trim($exec_data['execution_duration']) == '') {
$dura = 'NULL ';
} else {
$dura = floatval($exec_data['execution_duration']);
}
$sql .= ',' . $dura . ")";
$db->exec_query($sql);
// at least for Postgres DBMS table name is needed.
$execution_id = $db->insert_id($executions_table);
if ($has_custom_fields) {
// test useful when doing bulk update, because some type of custom fields
// like checkbox can not exist on exec_data. => why ??
//
$hash_cf = null;
$access_key = $is_bulk_save ? 0 : $tcase_id;
if (isset($map_nodeid_array_cfnames[$access_key])) {
foreach ($map_nodeid_array_cfnames[$access_key] as $cf_v) {
$hash_cf[$cf_v] = $exec_data[$cf_v];
}
}
$cfield_mgr->execution_values_to_db($hash_cf, $tcversion_id, $execution_id, $exec_signature->tplan_id, $cf_map);
}
// 20140412
$hasMoreData = new stdClass();
$hasMoreData->step_notes = isset($exec_data['step_notes']);
$hasMoreData->step_status = isset($exec_data['step_status']);
$hasMoreData->nike = $execCfg->steps_exec && ($hasMoreData->step_notes || $hasMoreData->step_status);
if ($hasMoreData->nike) {
$target = DB_TABLE_PREFIX . 'execution_tcsteps';
$key2loop = array_keys($exec_data['step_notes']);
foreach ($key2loop as $step_id) {
$doIt = !is_null($exec_data['step_notes'][$step_id]) && trim($exec_data['step_notes'][$step_id]) != '' || $exec_data['step_status'][$step_id] != $resultsCfg['status_code']['not_run'];
if ($doIt) {
$sql = " INSERT INTO {$target} (execution_id,tcstep_id,notes";
$values = " VALUES ( {$execution_id}, {$step_id}," . "'" . $db->prepare_string($exec_data['step_notes'][$step_id]) . "'";
$status = strtolower(trim($exec_data['step_status'][$step_id]));
$status = $status[0];
if ($status != $resultsCfg['status_code']['not_run']) {
$sql .= ",status";
$values .= ",'" . $db->prepare_string($status) . "'";
}
$sql .= ") " . $values . ")";
$db->exec_query($sql);
}
}
}
}
}
}
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:97,代码来源:exec.inc.php
示例10: initializeGui
/**
*
*
*
**/
function initializeGui(&$dbHandler, &$argsObj)
{
$guiObj = new stdClass();
$guiObj->importLimitBytes = config_get('import_file_max_size_bytes');
$guiObj->importLimitKB = $guiObj->importLimitBytes / 1024;
$guiObj->importTypes = array('XML' => 'Mantis XML');
$guiObj->req_spec_id = $argsObj->req_spec_id;
$guiObj->refreshTree = $guiObj->doImport = tlStringLen($argsObj->importType);
$guiObj->resultMap = null;
$guiObj->req_spec_name = '';
$guiObj->file_check = array('status_ok' => 1, 'msg' => 'ok');
$guiObj->import_title = lang_get('title_req_import');
$guiObj->fileName = TL_TEMP_PATH . session_id() . "-import_req_from_issue";
if ($argsObj->req_spec_id) {
$tree_mgr = new tree($dbHandler);
$node_info = $tree_mgr->get_node_hierarchy_info($argsObj->req_spec_id);
unset($tree_mgr);
$guiObj->req_spec_name = $node_info['name'];
}
return $guiObj;
}
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:26,代码来源:reqCreateFromIssueMantisXML.php
示例11: testlinkInitPage
* 20070505 - franciscom - use of role_separator configuration
*
**/
require_once '../../config.inc.php';
require_once "common.php";
testlinkInitPage($db, true);
$tproject_mgr = new testproject($db);
$args = init_args();
$gui = new stdClass();
$gui->tprojectID = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$gui->tcasePrefix = '';
$gui->searchSize = 8;
// magic default
if ($gui->tprojectID > 0) {
$gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($gui->tprojectID) . config_get('testcase_cfg')->glue_character;
$gui->searchSize = tlStringLen($gui->tcasePrefix) + 7;
// magic again
}
$user = $_SESSION['currentUser'];
$userID = $user->dbID;
$gui->TestProjects = $tproject_mgr->get_accessible_for_user($userID, 'map', $tlCfg->gui->tprojects_combo_order_by);
$gui->TestProjectCount = sizeof($gui->TestProjects);
$gui->TestPlanCount = 0;
if ($gui->tprojectID) {
$testPlanSet = $user->getAccessibleTestPlans($db, $gui->tprojectID);
$gui->TestPlanCount = sizeof($testPlanSet);
$tplanID = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : null;
if (!is_null($tplanID)) {
// Need to set this info on session with first Test Plan from $testPlanSet
// if this test plan is present on $testPlanSet
// OK we will set it on $testPlanSet as selected one.
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:navBar.php
示例12: initEnvironment
/**
*/
function initEnvironment(&$dbHandler, &$userObj)
{
$argsObj = new stdClass();
$guiObj = new stdClass();
$cfg = config_get("gui");
$tprojectMgr = new testproject($dbHandler);
$_REQUEST = strings_stripSlashes($_REQUEST);
$iParams = array("tprojectIDNavBar" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "tplan_id" => array(tlInputParameter::INT_N));
R_PARAMS($iParams, $argsObj);
$guiObj->tcasePrefix = '';
$guiObj->tplanCount = 0;
$guiObj->tprojectSet = $tprojectMgr->get_accessible_for_user($userObj->dbID);
$guiObj->tprojectCount = sizeof($guiObj->tprojectSet);
// -----------------------------------------------------------------------------------------------------
// Important Logic
// -----------------------------------------------------------------------------------------------------
$argsObj->tprojectIDNavBar = intval($argsObj->tprojectIDNavBar);
$argsObj->tproject_id = intval($argsObj->tproject_id);
$argsObj->tproject_id = $argsObj->tproject_id > 0 ? $argsObj->tproject_id : $argsObj->tprojectIDNavBar;
if ($argsObj->tproject_id == 0) {
$argsObj->tproject_id = key($guiObj->tprojectSet);
}
$guiObj->tprojectID = $argsObj->tproject_id;
$guiObj->tprojectOptions = null;
$guiObj->tprojectTopMenu = null;
if ($guiObj->tprojectID > 0) {
$dummy = $tprojectMgr->get_by_id($guiObj->tprojectID);
$guiObj->tprojectOptions = $dummy['opt'];
}
// -----------------------------------------------------------------------------------------------------
$argsObj->tplan_id = intval($argsObj->tplan_id);
$guiObj->tplanID = $argsObj->tplan_id;
// Julian: left magic here - do think this value will never be used as a project with a prefix
// has to be created after first login -> searchSize should be set dynamically.
// If any reviewer agrees on that feel free to change it.
$guiObj->searchSize = 8;
if ($guiObj->tprojectID > 0) {
$guiObj->tcasePrefix = $tprojectMgr->getTestCasePrefix($guiObj->tprojectID) . config_get('testcase_cfg')->glue_character;
$guiObj->searchSize = tlStringLen($guiObj->tcasePrefix) + $cfg->dynamic_quick_tcase_search_input_size;
$guiObj->tplanSet = $userObj->getAccessibleTestPlans($dbHandler, $guiObj->tprojectID);
$guiObj->tplanCount = sizeof($guiObj->tplanSet);
if ($guiObj->tplanID == 0) {
$guiObj->tplanID = $guiObj->tplanSet[0]['id'];
$guiObj->tplanSet[0]['selected'] = 1;
}
}
return array($argsObj, $guiObj);
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:50,代码来源:mainPage.php
示例13: write_execution
/**
* write execution result to DB
*
* @param resource &$db reference to database handler
* @param obj &$exec_signature object with tproject_id,tplan_id,build_id,platform_id,user_id
*
* @internal revisions
*
*/
function write_execution(&$db, &$exec_signature, &$exec_data, &$issueTracker)
{
static $docRepo;
if (is_null($docRepo)) {
$docRepo = tlAttachmentRepository::create($db);
}
$executions_table = DB_TABLE_PREFIX . 'executions';
$resultsCfg = config_get('results');
$execCfg = config_get('exec_cfg');
$db_now = $db->db_now();
$cfield_mgr = new cfield_mgr($db);
$cf_prefix = $cfield_mgr->get_name_prefix();
$len_cfp = tlStringLen($cf_prefix);
$cf_nodeid_pos = 4;
$bulk_notes = '';
$ENABLED = 1;
$cf_map = $cfield_mgr->get_linked_cfields_at_execution($exec_signature->tproject_id, $ENABLED, 'testcase');
$has_custom_fields = is_null($cf_map) ? 0 : 1;
// extract custom fields id.
$map_nodeid_array_cfnames = null;
foreach ($exec_data as $input_name => $value) {
if (strncmp($input_name, $cf_prefix, $len_cfp) == 0) {
$dummy = explode('_', $input_name);
$map_nodeid_array_cfnames[$dummy[$cf_nodeid_pos]][] = $input_name;
}
}
if (isset($exec_data['do_bulk_save'])) {
// create structure to use common algoritm
$item2loop = $exec_data['status'];
$is_bulk_save = 1;
$bulk_notes = $db->prepare_string(trim($exec_data['bulk_exec_notes']));
$execStatusKey = 'status';
} else {
$item2loop = $exec_data['save_results'];
$is_bulk_save = 0;
$execStatusKey = 'statusSingle';
}
$addIssueOp = array('createIssue' => null, 'issueForStep' => null);
foreach ($item2loop as $tcversion_id => $val) {
$tcase_id = $exec_data['tc_version'][$tcversion_id];
$current_status = $exec_data[$execStatusKey][$tcversion_id];
$version_number = $exec_data['version_number'][$tcversion_id];
$has_been_executed = $current_status != $resultsCfg['status_code']['not_run'] ? TRUE : FALSE;
if ($has_been_executed) {
$my_notes = $is_bulk_save ? $bulk_notes : $db->prepare_string(trim($exec_data['notes'][$tcversion_id]));
$sql = "INSERT INTO {$executions_table} " . "(build_id,tester_id,status,testplan_id,tcversion_id," . " execution_ts,notes,tcversion_number,platform_id,execution_duration)" . " VALUES ( {$exec_signature->build_id}, {$exec_signature->user_id}, '{$exec_data[$execStatusKey][$tcversion_id]}'," . "{$exec_signature->tplan_id}, {$tcversion_id},{$db_now},'{$my_notes}'," . "{$version_number},{$exec_signature->platform_id}";
$dura = 'NULL ';
if (isset($exec_data['execution_duration'])) {
if (trim($exec_data['execution_duration']) == '') {
$dura = 'NULL ';
} else {
$dura = floatval($exec_data['execution_duration']);
}
}
$sql .= ',' . $dura . ")";
$db->exec_query($sql);
// at least for Postgres DBMS table name is needed.
$execution_id = $db->insert_id($executions_table);
$execSet[$tcversion_id] = $execution_id;
if ($has_custom_fields) {
// test useful when doing bulk update, because some type of custom fields
// like checkbox can not exist on exec_data. => why ??
//
$hash_cf = null;
$access_key = $is_bulk_save ? 0 : $tcase_id;
if (isset($map_nodeid_array_cfnames[$access_key])) {
foreach ($map_nodeid_array_cfnames[$access_key] as $cf_v) {
$hash_cf[$cf_v] = $exec_data[$cf_v];
}
}
$cfield_mgr->execution_values_to_db($hash_cf, $tcversion_id, $execution_id, $exec_signature->tplan_id, $cf_map);
}
$hasMoreData = new stdClass();
$hasMoreData->step_notes = isset($exec_data['step_notes']);
$hasMoreData->step_status = isset($exec_data['step_status']);
$hasMoreData->nike = $execCfg->steps_exec && ($hasMoreData->step_notes || $hasMoreData->step_status);
if ($hasMoreData->nike) {
$target = DB_TABLE_PREFIX . 'execution_tcsteps';
$key2loop = array_keys($exec_data['step_notes']);
foreach ($key2loop as $step_id) {
$doIt = !is_null($exec_data['step_notes'][$step_id]) && trim($exec_data['step_notes'][$step_id]) != '' || $exec_data['step_status'][$step_id] != $resultsCfg['status_code']['not_run'];
if ($doIt) {
$sql = " INSERT INTO {$target} (execution_id,tcstep_id,notes";
$values = " VALUES ( {$execution_id}, {$step_id}," . "'" . $db->prepare_string($exec_data['step_notes'][$step_id]) . "'";
$status = strtolower(trim($exec_data['step_status'][$step_id]));
$status = $status[0];
if ($status != $resultsCfg['status_code']['not_run']) {
$sql .= ",status";
$values .= ",'" . $db->prepare_string($status) . "'";
}
$sql .= ") " . $values . ")";
//.........这里部分代码省略.........
开发者ID:mweyamutsvene,项目名称:testlink,代码行数:101,代码来源:exec.inc.php
示例14: saveImportedTCData
function saveImportedTCData(&$db, $tcData, $tproject_id, $container_id, $userID, $kwMap, $duplicatedLogic = array('hitCriteria' => 'name', 'actionOnHit' => null))
{
static $messages;
static $fieldSizeCfg;
static $feedbackMsg;
static $tcase_mgr;
static $tproject_mgr;
static $req_spec_mgr;
static $req_mgr;
static $safeSizeCfg;
static $linkedCustomFields;
static $tprojectHas;
static $reqSpecSet;
static $getVersionOpt;
if (!$tcData) {
return;
}
// $tprojectHas = array('customFields' => false, 'reqSpec' => false);
$hasCustomFieldsInfo = false;
$hasRequirements = false;
if (is_null($messages)) {
$feedbackMsg = array();
$messages = array();
$fieldSizeCfg = config_get('field_size');
$tcase_mgr = new testcase($db);
$tproject_mgr = new testproject($db);
$req_spec_mgr = new requirement_spec_mgr($db);
$req_mgr = new requirement_mgr($db);
$messages['cf_warning'] = lang_get('no_cf_defined_can_not_import');
$messages['reqspec_warning'] = lang_get('no_reqspec_defined_can_not_import');
$messages['already_exists_updated'] = lang_get('already_exists_updated');
$messages['original_name'] = lang_get('original_name');
$messages['testcase_name_too_long'] = lang_get('testcase_name_too_long');
$messages['start_warning'] = lang_get('start_warning');
$messages['end_warning'] = lang_get('end_warning');
$messages['testlink_warning'] = lang_get('testlink_warning');
$messages['start_feedback'] = $messages['start_warning'] . "\n" . $messages['testlink_warning'] . "\n";
$feedbackMsg['cfield'] = lang_get('cf_value_not_imported_missing_cf_on_testproject');
$feedbackMsg['tcase'] = lang_get('testcase');
$feedbackMsg['req'] = lang_get('req_not_in_req_spec_on_tcimport');
$feedbackMsg['req_spec'] = lang_get('req_spec_ko_on_tcimport');
// because name can be changed automatically during item creation
// to avoid name conflict adding a suffix automatically generated,
// is better to use a max size < max allowed size
$safeSizeCfg = new stdClass();
$safeSizeCfg->testcase_name = $fieldSizeCfg->testcase_name * 0.8;
// Get CF with scope design time and allowed for test cases linked to this test project
// $customFields=$tproject_mgr->get_linked_custom_fields($tproject_id,'testcase','name');
// function get_linked_cfields_at_design($tproject_id,$enabled,$filters=null,
// $node_type=null,$node_id=null,$access_key='id')
//
$linkedCustomFields = $tcase_mgr->cfield_mgr->get_linked_cfields_at_design($tproject_id, 1, null, 'testcase', null, 'name');
$tprojectHas['customFields'] = !is_null($linkedCustomFields);
// BUGID - 20090205 - franciscom
$reqSpecSet = $tproject_mgr->getReqSpec($tproject_id, null, array('RSPEC.id', 'NH.name AS title', 'RSPEC.doc_id as rspec_doc_id', 'REQ.req_doc_id'), 'req_doc_id');
$tprojectHas['reqSpec'] = !is_null($reqSpecSet) && count($reqSpecSet) > 0;
$getVersionOpt = array('output' => 'minimun');
}
$resultMap = array();
$tc_qty = sizeof($tcData);
for ($idx = 0; $idx < $tc_qty; $idx++) {
$tc = $tcData[$idx];
$name = $tc['name'];
$summary = $tc['summary'];
$steps = $tc['steps'];
$node_order = isset($tc['node_order']) ? intval($tc['node_order']) : testcase::DEFAULT_ORDER;
$externalid = $tc['externalid'];
$internalid = $tc['internalid'];
$preconditions = $tc['preconditions'];
$exec_type = isset($tc['execution_type']) ? $tc['execution_type'] : TESTCASE_EXECUTION_TYPE_MANUAL;
$importance = isset($tc['importance']) ? $tc['importance'] : MEDIUM;
$name_len = tlStringLen($name);
if ($name_len > $fieldSizeCfg->testcase_name) {
// Will put original name inside summary
$xx = $messages['start_feedback'];
$xx .= sprintf($messages['testcase_name_too_long'], $name_len, $fieldSizeCfg->testcase_name) . "\n";
$xx .= $messages['original_name'] . "\n" . $name . "\n" . $messages['end_warning'] . "\n";
$summary = nl2br($xx) . $summary;
$name = tlSubStr($name, 0, $safeSizeCfg->testcase_name);
}
$kwIDs = null;
if (isset($tc['keywords']) && $tc['keywords']) {
$kwIDs = implode(",", buildKeywordList($kwMap, $tc['keywords']));
}
$doCreate = true;
if ($duplicatedLogic['actionOnHit'] == 'update_last_version') {
switch ($duplicatedLogic['hitCriteria']) {
case 'name':
$info = $tcase_mgr->getDuplicatesByName($name, $container_id);
break;
case 'internalID':
$dummy = $tcase_mgr->tree_manager->get_node_hierarchy_info($internalid, $container_id);
if (!is_null($dummy)) {
$info[$internalid] = $dummy;
}
break;
case 'externalID':
$info = $tcase_mgr->get_by_external($externalid, $container_id);
break;
}
//.........这里部分代码省略.........
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:101,代码来源:tcImport.php
示例15: getBugSummaryString
/**
* Returns the bug summary in a human redable format, cutted down to 45 chars
*
* @return string returns the summary (in readable form) of the given bug
*
* @version 1.0
* @author Raphael Bosshard
* @author Arjen van Summeren
* @since 28.09.2005, 16:06:25
**/
function getBugSummaryString($id)
{
if (!$this->isConnected()) {
return null;
}
$status = null;
$query = "SELECT short_desc FROM {$this->dbSchema}.bugs WHERE bug_id='" . $id . "'";
$result = $this->dbConnection->exec_query($query);
$summary = null;
if ($result) {
$summary = $this->dbConnection->fetch_array($result);
if ($summary) {
$summary = array_pop($summary);
if (tlStringLen($summary) > 45) {
$summary = tlSubStr($summary, 0, 42) . "...";
}
} else {
$summary = null;
}
}
return $summary;
}
开发者ID:tamtrong,项目名称:testlink,代码行数:32,代码来源:int_bugzilla.php
示例16: formatTcPrefix
/** @TODO add description */
function formatTcPrefix($str)
{
// limit tcasePrefix len.
$fstr = trim($str);
if (tlStringLen($fstr) > self::TESTCASE_PREFIX_MAXLEN) {
$tcprefix = substr($fstr, self::TESTCASE_PREFIX_MAXLEN);
}
return $fstr;
}
开发者ID:viglesiasce,项目名称:tl_RC1,代码行数:10,代码来源:testproject.class.php
示例17: validate
/**
* @param string $value the string which should be validated
* @return bool returns true if the value was successfully validated, else throws an Exception
*/
public function validate($value)
{
$minLen = $this->minLen;
if ($minLen && tlStringLen($value) < $minLen) {
$msg = "Input parameter validation failed [minLen: " . tlStringLen($value) . " {$minLen}]";
tLog($msg, 'ERROR');
throw new Exception($msg);
}
$regExp = $this->regExp;
if ($regExp) {
$dummy = null;
if (!preg_match($regExp, $value, $dummy)) {
$msg = "Input parameter validation failed [regExp: " . htmlspecialchars($value) . " " . htmlspecialchars($regExp) . "]";
tLog($msg, 'ERROR');
throw new Exception($msg);
}
}
$pfnValidation = $this->pfnValidation;
if ($pfnValidation) {
if (!$pfnValidation($value)) {
$msg = "Input parameter validation failed [external function" . " - {$pfnValidation}]";
tLog($msg, 'ERROR');
throw new Exception($msg);
}
}
return true;
}
开发者ID:moraesmv,项目名称:testlink-code,代码行数:31,代码来源:inputparameter.class.php
示例18: create_tcase_only
function create_tcase_only($parent_id, $name, $order = self::DEFAULT_ORDER, $id = self::AUTOMATIC_ID, $options = null)
{
$dummy = config_get('field_size');
$name_max_len = $dummy->testcase_name;
$name = trim($name);
$originalNameLen = tlStringLen($name);
$getOptions = array();
$ret = array('id' => -1, 'external_id' => 0, 'status_ok' => 1, 'msg' => 'ok', 'new_name' => '', 'version_number' => 1, 'has_duplicate' => false);
$my['options'] = array('check_duplicate_name' => self::DONT_CHECK_DUPLICATE_NAME, 'action_on_duplicate_name' => 'generate_new');
$my['options'] = array_merge($my['options'], (array) $options);
$doCreate = true;
if ($my['options']['check_duplicate_name']) {
$algo_cfg = config_get('testcase_cfg')->duplicated_name_algorithm;
$getOptions['check_criteria'] = $algo_cfg->type == 'counterSuffix' ? 'like' : '=';
$getOptions['access_key'] = $algo_cfg->type == 'counterSuffix' ? 'name' : 'id';
$itemSet = $this->getDuplicatesByName($name, $parent_id, $getOptions);
if (!is_null($itemSet) && ($siblingQty = count($itemSet)) > 0) {
$ret['has_duplicate'] = true;
switch ($my['options']['action_on_duplicate_name']) {
case 'block':
$doCreate = false;
$ret['status_ok'] = 0;
$ret['msg'] = sprintf(lang_get('testcase_name_already_exists'), $name);
break;
case 'generate_new':
$doCreate = true;
switch ($algo_cfg->type) {
case 'stringPrefix':
$name = $algo_cfg->text . " " . $name;
$final_len = strlen($name);
if ($final_len > $name_max_len) {
$name = substr($name, 0, $name_max_len);
}
break;
case 'counterSuffix':
$mask = !is_null($algo_cfg->text) ? $algo_cfg->text : '#%s';
$nameSet = array_flip(array_keys($itemSet));
$target = $name . ($suffix = sprintf($mask, ++$siblingQty));
// BUGID 3367
$final_len = strlen($target);
if ($final_len > $name_max_len) {
$target = substr($target, strlen($suffix), $name_max_len);
}
// Need to recheck if new generated name does not crash with existent name
// why? Suppose you have created:
// TC [1]
// TC [2]
// TC [3]
// Then you delete TC [2].
// When I got siblings il will got 2 siblings, if I create new progressive using next,
// it will be 3 => I will get duplicated name.
while (isset($nameSet[$target])) {
$target = $name . ($suffix = sprintf($mask, ++$siblingQty));
// BUGID 3367
$final_len = strlen($target);
if ($final_len > $name_max_len) {
$target = substr($target, strlen($suffix), $name_max_len);
}
}
$name = $target;
break;
}
$ret['status_ok'] = 1;
$ret['new_name'] = $name;
$ret['msg'] = sprintf(lang_get('created_with_title'), $name);
break;
case 'create_new_version':
$doCreate = false;
// If we found
|
请发表评论