• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP helper_project_specific_where函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中helper_project_specific_where函数的典型用法代码示例。如果您正苦于以下问题:PHP helper_project_specific_where函数的具体用法?PHP helper_project_specific_where怎么用?PHP helper_project_specific_where使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了helper_project_specific_where函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: renderIssues

    function renderIssues($status)
    {
        $content = array();
        $t_bug_table = db_get_table('mantis_bug_table');
        $t_user_id = auth_get_current_user_id();
        $specific_where = helper_project_specific_where($this->project_id, $t_user_id);
        if ($this->severity) {
            $severityCond = '= ' . $this->severity;
        } else {
            $severityCond = '> -1';
        }
        if ($this->version) {
            $versionCon = '= ' . $this->version;
        } else {
            $versionCon = '> -1';
        }
        $query = "SELECT *\n\t\t\tFROM {$t_bug_table}\n\t\t\tWHERE {$specific_where}\n\t\t\tAND status = {$status}\n\t\t\tAND severity {$severityCond}\n                        AND version {$versionCon}\n\t\t\tORDER BY last_updated DESC\n\t\t\tLIMIT 20";
        $result = db_query_bound($query);
        $category_count = db_num_rows($result);
        for ($i = 0; $i < $category_count; $i++) {
            $row = db_fetch_array($result);
            $content[] = '<div class="portlet ui-helper-clearfix" id="' . $row['id'] . '"> 
			<div class="portlet-header">' . icon_get_status_icon($row['priority']) . ' ' . string_get_bug_view_link($row['id']) . ': ' . $row['summary'] . '</div>
			<div class="portlet-content">' . ($row['handler_id'] ? '<strong>Assigned:</strong> ' . user_get_name($row['handler_id']) . BR : '') . '</div></div>';
        }
        if ($row) {
            //pre_var_dump(array_keys($row));
        }
        return $content;
    }
开发者ID:pedroresende,项目名称:MantisBTKanbanBoard,代码行数:30,代码来源:kanban.php


示例2: profile_get_all_for_project

