Skip to content

Commit

Permalink
feeding dynamic bill info to homepage now. ha.
Browse files Browse the repository at this point in the history
  • Loading branch information
paleomedia committed Apr 23, 2015
1 parent 48175a3 commit 64416cb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 7 deletions.
8 changes: 8 additions & 0 deletions dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,13 @@ public function saveBills ($bill_id, $year, $title, $bill_name, $connection) {
return $bill_name;
}

public function getBills () {
$conn = $this->getConnection();
return $conn->query("SELECT bill_name, title, (votes_for + votes_against) AS total
FROM bills
ORDER BY total
LIMIT 5");
}

} // end Dao
?>
50 changes: 43 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,42 @@
<div class="maincontainer">

<?php include 'dash.php'; ?>

<div class="billmain">
<div class="active">
<p>Most Active Bills</p>

<?php
$bill_list = $dao->getBills();

foreach ($bill_list as $bill) { ?>
<div class="billimage"><span><?php echo $bill["bill_name"]; ?></span></div>
<div class="lastaction">Passed xx/xx/xxxx</div>
<div class="billsummary"><?php echo $bill["title"]; ?></div>
<?php } ?>
</div>
</div>

<!--
<div class="comments">
<div class="commentbox">
<form name="commentForm" action="handler.php" method="POST">
<textarea name="comment" rows="4" placeholder="Write comments or testimony here, select pro, neutral or anti, and press Go."></textarea>
<label>Yea or Nay?</label>
<label>
<input type="radio" name="vote" value="pro" /><img class="prolabel" src="images/thumbs_up.png" />
</label>
<label class="neutrallabel">
<input type="radio" name="vote" value="neutral" />?</label>
<label>
<input type="radio" name="vote" value="anti" /><img class="antilabel" src="images/thumbs_down.png" />
</label>
<input type="submit" name="commentButton" value="Comment" />
<input type="hidden" name="form" value="comment">
</form>
</div> -->

<div class="billmain">
<!-- <div class="billmain">
<div class="active">
<p>Most Active</p>
<div class="billimage"><span>S 1081</span></div>
Expand All @@ -32,9 +66,11 @@
<input type="submit" name="commentButton" value="Comment" />
<input type="hidden" name="form" value="comment">
</form>
</div>
<?php
$comments = $dao->getComments();
</div> -->


<?php
/* $comments = $dao->getComments();
echo "<table>";
foreach ($comments as $comment) {
echo "<tr>";
Expand All @@ -43,9 +79,9 @@
echo "</tr>";
}
echo "</table>";
?>
*/ ?>
</div>
</div>


<!-- <div class="active">
<p>Also Active</p>
Expand Down Expand Up @@ -88,6 +124,6 @@

</div> -->

</div>


<?php include 'footer.php'; ?>

0 comments on commit 64416cb

Please sign in to comment.