PageRenderTime 66ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/voting/index.php

https://github.com/damanlovett/SEAHO
PHP | 193 lines | 174 code | 12 blank | 7 comment | 24 complexity | 7597413e367811da4baf73e124bbf558 MD5 | raw file
  1. <?php
  2. // technocurve arc 3 php bv block1/3 start
  3. $color1 = "#FFFFFF";
  4. $color2 = "#DEDEDE";
  5. $color = $color1;
  6. // technocurve arc 3 php bv block1/3 end
  7. ?><?php require_once('../../Connections/Directory.php'); ?>
  8. <?php require_once('../includefiles/init.php'); ?>
  9. <?php require_once('../includefiles/AdminLogin.php'); ?>
  10. <?php
  11. $currentPage = $_SERVER["PHP_SELF"];
  12. $maxRows_rsBallot = 10;
  13. $pageNum_rsBallot = 0;
  14. if (isset($_GET['pageNum_rsBallot'])) {
  15. $pageNum_rsBallot = $_GET['pageNum_rsBallot'];
  16. }
  17. $startRow_rsBallot = $pageNum_rsBallot * $maxRows_rsBallot;
  18. if(isset($_POST['Submit'])) {
  19. $title = $_POST['title'];
  20. $sortby = $_POST['sortby'];
  21. mysql_select_db($database_Directory, $Directory);
  22. $query_rsBallot = "SELECT vote_ballot.id, vote_ballot.`description`, vote_ballot.close, vote_ballot.ballot_id, vote_ballot.title, DATE_FORMAT(vote_ballot.due_date,'%a, %M %d, %Y') AS due_date, DATE_FORMAT(vote_ballot.created_on,'%a, %M %d, %Y') AS created_date, vote_ballot.`delete` FROM vote_ballot WHERE vote_ballot.`delete` != 1 AND vote_ballot.title LIKE '%".$title."%' ORDER BY ".$sortby."";
  23. $query_limit_rsBallot = sprintf("%s LIMIT %d, %d", $query_rsBallot, $startRow_rsBallot, $maxRows_rsBallot);
  24. $rsBallot = mysql_query($query_limit_rsBallot, $Directory) or die(mysql_error());
  25. $row_rsBallot = mysql_fetch_assoc($rsBallot);
  26. } else {
  27. mysql_select_db($database_Directory, $Directory);
  28. $query_rsBallot = "SELECT vote_ballot.id, vote_ballot.`description`, vote_ballot.close, vote_ballot.ballot_id, vote_ballot.title, DATE_FORMAT(vote_ballot.due_date,'%a, %M %d, %Y') AS due_date, DATE_FORMAT(vote_ballot.created_on,'%a, %M %d, %Y') AS created_date, vote_ballot.`delete`, vote_ballot.due_date AS sort_date FROM vote_ballot WHERE vote_ballot.`delete` != 1 ORDER BY sort_date";
  29. $query_limit_rsBallot = sprintf("%s LIMIT %d, %d", $query_rsBallot, $startRow_rsBallot, $maxRows_rsBallot);
  30. $rsBallot = mysql_query($query_limit_rsBallot, $Directory) or die(mysql_error());
  31. $row_rsBallot = mysql_fetch_assoc($rsBallot);
  32. }
  33. if (isset($_GET['totalRows_rsBallot'])) {
  34. $totalRows_rsBallot = $_GET['totalRows_rsBallot'];
  35. } else {
  36. $all_rsBallot = mysql_query($query_rsBallot);
  37. $totalRows_rsBallot = mysql_num_rows($all_rsBallot);
  38. }
  39. $totalPages_rsBallot = ceil($totalRows_rsBallot/$maxRows_rsBallot)-1;
  40. $queryString_rsBallot = "";
  41. if (!empty($_SERVER['QUERY_STRING'])) {
  42. $params = explode("&", $_SERVER['QUERY_STRING']);
  43. $newParams = array();
  44. foreach ($params as $param) {
  45. if (stristr($param, "pageNum_rsBallot") == false &&
  46. stristr($param, "totalRows_rsBallot") == false) {
  47. array_push($newParams, $param);
  48. }
  49. }
  50. if (count($newParams) != 0) {
  51. $queryString_rsBallot = "&" . htmlentities(implode("&", $newParams));
  52. }
  53. }
  54. $queryString_rsBallot = sprintf("&totalRows_rsBallot=%d%s", $totalRows_rsBallot, $queryString_rsBallot);
  55. ?>
  56. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  57. <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/adminTemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
  58. <head>
  59. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  60. <!-- InstanceBeginEditable name="doctitle" -->
  61. <title>Voting Manager</title>
  62. <!-- InstanceEndEditable -->
  63. <link href="../styles/mainStyle.css" rel="stylesheet" type="text/css" />
  64. <link href="../styles/table.css" rel="stylesheet" type="text/css" />
  65. <link href="../styles/navLeft.css" rel="stylesheet" type="text/css" />
  66. <!-- InstanceBeginEditable name="head" -->
  67. <script type="text/JavaScript">
  68. <!--
  69. function MM_goToURL() { //v3.0
  70. var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  71. for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
  72. }
  73. //-->
  74. </script>
  75. <!-- InstanceEndEditable -->
  76. </head>
  77. <body>
  78. <div id="header"><?php require_once('../includefiles/userInfo.php'); ?></div>
  79. <div id="sidebar"><?php require_once('../includefiles/navPage.php'); ?></div>
  80. <div id="mainContent">
  81. <div id="mainText">
  82. <h2><!-- InstanceBeginEditable name="PageTitle" --><span class="pageHeadVoting">Voting Central </span><!-- InstanceEndEditable --></h2>
  83. <!-- InstanceBeginEditable name="PageContent" -->
  84. <div id="pageInformation">
  85. <form method="post" name="search" id="search">
  86. <table border="0" cellpadding="3" cellspacing="0">
  87. <tr align="left" valign="middle">
  88. <td nowrap="nowrap"><label><strong>Search by </strong><input name="title" type="text" id="title" onFocus="if(this.value=='----- Title ----- ')this.value='';" value="----- Title ----- " size="40"/></label> </td>
  89. <td>&nbsp;</td>
  90. <td nowrap="nowrap"><select name="sortby" id="sortby">
  91. <option value="vote_ballot.id">--- Sort by ---</option>
  92. <option value="vote_ballot.title">Report</option>
  93. <option value="vote_ballot.due_date">Due Date</option>
  94. <?php
  95. do {
  96. ?>
  97. <?php
  98. } while ($row_rsProgramsList = mysql_fetch_assoc($rsProgramsList));
  99. ?>
  100. </select></td>
  101. <td>&nbsp;</td>
  102. <td><input name="Submit" type="submit" class="submitButton" id="Submit" value="Search" /></td>
  103. <td><label>
  104. <input name="Reset" type="button" class="submitButton" id="Reset" onclick="MM_goToURL('parent','index.php');return document.MM_returnValue" value="Reset List" />
  105. </label></td>
  106. </tr>
  107. </table>
  108. </form>
  109. </div>
  110. <?php if ($totalRows_rsBallot == 0) { // Show if recordset empty ?>
  111. <p class="commenttext">No Ballots Founds!</p>
  112. <?php } // Show if recordset empty ?>
  113. <?php if ($totalRows_rsBallot > 0) { // Show if recordset not empty ?>
  114. <table border="0" cellpadding="5" cellspacing="0" class="tableborder">
  115. <tr>
  116. <td colspan="3" nowrap="nowrap" class="tableTop"><?php echo ($startRow_rsBallot + 1) ?> to <?php echo min($startRow_rsBallot + $maxRows_rsBallot, $totalRows_rsBallot) ?> of <?php echo $totalRows_rsBallot ?> </td>
  117. <td class="tableTop">&nbsp;</td>
  118. <td class="tableTop">&nbsp;</td>
  119. <td class="tableTop">&nbsp;</td>
  120. <td class="tableTop">&nbsp;</td>
  121. <td class="tableTop">&nbsp;</td>
  122. <td colspan="2" nowrap="nowrap" class="tableTop"><?php if ($pageNum_rsBallot > 0) { // Show if not first page ?>
  123. <a href="<?php printf("%s?pageNum_rsBallot=%d%s", $currentPage, max(0, $pageNum_rsBallot - 1), $queryString_rsBallot); ?>">Previous</a>
  124. <?php } // Show if not first page ?>&nbsp;&nbsp;<?php if ($pageNum_rsBallot < $totalPages_rsBallot) { // Show if not last page ?>
  125. <a href="<?php printf("%s?pageNum_rsBallot=%d%s", $currentPage, min($totalPages_rsBallot, $pageNum_rsBallot + 1), $queryString_rsBallot); ?>">Next</a>
  126. <?php } // Show if not last page ?></td>
  127. </tr>
  128. <tr>
  129. <th>Report </th>
  130. <th>&nbsp;</th>
  131. <th nowrap="nowrap">Description </th>
  132. <th>&nbsp;</th>
  133. <th>Status</th>
  134. <th>&nbsp;</th>
  135. <th>Created on</th>
  136. <th>&nbsp;</th>
  137. <th nowrap="nowrap">Vote Due Date </th>
  138. <th><div align="center">&nbsp;</div></th>
  139. </tr>
  140. <?php do { ?>
  141. <tr <?php
  142. // technocurve arc 3 php bv block2/3 start
  143. echo " style=\"background-color:$color\"";
  144. // technocurve arc 3 php bv block2/3 end
  145. ?> >
  146. <td nowrap="nowrap"><a href="details.php?recordID=<?php echo $row_rsBallot['ballot_id']; ?>"><?php echo $row_rsBallot['title']; ?></a></td>
  147. <td>&nbsp;</td>
  148. <td nowrap="nowrap"><?php echo substr($row_rsBallot['description'],0, 30).". . ."; ?></td>
  149. <td>&nbsp;</td>
  150. <td><?php echo OnOffSwitch($row_rsBallot['close'],"------","Passed","Failed","Tabled");?></td>
  151. <td>&nbsp;</td>
  152. <td><?php echo $row_rsBallot['created_date']; ?></td>
  153. <td>&nbsp;</td>
  154. <td nowrap="nowrap"><?php echo $row_rsBallot['due_date']; ?></td>
  155. <td nowrap="nowrap">&nbsp;</td>
  156. </tr>
  157. <?php
  158. // technocurve arc 3 php bv block3/3 start
  159. if ($color == $color1) {
  160. $color = $color2;
  161. } else {
  162. $color = $color1;
  163. }
  164. // technocurve arc 3 php bv block3/3 end
  165. ?>
  166. <?php } while ($row_rsBallot = mysql_fetch_assoc($rsBallot)); ?>
  167. <tr>
  168. <td colspan="10" nowrap="nowrap" class="tableBottom">&nbsp;</td>
  169. </tr>
  170. </table>
  171. <?php } // Show if recordset not empty ?>
  172. <p>&nbsp;</p>
  173. <!-- InstanceEndEditable --></div>
  174. </div>
  175. <div id="footer"><?php require_once('../includefiles/footer.php'); ?>
  176. </div>
  177. </body>
  178. <!-- InstanceEnd --></html>
  179. <?php
  180. mysql_free_result($rsBallot);
  181. ?>