function profile_get_all_for_project($p_project_id)
{
    $t_project_where = helper_project_specific_where($p_project_id);
    $t_bug_table = config_get('mantis_bug_table');
    $t_user_profile_table = config_get('mantis_user_profile_table');
    # using up.* causes an SQL error on MS SQL since up.description is of type text
    $query = "SELECT DISTINCT(up.id), up.user_id, up.platform, up.os, up.os_build\n\t\t\t\t  FROM {$t_user_profile_table} up, {$t_bug_table} b\n\t\t\t\t  WHERE {$t_project_where}\n\t\t\t\t  AND up.id = b.profile_id";
    $result = db_query($query);
    $t_rows = array();
    $t_row_count = db_num_rows($result);
    for ($i = 0; $i < $t_row_count; $i++) {
        array_push($t_rows, db_fetch_array($result));
    }
    return $t_rows;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:15,代码来源:profile_api.php


示例3: lang_get

echo lang_get('my_sponsorship');
?>
	</td>
	<td class="right">
		<?php 
print_account_menu('account_sponsor_page.php');
?>
	</td>
</tr>
</table>
<?php 
# get issues user has sponsored
$t_user = auth_get_current_user_id();
$t_resolved = config_get('bug_resolved_status_threshold');
$t_payment = config_get('payment_enable', 0);
$t_project_clause = helper_project_specific_where($t_project);
$t_query = 'SELECT b.id as bug, s.id as sponsor, s.paid, b.project_id, b.fixed_in_version, b.status
	FROM {bug} b, {sponsorship} s
	WHERE s.user_id=' . db_param() . ' AND s.bug_id = b.id ' . ($t_show_all ? '' : 'AND ( b.status < ' . db_param() . ' OR s.paid < ' . SPONSORSHIP_PAID . ')') . '
	AND ' . $t_project_clause . '
	ORDER BY s.paid ASC, b.project_id ASC, b.fixed_in_version ASC, b.status ASC, b.id DESC';
$t_result = db_query($t_query, $t_show_all ? array($t_user) : array($t_user, $t_resolved));
$t_sponsors = array();
while ($t_row = db_fetch_array($t_result)) {
    $t_sponsors[] = $t_row;
}
$t_sponsor_count = count($t_sponsors);
if ($t_sponsor_count === 0) {
    echo '<p>' . lang_get('no_own_sponsored') . '</p>';
} else {
    ?>
开发者ID:gtn,项目名称:mantisbt,代码行数:31,代码来源:account_sponsor_page.php


示例4: news_get_count

function news_get_count($p_project_id, $p_sitewide = true)
{
    $c_project_id = db_prepare_int($p_project_id);
    $t_news_table = db_get_table('mantis_news_table');
    $t_project_where = helper_project_specific_where($p_project_id);
    $query = "SELECT COUNT(*)\n\t\t\t\t  FROM {$t_news_table}\n\t\t\t\t  WHERE {$t_project_where}";
    if ($p_sitewide) {
        $query .= ' OR project_id=' . ALL_PROJECTS;
    }
    $result = db_query_bound($query);
    return db_result($result, 0, 0);
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:12,代码来源:news_api.php


示例5: user_get_reported_open_bug_count

function user_get_reported_open_bug_count($p_user_id, $p_project_id = ALL_PROJECTS)
{
    $c_user_id = db_prepare_int($p_user_id);
    $c_project_id = db_prepare_int($p_project_id);
    $t_bug_table = config_get('mantis_bug_table');
    $t_where_prj = helper_project_specific_where($p_project_id, $p_user_id) . " AND";
    $t_resolved = config_get('bug_resolved_status_threshold');
    $query = "SELECT COUNT(*)\n\t\t\t\t  FROM {$t_bug_table}\n\t\t\t\t  WHERE {$t_where_prj}\n\t\t\t\t\t\t  status<'{$t_resolved}' AND\n\t\t\t\t\t\t  reporter_id='{$c_user_id}'";
    $result = db_query($query);
    return db_result($result);
}
开发者ID:renemilk,项目名称:spring-website,代码行数:11,代码来源:user_api.php


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


示例7: user_get_reported_open_bug_count

/**
 * return the number of open reported bugs by a user in a project
 *
 * @param int $p_user_id User ID
 * @param int $p_project_id Project ID
 * @return int
 */
function user_get_reported_open_bug_count($p_user_id, $p_project_id = ALL_PROJECTS)
{
    $t_bug_table = db_get_table('bug');
    $t_where_prj = helper_project_specific_where($p_project_id, $p_user_id) . ' AND';
    $t_resolved = config_get('bug_resolved_status_threshold');
    $query = "SELECT COUNT(*)\n\t\t\t\t  FROM {$t_bug_table}\n\t\t\t\t  WHERE {$t_where_prj}\n\t\t\t\t\t\t  status<'{$t_resolved}' AND\n\t\t\t\t\t\t  reporter_id=" . db_param();
    $result = db_query_bound($query, array($p_user_id));
    return db_result($result);
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:16,代码来源:user_api.php


示例8: version_get_all_rows_with_subs

/**
 * Return all versions for the specified project, including subprojects
 * @param int $p_project_id
 * @param int $p_released
 * @param bool $p_obsolete
 * @return array
 */
function version_get_all_rows_with_subs($p_project_id, $p_released = null, $p_obsolete = false)
{
    $t_project_where = helper_project_specific_where($p_project_id);
    $t_param_count = 0;
    $t_query_params = array();
    if ($p_released === null) {
        $t_released_where = '';
    } else {
        $c_released = db_prepare_int($p_released);
        $t_released_where = "AND ( released = " . db_param($t_param_count++) . " )";
        $t_query_params[] = $c_released;
    }
    if ($p_obsolete === null) {
        $t_obsolete_where = '';
    } else {
        $c_obsolete = db_prepare_bool($p_obsolete);
        $t_obsolete_where = "AND ( obsolete = " . db_param($t_param_count++) . " )";
        $t_query_params[] = $c_obsolete;
    }
    $t_project_version_table = db_get_table('project_version');
    $query = "SELECT *\n\t\t\t\t  FROM {$t_project_version_table}\n\t\t\t\t  WHERE {$t_project_where} {$t_released_where} {$t_obsolete_where}\n\t\t\t\t  ORDER BY date_order DESC";
    $result = db_query_bound($query, $t_query_params);
    $count = db_num_rows($result);
    $rows = array();
    for ($i = 0; $i < $count; $i++) {
        $row = db_fetch_array($result);
        $rows[] = $row;
    }
    return $rows;
}
开发者ID:kaos,项目名称:mantisbt,代码行数:37,代码来源:version_api.php


示例9: 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])) {
//.........这里部分代码省略.........
开发者ID:centaurustech,项目名称:BenFund,代码行数:101,代码来源:summary_api.php


示例10: mci_category_get_all_rows

function mci_category_get_all_rows($p_project_id, $p_user_id)
{
    $t_project_category_table = config_get('mantis_project_category_table');
    $c_project_id = db_prepare_int($p_project_id);
    $t_project_where = helper_project_specific_where($c_project_id, $p_user_id);
    $query = "SELECT category FROM {$t_project_category_table}\n\t\t\t\tWHERE {$t_project_where}\n\t\t\t\tORDER BY category ASC";
    $result = db_query($query);
    $count = db_num_rows($result);
    $cat_arr = array();
    for ($i = 0; $i < $count; $i++) {
        $row = db_fetch_array($result);
        $cat_arr[] = string_attribute($row['category']);
    }
    sort($cat_arr);
    return $cat_arr;
}
开发者ID:jin255ff,项目名称:company_website,代码行数:16,代码来源:mc_api.php


示例11: get_percentage_by_status

/**
 * get the status percentages
 * @return array key is the status value, value is the percentage of bugs for the status
 */
function get_percentage_by_status() {
	$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 );

	$t_query = 'SELECT status, COUNT(*) AS num
				FROM {bug}
				WHERE ' . $t_specific_where;
	if( !access_has_project_level( config_get( 'private_bug_threshold' ) ) ) {
		$t_query .= ' AND view_state < ' . VS_PRIVATE;
	}
	$t_query .= ' GROUP BY status';
	$t_result = db_query( $t_query );

	$t_status_count_array = array();

	while( $t_row = db_fetch_array( $t_result ) ) {
		$t_status_count_array[$t_row['status']] = $t_row['num'];
	}
	$t_bug_count = array_sum( $t_status_count_array );
	foreach( $t_status_count_array as $t_status=>$t_value ) {
		$t_status_count_array[$t_status] = round( ( $t_value / $t_bug_count ) * 100 );
	}

	return $t_status_count_array;
}
开发者ID:01-Scripts,项目名称:mantisbt,代码行数:32,代码来源:helper_api.php


示例12: profile_get_all_for_project

/**
 * Return an array containing all profiles used in a given project
 * @param integer $p_project_id A valid project identifier.
 * @return array
 */
function profile_get_all_for_project($p_project_id)
{
    $t_project_where = helper_project_specific_where($p_project_id);
    $t_query = 'SELECT DISTINCT(up.id), up.user_id, up.platform, up.os, up.os_build
				  FROM {user_profile} up, {bug} b
				  WHERE ' . $t_project_where . '
				  AND up.id = b.profile_id
				  ORDER BY up.platform, up.os, up.os_build';
    $t_result = db_query($t_query);
    $t_rows = array();
    while ($t_row = db_fetch_array($t_result)) {
        array_push($t_rows, $t_row);
    }
    return $t_rows;
}
开发者ID:spring,项目名称:spring-website,代码行数:20,代码来源:profile_api.php


示例13: profile_get_all_for_project

/**
 * Return an array containing all profiles used in a given project
 * @param int $p_project_id
 * @return array
 */
function profile_get_all_for_project($p_project_id)
{
    $t_project_where = helper_project_specific_where($p_project_id);
    $t_bug_table = db_get_table('bug');
    $t_user_profile_table = db_get_table('user_profile');
    # using up.* causes an SQL error on MS SQL since up.description is of type text
    $query = "SELECT DISTINCT(up.id), up.user_id, up.platform, up.os, up.os_build\n\t\t\t\t  FROM {$t_user_profile_table} up, {$t_bug_table} b\n\t\t\t\t  WHERE {$t_project_where}\n\t\t\t\t  AND up.id = b.profile_id\n\t\t\t\t  ORDER BY platform, os, os_build";
    $t_result = db_query_bound($query);
    $t_rows = array();
    while ($t_row = db_fetch_array($t_result)) {
        array_push($t_rows, $t_row);
    }
    return $t_rows;
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:19,代码来源:profile_api.php


示例14: create_cumulative_bydate

/**
 * Create cumulative graph by date
 * @return array
 */
function create_cumulative_bydate()
{
    $t_clo_val = config_get('bug_closed_status_threshold');
    $t_res_val = config_get('bug_resolved_status_threshold');
    $t_project_id = helper_get_current_project();
    $t_user_id = auth_get_current_user_id();
    $t_specific_where = helper_project_specific_where($t_project_id, $t_user_id);
    # Get all the submitted dates
    $t_query = 'SELECT date_submitted FROM {bug} WHERE ' . $t_specific_where . ' ORDER BY date_submitted';
    $t_result = db_query($t_query);
    while ($t_row = db_fetch_array($t_result)) {
        # rationalise the timestamp to a day to reduce the amount of data
        $t_date = $t_row['date_submitted'];
        $t_date = (int) ($t_date / SECONDS_PER_DAY);
        if (isset($t_calc_metrics[$t_date])) {
            $t_calc_metrics[$t_date][0]++;
        } else {
            $t_calc_metrics[$t_date] = array(1, 0, 0);
        }
    }
    # ## Get all the dates where a transition from not resolved to resolved may have happened
    #    also, get the last updated date for the bug as this may be all the information we have
    $t_query = 'SELECT {bug}.id, last_updated, date_modified, new_value, old_value
			FROM {bug} LEFT JOIN {bug_history}
			ON {bug}.id = {bug_history}.bug_id
			WHERE ' . $t_specific_where . '
						AND {bug}.status >= ' . db_param() . '
						AND ( ( {bug_history}.new_value >= ' . db_param() . '
								AND {bug_history}.field_name = \'status\' )
						OR {bug_history}.id is NULL )
			ORDER BY {bug}.id, date_modified ASC';
    $t_result = db_query($t_query, array($t_res_val, (string) $t_res_val));
    $t_bug_count = db_num_rows($t_result);
    $t_last_id = 0;
    $t_last_date = 0;
    while ($t_row = db_fetch_array($t_result)) {
        $t_id = $t_row['id'];
        # if h_last_updated is NULL, there were no appropriate history records
        #  (i.e. pre 0.18 data), use last_updated from bug table instead
        if (null == $t_row['date_modified']) {
            $t_date = $t_row['last_updated'];
        } else {
            if ($t_res_val > $t_row['old_value']) {
                $t_date = $t_row['date_modified'];
            }
        }
        if ($t_id != $t_last_id) {
            if (0 != $t_last_id) {
                # rationalise the timestamp to a day to reduce the amount of data
                $t_date_index = (int) ($t_last_date / SECONDS_PER_DAY);
                if (isset($t_calc_metrics[$t_date_index])) {
                    $t_calc_metrics[$t_date_index][1]++;
                } else {
                    $t_calc_metrics[$t_date_index] = array(0, 1, 0);
                }
            }
            $t_last_id = $t_id;
        }
        $t_last_date = $t_date;
    }
    ksort($t_calc_metrics);
    $t_last_opened = 0;
    $t_last_resolved = 0;
    foreach ($t_calc_metrics as $i => $t_values) {
        $t_date = $i * SECONDS_PER_DAY;
        $t_metrics[0][$t_date] = $t_last_opened = $t_calc_metrics[$i][0] + $t_last_opened;
        $t_metrics[1][$t_date] = $t_last_resolved = $t_calc_metrics[$i][1] + $t_last_resolved;
        $t_metrics[2][$t_date] = $t_metrics[0][$t_date] - $t_metrics[1][$t_date];
    }
    return $t_metrics;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:75,代码来源:graph_api.php


示例15: news_get_count

/**
 * get news count (selected project plus site wide posts)
 *
 * @param integer $p_project_id A project identifier.
 * @param boolean $p_global     Whether this is site wide news i.e. ALL_PROJECTS.
 * @return int news count
 */
function news_get_count($p_project_id, $p_global = true)
{
    $t_project_where = helper_project_specific_where($p_project_id);
    $t_query = 'SELECT COUNT(*) FROM {news} WHERE ' . $t_project_where;
    if ($p_global) {
        $t_query .= ' OR project_id=' . ALL_PROJECTS;
    }
    $t_result = db_query($t_query);
    return db_result($t_result, 0);
}
开发者ID:spring,项目名称:spring-website,代码行数:17,代码来源:news_api.php


示例16: require_api

require_api('constant_inc.php');
require_api('database_api.php');
require_api('gpc_api.php');
require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('summary_api.php');
require_api('user_api.php');
$f_project_id = gpc_get_int('project_id', helper_get_current_project());
# Override the current page to make sure we get the appropriate project-specific configuration
$g_project_override = $f_project_id;
access_ensure_project_level(config_get('view_summary_threshold'));
$t_user_id = auth_get_current_user_id();
$t_project_ids = user_get_all_accessible_projects($t_user_id, $f_project_id);
$t_specific_where = helper_project_specific_where($f_project_id, $t_user_id);
$t_resolved = config_get('bug_resolved_status_threshold');
# the issue may have passed through the status we consider resolved
#  (e.g., bug is CLOSED, not RESOLVED). The linkage to the history field
#  will look up the most recent 'resolved' status change and return it as well
$t_query = 'SELECT b.id, b.date_submitted, b.last_updated, MAX(h.date_modified) as hist_update, b.status
	FROM {bug} b LEFT JOIN {bug_history} h
		ON b.id = h.bug_id  AND h.type=0 AND h.field_name=\'status\' AND h.new_value=' . db_param() . '
		WHERE b.status >=' . db_param() . ' AND ' . $t_specific_where . '
		GROUP BY b.id, b.status, b.date_submitted, b.last_updated
		ORDER BY b.id ASC';
$t_result = db_query($t_query, array($t_resolved, $t_resolved));
$t_bug_count = 0;
$t_bug_id = 0;
$t_largest_diff = 0;
$t_total_time = 0;
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:31,代码来源:summary_page.php


示例17: version_get_all_rows_with_subs

/**
 * Return all versions for the specified project, including subprojects
 * @param int $p_project_id
 * @param int $p_released
 * @param bool $p_obsolete
 * @return array
 */
function version_get_all_rows_with_subs($p_project_id, $p_released = null, $p_obsolete = false)
{
    $t_project_where = helper_project_specific_where($p_project_id);
    $t_query_params = array();
    if ($p_released === null) {
        $t_released_where = '';
    } else {
        $c_released = (int) $p_released;
        $t_released_where = "AND ( released = " . db_param() . " )";
        $t_query_params[] = $c_released;
    }
    if ($p_obsolete === null) {
        $t_obsolete_where = '';
    } else {
        $t_obsolete_where = "AND ( obsolete = " . db_param() . " )";
        $t_query_params[] = $p_obsolete;
    }
    $t_project_version_table = db_get_table('project_version');
    $query = "SELECT * FROM {$t_project_version_table}\n\t\t\t\t  WHERE {$t_project_where} {$t_released_where} {$t_obsolete_where}\n\t\t\t\t  ORDER BY date_order DESC";
    $result = db_query_bound($query, $t_query_params);
    $rows = array();
    while ($row = db_fetch_array($result)) {
        $rows[] = $row;
    }
    return $rows;
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:33,代码来源:version_api.php


示例18: get_percentage_by_status

/**
 * get the status percentages
 * @return array key is the status value, value is the percentage of bugs for the status
 */
function get_percentage_by_status()
{
    $t_mantis_bug_table = db_get_table('bug');
    $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 = array_sum($t_status_count_array);
    foreach ($t_status_count_array as $t_status => $t_value) {
        $t_status_count_array[$t_status] = round($t_value / $t_bug_count * 100);
    }
    return $t_status_count_array;
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:28,代码来源:helper_api.php


示例19: news_get_count

/**
 * get news count (selected project plus site wide posts)
 *
 * @param int $p_project_id project id
 * @param bool $p_global site wide news i.e. ALL_PROJECTS
 * @return int news count
 */
function news_get_count($p_project_id, $p_global = true)
{
    $t_news_table = db_get_table('news');
    $t_project_where = helper_project_specific_where($p_project_id);
    $t_query = "SELECT COUNT(*) FROM {$t_news_table} WHERE {$t_project_where}";
    if ($p_global) {
        $t_query .= ' OR project_id=' . ALL_PROJECTS;
    }
    $result = db_query_bound($t_query);
    return db_result($result, 0);
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:18,代码来源:news_api.php


示例20: create_cumulative_bydate

function create_cumulative_bydate()
{
    $t_clo_val = config_get('bug_closed_status_threshold');
    $t_res_val = config_get('bug_resolved_status_threshold');
    $t_bug_table = db_get_table('bug');
    $t_history_table = db_get_table('bug_history');
    $t_project_id = helper_get_current_project();
    $t_user_id = auth_get_current_user_id();
    $specific_where = helper_project_specific_where($t_project_id, $t_user_id);
    # Get all the submitted dates
    $query = "SELECT date_submitted\n\t\t\t\tFROM {$t_bug_table}\n\t\t\t\tWHERE {$specific_where}\n\t\t\t\tORDER BY date_submitted";
    $result = db_query_bound($query);
    $bug_count = db_num_rows($result);
    for ($i = 0; $i < $bug_count; $i++) {
        $row = db_fetch_array($result);
        # rationalise the timestamp to a day to reduce the amount of data
        $t_date = $row['date_submitted'];
        $t_date = (int) ($t_date / SECONDS_PER_DAY);
        if (isset($metrics[$t_date])) {
            $metrics[$t_date][0]++;
        } else {
            $metrics[$t_date] = array(1, 0, 0);
        }
    }
    # ## Get all the dates where a transition from not resolved to resolved may have happened
    #    also, get the last updated date for the bug as this may be all the information we have
    $query = "SELECT {$t_bug_table}.id, last_updated, date_modified, new_value, old_value\n\t\t\tFROM {$t_bug_table} LEFT JOIN {$t_history_table}\n\t\t\tON {$t_bug_table}.id = {$t_history_table}.bug_id\n\t\t\tWHERE {$specific_where}\n\t\t\t\t\t\tAND {$t_bug_table}.status >= '{$t_res_val}'\n\t\t\t\t\t\tAND ( ( {$t_history_table}.new_value >= '{$t_res_val}'\n\t\t\t\t\t\t\t\tAND {$t_history_table}.field_name = 'status' )\n\t\t\t\t\t\tOR {$t_history_table}.id is NULL )\n\t\t\tORDER BY {$t_bug_table}.id, date_modified ASC";
    $result = db_query($query);
    $bug_count = db_num_rows($result);
    $t_last_id = 0;
    $t_last_date = 0;
    for ($i = 0; $i < $bug_count; $i++) {
        $row = db_fetch_array($result);
        $t_id = $row['id'];
        # if h_last_updated is NULL, there were no appropriate history records
        #  (i.e. pre 0.18 data), use last_updated from bug table instead
        if (NULL == $row['date_modified']) {
            $t_date = $row['last_updated'];
        } else {
            if ($t_res_val > $row['old_value']) {
                $t_date = $row['date_modified'];
            }
        }
        if ($t_id != $t_last_id) {
            if (0 != $t_last_id) {
                # rationalise the timestamp to a day to reduce the amount of data
                $t_date_index = (int) ($t_last_date / SECONDS_PER_DAY);
                if (isset($metrics[$t_date_index])) {
                    $metrics[$t_date_index][1]++;
                } else {
                    $metrics[$t_date_index] = array(0, 1, 0);
                }
            }
            $t_last_id = $t_id;
        }
        $t_last_date = $t_date;
    }
    ksort($metrics);
    $metrics_count = count($metrics);
    $t_last_opened = 0;
    $t_last_resolved = 0;
    foreach ($metrics as $i => $vals) {
        $t_date = $i * SECONDS_PER_DAY;
        $t_metrics[0][$t_date] = $t_last_opened = $metrics[$i][0] + $t_last_opened;
        $t_metrics[1][$t_date] = $t_last_resolved = $metrics[$i][1] + $t_last_resolved;
        $t_metrics[2][$t_date] = $t_metrics[0][$t_date] - $t_metrics[1][$t_date];
    }
    return $t_metrics;
}
开发者ID:kaos,项目名称:mantisbt,代码行数:69,代码来源:graph_api.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP helper_set_current_project函数代码示例发布时间:2022-05-15
下一篇:
PHP helper_name函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap