Example #1
0
function view_all_year_end_poll_for($poll)
{
    $column_names = get_column_names($poll);
    echo "<table class=\"table table-striped table-bordered-horizontal table-condensed table-center\">\n<thead>";
    for ($i = 0; $i <= count($column_names); $i++) {
        if ($column_names[$i] != 'id') {
            echo "<th>" . ucwords(format_poll_name($column_names[$i])) . "</th>";
        }
    }
    echo "</thead>\n";
    $query = "SELECT * FROM year_end_" . $poll . " ORDER BY votes DESC, " . $column_names[1] . " ASC";
    $result = mysql_query($query);
    for ($i = 1; $i <= mysql_num_rows($result); $i++) {
        $info = mysql_fetch_assoc($result);
        echo "<tr>";
        for ($j = 1; $j <= count($column_names); $j++) {
            echo "<td>" . $info[$column_names[$j]] . "</td>";
        }
        echo "</tr>";
    }
    echo "</table";
}
<?php

echo "<div class=\"row top-spacer_20\">\n    <div class=\"three columns center\">\n      <a href=\"" . create_link($ip, $polls[0]) . "\" class=\"" . klass($ip, $polls[0]) . "\">" . format_poll_name($polls[0]) . "</a>\n    </div>\n    <div class=\"two columns center\">\n      <a href=\"" . create_link($ip, $polls[1]) . "\" class=\"" . klass($ip, $polls[1]) . "\">" . format_poll_name($polls[1]) . "</a>\n    </div>\n    <div class=\"two columns center\">\n      <a href=\"" . create_link($ip, $polls[2]) . "\" class=\"" . klass($ip, $polls[2]) . "\">" . format_poll_name($polls[2]) . "</a>\n    </div>\n    <div class=\"two columns center\">\n      <a href=\"" . create_link($ip, $polls[3]) . "\" class=\"" . klass($ip, $polls[3]) . "\">" . format_poll_name($polls[3]) . "</a>\n    </div>\n    <div class=\"three columns center\">\n      <a href=\"" . create_link($ip, $polls[4]) . "\" class=\"" . klass($ip, $polls[4]) . "\">" . format_poll_name($polls[4]) . "</a>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"four columns center\">\n      <a href=\"" . create_link($ip, $polls[5]) . "\" class=\"" . klass($ip, $polls[5]) . "\">" . format_poll_name($polls[5]) . "</a>\n    </div>\n    <div class=\"four columns center\">\n      <a href=\"" . create_link($ip, $polls[6]) . "\" class=\"" . klass($ip, $polls[6]) . "\">" . format_poll_name($polls[6]) . "</a>\n    </div>\n    <div class=\"four columns center\">\n      <a href=\"" . create_link($ip, $polls[7]) . "\" class=\"" . klass($ip, $polls[7]) . "\">" . format_poll_name($polls[7]) . "</a>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"four columns center\">\n      <a href=\"" . create_link($ip, $polls[8]) . "\" class=\"" . klass($ip, $polls[8]) . "\">" . format_poll_name($polls[8]) . "</a>\n    </div>\n    <div class=\"four columns center\">\n      <a href=\"" . create_link($ip, $polls[9]) . "\" class=\"" . klass($ip, $polls[9]) . "\">" . format_poll_name($polls[9]) . "</a>\n    </div>\n    <div class=\"four columns center\">\n      <a href=\"" . create_link($ip, $polls[10]) . "\" class=\"" . klass($ip, $polls[10]) . "\">" . format_poll_name($polls[10]) . "</a>\n    </div>\n  </div>\n  <div class=\"row\">\n    <div class=\"three columns center\">\n      <a href=\"" . create_link($ip, $polls[11]) . "\" class=\"" . klass($ip, $polls[11]) . "\">" . format_poll_name($polls[11]) . "</a>\n    </div>\n    <div class=\"three columns center\">\n      <a href=\"" . create_link($ip, $polls[12]) . "\" class=\"" . klass($ip, $polls[12]) . "\">" . format_poll_name($polls[12]) . "</a>\n    </div>  \n    <div class=\"three columns center\">\n      <a href=\"" . create_link($ip, $polls[13]) . "\" class=\"" . klass($ip, $polls[13]) . "\">" . format_poll_name($polls[13]) . "</a>\n    </div>\n    <div class=\"three columns center\">\n      <a href=\"" . create_link($ip, $polls[14]) . "\" class=\"" . klass($ip, $polls[14]) . "\">" . format_poll_name($polls[14]) . "</a>\n    </div>\n  </div>\n</div>";
    ?>
<div class="row">
  <div class="tweleve columns content full-width">
    <h1>View all Year End Polls | <?php 
    echo ucwords(format_poll_name($poll));
    ?>
 </h1>
    <form action="year_end_poll_view_all.php" method="post">
      <select name="poll" onchange="javascript:this.form.submit();">
      <?php 
    $polls = get_poll_names();
    foreach ($polls as $pollvalue => $title) {
        if ($title == $poll) {
            echo '<option value="' . $title . '" selected="' . $title . '">' . ucwords(format_poll_name($title)) . '</option>' . "\n";
        } else {
            echo '<option value="' . $title . '">' . ucwords(format_poll_name($title)) . '</option>' . "\n";
        }
    }
    ?>
      </select>
    </form>
  <div class="row">
    <div class="tweleve columns content full-width">
    <?php 
    view_all_year_end_poll_for($poll);
    ?>
    </div>
  </div>
  <?php 
    view_all_year_end_poll_write_ins_for($poll);
    ?>