git-interface: Support SQLite as database backend
[aur.git] / web / template / tu_details.php
blob38f6c0d0b4a3d827b9c668dfaf55e46b36a535b6
1 <?php
2 $yes = $row["Yes"];
3 $no = $row["No"];
4 $abstain = $row["Abstain"];
5 $active_tus = $row["ActiveTUs"];
6 $quorum = $row["Quorum"];
8 $total = $yes + $no + $abstain;
9 if ($active_tus > 0) {
10 $participation = $total / $active_tus;
11 } else {
12 $participation = 0;
15 if ($yes > $active_tus / 2) {
16 $vote_accepted = true;
17 } elseif ($participation > $quorum && $yes > $no) {
18 $vote_accepted = true;
19 } else {
20 $vote_accepted = false;
23 <div class="box">
24 <h2><?= __("Proposal Details") ?></h2>
26 <?php if ($isrunning == 1): ?>
27 <p style="font-weight: bold; color: red">
28 <?= __("This vote is still running.") ?>
29 </p>
30 <?php endif; ?>
32 <p>
33 <?= __("User") ?>:
34 <strong>
35 <?php if (!empty($row['User'])): ?>
36 <a href="<?= get_uri('/packages/'); ?>?K=<?= $row['User'] ?>&amp;SeB=m"><?= $row['User'] ?></a>
37 <?php else: ?>
38 N/A
39 <?php endif; ?>
40 </strong>
41 <br />
42 <?= __("Submitted: %s by %s", gmdate("Y-m-d H:i", $row['Submitted']), html_format_username(username_from_id($row['SubmitterID']))) ?>
43 <br />
44 <?= __("End") ?>:
45 <strong><?= gmdate("Y-m-d H:i", $row['End']) ?></strong>
46 <?php if ($isrunning == 0): ?>
47 <br />
48 <?= __("Result") ?>:
49 <?php if ($active_tus == 0): ?>
50 <span><?= __("unknown") ?></span>
51 <?php elseif ($vote_accepted): ?>
52 <span style="color: green; font-weight: bold"><?= __("Accepted") ?></span>
53 <?php else: ?>
54 <span style="color: red; font-weight: bold"><?= __("Rejected") ?></span>
55 <?php endif; ?>
56 <?php endif; ?>
57 </p>
59 <p>
60 <?= str_replace("\n", "<br />\n", htmlspecialchars($row['Agenda'])) ?>
61 </p>
63 <table>
64 <tr>
65 <?php if (!$isrunning): ?>
66 <th><?= __("Yes") ?></th>
67 <th><?= __("No") ?></th>
68 <th><?= __("Abstain") ?></th>
69 <?php endif; ?>
70 <th><?= __("Total") ?></th>
71 <th><?= __('Voted') ?></th>
72 <th><?= __('Participation') ?></th>
73 </tr>
74 <tr>
75 <?php if (!$isrunning): ?>
76 <td><?= $yes ?></td>
77 <td><?= $no ?></td>
78 <td><?= $abstain ?></td>
79 <?php endif; ?>
80 <td><?= $total ?></td>
81 <td>
82 <?php if ($hasvoted == 0): ?>
83 <span style="color: red; font-weight: bold"><?= __("No") ?></span>
84 <?php else: ?>
85 <span style="color: green; font-weight: bold"><?= __("Yes") ?></span>
86 <?php endif; ?>
87 </td>
88 <?php if ($active_tus > 0): ?>
89 <td><?= number_format($participation * 100, 2) ?>%</td>
90 <?php else: ?>
91 <td><?= __("unknown") ?></td>
92 <?php endif; ?>
93 </tr>
94 </table>
95 </div>
97 <?php if (!$isrunning): ?>
98 <div class="box">
99 <h2><?= __("Voters"); ?></h2>
100 <ul>
101 <?php foreach($whovoted as $voter): ?>
102 <li><a href="<?= get_user_uri($voter) ?>"><?= htmlspecialchars($voter) ?></a></li>
103 <?php endforeach; ?>
104 </ul>
105 </div>
106 <?php endif; ?>
108 <div class="box">
110 <?php if ($canvote == 1): ?>
111 <form action="<?= get_uri('/tu/'); ?>?id=<?= $row['ID'] ?>" method="post">
112 <fieldset>
113 <input type="submit" class="button" name="voteYes" value="<?= __("Yes") ?>" />
114 <input type="submit" class="button" name="voteNo" value="<?= __("No") ?>" />
115 <input type="submit" class="button" name="voteAbstain" value="<?= __("Abstain") ?>" />
116 <input type="hidden" name="doVote" value="1" />
117 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
118 </fieldset>
119 </form>
120 <?php else:
121 print $errorvote ?>
122 <?php endif; ?>
123 </div>