pkgreq_results.php: Add a flag to hide headers

Introduce a new boolean flag that can be used to disable extended
headers, pagination and forms.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2017-02-07 08:44:14 +01:00
parent 05007d8b1a
commit 403241baa3
2 changed files with 9 additions and 4 deletions

View file

@ -78,6 +78,7 @@ if (isset($base_id)) {
html_header(__("Requests")); html_header(__("Requests"));
echo '<div id="pkglist-results" class="box">'; echo '<div id="pkglist-results" class="box">';
$show_headers = true;
include('pkgreq_results.php'); include('pkgreq_results.php');
echo '</div>'; echo '</div>';
} }

View file

@ -1,3 +1,4 @@
<?php if ($show_headers): ?>
<div class="pkglist-stats"> <div class="pkglist-stats">
<p> <p>
<?= _n('%d package request found.', '%d package requests found.', $total) ?> <?= _n('%d package request found.', '%d package requests found.', $total) ?>
@ -17,6 +18,7 @@
</p> </p>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?>
<table class="results"> <table class="results">
<thead> <thead>
@ -67,7 +69,7 @@
<a href="<?= get_uri('/account/') . htmlspecialchars($row['User'], ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($row['User'])) ?>"><?= htmlspecialchars($row['User']) ?></a> <a href="<?= get_uri('/account/') . htmlspecialchars($row['User'], ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($row['User'])) ?>"><?= htmlspecialchars($row['User']) ?></a>
</td> </td>
<td<?php if ($due): ?> class="flagged"<?php endif; ?>><?= date("Y-m-d H:i", intval($row['RequestTS'])) ?></td> <td<?php if ($due): ?> class="flagged"<?php endif; ?>><?= date("Y-m-d H:i", intval($row['RequestTS'])) ?></td>
<?php if ($row['Open']): ?> <?php if ($row['Open'] && $show_headers): ?>
<td> <td>
<?php if ($row['BaseID']): ?> <?php if ($row['BaseID']): ?>
<?php if ($row['Type'] == 'deletion'): ?> <?php if ($row['Type'] == 'deletion'): ?>
@ -89,8 +91,9 @@
<?php endif; ?> <?php endif; ?>
<a href="<?= get_pkgreq_route() . '/' . intval($row['ID']) ?>/close/"><?= __('Close') ?></a> <a href="<?= get_pkgreq_route() . '/' . intval($row['ID']) ?>/close/"><?= __('Close') ?></a>
</td> </td>
<?php else: ?> <?php elseif ($row['Open'] && !$show_headers): ?>
<?php if ($row['Status'] == 1): ?> <td><?= __("Pending") ?></td>
<?php elseif ($row['Status'] == 1): ?>
<td><?= __("Closed") ?></td> <td><?= __("Closed") ?></td>
<?php elseif ($row['Status'] == 2): ?> <?php elseif ($row['Status'] == 2): ?>
<td><?= __("Accepted") ?></td> <td><?= __("Accepted") ?></td>
@ -99,13 +102,13 @@
<?php else: ?> <?php else: ?>
<td><?= __("unknown") ?></td> <td><?= __("unknown") ?></td>
<?php endif; ?> <?php endif; ?>
<?php endif; ?>
</tr> </tr>
<?php endwhile; ?> <?php endwhile; ?>
</tbody> </tbody>
</table> </table>
<?php if ($show_headers): ?>
<div class="pkglist-stats"> <div class="pkglist-stats">
<p> <p>
<?= _n('%d package request found.', '%d package requests found.', $total) ?> <?= _n('%d package request found.', '%d package requests found.', $total) ?>
@ -125,3 +128,4 @@
</p> </p>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?>