当前位置: 首页>>代码示例>>PHP>>正文


PHP tree::nodeNameExists方法代码示例

本文整理汇总了PHP中tree::nodeNameExists方法的典型用法代码示例。如果您正苦于以下问题:PHP tree::nodeNameExists方法的具体用法?PHP tree::nodeNameExists怎么用?PHP tree::nodeNameExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tree的用法示例。


在下文中一共展示了tree::nodeNameExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: json_encode

 * This script is distributed under the GNU General Public License 2 or later.
 *
 * Checks if inside a container (parent_id) exists a node with specified name.
 * Used to warn user if non-unique name is entered.
 * 
 * Importante NOTICE:
 * no check on user rights is done (IMHO is ok because is a READ ONLY Operation).
 *
 * @package 	TestLink
 * @author 		Francisco Mancardi
 * @copyright 	2010,2014 TestLink community
 * @filesource  checkNodeDuplicateName.php
 *
 * @internal revisions
 *
 **/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
$data = array('success' => true, 'message' => '');
$iParams = array("node_name" => array(tlInputParameter::STRING_N, 0, 100), "node_id" => array(tlInputParameter::INT), "parent_id" => array(tlInputParameter::INT), "node_type" => array(tlInputParameter::STRING_N, 0, 20));
$args = G_PARAMS($iParams);
$tree_manager = new tree($db);
$node_types_descr_id = $tree_manager->get_available_node_types();
// To allow name check when creating a NEW NODE => we do not have node id
$args['node_id'] = $args['node_id'] > 0 ? $args['node_id'] : null;
$args['parent_id'] = $args['parent_id'] > 0 ? $args['parent_id'] : null;
$check = $tree_manager->nodeNameExists($args['node_name'], $node_types_descr_id[$args['node_type']], $args['node_id'], $args['parent_id']);
$data['success'] = !$check['status'];
$data['message'] = $check['msg'];
echo json_encode($data);
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:checkNodeDuplicateName.php

示例2: json_encode

 *
 * @internal Revisions:
 * 20101010 - franciscom - added testsuite_id as parameter, needed to do checks when creating test case
 * 20100225 - eloff - initial commit
 *
 **/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
$data = array('success' => true, 'message' => '');
$iParams = array("name" => array(tlInputParameter::STRING_N, 0, 100), "testcase_id" => array(tlInputParameter::INT), "testsuite_id" => array(tlInputParameter::INT));
$args = G_PARAMS($iParams);
if (has_rights($db, 'mgt_view_tc')) {
    $tree_manager = new tree($db);
    $node_types_descr_id = $tree_manager->get_available_node_types();
    // To allow name check when creating a NEW test case => we do not have test case id
    $args['testcase_id'] = $args['testcase_id'] > 0 ? $args['testcase_id'] : null;
    $args['testsuite_id'] = $args['testsuite_id'] > 0 ? $args['testsuite_id'] : null;
    // for debug -
    // $xx = "\$args['testcase_id']:{$args['testcase_id']} - \$args['name']:{$args['name']}" .
    //       " - \$args['testsuite_id']:{$args['testsuite_id']}";
    // file_put_contents('c:\checkTCaseDuplicateName.php.ajax', $xx);
    $check = $tree_manager->nodeNameExists($args['name'], $node_types_descr_id['testcase'], $args['testcase_id'], $args['testsuite_id']);
    $data['success'] = !$check['status'];
    $data['message'] = $check['msg'];
} else {
    tLog('User has not right needed to do requested action - checkTCaseDuplicateName.php', 'ERROR');
    $data['success'] = false;
    $data['message'] = lang_get('user_has_no_right_for_action');
}
echo json_encode($data);
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:31,代码来源:checkTCaseDuplicateName.php

示例3: json_encode

 *
 * @package 	TestLink
 * @author 		Erik Eloff
 * @copyright 	2010, TestLink community
 * @version    	CVS: $Id: checkDuplicateName.php,v 1.1 2010/03/06 16:43:14 erikeloff Exp $
 *
 * @internal Revisions:
 * 20100225 - eloff - initial commit
 *
 **/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
$data = array('success' => true, 'message' => '');
$iParams = array("name" => array(tlInputParameter::STRING_N, 0, 100), "testcase_id" => array(tlInputParameter::INT));
$args = G_PARAMS($iParams);
if (has_rights($db, 'mgt_view_tc')) {
    $tree_manager = new tree($db);
    $node_types_descr_id = $tree_manager->get_available_node_types();
    $my_node_type = $node_types_descr_id['testcase'];
    $name = $args['name'];
    $tc_id = $args['testcase_id'];
    $check = $tree_manager->nodeNameExists($name, $my_node_type, $tc_id);
    $data['success'] = !$check['status'];
    $data['message'] = $check['msg'];
} else {
    tLog('Invalid right for the user: ' . $args['right'], 'ERROR');
    $data['success'] = false;
    $data['message'] = lang_get('Invalid right');
}
echo json_encode($data);
开发者ID:CristianOspinaOspina,项目名称:testlinkpruebas,代码行数:31,代码来源:checkDuplicateName.php


注:本文中的tree::nodeNameExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。