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


PHP category_is_unique函数代码示例

本文整理汇总了PHP中category_is_unique函数的典型用法代码示例。如果您正苦于以下问题:PHP category_is_unique函数的具体用法?PHP category_is_unique怎么用?PHP category_is_unique使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: config_get

# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'category_api.php';
$f_project_id = gpc_get_int('project_id');
$f_category = gpc_get_string('category');
$f_new_category = gpc_get_string('new_category');
$f_assigned_to = gpc_get_int('assigned_to', 0);
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
if (is_blank($f_new_category)) {
    trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$f_category = trim($f_category);
$f_new_category = trim($f_new_category);
# check for duplicate
if (strtolower($f_category) == strtolower($f_new_category) || category_is_unique($f_project_id, $f_new_category)) {
    category_update($f_project_id, $f_category, $f_new_category, $f_assigned_to);
} else {
    trigger_error(ERROR_CATEGORY_DUPLICATE, ERROR);
}
$t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id;
html_page_top1();
html_meta_redirect($t_redirect_url);
html_page_top2();
?>
<br />
<div align="center">
<?php 
echo lang_get('operation_successful') . '<br />';
print_bracket_link($t_redirect_url, lang_get('proceed'));
?>
开发者ID:centaurustech,项目名称:BenFund,代码行数:31,代码来源:manage_proj_cat_update.php

示例2: auth_reauthenticate

auth_reauthenticate();
$f_project_id = gpc_get_int('project_id');
$f_name = gpc_get_string('name');
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
if (is_blank($f_name)) {
    error_parameters(lang_get('category'));
    trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$t_names = explode('|', $f_name);
$t_category_count = count($t_names);
foreach ($t_names as $t_name) {
    if (is_blank($t_name)) {
        continue;
    }
    $t_name = trim($t_name);
    if (category_is_unique($f_project_id, $t_name)) {
        category_add($f_project_id, $t_name);
    } else {
        if (1 == $t_category_count) {
            # We only error out on duplicates when a single value was
            #  given.  If multiple values were given, we just add the
            #  ones we can.  The others already exist so it isn't really
            #  an error.
            trigger_error(ERROR_CATEGORY_DUPLICATE, ERROR);
        }
    }
}
form_security_purge('manage_proj_cat_add');
if ($f_project_id == ALL_PROJECTS) {
    $t_redirect_url = 'manage_proj_page.php';
} else {
开发者ID:Kirill,项目名称:mantisbt,代码行数:31,代码来源:manage_proj_cat_add.php

示例3: config_get

# --------------------------------------------------------
# $Id: manage_proj_cat_copy.php,v 1.21 2005/02/27 15:33:01 jlatour Exp $
# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'category_api.php';
$f_project_id = gpc_get_int('project_id');
$f_other_project_id = gpc_get_int('other_project_id');
$f_copy_from = gpc_get_bool('copy_from');
$f_copy_to = gpc_get_bool('copy_to');
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
access_ensure_project_level(config_get('manage_project_threshold'), $f_other_project_id);
if ($f_copy_from) {
    $t_src_project_id = $f_other_project_id;
    $t_dst_project_id = $f_project_id;
} else {
    if ($f_copy_to) {
        $t_src_project_id = $f_project_id;
        $t_dst_project_id = $f_other_project_id;
    } else {
        trigger_error(ERROR_CATEGORY_NO_ACTION, ERROR);
    }
}
$rows = category_get_all_rows($t_src_project_id);
foreach ($rows as $row) {
    $t_category = $row['category'];
    if (category_is_unique($t_dst_project_id, $t_category)) {
        category_add($t_dst_project_id, $t_category);
    }
}
print_header_redirect('manage_proj_edit_page.php?project_id=' . $f_project_id);
开发者ID:centaurustech,项目名称:BenFund,代码行数:31,代码来源:manage_proj_cat_copy.php

示例4: category_ensure_unique

/**
 * Check whether the category is unique within a project
 * Trigger an error if it is not
 * @param int $p_project_id Project id
 * @param string $p_name Category Name
 * @return null
 * @access public
 */
 function category_ensure_unique( $p_project_id, $p_name ) {
	if( !category_is_unique( $p_project_id, $p_name ) ) {
		trigger_error( ERROR_CATEGORY_DUPLICATE, ERROR );
	}
}
开发者ID:rombert,项目名称:mantisbt,代码行数:13,代码来源:category_api.php


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