PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/view/SEIP143467/Gender/index.php

https://gitlab.com/Princy008/Princy_143467_B37_Atomic_project
PHP | 330 lines | 224 code | 94 blank | 12 comment | 38 complexity | 3e19af45b255fbbe7358372cefd43ae3 MD5 | raw file
  1. <?php
  2. require_once("../../../vendor/autoload.php");
  3. use App\BITM\SEIP143467\Message\Message;
  4. if(!isset( $_SESSION)) session_start();
  5. $message1=Message::message();
  6. use App\BITM\SEIP143467\Gender\Gender;
  7. $obj= new Gender();
  8. $all_person= $obj->index();
  9. ######################## pagination code block#1 of 2 start ######################################
  10. $recordCount= count($all_person);
  11. if(isset($_REQUEST['Page'])) $page = $_REQUEST['Page'];
  12. else if(isset($_SESSION['Page'])) $page = $_SESSION['Page'];
  13. else $page = 1;
  14. $_SESSION['Page']= $page;
  15. if(isset($_REQUEST['ItemsPerPage'])) $itemsPerPage = $_REQUEST['ItemsPerPage'];
  16. else if(isset($_SESSION['ItemsPerPage'])) $itemsPerPage = $_SESSION['ItemsPerPage'];
  17. else $itemsPerPage = 3;
  18. $_SESSION['ItemsPerPage']= $itemsPerPage;
  19. $pages = ceil($recordCount/$itemsPerPage);
  20. $someData = $obj->indexPaginator($page,$itemsPerPage);
  21. $serial = (($page-1) * $itemsPerPage) +1;
  22. ####################### pagination code block#1 of 2 end #########################################
  23. ####################### pagination code block#1 of 2 end #########################################
  24. ################## search block 1 of 5 start ##################
  25. if(isset($_REQUEST['search']) )$all_person = $obj->search($_REQUEST);
  26. $availableKeywords=$obj->getAllKeywords();
  27. $comma_separated_keywords= '"'.implode('","',$availableKeywords).'"';
  28. ################## search block 1 of 5 end ##################
  29. ################## search block 2 of 5 start ##################
  30. if(isset($_REQUEST['search']) ) {
  31. $someData = $obj->search($_REQUEST);
  32. // Utility::dd($someData);
  33. $serial = 1;
  34. }
  35. ################## search block 2 of 5 end ##################
  36. ?>
  37. <!--table-->
  38. <!DOCTYPE html>
  39. <html lang="en">
  40. <head>
  41. <meta charset="utf-8">
  42. <title> </title>
  43. <!-- Latest compiled and minified CSS -->
  44. <!-- Latest compiled and minified CSS -->
  45. <link rel="stylesheet" href="../../../resource/Bootstrap/css/bootstrap.min.css">
  46. <!-- Optional theme -->
  47. <link rel="stylesheet" href="../../../resource/Bootstrap/css/bootstrap-theme.min.css">
  48. <!-- <link rel="stylesheet" href="../../../resource/Bootstrap/css/booktitle.css"> -->
  49. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  50. <!-- required for search, block3 of 5 start -->
  51. <link rel="stylesheet" href="../../../resource/Bootstrap/js/jquery-ui.js">
  52. <script src="../../../resource/Bootstrap/js/jquery-1.12.4.js"></script>
  53. <script src="../../../resource/Bootstrap/js/jquery-ui.js"></script>
  54. <!-- required for search, block3 of 5 end -->
  55. </head>
  56. <style>
  57. .main{
  58. margin-top: 10%;
  59. margin-left: 15%;
  60. margin-right:15%;
  61. background-color: #679a9f;
  62. }
  63. body{
  64. background-image:url("../../../resource/assets/images/general3.jpg");
  65. background-repeat:no-repeat;
  66. background-size: 100% 925px;
  67. }
  68. </style>
  69. <body >
  70. <div class="container ">
  71. <div style="margin-top: 40px ;float: left;"> <a href="pdf.php" class="btn btn-primary btn-lg" role="button">Download As Pdf</a></br></br></div>&nbsp;&nbsp;&nbsp;
  72. <div style="margin-top: 40px ;float: left;"> <a href="xl.php" class="btn btn-danger btn-lg" role="button">Download As Xl</a></br></br>&nbsp;&nbsp;&nbsp;</div>
  73. <div style="margin-top: 40px ;float: left;"> <a href="email.php?list=1" class="btn btn-success btn-lg" role="button">Email To A Friend</a></br></br></div>
  74. <div style="margin-top: 40px ;float: right;"> <a href="../index.php" class="btn btn-info btn-info btn-lg" role="button">Go Atomic Project List</a></br></br></div>
  75. <div class="main">
  76. <div class="panel panel-default" >
  77. <div class="panel-heading">
  78. <div class="panel-heading">
  79. <h1 style="text-align: center"> Gender List</h1>
  80. <!-- required for search, block 4 of 5 start -->
  81. <div style="float: right;"> <form id="searchForm" action="index.php" method="get">
  82. <input type="text" value="" id="searchID" name="search" placeholder="Search" width="60" >
  83. <input type="checkbox" name="byTitle" checked >By Title
  84. <input type="checkbox" name="byAuthor" checked >By Author
  85. <input hidden type="submit" class="btn-primary" value="search">
  86. </form></div>
  87. <!-- required for search, block 4 of 5 end -->
  88. </div>
  89. </div>
  90. <div class="panel-body">
  91. <form action="trashmultiple.php" method="post" id="multiple">
  92. <div class="table-responsive" >
  93. </br></br></br></br>
  94. <table class="table">
  95. <thead>
  96. <tr>
  97. <th>Select all <input id="select_all" type="checkbox" value="select all"></th>
  98. <th>#</th>
  99. <th>ID</th>
  100. <th>Name</th>
  101. <th>Gender</th>
  102. <th>Action</th>
  103. </tr>
  104. </thead>
  105. <tbody>
  106. <tr>
  107. <?php
  108. $serial=0;
  109. foreach($someData as $result){
  110. $serial++; ?>
  111. <td><input type="checkbox" class="checkbox" name="mark[]" value="<?php echo $result['id']?>"></td>
  112. <td><?php echo $serial?></td>
  113. <td><?php echo $result['id']?></td>
  114. <td><?php echo $result['name']?></td>
  115. <td><?php echo $result['gender']?></td>
  116. <td><a href="view.php?id=<?php echo $result['id'] ?>" class="btn btn-primary" role="button">View</a>
  117. <a href="edit.php?id=<?php echo $result['id'] ?>" class="btn btn-info" role="button">Edit</a>
  118. <a href="delete.php?id=<?php echo $result['id'] ?>" class="btn btn-danger" role="button" id="delete" Onclick="return ConfirmDelete()">Delete</a>
  119. <a href="trash.php?id=<?php echo $result['id'] ?>" class="btn btn-info" role="button">Trash</a>
  120. </td>
  121. </tr>
  122. <?php }?>
  123. <a href="trashed.php" class="btn btn-info role="button"> View Trashed List</a> &nbsp;&nbsp;&nbsp;
  124. <a href="create.php " class="btn btn-info role="button"> Add new person</a>
  125. &nbsp;&nbsp;&nbsp;
  126. <button type="button" class="btn btn-primary" id="delete">Delete Selected</button>&nbsp;&nbsp;&nbsp;
  127. <button type="submit" class="btn btn-info">Trash Selected</button>
  128. </tbody>
  129. </table>
  130. <!-- ######################## pagination code block#2 of 2 start ###################################### -->
  131. <div align="left" class="container">
  132. <ul class="pagination">
  133. <?php
  134. $previous=$page-1;
  135. if($previous>0)
  136. {echo "<li><a href='index.php?Page=$previous'>" . "Previous" . '</a></li>';}
  137. for($i=1;$i<=$pages;$i++)
  138. {
  139. if($i==$page) echo '<li class="active"><a href="">'. $i . '</a></li>';
  140. else echo "<li><a href='?Page=$i'>". $i . '</a></li>';
  141. }
  142. $next=$page+1;
  143. if($next<=$pages)
  144. echo "<li><a href='index.php?Page=$next'>" . "Next" . '</a></li>';
  145. ?>
  146. <select class="form-control" name="ItemsPerPage" id="ItemsPerPage" onchange="javascript:location.href = this.value;" >
  147. <?php
  148. if($itemsPerPage==3 ) echo '<option value="?ItemsPerPage=3" selected >Show 3 Items Per Page</option>';
  149. else echo '<option value="?ItemsPerPage=3">Show 3 Items Per Page</option>';
  150. if($itemsPerPage==4 ) echo '<option value="?ItemsPerPage=4" selected >Show 4 Items Per Page</option>';
  151. else echo '<option value="?ItemsPerPage=4">Show 4 Items Per Page</option>';
  152. if($itemsPerPage==5 ) echo '<option value="?ItemsPerPage=5" selected >Show 5 Items Per Page</option>';
  153. else echo '<option value="?ItemsPerPage=5">Show 5 Items Per Page</option>';
  154. if($itemsPerPage==6 ) echo '<option value="?ItemsPerPage=6"selected >Show 6 Items Per Page</option>';
  155. else echo '<option value="?ItemsPerPage=6">Show 6 Items Per Page</option>';
  156. if($itemsPerPage==10 ) echo '<option value="?ItemsPerPage=10"selected >Show 10 Items Per Page</option>';
  157. else echo '<option value="?ItemsPerPage=10">Show 10 Items Per Page</option>';
  158. if($itemsPerPage==15 ) echo '<option value="?ItemsPerPage=15"selected >Show 15 Items Per Page</option>';
  159. else echo '<option value="?ItemsPerPage=15">Show 15 Items Per Page</option>';
  160. ?>
  161. </select>
  162. </ul>
  163. </div>
  164. <!-- ######################## pagination code block#2 of 2 end ###################################### -->
  165. <div id="confirmation_message" style="color:red;">
  166. <?php echo $message1 ?>
  167. </div>
  168. </div>
  169. </form>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <script>
  175. $(document).ready(function(){
  176. $(function() {
  177. $('#confirmation_message').delay(3000).fadeOut();
  178. });
  179. });
  180. function ConfirmDelete()
  181. {
  182. var x = confirm("Are you sure you want to delete?");
  183. if (x)
  184. return true;
  185. else
  186. return false;
  187. }
  188. $('#delete').on('click',function(){
  189. document.forms[0].action="deletemultiple.php";
  190. $('#multiple').submit();
  191. });
  192. $(function() {
  193. var availableTags = [
  194. <?php
  195. echo $comma_separated_keywords;
  196. ?>
  197. ];
  198. // Filter function to search only from the beginning of the string
  199. $( "#searchID" ).autocomplete({
  200. source: function(request, response) {
  201. var results = $.ui.autocomplete.filter(availableTags, request.term);
  202. results = $.map(availableTags, function (tag) {
  203. if (tag.toUpperCase().indexOf(request.term.toUpperCase()) === 0) {
  204. return tag;
  205. }
  206. });
  207. response(results.slice(0, 15));
  208. }
  209. });
  210. $( "#searchID" ).autocomplete({
  211. select: function(event, ui) {
  212. $("#searchID").val(ui.item.label);
  213. $("#searchForm").submit();
  214. }
  215. });
  216. });
  217. //select all checkboxes
  218. $("#select_all").change(function(){ //"select all" change
  219. var status = this.checked; // "select all" checked status
  220. $('.checkbox').each(function(){ //iterate all listed checkbox items
  221. this.checked = status; //change ".checkbox" checked status
  222. });
  223. });
  224. $('.checkbox').change(function(){ //".checkbox" change
  225. //uncheck "select all", if one of the listed checkbox item is unchecked
  226. if(this.checked == false){ //if this item is unchecked
  227. $("#select_all")[0].checked = false; //change "select all" checked status to false
  228. }
  229. //check "select all" if all checkbox items are checked
  230. if ($('.checkbox:checked').length == $('.checkbox').length ){
  231. $("#select_all")[0].checked = true; //change "select all" checked status to true
  232. }
  233. });
  234. </script>
  235. </body>
  236. </html>