pearweb_election
[ class tree: pearweb_election ] [ index: pearweb_election ] [ all elements ]

Source for file showresults.tpl.php

Documentation is available at showresults.tpl.php

  1. <?php response_header('Results'); ?>
  2. <h2>Election Results for <?php echo $info['purpose'] ?>:</h2>
  3. <table>
  4.  <tr>
  5.   <th class="form-label_left">Election Issue</td>
  6.   <td class="form-input"><?php echo $info['detail'] ?></td>
  7.  </tr>
  8.  <tr>
  9.   <th class="form-label_left">Eligible Voters</td>
  10.   <td class="form-input"><?php echo $info['eligiblevoters'] == 1 ? 
  11.     'PEAR Developers' : 'General PHP Public' ?></td>
  12.  </tr>
  13.  <tr>
  14.   <th class="form-label_left">Election dates</th>
  15.   <td class="form-input"><?php echo $info['votestart'] . ' until ' .
  16.     $info['voteend']; ?></td>
  17.  </tr>
  18.  <tr>
  19.   <th class="form-label_left">Voter turnout</th>
  20.   <td class="form-input"><?php echo number_format($info['turnout'] * 100, 2) ?>%</td>
  21.  </tr>
  22.  <?php
  23.  
  24.      $voteEnd     = strtotime($info['voteend']);
  25.      $currentDate = strtotime(date('Y-m-d'));
  26.  
  27.      if ($voteEnd < $currentDate) {
  28.  ?>
  29.  <tr>
  30.   <th class="form-label_left">Results (<?php echo count($info['winners']) ?> winners)</th>
  31.   <td class="form-input">
  32.    <table>
  33.     <tr><th>Vote percentage</th><th>Choice</th><th>Votes</th></td></tr>
  34.    <?php
  35.   foreach ($info['results'] as $i => $result) {
  36.       if (in_array($result['choice'], $info['winners'])) {
  37.           echo '<tr><td class="vote-winner">' . number_format($result['votepercent'] * 100, 2) .
  38.               '%</td><td class="vote-winner"><a href="' . $result['summary_link'] . '">' .
  39.               htmlspecialchars($result['summary']) .
  40.               '</a></td><td class="vote-winner">' . number_format($result['votetotal']) . 
  41.               '</td></tr>';
  42.       } else {
  43.           echo '<tr><td>' . number_format($result['votepercent'] * 100, 2) .
  44.               '%</td><td><a href="' . $result['summary_link'] . '">' .
  45.               htmlspecialchars($result['summary']) .
  46.               '</a></td><td>' . number_format($result['votetotal']) . 
  47.               '</td></tr>';
  48.       }
  49.   }
  50.    ?>
  51.     <tr><td><?php echo number_format($info['abstain'] * 100, 2) ?>%</td><td>Abstained</td><td><?php echo number_format($info['abstaincount']) ?></td></tr>
  52.    </table>
  53.   </td>
  54.  </tr>
  55.  <?php 
  56.      }
  57.  
  58.      if ($voteEnd > $currentDate) { 
  59.  
  60.  ?>
  61.  <tr>
  62.   <th class="form-label_left">Status</th>
  63.   <td class="form-input">In Progress until : <?php echo date(DateTime::RSS, $voteEnd); ?></td>
  64.  </tr>
  65.  <?php } ?>
  66. </table>
  67. <a href="/election/"><< Back to elections list</a>
  68. <?php response_footer();

Documentation generated on Mon, 11 Mar 2019 15:34:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.