// function to show single news item
// factored out because called 3 time below
- function show_news_item($result,$i,$approved,$selectable) {
+ function show_news_item($row,$i,$approved,$selectable) {
global $HTML;
echo '<tr '. $HTML->boxGetAltRowStyle($i) . '><td width="20%">';
if ($selectable) {
echo '<input type="checkbox" '
.'name="news_id[]" value="'
- .db_result($result, $i, 'id').'" />';
+ .$row['id'].'" />';
}
- echo date(_('Y-m-d'), db_result($result,$i,'post_date')).'</td>
+ echo date(_('Y-m-d'), $row['post_date']).'</td>
<td width="45%">';
echo '
- <a href="'.getStringFromServer('PHP_SELF').'?approve=1&id='.db_result($result,$i,'id').'">'.db_result($result,$i,'summary').'</a>
+ <a href="'.getStringFromServer('PHP_SELF').'?approve=1&id='.$row['id'].'">'.$row['summary'].'</a>
</td>
<td width="35%">'
- .util_make_link_g (db_result($result,$i,'unix_group_name'),db_result($result,$i,'group_id'),db_result($result,$i,'group_name').' ('.db_result($result,$i,'unix_group_name').')')
+ .util_make_link_g ($row['unix_group_name'],$row['group_id'],$row['group_name'].' ('.$row['unix_group_name'].')')
.'</td>
</tr>'
;
}
- $title_arr=array(
+ $title_arr = array(
_('Date'),
_('Subject'),
_('Project')
);
- $result=db_query_qpa($qpa_pending);
- $rows=db_numrows($result);
+ $ra = RoleAnonymous::getInstance() ;
+
+ $result = db_query_qpa($qpa_pending);
+ $items = array();
+ while ($row_item = db_fetch_array($result)) {
+ if ($ra->hasPermission('project_read', $row_item['group_id'])) {
+ $items[] = $row_item;
+ }
+ }
+ $rows = count($items);
echo '<form action="'. getStringFromServer('PHP_SELF') .'" method="post">';
echo '<input type="hidden" name="mass_reject" value="1" />';
echo '<h2>'.sprintf(_('These items need to be approved (total: %1$s)'), $rows).'</h2>';
echo $GLOBALS['HTML']->listTableTop($title_arr);
for ($i=0; $i<$rows; $i++) {
- show_news_item($result,$i,false,true);
+ show_news_item($items[$i],$i,false,true);
}
echo $GLOBALS['HTML']->listTableBottom();
echo '<br /><input type="submit" name="submit" value="'._('Reject Selected').'" />';
Show list of rejected news items for this week
*/
- $result=db_query_qpa($qpa_rejected);
- $rows=db_numrows($result);
+ $result = db_query_qpa($qpa_rejected);
+ $items = array();
+ while ($row_item = db_fetch_array($result)) {
+ if ($ra->hasPermission('project_read', $row_item['group_id'])) {
+ $items[] = $row_item;
+ }
+ }
+ $rows = count($items);
+
if ($rows < 1) {
echo '
<h2>'._('No rejected items found for this week').'</h2>';
echo '<h2>'.sprintf(_('These items were rejected this past week or were not intended for front page (total: %1$s)'), $rows).'</h2>';
echo $GLOBALS['HTML']->listTableTop($title_arr);
for ($i=0; $i<$rows; $i++) {
- show_news_item($result,$i,false,false);
+ show_news_item($items[$i],$i,false,true);
}
echo $GLOBALS['HTML']->listTableBottom();
}
Show list of approved news items for this week
*/
- $result=db_query_qpa($qpa_approved);
- $rows=db_numrows($result);
+ $result = db_query_qpa($qpa_approved);
+ $items = array();
+ while ($row_item = db_fetch_array($result)) {
+ if ($ra->hasPermission('project_read', $row_item['group_id'])) {
+ $items[] = $row_item;
+ }
+ }
+ $rows = count($items);
if ($rows < 1) {
echo '
<h2>'._('No approved items found for this week').'</h2>';
echo '<h2>'.sprintf(_('These items were approved this past week (total: %1$s)'), $rows).'</h2>';
echo $GLOBALS['HTML']->listTableTop($title_arr);
for ($i=0; $i<$rows; $i++) {
- show_news_item($result,$i,true,false);
+ show_news_item($items[$i],$i,false,true);
}
echo $GLOBALS['HTML']->listTableBottom();
}