--- a/index.php +++ b/index.php @@ -4,11 +4,33 @@ ?> <div class="hero-unit"> <h1>Contract Dashboard</h1> -<iframe width='700' height='400' src='http://openspending.org/australian_federal_government_contract_spending/embed?widget=treemap&state=%7B%22drilldown%22%3A%22from%22%2C%22year%22%3A%222011%22%2C%22cuts%22%3A%7B%7D%2C%22drilldowns%22%3A%5B%22from%22%5D%7D&width=700&height=400' frameborder='0'></iframe> -<br> -<a href="http://openspending.org/australian_federal_government_contract_spending">Explore further on OpenSpending.org!</a> </div> +<table> <?php +$query = 'SELECT DATE("importDate") d FROM contractnotice ORDER BY "importDate" DESC limit 1'; +$query = $conn->prepare($query); +$query->execute(); +databaseError($conn->errorInfo()); +$date = $query->fetch(); +$query = 'SELECT * FROM contractnotice where DATE("importDate") = ? +OFFSET random()*(select count(*) from contractnotice where DATE("importDate") = ?) LIMIT 10'; +$query = $conn->prepare($query); +$query->execute(Array($date[0],$date[0])); +databaseError($conn->errorInfo()); +$res = $query->fetchAll(PDO::FETCH_ASSOC); + +foreach ($res as $row) { +setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']), 2); + echo ("<tr> + <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> + <td><b>{$row['description']}</b></a></td> + <td>\$$value</td><td>{$row['agencyName']}</td> + <td>{$row['contractStart']}</td> + <td>{$row['supplierName']}</td> + </tr>"); +} +echo "</table>"; include_footer(); ?>