本文整理汇总了PHP中explode_enum_arr函数的典型用法代码示例。如果您正苦于以下问题:PHP explode_enum_arr函数的具体用法?PHP explode_enum_arr怎么用?PHP explode_enum_arr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了explode_enum_arr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_enum_to_string
function get_enum_to_string($p_enum_string, $p_num)
{
$t_arr = explode_enum_string($p_enum_string);
$enum_count = count($t_arr);
for ($i = 0; $i < $enum_count; $i++) {
$t_s = explode_enum_arr($t_arr[$i]);
if ($t_s[0] == $p_num) {
return $t_s[1];
}
}
return '@' . $p_num . '@';
}
示例2: get_capability_row
function get_capability_row($p_caption, $p_access_level)
{
$t_access_levels = explode_enum_string(config_get('access_levels_enum_string'));
$t_output = '<tr ' . helper_alternate_class() . '><td>' . string_display($p_caption) . '</td>';
foreach ($t_access_levels as $t_access_level) {
$t_entry_array = explode_enum_arr($t_access_level);
if ((int) $t_entry_array[0] >= (int) $p_access_level) {
$t_value = '<img src="images/ok.gif" width="20" height="15" alt="X" title="X" />';
} else {
$t_value = ' ';
}
$t_output .= '<td class="center">' . $t_value . '</td>';
}
$t_output .= '</tr>' . "\n";
return $t_output;
}
示例3: get_enum_element
function get_enum_element($p_enum_name, $p_val)
{
$config_var = config_get($p_enum_name . '_enum_string');
$string_var = lang_get($p_enum_name . '_enum_string');
# use the global enum string to search
$t_arr = explode_enum_string($config_var);
$t_arr_count = count($t_arr);
for ($i = 0; $i < $t_arr_count; $i++) {
$elem_arr = explode_enum_arr($t_arr[$i]);
if ($elem_arr[0] == $p_val) {
# now get the appropriate translation
return get_enum_to_string($string_var, $p_val);
}
}
return '@' . $p_val . '@';
}
示例4: get_string_to_enum
function get_string_to_enum($enum_string, $string)
{
/**
* Gets Mantis's integer for the given string
*
* This is the inverse of Mantis's get_enum_to_string(). If the string is
* not found in the enum string, we return -1.
*/
if (preg_match('/^@.*@$/', $string)) {
return substr($string, 1, -1);
}
$enum_array = explode_enum_string($enum_string);
foreach ($enum_array as $pair) {
$t_s = explode_enum_arr($pair);
if ($t_s[1] == $string) {
return $t_s[0];
}
}
return -1;
}
示例5: create_bug_enum_summary
function create_bug_enum_summary($p_enum_string, $p_enum)
{
$t_project_id = helper_get_current_project();
$t_bug_table = config_get('mantis_bug_table');
$t_user_id = auth_get_current_user_id();
$specific_where = " AND " . helper_project_specific_where($t_project_id, $t_user_id);
$t_arr = explode_enum_string($p_enum_string);
$enum_count = count($t_arr);
for ($i = 0; $i < $enum_count; $i++) {
$t_s = explode_enum_arr($t_arr[$i]);
$c_s[0] = addslashes($t_s[0]);
$t_key = get_enum_to_string($p_enum_string, $t_s[0]);
$query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}='{$c_s['0']}' {$specific_where}";
$result = db_query($query);
$t_metrics[$t_key] = db_result($result, 0);
}
# end for
return $t_metrics;
}
示例6: lang_get
<?php
# DEVELOPER / RESOLUTION #
?>
<table class="width100" cellspacing="1">
<tr>
<td class="form-title" colspan="1">
<?php
echo lang_get('developer_by_resolution');
?>
</td>
<?php
$t_arr = explode_enum_string(config_get('resolution_enum_string'));
$enum_count = count($t_arr);
for ($i = 0; $i < $enum_count; $i++) {
print '<td>';
$t_s = explode_enum_arr($t_arr[$i]);
$c_s[0] = db_prepare_string($t_s[0]);
echo get_enum_element('resolution', $c_s[0]);
print '</td>';
}
print '<td>';
print lang_get('percentage_fixed');
print '</td>';
?>
</tr>
<?php
summary_print_developer_resolution(config_get('resolution_enum_string'));
?>
</table>
</td>
</tr>
示例7: get_capability_row_for_email
function get_capability_row_for_email($p_caption, $p_message_type)
{
$t_access_levels = explode_enum_string(config_get('access_levels_enum_string'));
echo '<tr ' . helper_alternate_class() . '><td>' . string_display($p_caption) . '</td>';
echo '<td class="center"' . colour_notify_flag($p_message_type, 'reporter') . '>' . show_notify_flag($p_message_type, 'reporter') . '</td>';
echo '<td class="center"' . colour_notify_flag($p_message_type, 'handler') . '>' . show_notify_flag($p_message_type, 'handler') . '</td>';
echo '<td class="center"' . colour_notify_flag($p_message_type, 'monitor') . '>' . show_notify_flag($p_message_type, 'monitor') . '</td>';
echo '<td class="center"' . colour_notify_flag($p_message_type, 'bugnotes') . '>' . show_notify_flag($p_message_type, 'bugnotes') . '</td>';
foreach ($t_access_levels as $t_access_level) {
$t_entry_array = explode_enum_arr($t_access_level);
echo '<td class="center"' . colour_threshold_flag((int) $t_entry_array[0], $p_message_type) . '>' . show_notify_threshold((int) $t_entry_array[0], $p_message_type) . '</td>';
}
echo '</tr>' . "\n";
}
示例8: get_enum_element
function get_enum_element($p_enum_name, $p_val)
{
$g_var = "g_" . $p_enum_name . "_enum_string";
$s_var = "s_" . $p_enum_name . "_enum_string";
global ${$g_var}, ${$s_var};
# use the global enum string to search
$t_arr = explode_enum_string(${$g_var});
$t_arr_count = count($t_arr);
for ($i = 0; $i < $t_arr_count; $i++) {
$elem_arr = explode_enum_arr($t_arr[$i]);
if ($elem_arr[0] == $p_val) {
# now get the appropriate translation
return get_enum_to_string(${$s_var}, $p_val);
}
}
return "@null@";
}
示例9: filter_get_bug_rows
//.........这里部分代码省略.........
} else {
array_push($t_where_clauses, "( {$t_bug_table}.category={$t_clauses['0']} )");
}
}
# severity
$t_any_found = false;
foreach ($t_filter['show_severity'] as $t_filter_member) {
if (META_FILTER_ANY == $t_filter_member || 0 === $t_filter_member) {
$t_any_found = true;
}
}
if (count($t_filter['show_severity']) == 0) {
$t_any_found = true;
}
if (!$t_any_found) {
$t_clauses = array();
foreach ($t_filter['show_severity'] as $t_filter_member) {
$c_show_severity = db_prepare_int($t_filter_member);
array_push($t_clauses, $c_show_severity);
}
if (1 < count($t_clauses)) {
array_push($t_where_clauses, "( {$t_bug_table}.severity in (" . implode(', ', $t_clauses) . ") )");
} else {
array_push($t_where_clauses, "( {$t_bug_table}.severity={$t_clauses['0']} )");
}
}
# show / hide status
# take a list of all available statuses then remove the ones that we want hidden, then make sure
# the ones we want shown are still available
$t_status_arr = explode_enum_string(config_get('status_enum_string'));
$t_available_statuses = array();
$t_desired_statuses = array();
foreach ($t_status_arr as $t_this_status) {
$t_this_status_arr = explode_enum_arr($t_this_status);
$t_available_statuses[] = $t_this_status_arr[0];
}
if ('simple' == $t_filter['_view_type']) {
# simple filtering: if showing any, restrict by the hide status value, otherwise ignore the hide
$t_any_found = false;
$t_this_status = $t_filter['show_status'][0];
$t_this_hide_status = $t_filter['hide_status'][0];
if (META_FILTER_ANY == $t_this_status || is_blank($t_this_status) || 0 === $t_this_status) {
$t_any_found = true;
}
if ($t_any_found) {
foreach ($t_available_statuses as $t_this_available_status) {
if ($t_this_hide_status > $t_this_available_status) {
$t_desired_statuses[] = $t_this_available_status;
}
}
} else {
$t_desired_statuses[] = $t_this_status;
}
} else {
# advanced filtering: ignore the hide
$t_any_found = false;
foreach ($t_filter['show_status'] as $t_this_status) {
$t_desired_statuses[] = $t_this_status;
if (META_FILTER_ANY == $t_this_status || is_blank($t_this_status) || 0 === $t_this_status) {
$t_any_found = true;
}
}
if ($t_any_found) {
$t_desired_statuses = array();
}
}
示例10: print_project_user_option_list
function print_project_user_option_list($p_val)
{
global $g_mantis_project_table, $g_access_levels_enum_string;
$t_arr = explode_enum_string($g_access_levels_enum_string);
$enum_count = count($t_arr);
for ($i = 0; $i < $enum_count; $i++) {
$t_elem = explode_enum_arr($t_arr[$i]);
if ($t_elem[0] >= ADMINISTRATOR) {
continue;
}
$t_access_level = get_enum_element("access_levels", $t_elem[0]);
if ($p_val == $t_elem[0]) {
print "<option value=\"{$t_elem['0']}\" SELECTED>{$t_access_level}</option>";
} else {
print "<option value=\"{$t_elem['0']}\">{$t_access_level}</option>";
}
}
# end for
}
示例11: summary_print_reporter_effectiveness
function summary_print_reporter_effectiveness($p_severity_enum_string, $p_resolution_enum_string)
{
$t_mantis_bug_table = config_get('mantis_bug_table');
$t_mantis_user_table = config_get('mantis_user_table');
$t_reporter_summary_limit = config_get('reporter_summary_limit');
$t_project_id = helper_get_current_project();
$t_user_id = auth_get_current_user_id();
# These are our overall "values" for severities and non-bug results
$t_severity_multiplier[FEATURE] = 1;
$t_severity_multiplier[TRIVIAL] = 2;
$t_severity_multiplier[TEXT] = 3;
$t_severity_multiplier[TWEAK] = 2;
$t_severity_multiplier[MINOR] = 5;
$t_severity_multiplier[MAJOR] = 8;
$t_severity_multiplier[CRASH] = 8;
$t_severity_multiplier[BLOCK] = 10;
$t_severity_multiplier['average'] = 5;
$t_notbug_multiplier[UNABLE_TO_DUPLICATE] = 2;
$t_notbug_multiplier[DUPLICATE] = 3;
$t_notbug_multiplier[NOT_A_BUG] = 5;
$t_sev_arr = explode_enum_string($p_severity_enum_string);
$enum_sev_count = count($t_sev_arr);
$c_sev_s = array();
for ($i = 0; $i < $enum_sev_count; $i++) {
$t_sev_s = explode_enum_arr($t_sev_arr[$i]);
$c_sev_s[$i] = db_prepare_string($t_sev_s[0]);
}
$t_res_arr = explode_enum_string($p_resolution_enum_string);
$enum_res_count = count($t_res_arr);
$c_res_s = array();
for ($i = 0; $i < $enum_res_count; $i++) {
$t_res_s = explode_enum_arr($t_res_arr[$i]);
$c_res_s[$i] = db_prepare_string($t_res_s[0]);
}
# Checking if it's a per project statistic or all projects
$specific_where = helper_project_specific_where($t_project_id);
if (' 1<>1' == $specific_where) {
return;
}
# Get all of the bugs and split them up into an array
$query = "SELECT COUNT(id) as count, reporter_id, resolution, severity\n\t\t\t\tFROM {$t_mantis_bug_table}\n\t\t\t\tWHERE {$specific_where}\n\t\t\t\tGROUP BY reporter_id, resolution, severity";
$result = db_query($query);
$t_reporter_ressev_arr = array();
$t_reporter_bugcount_arr = array();
$t_arr = db_fetch_array($result);
while ($t_arr) {
if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']])) {
$t_reporter_ressev_arr[$t_arr['reporter_id']] = array();
$t_reporter_bugcount_arr[$t_arr['reporter_id']] = 0;
}
if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']])) {
$t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']] = array();
$t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']]['total'] = 0;
}
if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']])) {
$t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']] = 0;
}
$t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']] += $t_arr['count'];
$t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']]['total'] += $t_arr['count'];
$t_reporter_bugcount_arr[$t_arr['reporter_id']] += $t_arr['count'];
$t_arr = db_fetch_array($result);
}
# Sort our total bug count array so that the reporters with the highest number of bugs are listed first,
arsort($t_reporter_bugcount_arr);
$t_row_count = 0;
# We now have a multi dimensional array of users, resolutions and severities, with the
# value of each resolution and severity for each user
foreach ($t_reporter_bugcount_arr as $t_reporter_id => $t_total_user_bugs) {
# Limit the number of reporters listed
if ($t_row_count > $t_reporter_summary_limit) {
break;
}
# Only print reporters who have reported at least one bug. This helps
# prevent divide by zeroes, showing reporters not on this project, and showing
# users that aren't actually reporters...
if ($t_total_user_bugs > 0) {
$t_arr2 = $t_reporter_ressev_arr[$t_reporter_id];
print '<tr ' . helper_alternate_class($t_row_count) . '>';
$t_row_count++;
print '<td>';
print user_get_name($t_reporter_id);
print '</td>';
$t_total_severity = 0;
$t_total_errors = 0;
for ($j = 0; $j < $enum_sev_count; $j++) {
if (!isset($t_arr2[$c_sev_s[$j]])) {
continue;
}
$sev_bug_count = $t_arr2[$c_sev_s[$j]]['total'];
$t_sev_mult = $t_severity_multiplier['average'];
if ($t_severity_multiplier[$c_sev_s[$j]]) {
$t_sev_mult = $t_severity_multiplier[$c_sev_s[$j]];
}
if ($sev_bug_count > 0) {
$t_total_severity += $sev_bug_count * $t_sev_mult;
}
# Calculate the "error value" of bugs reported
$t_notbug_res_arr = array(UNABLE_TO_DUPLICATE, DUPLICATE, NOT_A_BUG);
foreach ($t_notbug_res_arr as $t_notbug_res) {
if (isset($t_arr2[$c_sev_s[$j]][$t_notbug_res])) {
//.........这里部分代码省略.........
示例12: bug_check_workflow
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;
} else {
if ($p_bug_status == $p_wanted_status) {
# no change in state, allow the transition
return true;
} else {
# workflow defined - find allowed states
$t_allowed_states = $t_status_enum_workflow[$p_bug_status];
$t_arr = explode_enum_string($t_allowed_states);
$t_enum_count = count($t_arr);
for ($i = 0; $i < $t_enum_count; $i++) {
# check if wanted status is allowed
$t_elem = explode_enum_arr($t_arr[$i]);
if ($p_wanted_status == $t_elem[0]) {
return true;
}
}
# end for
}
}
return false;
}
示例13: print_project_access_levels_option_list
function print_project_access_levels_option_list($p_val, $p_project_id = null)
{
$t_current_user_access_level = access_get_project_level($p_project_id);
$t_access_levels_enum_string = config_get('access_levels_enum_string');
# Add [default access level] to add the user to a project
# with his default access level.
print "<option value=\"" . DEFAULT_ACCESS_LEVEL . "\"";
print ">[" . lang_get('default_access_level') . "]</option>";
$t_arr = explode_enum_string($t_access_levels_enum_string);
$enum_count = count($t_arr);
for ($i = 0; $i < $enum_count; $i++) {
$t_elem = explode_enum_arr($t_arr[$i]);
# a user must not be able to assign another user an access level that is higher than theirs.
if ($t_elem[0] > $t_current_user_access_level) {
continue;
}
$t_access_level = get_enum_element('access_levels', $t_elem[0]);
print "<option value=\"{$t_elem['0']}\"";
check_selected($p_val, $t_elem[0]);
print ">{$t_access_level}</option>";
}
# end for
}
示例14: filter_get_bug_rows
//.........这里部分代码省略.........
} else {
array_push($t_where_clauses, "( {$t_bug_table}.category={$t_clauses['0']} )");
}
}
# severity
$t_any_found = false;
foreach ($t_filter['show_severity'] as $t_filter_member) {
if (META_FILTER_ANY == $t_filter_member || 0 === $t_filter_member) {
$t_any_found = true;
}
}
if (count($t_filter['show_severity']) == 0) {
$t_any_found = true;
}
if (!$t_any_found) {
$t_clauses = array();
foreach ($t_filter['show_severity'] as $t_filter_member) {
$c_show_severity = db_prepare_int($t_filter_member);
array_push($t_clauses, $c_show_severity);
}
if (1 < count($t_clauses)) {
array_push($t_where_clauses, "( {$t_bug_table}.severity in (" . implode(', ', $t_clauses) . ") )");
} else {
array_push($t_where_clauses, "( {$t_bug_table}.severity={$t_clauses['0']} )");
}
}
# show / hide status
# take a list of all available statuses then remove the ones that we want hidden, then make sure
# the ones we want shown are still available
$t_status_arr = explode_enum_string(config_get('status_enum_string'));
$t_available_statuses = array();
$t_desired_statuses = array();
foreach ($t_status_arr as $t_this_status) {
$t_this_status_arr = explode_enum_arr($t_this_status);
$t_available_statuses[] = $t_this_status_arr[0];
}
if ('simple' == $t_filter['_view_type']) {
# simple filtering: if showing any, restrict by the hide status value, otherwise ignore the hide
$t_any_found = false;
$t_this_status = $t_filter['show_status'][0];
$t_this_hide_status = $t_filter['hide_status'][0];
if (META_FILTER_ANY == $t_this_status || is_blank($t_this_status) || 0 === $t_this_status) {
$t_any_found = true;
}
if ($t_any_found) {
foreach ($t_available_statuses as $t_this_available_status) {
if ($t_this_hide_status > $t_this_available_status) {
$t_desired_statuses[] = $t_this_available_status;
}
}
} else {
$t_desired_statuses[] = $t_this_status;
}
} else {
# advanced filtering: ignore the hide
$t_any_found = false;
foreach ($t_filter['show_status'] as $t_this_status) {
$t_desired_statuses[] = $t_this_status;
if (META_FILTER_ANY == $t_this_status || is_blank($t_this_status) || 0 === $t_this_status) {
$t_any_found = true;
}
}
if ($t_any_found) {
$t_desired_statuses = array();
}
}
示例15: section_begin
function section_begin($p_section_name)
{
$t_enum_status = explode_enum_string(config_get('status_enum_string'));
echo '<table class="width100">';
echo '<tr><td class="form-title" colspan="' . (count($t_enum_status) + 2) . '">' . strtoupper($p_section_name) . '</td></tr>' . "\n";
echo '<tr><td class="form-title" width="30%" rowspan="2">' . lang_get('current_status') . '</td>';
echo '<td class="form-title" style="text-align:center" colspan="' . (count($t_enum_status) + 1) . '">' . lang_get('next_status') . '</td></tr>';
echo "\n<tr></td>";
foreach ($t_enum_status as $t_status) {
$t_entry_array = explode_enum_arr($t_status);
echo '<td class="form-title" style="text-align:center"> ' . string_no_break(get_enum_to_string(lang_get('status_enum_string'), $t_entry_array[0])) . ' </td>';
}
echo '<td class="form-title" style="text-align:center">' . lang_get('custom_field_default_value') . '</td>';
echo '</tr>' . "\n";
}