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


PHP MantisEnum::getAssocArrayIndexedByValues方法代码示例

本文整理汇总了PHP中MantisEnum::getAssocArrayIndexedByValues方法的典型用法代码示例。如果您正苦于以下问题:PHP MantisEnum::getAssocArrayIndexedByValues方法的具体用法?PHP MantisEnum::getAssocArrayIndexedByValues怎么用?PHP MantisEnum::getAssocArrayIndexedByValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MantisEnum的用法示例。


在下文中一共展示了MantisEnum::getAssocArrayIndexedByValues方法的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);
}
开发者ID:kaos,项目名称:mantisbt,代码行数:64,代码来源:workflow_api.php

示例2: testGetAssocArrayIndexedByValues

 /**
  * Tests getAssocArrayIndexedByValues() method.
  */
 public function testGetAssocArrayIndexedByValues()
 {
     $this->assertEquals(array(), MantisEnum::getAssocArrayIndexedByValues(MantisEnumTest::EMPTY_ENUM));
     $this->assertEquals(array(10 => 'viewer'), MantisEnum::getAssocArrayIndexedByValues(MantisEnumTest::SINGLE_VALUE_ENUM));
     $this->assertEquals(array(10 => 'viewer1'), MantisEnum::getAssocArrayIndexedByValues(MantisEnumTest::DUPLICATE_VALUES_ENUM));
     $this->assertEquals(array(10 => 'viewer', 20 => 'viewer'), MantisEnum::getAssocArrayIndexedByValues(MantisEnumTest::DUPLICATE_LABELS_ENUM));
     $this->assertEquals(array(10 => 'first label', 20 => 'second label'), MantisEnum::getAssocArrayIndexedByValues(MantisEnumTest::NAME_WITH_SPACES_ENUM));
 }
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:11,代码来源:EnumTest.php

示例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>';
}
开发者ID:Cre-ator,项目名称:Whiteboard.StoryBoard-Plugin,代码行数:18,代码来源:storyboard_index.php

示例4: 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 );
			}
		}
	}
}
开发者ID:rombert,项目名称:mantisbt,代码行数:43,代码来源:manage_config_work_threshold_set.php

示例5: 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;
 }
开发者ID:pedroresende,项目名称:MantisBTKanbanBoard,代码行数:23,代码来源:kanban.php

示例6: 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) . ' } } );';
}
开发者ID:evilchewits,项目名称:gitweb-mantisbt,代码行数:24,代码来源:getBugsInfo.php

