mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add "Last Votes by TU" list
This shows a list of all Trusted Users and the vote ID of the last proposal each of the TUs voted on. This list is sorted by vote ID. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
fb76aab8cf
commit
2dd3d04f45
3 changed files with 61 additions and 0 deletions
|
@ -134,6 +134,8 @@ if ($atype == "Trusted User" || $atype == "Developer") {
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
$result = last_votes_list();
|
||||
include("tu_last_votes_list.php");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -995,6 +995,25 @@ function past_proposal_list($order, $lim) {
|
|||
return $details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the vote ID of the last vote of all Trusted Users
|
||||
*
|
||||
* @return array The vote ID of the last vote of each Trusted User
|
||||
*/
|
||||
function last_votes_list() {
|
||||
$dbh = DB::connect();
|
||||
|
||||
$q = "SELECT UserID, MAX(VoteID) AS LastVote FROM TU_Votes GROUP BY UserID ORDER BY VoteID DESC";
|
||||
$result = $dbh->query($q);
|
||||
|
||||
$details = array();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$details[] = $row;
|
||||
}
|
||||
|
||||
return $details;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the total number of Trusted User proposals
|
||||
*
|
||||
|
|
40
web/template/tu_last_votes_list.php
Normal file
40
web/template/tu_last_votes_list.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<div class="box">
|
||||
<h2><?= __("Last Votes by TU") ?></h2>
|
||||
<table class="results">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= __("User") ?></th>
|
||||
<th><?= __("Last vote") ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if (empty($result)): ?>
|
||||
<tr><td align="center" colspan="0"><?= __("No results found.") ?></td></tr>
|
||||
<?php else: while (list($indx, $row) = each($result)):
|
||||
if ($indx % 2):
|
||||
$c = "even";
|
||||
else:
|
||||
$c = "odd";
|
||||
endif;
|
||||
$username = username_from_id($row["UserID"]);
|
||||
?>
|
||||
<tr class="<?= $c ?>">
|
||||
<td>
|
||||
<?php if (!$USE_VIRTUAL_URLS): ?>
|
||||
<a href="<?= get_uri('/account/'); ?>?Action=AccountInfo&ID=<?= htmlspecialchars($row['UserID'], ENT_QUOTES) ?>" title="<?= __('View account information for')?> <?= htmlspecialchars($username) ?>"><?= htmlspecialchars($username) ?></a></td>
|
||||
<?php else: ?>
|
||||
<a href="<?= get_uri('/account/') . htmlspecialchars($username, ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($username)) ?>"><?= htmlspecialchars($username) ?></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?= get_uri('/tu/'); ?>?id=<?= $row['LastVote'] ?>"><?= intval($row["LastVote"]) ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
endif;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
Loading…
Add table
Reference in a new issue