本文整理汇总了PHP中MantisEnum::hasValue方法的典型用法代码示例。如果您正苦于以下问题:PHP MantisEnum::hasValue方法的具体用法?PHP MantisEnum::hasValue怎么用?PHP MantisEnum::hasValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MantisEnum
的用法示例。
在下文中一共展示了MantisEnum::hasValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLocalizedLabel
/**
* Gets the localized label corresponding to a value. Note that this method
* takes in the standard / localized enums so that if the value is in the localized
* enum but not the standard one, then it returns not found.
*
* @param string $enumString The standard enum string.
* @param string $localizedEnumString The localized enum string.
* @param integer $value The value to lookup.
*
* @return the label or the decorated value to represent not found.
*/
public static function getLocalizedLabel($enumString, $localizedEnumString, $value)
{
if (!MantisEnum::hasValue($enumString, $value)) {
return MantisEnum::getLabelForUnknownValue($value);
}
return MantisEnum::getLabel($localizedEnumString, $value);
}
示例2: getLocalizedLabel
/**
* Gets the localized label corresponding to a value. Note that this method
* takes in the standard / localized enums so that if the value is in the localized
* enum but not the standard one, then it returns not found.
*
* @param string $p_enum_string The standard enum string.
* @param string $p_localized_enum_string The localized enum string.
* @param integer $p_value The value to lookup.
*
* @return string the label or the decorated value to represent not found.
*/
public static function getLocalizedLabel($p_enum_string, $p_localized_enum_string, $p_value)
{
if (!MantisEnum::hasValue($p_enum_string, $p_value)) {
return MantisEnum::getLabelForUnknownValue($p_value);
}
$t_assoc_array = MantisEnum::getAssocArrayIndexedByValues($p_localized_enum_string);
if (isset($t_assoc_array[(int) $p_value])) {
return $t_assoc_array[(int) $p_value];
}
return MantisEnum::getLabel($p_enum_string, $p_value);
}
示例3: helper_alternate_class
<!-- Access Level -->
<tr <?php
echo helper_alternate_class();
?>
>
<td class="category">
<?php
echo lang_get('access_level');
?>
</td>
<td>
<select name="access_level">
<?php
$t_access_level = $t_user['access_level'];
if (!MantisEnum::hasValue(config_get('access_levels_enum_string'), $t_access_level)) {
$t_access_level = config_get('default_new_account_access_level');
}
print_project_access_levels_option_list($t_access_level);
?>
</select>
</td>
</tr>
<!-- Enabled Checkbox -->
<tr <?php
echo helper_alternate_class();
?>
>
<td class="category">
<?php
示例4: bug_check_workflow
/**
* Validate workflow state to see if bug can be moved to requested state
* @param int p_bug_status current bug status
* @param int p_wanted_status new bug status
* @return bool
* @access public
* @uses config_api.php
* @uses utility_api.php
*/
function bug_check_workflow($p_bug_status, $p_wanted_status)
{
$t_status_enum_workflow = config_get('status_enum_workflow');
if (count($t_status_enum_workflow) < 1) {
# workflow not defined, use default enum
return true;
}
if ($p_bug_status == $p_wanted_status) {
# no change in state, allow the transition
return true;
}
# There should always be a possible next status, if not defined, then allow all.
if (!isset($t_status_enum_workflow[$p_bug_status])) {
return true;
}
# workflow defined - find allowed states
$t_allowed_states = $t_status_enum_workflow[$p_bug_status];
return MantisEnum::hasValue($t_allowed_states, $p_wanted_status);
}
示例5: bug_check_workflow
/**
* Validate workflow state to see if bug can be moved to requested state
* @param int p_bug_status current bug status
* @param int p_wanted_status new bug status
* @return bool
* @access public
* @uses config_api.php
* @uses utility_api.php
*/
function bug_check_workflow($p_bug_status, $p_wanted_status)
{
$t_status_enum_workflow = config_get('status_enum_workflow');
if (count($t_status_enum_workflow) < 1) {
# workflow not defined, use default enum
return true;
}
if ($p_bug_status == $p_wanted_status) {
# no change in state, allow the transition
return true;
}
# workflow defined - find allowed states
$t_allowed_states = $t_status_enum_workflow[$p_bug_status];
return MantisEnum::hasValue($t_allowed_states, $p_wanted_status);
}
示例6: testHasValue
/**
* Tests hasValue() method.
*/
public function testHasValue()
{
$this->assertEquals(true, MantisEnum::hasValue(MantisEnumTest::ACCESS_LEVELS_ENUM, 10));
$this->assertEquals(false, MantisEnum::hasValue(MantisEnumTest::ACCESS_LEVELS_ENUM, 5));
$this->assertEquals(false, MantisEnum::hasValue(MantisEnumTest::EMPTY_ENUM, 10));
}
示例7: html_get_status_css_class
/**
* get the css class name for the given status, user and project
* @param integer $p_status An enumeration value.
* @param integer $p_user A valid user identifier.
* @param integer $p_project A valid project identifier.
* @return string
*
* @todo This does not work properly when displaying issues from a project other
* than then current one, if the other project has custom status or colors.
* This is due to the dynamic css for color coding (css/status_config.php).
* Build CSS including project or even user-specific colors ?
*/
function html_get_status_css_class($p_status, $p_user = null, $p_project = null)
{
$t_status_enum = config_get('status_enum_string', null, $p_user, $p_project);
if (MantisEnum::hasValue($t_status_enum, $p_status)) {
return 'status-' . $p_status . '-color';
} else {
return '';
}
}
示例8: get_status_option_list
/**
* Select the proper enumeration values for status based on workflow
* or the input parameter if workflows are not used
* @param integer $p_user_auth A user identifier.
* @param integer $p_current_value The current value.
* @param boolean $p_show_current Whether to show the current status.
* @param boolean $p_add_close Whether to add close option.
* @param integer $p_project_id A project identifier.
* @return array
*/
function get_status_option_list($p_user_auth = 0, $p_current_value = 0, $p_show_current = true, $p_add_close = false, $p_project_id = ALL_PROJECTS)
{
$t_config_var_value = config_get('status_enum_string', null, null, $p_project_id);
$t_enum_workflow = config_get('status_enum_workflow', null, null, $p_project_id);
if (count($t_enum_workflow) < 1 || !MantisEnum::hasValue($t_config_var_value, $p_current_value)) {
# workflow not defined, use default enumeration
$t_enum_values = MantisEnum::getValues($t_config_var_value);
} else {
# workflow defined - find allowed states
if (isset($t_enum_workflow[$p_current_value])) {
$t_enum_values = MantisEnum::getValues($t_enum_workflow[$p_current_value]);
} else {
# workflow was not set for this status, this shouldn't happen
# caller should be able to handle empty list
$t_enum_values = array();
}
}
$t_enum_list = array();
foreach ($t_enum_values as $t_enum_value) {
if (($p_show_current || $p_current_value != $t_enum_value) && access_compare_level($p_user_auth, access_get_status_threshold($t_enum_value, $p_project_id))) {
$t_enum_list[$t_enum_value] = get_enum_element('status', $t_enum_value);
}
}
if ($p_show_current) {
$t_enum_list[$p_current_value] = get_enum_element('status', $p_current_value);
}
if ($p_add_close && access_compare_level($p_current_value, config_get('bug_resolved_status_threshold', null, null, $p_project_id))) {
$t_closed = config_get('bug_closed_status_threshold', null, null, $p_project_id);
if ($p_show_current || $p_current_value != $t_closed) {
$t_enum_list[$t_closed] = get_enum_element('status', $t_closed);
}
}
return $t_enum_list;
}