示例7: array

 * status of task, see lang/strings_german.txt ($s_status_enum_string) and
 * MantisKanban/lang/strings_german.txt:
 * Sets your kanban board columns - format is
 *
 * $columns = array(
 *	COLUM_NAME => array('status' => ARRAY_OF_MANTIS_STATI, WORK_IN_PROGRESS_LIMIT),
 *      ...
 * example:
 * $columns = array(
 *	lang_get('header_column_1') => array('status' => array(10), 'wip_limit' => 0),
 * means: Column 1 of your board has the name of the key "header_column_1" (e.g. "New"),
 * shows all tickets with status = 10 and has a "work in progress" limit of 0 (unlimited).
*/
$columns = array(lang_get('header_column_1') => array('status' => array(10), 'wip_limit' => 0), lang_get('header_column_2') => array('status' => array(30), 'wip_limit' => 0), lang_get('header_column_3') => array('status' => array(40), 'wip_limit' => 8), lang_get('header_column_4') => array('status' => 20, 'wip_limit' => 0), lang_get('header_column_5') => array('status' => 50, 'wip_limit' => 8));
if (ON == plugin_config_get('kanban_simple_columns')) {
    $defaults = MantisEnum::getAssocArrayIndexedByValues($g_status_enum_string);
    $columns = null;
    $hideUntilThisStatus = config_get('bug_resolved_status_threshold');
    foreach ($defaults as $num => $status) {
        if ($num < $hideUntilThisStatus) {
            $wip_limit = 12;
            //no limit for "new"
            if (10 == $num) {
                $wip_limit = 0;
            }
            $columns[kanban_get_status_text($num)] = array('status' => array($num), 'wip_limit' => $wip_limit, 'color' => get_status_color($num));
        }
    }
}
// default sorting of the tickets in the columns
// either 'last_updated' or 'priority'
开发者ID:aberad,项目名称:MantisKanban,代码行数:31,代码来源:kanban_page.php

示例8: require_api

require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('project_api.php');
require_api('string_api.php');
require_api('user_api.php');
auth_reauthenticate();
html_page_top(lang_get('manage_threshold_config'));
print_manage_menu('adm_permissions_report.php');
print_manage_config_menu('manage_config_work_threshold_page.php');
$t_user = auth_get_current_user_id();
$t_project_id = helper_get_current_project();
$t_access = user_get_access_level($t_user, $t_project_id);
$t_show_submit = false;
$t_access_levels = MantisEnum::getAssocArrayIndexedByValues(config_get('access_levels_enum_string'));
$t_overrides = array();
function set_overrides($p_config)
{
    global $t_overrides;
    if (!in_array($p_config, $t_overrides)) {
        $t_overrides[] = $p_config;
    }
}
function get_section_begin_mcwt($p_section_name)
{
    global $t_access_levels;
    echo '<table class="width100">';
    echo '<tr><td class="form-title" colspan="' . (count($t_access_levels) + 2) . '">' . $p_section_name . '</td></tr>' . "\n";
    echo '<tr><td class="form-title" width="40%" rowspan="2">' . lang_get('perm_rpt_capability') . '</td>';
    echo '<td class="form-title"style="text-align:center"  width="40%" colspan="' . count($t_access_levels) . '">' . lang_get('access_levels') . '</td>';
开发者ID:kaos,项目名称:mantisbt,代码行数:31,代码来源:manage_config_work_threshold_page.php

示例9: access_row

/**
 * access row
 * @return void
 */
function access_row()
{
    global $g_access, $g_can_change_flags;
    $t_enum_status = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    $t_file_new = config_get_global('report_bug_threshold');
    $t_global_new = config_get('report_bug_threshold', null, ALL_USERS, ALL_PROJECTS);
    $t_project_new = config_get('report_bug_threshold');
    $t_file_set = config_get_global('set_status_threshold');
    $t_global_set = config_get('set_status_threshold', null, ALL_USERS, ALL_PROJECTS);
    $t_project_set = config_get('set_status_threshold');
    $t_submit_status = config_get('bug_submit_status');
    # Print the table rows
    foreach ($t_enum_status as $t_status => $t_status_label) {
        echo "\t\t" . '<tr><td class="width30">' . string_no_break(MantisEnum::getLabel(lang_get('status_enum_string'), $t_status)) . '</td>' . "\n";
        if ($t_status == $t_submit_status) {
            # 'NEW' status
            $t_level_project = $t_project_new;
            $t_can_change = $g_access >= config_get_access('report_bug_threshold');
            $t_color = set_color_override($t_file_new, $t_global_new, $t_project_new);
            set_overrides('report_bug_threshold', $t_can_change, $t_color);
        } else {
            # Other statuses
            # File level: fallback if set_status_threshold is not defined
            if (isset($t_file_set[$t_status])) {
                $t_level_file = $t_file_set[$t_status];
            } else {
                $t_level_file = config_get_global('update_bug_status_threshold');
            }
            $t_level_global = isset($t_global_set[$t_status]) ? $t_global_set[$t_status] : $t_level_file;
            $t_level_project = isset($t_project_set[$t_status]) ? $t_project_set[$t_status] : $t_level_global;
            $t_can_change = $g_access >= config_get_access('set_status_threshold');
            $t_color = set_color_override($t_level_file, $t_level_global, $t_level_project);
            set_overrides('set_status_threshold', $t_can_change, $t_color);
        }
        if ($t_can_change) {
            echo '<td class="center ' . $t_color . '"><select name="access_change_' . $t_status . '">' . "\n";
            print_enum_string_option_list('access_levels', $t_level_project);
            echo '</select> </td>' . "\n";
            $g_can_change_flags = true;
        } else {
            echo '<td class="center ' . $t_color . '">' . MantisEnum::getLabel(lang_get('access_levels_enum_string'), $t_level_project) . '</td>' . "\n";
        }
        echo '</tr>' . "\n";
    }
}
开发者ID:gtn,项目名称:mantisbt,代码行数:49,代码来源:manage_config_workflow_page.php

示例10: hasValue

 /**
  * Checks if the specified enum string contains the specified value.
  *
  * @param string $enumString  The enumeration string.
  * @param integer $value      The value to chec,
  * @return bool true if found, false otherwise.
  */
 public static function hasValue($enumString, $value)
 {
     $assocArray = MantisEnum::getAssocArrayIndexedByValues($enumString);
     $valueAsInteger = (int) $value;
     return isset($assocArray[$valueAsInteger]);
 }
开发者ID:kaos,项目名称:mantisbt,代码行数:13,代码来源:MantisEnum.class.php

示例11: html_status_legend

/**
 * Print the color legend for the status colors
 * @param string
 * @return null
 */
function html_status_legend()
{
    echo '<br />';
    echo '<table class="width100" cellspacing="1">';
    echo '<tr>';
    $t_status_array = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    $t_status_names = MantisEnum::getAssocArrayIndexedByValues(lang_get('status_enum_string'));
    $enum_count = count($t_status_array);
    # read through the list and eliminate unused ones for the selected project
    # assumes that all status are are in the enum array
    $t_workflow = config_get('status_enum_workflow');
    if (!empty($t_workflow)) {
        foreach ($t_status_array as $t_status => $t_name) {
            if (!isset($t_workflow[$t_status])) {
                # drop elements that are not in the workflow
                unset($t_status_array[$t_status]);
            }
        }
    }
    # draw the status bar
    $width = (int) (100 / count($t_status_array));
    foreach ($t_status_array as $t_status => $t_name) {
        $t_val = isset($t_status_names[$t_status]) ? $t_status_names[$t_status] : $t_status_array[$t_status];
        $t_color = get_status_color($t_status);
        echo "<td class=\"small-caption\" width=\"{$width}%\" bgcolor=\"{$t_color}\">{$t_val}</td>";
    }
    echo '</tr>';
    echo '</table>';
    if (ON == config_get('status_percentage_legend')) {
        html_status_percentage_legend();
    }
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:37,代码来源:html_api.php

示例12: html_status_legend

/**
 * Print the color legend for the status colors at the requested position
 * @param int  $p_display_position   STATUS_LEGEND_POSITION_TOP or STATUS_LEGEND_POSITION_BOTTOM
 * @param bool $p_restrict_by_filter If true, only display status visible in current filter
 * @return void
 */
function html_status_legend($p_display_position, $p_restrict_by_filter = false)
{
    if ($p_restrict_by_filter) {
        # Don't show the legend if only one status is selected by the current filter
        $t_current_filter = current_user_get_bug_filter();
        if ($t_current_filter === false) {
            $t_current_filter = filter_get_default();
        }
        $t_simple_filter = $t_current_filter['_view_type'] == 'simple';
        if ($t_simple_filter) {
            if (!filter_field_is_any($t_current_filter[FILTER_PROPERTY_STATUS][0])) {
                return;
            }
        }
    }
    $t_status_array = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    $t_status_names = MantisEnum::getAssocArrayIndexedByValues(lang_get('status_enum_string'));
    # read through the list and eliminate unused ones for the selected project
    # assumes that all status are are in the enum array
    $t_workflow = config_get('status_enum_workflow');
    if (!empty($t_workflow)) {
        foreach ($t_status_array as $t_status => $t_name) {
            if (!isset($t_workflow[$t_status])) {
                # drop elements that are not in the workflow
                unset($t_status_array[$t_status]);
            }
        }
    }
    if ($p_restrict_by_filter) {
        # Remove status values that won't appear as a result of the current filter
        foreach ($t_status_array as $t_status => $t_name) {
            if ($t_simple_filter) {
                if (!filter_field_is_none($t_current_filter[FILTER_PROPERTY_HIDE_STATUS][0]) && $t_status >= $t_current_filter[FILTER_PROPERTY_HIDE_STATUS][0]) {
                    unset($t_status_array[$t_status]);
                }
            } else {
                if (!in_array(META_FILTER_ANY, $t_current_filter[FILTER_PROPERTY_STATUS]) && !in_array($t_status, $t_current_filter[FILTER_PROPERTY_STATUS])) {
                    unset($t_status_array[$t_status]);
                }
            }
        }
        # If there aren't at least two statuses showable by the current filter,
        # don't draw the status bar
        if (count($t_status_array) <= 1) {
            return;
        }
    }
    # Display the legend
    $t_legend_position = config_get('status_legend_position') & $p_display_position;
    if (STATUS_LEGEND_POSITION_NONE != $t_legend_position) {
        echo '<br />';
        echo '<table class="status-legend width100" cellspacing="1">';
        echo '<tr>';
        # draw the status bar
        foreach ($t_status_array as $t_status => $t_name) {
            $t_val = isset($t_status_names[$t_status]) ? $t_status_names[$t_status] : $t_status_array[$t_status];
            echo '<td class="small-caption status-legend-width ' . html_get_status_css_class($t_status) . '">' . $t_val . '</td>';
        }
        echo '</tr>';
        echo '</table>';
        if (ON == config_get('status_percentage_legend')) {
            html_status_percentage_legend();
        }
    }
    if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) {
        echo '<br />';
    }
}
开发者ID:AsBilou,项目名称:mantisbt,代码行数:74,代码来源:html_api.php

示例13: hasValue

 /**
  * Checks if the specified enum string contains the specified value.
  *
  * @param string  $p_enum_string The enumeration string.
  * @param integer $p_value       The value to check.
  * @return boolean true if found, false otherwise.
  */
 public static function hasValue($p_enum_string, $p_value)
 {
     $t_assoc_array = MantisEnum::getAssocArrayIndexedByValues($p_enum_string);
     $t_value_as_integer = (int) $p_value;
     return isset($t_assoc_array[$t_value_as_integer]);
 }
开发者ID:gtn,项目名称:mantisbt,代码行数:13,代码来源:MantisEnum.class.php

示例14: workflow_parse

/**
 * Parse a workflow into a graph-like array of workflow transitions.
 * @param array $p_enum_workflow The workflow enumeration to parse.
 * @return array The parsed workflow graph.
 */
function workflow_parse(array $p_enum_workflow)
{
    $t_status_arr = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    # If workflow is not set, defaults to array(), which means that all transitions are valid
    if (!is_array($p_enum_workflow)) {
        $p_enum_workflow = array();
    }
    # If any status row is missing, it defaults to all transitions
    foreach ($t_status_arr as $t_status => $t_label) {
        if (!isset($p_enum_workflow[$t_status])) {
            $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
    $t_default = array();
    foreach ($t_status_arr as $t_status => $t_status_label) {
        $t_exit[$t_status] = array();
        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] = '';
            }
        }
        if (!isset($t_entry[$t_status])) {
            $t_entry[$t_status] = array();
        }
    }
    return array('entry' => $t_entry, 'exit' => $t_exit, 'default' => $t_default);
}
开发者ID:spring,项目名称:spring-website,代码行数:60,代码来源:workflow_api.php

示例15: enum_bug_group

/**
 * Function which gives the absolute values according to the status (opened/closed/resolved)
 *
 * @param string $p_enum_string Enumeration string.
 * @param string $p_enum        Enumeration field.
 * @return array
 */
function enum_bug_group($p_enum_string, $p_enum)
{
    $t_project_id = helper_get_current_project();
    $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');
    $t_specific_where = ' AND ' . helper_project_specific_where($t_project_id, $t_user_id);
    if (!db_field_exists($p_enum, db_get_table('bug'))) {
        trigger_error(ERROR_DB_FIELD_NOT_FOUND, ERROR);
    }
    $t_array_indexed_by_enum_values = MantisEnum::getAssocArrayIndexedByValues($p_enum_string);
    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
        $t_query = 'SELECT COUNT(*) FROM {bug}
					WHERE ' . $p_enum . '=' . db_param() . ' AND
						status<' . db_param() . ' ' . $t_specific_where;
        $t_result2 = db_query($t_query, array($t_value, $t_res_val));
        $t_metrics['open'][$t_label] = db_result($t_result2, 0, 0);
        # Calculates the number of bugs closed and puts the results in a table
        $t_query = 'SELECT COUNT(*) FROM {bug}
					WHERE ' . $p_enum . '=' . db_param() . ' AND
						status>=' . db_param() . ' ' . $t_specific_where;
        $t_result2 = db_query($t_query, array($t_value, $t_clo_val));
        $t_metrics['closed'][$t_label] = db_result($t_result2, 0, 0);
        # Calculates the number of bugs resolved and puts the results in a table
        $t_query = 'SELECT COUNT(*) FROM {bug}
					WHERE ' . $p_enum . '=' . db_param() . ' AND
						status>=' . db_param() . ' AND
						status<' . db_param() . ' ' . $t_specific_where;
        $t_result2 = db_query($t_query, array($t_value, $t_res_val, $t_clo_val));
        $t_metrics['resolved'][$t_label] = db_result($t_result2, 0, 0);
    }
    return $t_metrics;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:41,代码来源:graph_api.php


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