本文整理汇总了PHP中MantisEnum类的典型用法代码示例。如果您正苦于以下问题:PHP MantisEnum类的具体用法?PHP MantisEnum怎么用?PHP MantisEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MantisEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: workflow_parse
/**
* Parse a workflow into a graph-like array of workflow transitions.
* @param array The workflow enumeration to parse.
* @return array The parsed workflow graph.
*/
function workflow_parse($p_enum_workflow)
{
$t_status_arr = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
if (count($p_enum_workflow) == 0) {
# workflow is not set, default it to all transitions
foreach ($t_status_arr as $t_status => $t_label) {
$t_temp_workflow = array();
foreach ($t_status_arr as $t_next => $t_next_label) {
if ($t_status != $t_next) {
$t_temp_workflow[] = $t_next . ':' . $t_next_label;
}
}
$p_enum_workflow[$t_status] = implode(',', $t_temp_workflow);
}
}
$t_entry = array();
$t_exit = array();
# prepopulate new bug state (bugs go from nothing to here)
$t_submit_status_array = config_get('bug_submit_status');
$t_new_label = MantisEnum::getLabel(lang_get('status_enum_string'), config_get('bug_submit_status'));
if (is_array($t_submit_status_array)) {
# @@@ (thraxisp) this is not implemented in bug_api.php
foreach ($t_submit_status_array as $t_access => $t_status) {
$t_entry[$t_status][0] = $t_new_label;
$t_exit[0][$t_status] = $t_new_label;
}
} else {
$t_status = $t_submit_status_array;
$t_entry[$t_status][0] = $t_new_label;
$t_exit[0][$t_status] = $t_new_label;
}
# add user defined arcs and implicit reopen arcs
$t_reopen = config_get('bug_reopen_status');
$t_reopen_label = MantisEnum::getLabel(lang_get('resolution_enum_string'), config_get('bug_reopen_resolution'));
$t_resolved_status = config_get('bug_resolved_status_threshold');
$t_default = array();
foreach ($t_status_arr as $t_status => $t_status_label) {
if (isset($p_enum_workflow[$t_status])) {
$t_next_arr = MantisEnum::getAssocArrayIndexedByValues($p_enum_workflow[$t_status]);
foreach ($t_next_arr as $t_next => $t_next_label) {
if (!isset($t_default[$t_status])) {
$t_default[$t_status] = $t_next;
}
$t_exit[$t_status][$t_next] = '';
$t_entry[$t_next][$t_status] = '';
}
} else {
$t_exit[$t_status] = array();
}
if ($t_status >= $t_resolved_status) {
$t_exit[$t_status][$t_reopen] = $t_reopen_label;
$t_entry[$t_reopen][$t_status] = $t_reopen_label;
}
if (!isset($t_entry[$t_status])) {
$t_entry[$t_status] = array();
}
}
return array('entry' => $t_entry, 'exit' => $t_exit, 'default' => $t_default);
}
示例2: 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>';
}
示例3: print_thead
/**
* Print table head
* @param $status_cols
*/
function print_thead($status_cols)
{
echo '<thead>';
echo '<tr>';
echo '<th></th>';
foreach ($status_cols as $status_col) {
echo '<th bgcolor="' . get_status_color($status_col, null, null) . '" class="center">';
$assocArray = MantisEnum::getAssocArrayIndexedByValues(lang_get('status_enum_string'));
echo $assocArray[$status_col];
echo '</th>';
}
echo '</tr>';
echo '</thead>';
}
示例4: 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;
}
示例5: set_capability_row
function set_capability_row( $p_threshold, $p_all_projects_only=false ) {
global $t_access, $t_project;
if ( ( $t_access >= config_get_access( $p_threshold ) )
&& ( ( ALL_PROJECTS == $t_project ) || !$p_all_projects_only ) ) {
$f_threshold = gpc_get_int_array( 'flag_thres_' . $p_threshold, array() );
$f_access = gpc_get_int( 'access_' . $p_threshold );
# @@debug @@ echo "<br />for $p_threshold "; var_dump($f_threshold, $f_access); echo '<br />';
$t_access_levels = MantisEnum::getAssocArrayIndexedByValues( config_get( 'access_levels_enum_string' ) );
ksort( $t_access_levels );
reset( $t_access_levels );
$t_lower_threshold = NOBODY;
$t_array_threshold = array();
foreach( $t_access_levels as $t_access_level => $t_level_name ) {
if ( in_array( $t_access_level, $f_threshold ) ) {
if ( NOBODY == $t_lower_threshold ) {
$t_lower_threshold = $t_access_level;
}
$t_array_threshold[] = $t_access_level;
} else {
if ( NOBODY <> $t_lower_threshold ) {
$t_lower_threshold = -1;
}
}
# @@debug @@ var_dump($$t_access_level, $t_lower_threshold, $t_array_threshold); echo '<br />';
}
$t_existing_threshold = config_get( $p_threshold );
$t_existing_access = config_get_access( $p_threshold );
if ( -1 == $t_lower_threshold ) {
if ( ( $t_existing_threshold != $t_array_threshold )
|| ( $t_existing_access != $f_access ) ) {
config_set( $p_threshold, $t_array_threshold, NO_USER, $t_project, $f_access );
}
} else {
if ( ( $t_existing_threshold != $t_lower_threshold )
|| ( $t_existing_access != $f_access ) ) {
config_set( $p_threshold, $t_lower_threshold, NO_USER, $t_project, $f_access );
}
}
}
}
示例6: 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;
}
示例7: renderLists
function renderLists()
{
$content = '';
$status_codes = config_get('status_enum_string');
$t_status_array = MantisEnum::getAssocArrayIndexedByValues($status_codes);
foreach ($t_status_array as $status => $statusCode) {
if ($statusCode != "backlog" && $statusCode != "closed") {
$issues = $this->renderIssues($status);
$statusName = string_display_line(get_enum_element('status', $status));
$content .= '<div class="column">
<div class="inside"
style="background-color: ' . get_status_color($status) . '"
id="' . $status . '">
<h5 title="' . $status . '">' . $statusName . ' (' . sizeof($issues) . ')</h5>';
$content .= implode("\n", $issues);
$content .= '</div>';
// inside
$content .= '</div>';
// column
}
}
return $content;
}
示例8: getBugsInfoJSONPResponse
function getBugsInfoJSONPResponse($bugsString)
{
$t_bug_table = db_get_table('mantis_bug_table');
$t_statuses = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
$statuses = '';
foreach ($t_statuses as $t_state => $t_label) {
$statuses .= '"' . $t_label . '": "' . get_status_color($t_state) . '", ';
}
$bugs_list = array_unique(str_split($bugsString, 7));
$bugs_list = "'" . implode("', '", $bugs_list) . "'";
$query = "SELECT id, status, summary\r\n\t\t\t FROM `" . $t_bug_table . "`\r\n\t\t\t WHERE id IN (" . $bugs_list . ")\r\n\t\t\t ORDER BY FIELD(id, " . $bugs_list . ")";
$results = db_query_bound($query);
if ($results) {
$json = '';
while ($row = db_fetch_array($results)) {
$id = $row['id'];
$statusId = $row['status'];
$summary = $row['summary'];
$json .= '"' . $id . '": { "status": "' . $t_statuses[$statusId] . '", "summary": "' . htmlspecialchars($summary) . '" }, ';
}
}
header("Content-Type: application/javascript; charset=utf-8");
echo 'bugtrackerConnection_callback( { "offset": "' . $_REQUEST['offset'] . '", "length": "' . $_REQUEST['length'] . '", "statuses": { ' . substr($statuses, 0, -2) . ' }, "bugsInfo" : { ' . substr($json, 0, -2) . ' } } );';
}
示例9: email_resolved
if ($t_resolve_issue) {
email_resolved($f_bug_id);
email_relationship_child_resolved($f_bug_id);
} else {
if ($t_close_issue) {
email_close($f_bug_id);
email_relationship_child_closed($f_bug_id);
} else {
if ($t_reopen_issue) {
email_reopen($f_bug_id);
} else {
if ($t_existing_bug->handler_id === NO_USER && $t_updated_bug->handler_id !== NO_USER) {
email_assign($f_bug_id);
} else {
if ($t_existing_bug->status !== $t_updated_bug->status) {
$t_new_status_label = MantisEnum::getLabel(config_get('status_enum_string'), $t_updated_bug->status);
$t_new_status_label = str_replace(' ', '_', $t_new_status_label);
email_generic($f_bug_id, $t_new_status_label, 'email_notification_title_for_status_bug_' . $t_new_status_label);
} else {
email_generic($f_bug_id, 'updated', 'email_notification_title_for_action_bug_updated');
}
}
}
}
}
# Twitter notification of bug update.
if ($t_resolve_issue && $t_updated_bug->resolution >= config_get('bug_resolution_fixed_threshold') && $t_updated_bug->resolution < config_get('bug_resolution_not_fixed_threshold')) {
twitter_issue_resolved($f_bug_id);
}
form_security_purge('bug_update');
print_successful_redirect_to_bug($f_bug_id);
示例10: mci_get_enum_element
/**
* Given a enum string and num, return the appropriate localized string
* @param string $p_enum_name Enumeration name.
* @param string $p_val Enumeration value.
* @param string $p_lang Language string.
* @return string
*/
function mci_get_enum_element($p_enum_name, $p_val, $p_lang)
{
$t_enum_string = config_get($p_enum_name . '_enum_string');
$t_localized_enum_string = lang_get($p_enum_name . '_enum_string', $p_lang);
return MantisEnum::getLocalizedLabel($t_enum_string, $t_localized_enum_string, $p_val);
}
示例11: enum_bug_group
function enum_bug_group($p_enum_string, $p_enum)
{
$t_bug_table = db_get_table('bug');
$t_project_id = helper_get_current_project();
$t_bug_table = db_get_table('bug');
$t_user_id = auth_get_current_user_id();
$t_res_val = config_get('bug_resolved_status_threshold');
$t_clo_val = config_get('bug_closed_status_threshold');
$specific_where = " AND " . helper_project_specific_where($t_project_id, $t_user_id);
$t_array_indexed_by_enum_values = MantisEnum::getAssocArrayIndexedByValues($p_enum_string);
$enum_count = count($t_array_indexed_by_enum_values);
foreach ($t_array_indexed_by_enum_values as $t_value => $t_label) {
# Calculates the number of bugs opened and puts the results in a table
$query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}='{$t_value}' AND\n\t\t\t\t\t\tstatus<'{$t_res_val}' {$specific_where}";
$result2 = db_query($query);
$t_metrics['open'][$t_label] = db_result($result2, 0, 0);
# Calculates the number of bugs closed and puts the results in a table
$query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}='{$t_value}' AND\n\t\t\t\t\t\tstatus='{$t_clo_val}' {$specific_where}";
$result2 = db_query($query);
$t_metrics['closed'][$t_label] = db_result($result2, 0, 0);
# Calculates the number of bugs resolved and puts the results in a table
$query = "SELECT COUNT(*)\n\t\t\t\t\tFROM {$t_bug_table}\n\t\t\t\t\tWHERE {$p_enum}='{$t_value}' AND\n\t\t\t\t\t\tstatus>='{$t_res_val}' AND\n\t\t\t\t\t\tstatus<'{$t_clo_val}' {$specific_where}";
$result2 = db_query($query);
$t_metrics['resolved'][$t_label] = db_result($result2, 0, 0);
}
# ## end for
return $t_metrics;
}
示例12: get_enum_element
/**
* Given a enum string and num, return the appropriate string for the
* specified user/project
* @param string $p_enum_name
* @param int $p_val
* @param int|null $p_user user id, defaults to null (all users)
* @param int|null $p_project project id, defaults to null (all projects)
* @return string
*/
function get_enum_element($p_enum_name, $p_val, $p_user = null, $p_project = null)
{
$config_var = config_get($p_enum_name . '_enum_string', null, $p_user, $p_project);
$string_var = lang_get($p_enum_name . '_enum_string');
return MantisEnum::getLocalizedLabel($config_var, $string_var, $p_val);
}
示例13: db_get_table
// no data to graph
exit;
}
$t_bug_table = db_get_table('mantis_bug_table');
$t_bug_hist_table = db_get_table('mantis_bug_history_table');
$t_marker = array();
$t_data = array();
$t_ptr = 0;
$t_end = $t_interval->get_end_timestamp();
$t_start = $t_interval->get_start_timestamp();
if ($t_end == false || $t_start == false) {
return;
}
// grab all status levels
$t_status_arr = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
$t_status_labels = MantisEnum::getAssocArrayIndexedByValues(lang_get('status_enum_string'));
$t_default_bug_status = config_get('bug_submit_status');
$t_bug = array();
$t_view_status = array();
// walk through all issues and grab their status for 'now'
$t_marker[$t_ptr] = time();
foreach ($rows as $t_row) {
if (isset($t_data[$t_ptr][$t_row->status])) {
$t_data[$t_ptr][$t_row->status]++;
} else {
$t_data[$t_ptr][$t_row->status] = 1;
$t_view_status[$t_row->status] = isset($t_status_arr[$t_row->status]) ? $t_status_arr[$t_row->status] : '@' . $t_row->status . '@';
}
$t_bug[] = $t_row->id;
}
// get the history for these bugs over the interval required to offset the data
示例14: mci_get_enum_value_from_label
/**
* Get the enum id given the enum label.
*
* @param $p_enum_string The enum string to search in.
* @param $p_label The label to search for.
*
* @return The id corresponding to the given label, or 0 if not found.
*/
function mci_get_enum_value_from_label($p_enum_string, $p_label)
{
$t_value = MantisEnum::getValue($p_enum_string, $p_label);
if ($t_value === false) {
return 0;
}
return $t_value;
}
示例15: 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