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

Source for file vote.tpl.php

Documentation is available at vote.tpl.php

  1. <?php response_header('Vote')?>
  2. <h1>Vote in a PEAR Election</h1>
  3.  
  4. <?php if (isset($error&& !empty($error))?>
  5. <div class="errors"><?php echo $error?></div>
  6. <?php endif; // if (isset($error)): ?>
  7. <?php if (isset($info&& !empty($info))?>
  8. <div class="success"><?php echo $info?></div>
  9. <?php endif; // if (isset($info)): ?>
  10. Current date is <strong><?php echo date('Y-m-d')?></strong>
  11.  
  12. <?php if (count($currentelections))?>
  13. <h2>Current Elections:</h2>
  14. <table>
  15.  <tr>
  16.   <th class="form-label_top">Active</th>
  17.   <th class="form-label_top">Election Issue</th>
  18.   <th class="form-label_top">Election dates</th>
  19.   <th class="form-label_top">Have you voted?</th>
  20.  </tr>
  21. <?php
  22. foreach ($currentelections as $election):
  23.     $class $election['active'== 'yes' 'vote-active' 'vote-inactive';
  24.     if ($election['voted'== 'yes'{
  25.         $class 'vote-complete';
  26.     }
  27. ?>
  28. <tr>
  29.  <td class="<?php echo $class?>"><?php echo $election['active']?></td>
  30.  <?php if ($election['voted'== 'yes')?>
  31.  <td class="<?php echo $class?>"><?php echo htmlspecialchars($election['purpose'])?></td>
  32.  <?php else: // if ($election['voted'] == 'yes'): ?>
  33.  <td class="<?php echo $class?>"><a href="/election/info.php?election=<?php
  34.     echo $election['id']?>&vote=1"><?php echo htmlspecialchars($election['purpose'])?></a></td>
  35.  <?php endif; // if ($election['voted'] == 'yes'): ?>
  36.  <td class="<?php echo $class?>"><?php echo $election['votestart'' until ' .
  37.     $election['voteend']?></td>
  38.  <td class="<?php echo $class?>"><?php echo $election['voted']?></td>
  39. </tr>
  40. <?php
  41. endforeach; // foreach ($currentelections as $election):
  42. ?>
  43. </table>
  44. <?php endif; // if (count($currentelections))
  45. require PEARWEB_TEMPLATEDIR . '/election/results.tpl.php';
  46. if (count($allelections)):
  47. if ($retrieval && isset($info))?>
  48. <h3>Your vote information:</h3>
  49. <table>
  50.  <tr>
  51.   <td class="form-input">
  52.    <table>
  53.     <?php foreach ($info['choices'as $choice)?>
  54.     <tr>
  55.      <?php if (in_array($choice['choice']$info['vote']true))?>
  56.      <input type="hidden" name="vote[]" value="<?php echo $choice['choice']?>" />
  57.      <td><strong>X</strong></td>
  58.      <?php else: // if (in_array($choice['choice'], $info['vote'], true)): ?>
  59.      <td>&nbsp;</td>
  60.      <?php endif; // if (in_array($choice['choice'], $info['vote'], true)): ?>
  61.     <td>
  62.      <?php echo htmlspecialchars($choice['summary'])?>
  63.     </td>
  64.    </tr>
  65.    <?php endforeach; // foreach ($info['choices'] as $choice): ?>
  66.    </table>
  67.   </td>
  68.  </tr>
  69. </table>
  70. <?php
  71. if ($info['vote'== array('(abstain)')) {
  72.     echo '<p><strong>(ABSTAIN)</strong></p>';
  73. };
  74. endif; // if ($retrieval && isset($info)) ?>
  75. <h3>Retrieve your vote in an election:</h3>
  76. <form name="checkvote" action="/election/index.php" method="post">
  77. <table>
  78.  <tr>
  79.   <th class="form-label_top">Election Issue</th>
  80.   <th class="form-label_top">Vote Salt (was emailed to you)</th>
  81.  </tr>
  82.  <tr>
  83.   <td class="form-input">
  84.    <select name="election">
  85.    <?php foreach ($allelections as $election)?>
  86.     <option value="<?php echo $election['id']?>"><?php echo htmlspecialchars($election['purpose'])?></option>
  87.    <?php endforeach; // foreach ($allelections as $elections): ?>
  88.    </select>
  89.   </td>
  90.   <td class="form-input">
  91.    <input type="text" size="17" name="salt" value="<?php echo date('YmdHis'mt_rand(1,999?>"/>
  92.   </td>
  93.  </tr>
  94. </table>
  95. <input type="submit" value="Retrieve Vote" />
  96. </form>
  97. <?php endif; // if (count($allelections))
  98. response_footer();

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