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

/views/SEIP137417/Birthday/index.php

https://gitlab.com/Nilufarjahan/LabExam8
PHP | 455 lines | 344 code | 104 blank | 7 comment | 35 complexity | f673fe6ee1efde5a6e7af0b6717dfc06 MD5 | raw file
  1. <?php
  2. require_once("../../../vendor/autoload.php");
  3. use App\Birthday\Birthday;
  4. use App\Message\Message;
  5. use App\Utility\Utility;
  6. $orgObject = new Birthday();
  7. $allData = $orgObject->index("obj");
  8. ################## search block 1 of 5 start ##################
  9. if(isset($_REQUEST['search']) )$allData = $orgObject->search($_REQUEST);
  10. $availableKeywords=$orgObject->getAllKeywords();
  11. $comma_separated_keywords= '"'.implode('","',$availableKeywords).'"';
  12. ################## search block 1 of 5 end ##################
  13. ######################## pagination code block#1 of 2 start ######################################
  14. $recordCount= count($allData);
  15. if(isset($_REQUEST['Page'])) $page = $_REQUEST['Page'];
  16. else if(isset($_SESSION['Page'])) $page = $_SESSION['Page'];
  17. else $page = 1;
  18. $_SESSION['Page']= $page;
  19. if(isset($_REQUEST['ItemsPerPage'])) $itemsPerPage = $_REQUEST['ItemsPerPage'];
  20. else if(isset($_SESSION['ItemsPerPage'])) $itemsPerPage = $_SESSION['ItemsPerPage'];
  21. else $itemsPerPage = 3;
  22. $_SESSION['ItemsPerPage']= $itemsPerPage;
  23. $pages = ceil($recordCount/$itemsPerPage);
  24. $someData = $orgObject->indexPaginator($page,$itemsPerPage);
  25. $serial = (($page-1) * $itemsPerPage) +1;
  26. ####################### pagination code block#1 of 2 end #########################################
  27. ################## search block 2 of 5 start ##################
  28. if(isset($_REQUEST['search']) ) {
  29. $someData = $orgObject->search($_REQUEST);
  30. $serial = 1;
  31. }
  32. ################## search block 2 of 5 end ##################
  33. ?>
  34. <!DOCTYPE html>
  35. <html>
  36. <head>
  37. <meta charset="utf-8">
  38. <meta name="viewport" content="width=device-width, initial-scale=1">
  39. <title>Atomic Project</title>
  40. <link href="../../../resource/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  41. <link href="../../../resource/bootstrap/css/datepicker3.css" rel="stylesheet">
  42. <link href="../../../resource/bootstrap/css/styles.css" rel="stylesheet">
  43. <link rel="stylesheet" href="../../../resource/bootstrap/css/font-icons/entypo/css/entypo.css">
  44. <link rel="stylesheet" href="../../../resource/bootstrap/css/font-icons/font-awesome/css/font-awesome.min.css">
  45. <script src="../../../resource/bootstrap/js/lumino.glyphs.js"></script>
  46. <script>
  47. $(document).ready(function(){
  48. $("#msg").delay(2500).fadeOut("slow");
  49. });
  50. </script>
  51. <!-- required for search, block3 of 5 start -->
  52. <link rel="stylesheet" href="../../../resource/bootstrap/css/jquery-ui.css">
  53. <script src="../../../resource/bootstrap/js/jquery-1.12.4.js"></script>
  54. <script src="../../../resource/bootstrap/js/jquery-ui.js"></script>
  55. <!-- required for search, block3 of 5 end -->
  56. </head>
  57. <body>
  58. <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  59. <div class="container-fluid">
  60. <div class="navbar-header">
  61. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
  62. <span class="sr-only">Toggle navigation</span>
  63. <span class="icon-bar"></span>
  64. <span class="icon-bar"></span>
  65. <span class="icon-bar"></span>
  66. </button>
  67. <a class="navbar-brand" href="#"><span>Atomic </span>Project</a>
  68. </div>
  69. </div><!-- /.container-fluid -->
  70. </nav>
  71. <div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
  72. <ul class="nav menu">
  73. <li class="has-sub">
  74. <a href="#">
  75. <i class="fa fa-book"></i>
  76. <span class="title">Book Title</span>
  77. </a>
  78. <ul>
  79. <li>
  80. <a href="../BookTitle/create.php">
  81. <span class="title">Add New</span>
  82. </a>
  83. </li>
  84. <li>
  85. <a href="../BookTitle/index.php">
  86. <span class="title">View List</span>
  87. </a>
  88. </li>
  89. </ul>
  90. </li>
  91. <li class="has-sub">
  92. <a href="#">
  93. <i class="fa fa-birthday-cake"></i>
  94. <span class="title">Birth Day</span>
  95. </a>
  96. <ul>
  97. <li>
  98. <a href="../Birthday/create.php">
  99. <span class="title">Add New</span>
  100. </a>
  101. </li>
  102. <li>
  103. <a href="../Birthday/index.php">
  104. <span class="title">View List</span>
  105. </a>
  106. </li>
  107. </ul>
  108. </li>
  109. <li class="has-sub">
  110. <a href="#">
  111. <i class="fa fa-envelope"></i>
  112. <span class="title">Email Addess</span>
  113. </a>
  114. <ul>
  115. <li>
  116. <a href="../Email/create.php">
  117. <span class="title">Add New</span>
  118. </a>
  119. </li>
  120. <li>
  121. <a href="../Email/index.php">
  122. <span class="title">View List</span>
  123. </a>
  124. </li>
  125. </ul>
  126. </li>
  127. <li class="has-sub">
  128. <a href="#">
  129. <i class="fa fa-male"></i>
  130. <span class="title">Gender</span>
  131. </a>
  132. <ul>
  133. <li>
  134. <a href="../Gender/create.php">
  135. <span class="title">Add New</span>
  136. </a>
  137. </li>
  138. <li>
  139. <a href="../Gender/index.php">
  140. <span class="title">View List</span>
  141. </a>
  142. </li>
  143. </ul>
  144. </li>
  145. <li class="has-sub">
  146. <a href="#">
  147. <i class="fa fa-camera"></i>
  148. <span class="title">Profile Picture</span>
  149. </a>
  150. <ul>
  151. <li>
  152. <a href="../ProfilePicture/create.php">
  153. <span class="title">Add New</span>
  154. </a>
  155. </li>
  156. <li>
  157. <a href="../ProfilePicture/index.php">
  158. <span class="title">View List</span>
  159. </a>
  160. </li>
  161. </ul>
  162. </li>
  163. <li class="has-sub">
  164. <a href="#">
  165. <i class="fa fa-tree"></i>
  166. <span class="title">City Name</span>
  167. </a>
  168. <ul>
  169. <li>
  170. <a href="../City/create.php">
  171. <span class="title">Add New</span>
  172. </a>
  173. </li>
  174. <li>
  175. <a href="../City/index.php">
  176. <span class="title">View List</span>
  177. </a>
  178. </li>
  179. </ul>
  180. </li>
  181. <li class="has-sub">
  182. <a href="#">
  183. <i class="fa fa-tree"></i>
  184. <span class="title">Hobbies</span>
  185. </a>
  186. <ul>
  187. <li>
  188. <a href="../Hobbies/create.php">
  189. <span class="title">Add New</span>
  190. </a>
  191. </li>
  192. <li>
  193. <a href="../Hobbies/index.php">
  194. <span class="title">View List</span>
  195. </a>
  196. </li>
  197. </ul>
  198. </li>
  199. <li class="has-sub">
  200. <a href="#">
  201. <i class="fa fa-tree"></i>
  202. <span class="title">Summary Of Organization</span>
  203. </a>
  204. <ul>
  205. <li>
  206. <a href="../SummaryOfOrganization/create.php">
  207. <span class="title">Add New</span>
  208. </a>
  209. </li>
  210. <li>
  211. <a href="../SummaryOfOrganization/index.php">
  212. <span class="title">View List</span>
  213. </a>
  214. </li>
  215. </ul>
  216. </li>
  217. </ul>
  218. </div><!--/.sidebar-->
  219. <div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
  220. <div class="row">
  221. <ol class="breadcrumb">
  222. <li><a href="#"><svg class="glyph stroked home"><use xlink:href="#stroked-home"></use></svg></a></li>
  223. <li class="active">Icons</li>
  224. </ol>
  225. </div><!--/.row-->
  226. <table>
  227. <tr>
  228. <td width="450">
  229. <a href="pdf.php" class="btn btn-primary" role="button">Download as PDF</a>
  230. <a href="xl.php" class="btn btn-primary" role="button">Download as XL</a>
  231. <a href="email.php?list=1" class="btn btn-primary" role="button">Email to friend</a>
  232. </td>
  233. <td width="150">
  234. <!-- required for search, block 4 of 5 start -->
  235. <form id="searchForm" action="index.php" method="get">
  236. <input type="text" value="" id="searchID" name="search" placeholder="Search" width="60" >
  237. <input type="checkbox" name="byName" checked >By Name
  238. <input type="checkbox" name="byBirthday" checked >By Birthday
  239. <input hidden type="submit" class="btn-primary" value="search">
  240. </form>
  241. <!-- required for search, block 4 of 5 end -->
  242. </td>
  243. </tr>
  244. </table>
  245. <div class="row">
  246. <div class="col-lg-12">
  247. <div class="panel panel-default">
  248. <div class="panel-heading">Birthday Table </div>
  249. <div class="panel-body">
  250. <div class="col-md-12">
  251. <h2>Birthday Information</h2>
  252. <table class="table table-bordered">
  253. <thead>
  254. <tr>
  255. <th style="text-align: center">Serial</th>
  256. <th style="text-align: center">Id</th>
  257. <th style="text-align: center">Name</th>
  258. <th style="text-align: center">Birthday</th>
  259. <th style="text-align: center">Option</th>
  260. </tr>
  261. </thead>
  262. <tbody>
  263. <tr>
  264. <?php
  265. foreach($allData as $oneData)
  266. {
  267. ?>
  268. <tr>
  269. <td><?php echo ++$serial ?> </td>
  270. <td><?php echo $oneData->id ?> </td>
  271. <td><?php echo $oneData->name ?></td>
  272. <td><?php echo $oneData->birthday?></td>
  273. <?php echo "<td> <a href=\"edits.php?id=$oneData->id\"class=\"btn btn-info\" role=\"button\">Edit</a> ";?>
  274. <?php echo " <a href=\"delete.php?id=$oneData->id\"class=\"btn btn-danger\" role=\"button\">Delete</a> ";?>
  275. <?php echo " <a href=\"trash.php?id=$oneData->id\"class=\"btn btn-danger\" role=\"button\">Trash</a> </td> ";?>
  276. </tr>
  277. <?php }
  278. ?>
  279. </tbody>
  280. </table>
  281. </div>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. </div><!-- /.col-->
  287. <!-- ######################## pagination code block#2 of 2 start ###################################### -->
  288. <div align="center" class="container">
  289. <ul class="pagination">
  290. <?php
  291. $pageMinusOne = $page-1;
  292. $pagePlusOne = $page+1;
  293. if($page>$pages) Utility::redirect("index.php?Page=$pages");
  294. if($page>1) echo "<li><a href='index.php?Page=$pageMinusOne'>" . "Previous" . "</a></li>";
  295. for($i=1;$i<=$pages;$i++)
  296. {
  297. if($i==$page) echo '<li class="active"><a href="">'. $i . '</a></li>';
  298. else echo "<li><a href='?Page=$i'>". $i . '</a></li>';
  299. }
  300. if($page<$pages) echo "<li><a href='index.php?Page=$pagePlusOne'>" . "Next" . "</a></li>";
  301. ?>
  302. <select class="form-control" name="ItemsPerPage" id="ItemsPerPage" onchange="javascript:location.href = this.value;" >
  303. <?php
  304. if($itemsPerPage==3 ) echo '<option value="?ItemsPerPage=3" selected >Show 3 Items Per Page</option>';
  305. else echo '<option value="?ItemsPerPage=3">Show 3 Items Per Page</option>';
  306. if($itemsPerPage==4 ) echo '<option value="?ItemsPerPage=4" selected >Show 4 Items Per Page</option>';
  307. else echo '<option value="?ItemsPerPage=4">Show 4 Items Per Page</option>';
  308. if($itemsPerPage==5 ) echo '<option value="?ItemsPerPage=5" selected >Show 5 Items Per Page</option>';
  309. else echo '<option value="?ItemsPerPage=5">Show 5 Items Per Page</option>';
  310. if($itemsPerPage==6 ) echo '<option value="?ItemsPerPage=6"selected >Show 6 Items Per Page</option>';
  311. else echo '<option value="?ItemsPerPage=6">Show 6 Items Per Page</option>';
  312. if($itemsPerPage==10 ) echo '<option value="?ItemsPerPage=10"selected >Show 10 Items Per Page</option>';
  313. else echo '<option value="?ItemsPerPage=10">Show 10 Items Per Page</option>';
  314. if($itemsPerPage==15 ) echo '<option value="?ItemsPerPage=15"selected >Show 15 Items Per Page</option>';
  315. else echo '<option value="?ItemsPerPage=15">Show 15 Items Per Page</option>';
  316. ?>
  317. </select>
  318. </ul>
  319. </div>
  320. <!-- ######################## pagination code block#2 of 2 end ###################################### -->
  321. </body>
  322. </html>
  323. <!-- required for search, block 5 of 5 start -->
  324. <script>
  325. $(function() {
  326. var availableTags = [
  327. <?php
  328. echo $comma_separated_keywords;
  329. ?>
  330. ];
  331. // Filter function to search only from the beginning of the string
  332. $( "#searchID" ).autocomplete({
  333. source: function(request, response) {
  334. var results = $.ui.autocomplete.filter(availableTags, request.term);
  335. results = $.map(availableTags, function (tag) {
  336. if (tag.toUpperCase().indexOf(request.term.toUpperCase()) === 0) {
  337. return tag;
  338. }
  339. });
  340. response(results.slice(0, 15));
  341. }
  342. });
  343. $( "#searchID" ).autocomplete({
  344. select: function(event, ui) {
  345. $("#searchID").val(ui.item.label);
  346. $("#searchForm").submit();
  347. }
  348. });
  349. });
  350. </script>
  351. <!-- required for search, block5 of 5 end -->