Voting Tool
[cacert-boardvoting.git] / motions.php
1 <?php
2 require_once("database.php");
3 $db = new DB();
4 $db->closeVotes();
5 $page = is_numeric($_REQUEST['page'])?$_REQUEST['page']:1;
6 ?>
7 <html>
8 <head>
9 <title>CAcert Board Decisions</title>
10 <meta http-equiv="Content-Type" content="text/html; charset='UTF-8'" />
11 <link rel="stylesheet" type="text/css" href="styles.css" />
12 </head>
13 <body>
14 <table class="list">
15 <tr>
16 <th>Status</th>
17 <th>Motion</th>
18 <th>Actions</th>
19 </tr>
20 <?php
21 $stmt = $db->getStatement("list decisions");
22 $stmt->execute(array($page));
23 $items = 0;
24 while ($row = $stmt->fetch()) {
25 $items++;
26 ?><tr>
27 <td class="<?php switch($row['status']) { case 0: echo "pending"; break; case 1: echo "approved"; break; case -1: echo "declined"; break; }?>">
28 <?php
29 switch($row['status']) {
30 case 0: echo "Pending<br/><i>".$row['due']." UTC</i>"; break;
31 case 1: echo "Approved<br/><i>".$row['modified']." UTC</i>"; break;
32 case -1: echo "Declined<br/><i>".$row['modified']." UTC</i>"; break;
33 }
34 ?>
35 </td>
36 <td>
37 <i><?php echo $row['tag'] ?></i><br/>
38 <b><?php echo $row['title']; ?></b><br/>
39 <pre><?php echo $row['content']; ?></pre>
40 <br/>
41 <i>Due: <?php echo($row['due']); ?> UTC</i><br/>
42 <i>Proposed: <?php echo($row['proposer']); ?> (<?php echo($row['proposed']); ?> UTC)</i><br/>
43 <i>Required Votes: <?php echo($row['quorum']); ?></i><br/>
44 <i>Majority: <?php echo($row['majority']); ?>%</i><br/>
45 <i>Aye|Naye|Abstain: <?php echo($row['ayes']); ?>|<?php echo($row['nayes']); ?>|<?php echo($row['abstains']); ?></i><br/>
46 </td><?php
47 ?><td class="actions">
48 <?php
49 if ($row['status'] == 0) {
50 ?>
51 <ul>
52 <li><a href="vote.php?motion=<?php echo($row['id']); ?>&amp;vote=1">Aye</a></li>
53 <li><a href="vote.php?motion=<?php echo($row['id']); ?>&amp;vote=0">Abstain</a></li>
54 <li><a href="vote.php?motion=<?php echo($row['id']); ?>&amp;vote=-1">Naye</a></li>
55 <li><a href="proxy.php?motion=<?php echo($row['id']); ?>">Proxy Vote</a></li>
56 <li><a href="motion.php?motion=<?php echo($row['id']); ?>">Modify</a></li>
57 </ul>
58 <?php
59 } else {
60 ?>
61 &nbsp;
62 <?php
63 }
64 ?>
65 </td>
66 </tr><?php
67 }
68 ?>
69 <tr>
70 <td colspan="2" class="navigation">
71 <?php if ($page>1) { ?><a href="?page=<?php echo($page-1); ?>">&lt;</a><?php } else { ?>&nbsp;<?php } ?>
72 &nbsp;
73 <?php if ($items>9) { ?><a href="?page=<?php echo($page+1); ?>">&gt;</a><?php } else { ?>&nbsp;<?php } ?>
74 </td>
75 <td class="actions">
76 <ul>
77 <li><a href="motion.php">New Motion</a></li>
78 </ul>
79 </td>
80 </tr>
81 </table>
82 </body>
83 </html>