本文整理汇总了PHP中helper_project_specific_where函数的典型用法代码示例。如果您正苦于以下问题:PHP helper_project_specific_where函数的具体用法?PHP helper_project_specific_where怎么用?PHP helper_project_specific_where使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了helper_project_specific_where函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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 {
?>
示例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);
}
示例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);
}
示例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>';
}
}
}
示例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);
}
示例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;
}
示例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])) {
//.........这里部分代码省略.........
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}