PageRenderTime 28ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/view/SEIP143203/Birthday/index.php

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