本文整理汇总了PHP中MantisEnum::getValues方法的典型用法代码示例。如果您正苦于以下问题:PHP MantisEnum::getValues方法的具体用法?PHP MantisEnum::getValues怎么用?PHP MantisEnum::getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MantisEnum
的用法示例。
在下文中一共展示了MantisEnum::getValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reminder_print_status_option_list
function reminder_print_status_option_list($p_name)
{
$t_enum_values = MantisEnum::getValues(config_get('status_enum_string'));
$t_selection = plugin_config_get($p_name);
echo '<select name="' . $p_name . '[]" multiple="multiple" size="' . count($t_enum_values) . '">';
foreach ($t_enum_values as $t_key) {
$t_elem2 = get_enum_element('status', $t_key);
echo '<option value="' . $t_key . '"';
reminder_check_selected($t_selection, $t_key);
echo '>' . $t_elem2 . '</option>';
}
echo '</select>';
}
示例2: get_capability_row
/**
* Return html for a row
* @param string $p_caption Caption.
* @param integer $p_access_level Access level.
* @return string
*/
function get_capability_row($p_caption, $p_access_level)
{
$t_access_levels = MantisEnum::getValues(config_get('access_levels_enum_string'));
$t_output = '<tr><td>' . string_display($p_caption) . '</td>';
foreach ($t_access_levels as $t_access_level) {
if ($t_access_level >= (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_status_option_list_plugin
function get_status_option_list_plugin($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);
$t_enum_values = MantisEnum::getValues($t_config_var_value);
$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;
}
示例4: mci_explode_to_objectref
/**
* Explode a configuration enumeration name into an array structure that can
* be safely converted into an ObjectRef structure.
*
* @param string $p_enumeration_name The name of the enumeration to convert
* @return Array The converted enumeration
*/
function mci_explode_to_objectref($p_enumeration_name)
{
$t_config_var_name = $p_enumeration_name . '_enum_string';
$t_config_var_value = config_get($t_config_var_name);
$t_translated_values = lang_get($t_config_var_name, mci_get_user_lang(auth_get_current_user_id()));
$t_enum_values = MantisEnum::getValues($t_config_var_value);
$t_result = array();
foreach ($t_enum_values as $t_key) {
$t_translated = MantisEnum::getLocalizedLabel($t_config_var_value, $t_translated_values, $t_key);
$t_result[] = array('id' => $t_key, 'name' => $t_translated);
}
return $t_result;
}
示例5: get_capability_row_for_email
/**
* HTML for Row
*
* @param string $p_caption Caption.
* @param string $p_message_type Message type.
* @return void
*/
function get_capability_row_for_email($p_caption, $p_message_type)
{
$t_access_levels = MantisEnum::getValues(config_get('access_levels_enum_string'));
echo '<tr><td>' . string_display($p_caption) . '</td>' . "\n";
echo ' <td' . color_notify_flag($p_message_type, 'reporter') . '>' . show_notify_flag($p_message_type, 'reporter') . '</td>' . "\n";
echo ' <td' . color_notify_flag($p_message_type, 'handler') . '>' . show_notify_flag($p_message_type, 'handler') . '</td>' . "\n";
echo ' <td' . color_notify_flag($p_message_type, 'monitor') . '>' . show_notify_flag($p_message_type, 'monitor') . '</td>' . "\n";
echo ' <td' . color_notify_flag($p_message_type, 'bugnotes') . '>' . show_notify_flag($p_message_type, 'bugnotes') . '</td>' . "\n";
echo ' <td' . color_notify_flag($p_message_type, 'category') . '>' . show_notify_flag($p_message_type, 'category') . '</td>' . "\n";
foreach ($t_access_levels as $t_access_level) {
echo ' <td' . color_threshold_flag($t_access_level, $p_message_type) . '>' . show_notify_threshold($t_access_level, $p_message_type) . '</td>' . "\n";
}
echo '</tr>' . "\n";
}
示例6: section_begin
/**
* section header
* @param string $p_section_name Section name.
* @return void
*/
function section_begin($p_section_name)
{
$t_enum_statuses = MantisEnum::getValues(config_get('status_enum_string'));
echo '<div class="form-container">' . "\n";
echo '<h2>' . $p_section_name . '</h2>' . "\n";
echo "\t<table>\n";
echo "\t\t<thead>\n";
echo "\t\t" . '<tr class="row-category2">' . "\n";
echo "\t\t\t" . '<th class="form-title width30" rowspan="2">' . lang_get('current_status') . '</th>' . "\n";
echo "\t\t\t" . '<th class="form-title" style="text-align:center" colspan="' . (count($t_enum_statuses) + 1) . '">' . lang_get('next_status') . '</th>';
echo "\n\t\t" . '</tr>' . "\n";
echo "\t\t" . '<tr class="row-category2">' . "\n";
foreach ($t_enum_statuses as $t_status) {
echo "\t\t\t" . '<th class="form-title" style="text-align:center"> ' . string_no_break(MantisEnum::getLabel(lang_get('status_enum_string'), $t_status)) . ' </th>' . "\n";
}
echo "\t\t\t" . '<th class="form-title" style="text-align:center">' . lang_get('custom_field_default_value') . '</th>' . "\n";
echo "\t\t" . '</tr>' . "\n";
echo "\t\t</thead>\n";
echo "\t\t<tbody>\n";
}
示例7: summary_print_reporter_effectiveness
/**
* Print reporter effectiveness report
*
* @param string $p_severity_enum_string Severity enumeration string.
* @param string $p_resolution_enum_string Resolution enumeration string.
* @return void
*/
function summary_print_reporter_effectiveness($p_severity_enum_string, $p_resolution_enum_string)
{
$t_reporter_summary_limit = config_get('reporter_summary_limit');
$t_project_id = helper_get_current_project();
$t_severity_multipliers = config_get('severity_multipliers');
$t_resolution_multipliers = config_get('resolution_multipliers');
# Get the severity values to use
$c_sev_s = MantisEnum::getValues($p_severity_enum_string);
$t_enum_sev_count = count($c_sev_s);
# Get the resolution values to use
$c_res_s = MantisEnum::getValues($p_resolution_enum_string);
# Checking if it's a per project statistic or all projects
$t_specific_where = helper_project_specific_where($t_project_id);
if (' 1<>1' == $t_specific_where) {
return;
}
# Get all of the bugs and split them up into an array
$t_query = 'SELECT COUNT(id) as bugcount, reporter_id, resolution, severity
FROM {bug}
WHERE ' . $t_specific_where . '
GROUP BY reporter_id, resolution, severity';
$t_result = db_query($t_query);
$t_reporter_ressev_arr = array();
$t_reporter_bugcount_arr = array();
$t_arr = db_fetch_array($t_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['bugcount'];
$t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']]['total'] += $t_arr['bugcount'];
$t_reporter_bugcount_arr[$t_arr['reporter_id']] += $t_arr['bugcount'];
$t_arr = db_fetch_array($t_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];
echo '<tr>';
$t_row_count++;
echo '<td>';
echo string_display_line(user_get_name($t_reporter_id));
echo '</td>';
$t_total_severity = 0;
$t_total_errors = 0;
for ($j = 0; $j < $t_enum_sev_count; $j++) {
if (!isset($t_arr2[$c_sev_s[$j]])) {
continue;
}
$t_sev_bug_count = $t_arr2[$c_sev_s[$j]]['total'];
$t_sev_mult = 1;
if ($t_severity_multipliers[$c_sev_s[$j]]) {
$t_sev_mult = $t_severity_multipliers[$c_sev_s[$j]];
}
if ($t_sev_bug_count > 0) {
$t_total_severity += $t_sev_bug_count * $t_sev_mult;
}
foreach ($t_resolution_multipliers as $t_res => $t_res_mult) {
if (isset($t_arr2[$c_sev_s[$j]][$t_res])) {
$t_total_errors += $t_sev_mult * $t_res_mult;
}
}
}
echo '<td class="right">' . $t_total_severity . '</td>';
echo '<td class="right">' . $t_total_errors . '</td>';
printf('<td class="right">%d</td>', $t_total_severity - $t_total_errors);
echo '</tr>';
}
}
}
示例8: summary_print_reporter_resolution
</thead>
<?php
summary_print_reporter_resolution(config_get('resolution_enum_string'));
?>
</table>
<!-- DEVELOPER BY RESOLUTION -->
<table>
<thead>
<tr class="row-category2">
<th><?php
echo lang_get('developer_by_resolution');
?>
</th>
<?php
$t_resolutions = MantisEnum::getValues(config_get('resolution_enum_string'));
foreach ($t_resolutions as $t_resolution) {
echo '<td class="right">', get_enum_element('resolution', $t_resolution), "</td>\n";
}
echo '<td class="right">', lang_get('percentage_fixed'), "</td>\n";
?>
</tr>
</thead>
<?php
summary_print_developer_resolution(config_get('resolution_enum_string'));
?>
</table>
</div>
</div>
示例9: html_status_percentage_legend
/**
* Print the legend for the status percentage
* @return void
*/
function html_status_percentage_legend()
{
$t_status_percents = get_percentage_by_status();
$t_status_enum_string = config_get('status_enum_string');
$t_enum_values = MantisEnum::getValues($t_status_enum_string);
$t_enum_count = count($t_enum_values);
$t_bug_count = array_sum($t_status_percents);
if ($t_bug_count > 0) {
echo '<br />';
echo '<table class="width100" cellspacing="1">';
echo '<tr>';
echo '<td class="form-title" colspan="' . $t_enum_count . '">' . lang_get('issue_status_percentage') . '</td>';
echo '</tr>';
echo '<tr>';
foreach ($t_enum_values as $t_status) {
$t_percent = isset($t_status_percents[$t_status]) ? $t_status_percents[$t_status] : 0;
if ($t_percent > 0) {
$t_class = html_get_status_css_class($t_status);
echo '<td class="small-caption-center ' . $t_class . ' ' . str_replace('color', 'percentage', $t_class) . '">' . $t_percent . '%</td>';
}
}
echo '</tr>';
echo '</table>';
}
}
示例10: html_status_percentage_legend
/**
* Print the legend for the status percentage
* @return null
*/
function html_status_percentage_legend()
{
$t_mantis_bug_table = db_get_table('mantis_bug_table');
$t_project_id = helper_get_current_project();
$t_user_id = auth_get_current_user_id();
# checking if it's a per project statistic or all projects
$t_specific_where = helper_project_specific_where($t_project_id, $t_user_id);
$query = "SELECT status, COUNT(*) AS number\n\t\t\t\tFROM {$t_mantis_bug_table}\n\t\t\t\tWHERE {$t_specific_where}";
if (!access_has_project_level(config_get('private_bug_threshold'))) {
$query .= ' AND view_state < ' . VS_PRIVATE;
}
$query .= ' GROUP BY status';
$result = db_query_bound($query);
$t_bug_count = 0;
$t_status_count_array = array();
while ($row = db_fetch_array($result)) {
$t_status_count_array[$row['status']] = $row['number'];
$t_bug_count += $row['number'];
}
$t_enum_values = MantisEnum::getValues(config_get('status_enum_string'));
$enum_count = count($t_enum_values);
if ($t_bug_count > 0) {
echo '<br />';
echo '<table class="width100" cellspacing="1">';
echo '<tr>';
echo '<td class="form-title" colspan="' . $enum_count . '">' . lang_get('issue_status_percentage') . '</td>';
echo '</tr>';
echo '<tr>';
foreach ($t_enum_values as $t_status) {
$t_color = get_status_color($t_status);
if (!isset($t_status_count_array[$t_status])) {
$t_status_count_array[$t_status] = 0;
}
$width = round($t_status_count_array[$t_status] / $t_bug_count * 100);
if ($width > 0) {
echo "<td class=\"small-caption-center\" width=\"{$width}%\" bgcolor=\"{$t_color}\">{$width}%</td>";
}
}
echo '</tr>';
echo '</table>';
}
}
示例11: log_event
log_event(LOG_FILTERING, 'view_all_set.php: View state (simple/advanced)');
$t_setting_arr['_view_type'] = $f_view_type;
break;
# does nothing. catch all case
# does nothing. catch all case
default:
log_event(LOG_FILTERING, 'view_all_set.php: default - do nothing');
break;
}
$tc_setting_arr = filter_ensure_valid_filter($t_setting_arr);
/**
* Remove any statuses that should be excluded by the hide_status field
*/
if ($f_view_type == "advanced") {
if ($tc_setting_arr[FILTER_PROPERTY_HIDE_STATUS][0] > 0) {
$t_statuses = MantisEnum::getValues(config_get('status_enum_string'));
foreach ($t_statuses as $t_key => $t_val) {
if ($t_val < $tc_setting_arr[FILTER_PROPERTY_HIDE_STATUS][0]) {
$t_keep_statuses[$t_key] = $t_val;
}
}
$tc_setting_arr[FILTER_PROPERTY_STATUS] = $t_keep_statuses;
}
}
/**
* If a status is selected in the status and the hide status field, remove it from
* hide status
*/
if ($f_view_type == "simple" && $tc_setting_arr[FILTER_PROPERTY_HIDE_STATUS][0] > 0) {
foreach ($tc_setting_arr[FILTER_PROPERTY_STATUS] as $t_key => $t_val) {
if ($tc_setting_arr[FILTER_PROPERTY_STATUS][$t_key] == $tc_setting_arr[FILTER_PROPERTY_HIDE_STATUS][0]) {
示例12: testGetValues
/**
* Tests getValues() method.
*/
public function testGetValues()
{
$this->assertEquals(array(10, 25, 40, 55, 70, 90), MantisEnum::getValues(MantisEnumTest::ACCESS_LEVELS_ENUM, 10));
$this->assertEquals(array(), MantisEnum::getValues(MantisEnumTest::EMPTY_ENUM, 10));
}
示例13: section_begin
function section_begin($p_section_name)
{
$t_enum_statuses = MantisEnum::getValues(config_get('status_enum_string'));
echo '<table class="width100">';
echo '<tr><td class="form-title-caps" colspan="' . (count($t_enum_statuses) + 2) . '">' . $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_statuses) + 1) . '">' . lang_get('next_status') . '</td></tr>';
echo "\n<tr>";
foreach ($t_enum_statuses as $t_status) {
echo '<td class="form-title" style="text-align:center"> ' . string_no_break(MantisEnum::getLabel(lang_get('status_enum_string'), $t_status)) . ' </td>';
}
echo '<td class="form-title" style="text-align:center">' . lang_get('custom_field_default_value') . '</td>';
echo '</tr>' . "\n";
}
示例14: filter_get_bug_rows
//.........这里部分代码省略.........
foreach ($t_clauses as $t_clause) {
$t_where_tmp[] = db_param();
$t_where_params[] = $t_clause;
}
array_push($t_where_clauses, "( {$t_bug_table}.category_id in ( SELECT id FROM {$t_category_table} WHERE name in (" . implode(', ', $t_where_tmp) . ") ) )");
} else {
$t_where_params[] = $t_clauses[0];
array_push($t_where_clauses, "( {$t_bug_table}.category_id in ( SELECT id FROM {$t_category_table} WHERE name=" . db_param() . ") )");
}
}
# severity
if (!filter_field_is_any($t_filter[FILTER_PROPERTY_SEVERITY_ID])) {
$t_clauses = array();
foreach ($t_filter[FILTER_PROPERTY_SEVERITY_ID] 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)) {
$t_where_tmp = array();
foreach ($t_clauses as $t_clause) {
$t_where_tmp[] = db_param();
$t_where_params[] = $t_clause;
}
array_push($t_where_clauses, "( {$t_bug_table}.severity in (" . implode(', ', $t_where_tmp) . ") )");
} else {
$t_where_params[] = $t_clauses[0];
array_push($t_where_clauses, "( {$t_bug_table}.severity=" . db_param() . " )");
}
}
# 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_desired_statuses = array();
$t_available_statuses = MantisEnum::getValues(config_get('status_enum_string'));
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[FILTER_PROPERTY_STATUS_ID][0];
$t_this_hide_status = $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID][0];
if (filter_field_is_any($t_this_status)) {
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
if (filter_field_is_any($t_filter[FILTER_PROPERTY_STATUS_ID])) {
$t_desired_statuses = array();
} else {
foreach ($t_filter[FILTER_PROPERTY_STATUS_ID] as $t_this_status) {
$t_desired_statuses[] = $t_this_status;
}
}
}
if (count($t_desired_statuses) > 0) {
$t_clauses = array();
foreach ($t_desired_statuses as $t_filter_member) {
$c_show_status = db_prepare_int($t_filter_member);
array_push($t_clauses, $c_show_status);
}
if (1 < count($t_clauses)) {
$t_where_tmp = array();
示例15: filter_get_bug_rows
//.........这里部分代码省略.........
foreach ($t_clauses as $t_clause) {
$t_where_tmp[] = db_param();
$t_where_params[] = $t_clause;
}
array_push($t_where_clauses, '( {bug}.category_id in ( SELECT id FROM {category} WHERE name in (' . implode(', ', $t_where_tmp) . ') ) )');
} else {
$t_where_params[] = $t_clauses[0];
array_push($t_where_clauses, '( {bug}.category_id in ( SELECT id FROM {category} WHERE name=' . db_param() . ') )');
}
}
# severity
if (!filter_field_is_any($t_filter[FILTER_PROPERTY_SEVERITY])) {
$t_clauses = array();
foreach ($t_filter[FILTER_PROPERTY_SEVERITY] as $t_filter_member) {
$c_show_severity = (int) $t_filter_member;
array_push($t_clauses, $c_show_severity);
}
if (1 < count($t_clauses)) {
$t_where_tmp = array();
foreach ($t_clauses as $t_clause) {
$t_where_tmp[] = db_param();
$t_where_params[] = $t_clause;
}
array_push($t_where_clauses, '( {bug}.severity in (' . implode(', ', $t_where_tmp) . ') )');
} else {
$t_where_params[] = $t_clauses[0];
array_push($t_where_clauses, '( {bug}.severity=' . db_param() . ' )');
}
}
# 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_desired_statuses = array();
$t_available_statuses = MantisEnum::getValues(config_get('status_enum_string'));
if ('simple' == $t_filter['_view_type']) {
# simple filtering: if showing any, restrict by the hide status value, otherwise ignore the hide
$t_this_status = $t_filter[FILTER_PROPERTY_STATUS][0];
$t_this_hide_status = isset($t_filter[FILTER_PROPERTY_HIDE_STATUS][0]) ? $t_filter[FILTER_PROPERTY_HIDE_STATUS][0] : null;
if (filter_field_is_any($t_this_status)) {
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
if (filter_field_is_any($t_filter[FILTER_PROPERTY_STATUS])) {
$t_desired_statuses = array();
} else {
foreach ($t_filter[FILTER_PROPERTY_STATUS] as $t_this_status) {
$t_desired_statuses[] = $t_this_status;
}
}
}
if (count($t_desired_statuses) > 0) {
$t_clauses = array();
foreach ($t_desired_statuses as $t_filter_member) {
$c_show_status = (int) $t_filter_member;
array_push($t_clauses, $c_show_status);
}
if (1 < count($t_clauses)) {
$t_where_tmp = array();
foreach ($t_clauses as $t_clause) {