PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/views/all_patient.php

https://gitlab.com/sharadmohajan/xyz
PHP | 291 lines | 245 code | 30 blank | 16 comment | 19 complexity | 422bdfae7ce6fdb1dd9f77e07b090c8c MD5 | raw file
  1. <?php
  2. session_start();
  3. include_once ('../vendor/autoload.php');
  4. //var_dump($_POST);
  5. use App\Patient\Patient;
  6. use App\Utility\Utility;
  7. use App\Message\Message;
  8. $patient = new Patient();
  9. $allName= $patient->allName();
  10. $allRoom= $patient->allRoom();
  11. //$allinfo=$book->allTD();
  12. //Utility::dd($allinfo);
  13. $commaSeparated= implode('","',$allName);
  14. $commaSeparatedString= implode('","',$allRoom);
  15. //$commaSeparatedStrings= implode('","',$allinfo);
  16. //Utility::dd($commaSeparatedString);
  17. $allTD= '"'.$commaSeparated.$commaSeparatedString.'"';
  18. $totalItem=$patient->count();
  19. //Utility::dd($totalItem);
  20. if(array_key_exists('itemPerPage',$_SESSION)) {
  21. if(array_key_exists('itemPerPage',$_GET)){
  22. $_SESSION['itemPerPage']=$_GET['itemPerPage'];
  23. }
  24. }
  25. else{
  26. $_SESSION['itemPerPage']=5;
  27. }
  28. $itemPerPage= $_SESSION['itemPerPage'];
  29. $noOfPage=ceil($totalItem/$itemPerPage);
  30. //Utility::d($noOfPage);
  31. $pagination="";
  32. if(array_key_exists('pageNo',$_GET)){
  33. $pageNo= $_GET['pageNo'];
  34. }else {
  35. $pageNo = 1;
  36. }
  37. for($i=1;$i<=$noOfPage;$i++){
  38. $active=($i==$pageNo)?"active":"";
  39. $pagination.="<li class='$active'><a href='patient_info.php?pageNo=$i'>$i</a></li>";
  40. }
  41. $pageStartFrom=$itemPerPage*($pageNo-1);
  42. if(strtoupper($_SERVER['REQUEST_METHOD']=='GET')) {
  43. $allInfo = $patient->paginator($pageStartFrom, $itemPerPage);
  44. }
  45. if(strtoupper($_SERVER['REQUEST_METHOD']=='POST')) {
  46. //Utility::dd($_POST);
  47. //die();
  48. $allInfo = $patient->prepare($_POST)->index();
  49. }
  50. if(strtoupper(($_SERVER['REQUEST_METHOD']=='GET')) && isset($_GET['search'])) {
  51. $allInfo = $patient->prepare($_GET)->index();
  52. }
  53. ?>
  54. <!DOCTYPE html>
  55. <html xmlns="http://www.w3.org/1999/html">
  56. <head>
  57. <meta name="viewport" content="width=device-width, initial-scale=1">
  58. <link rel="stylesheet" href="../Resources/bootstrap/css/bootstrap.css">
  59. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  60. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  61. <link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
  62. <link rel="stylesheet" href="/resources/demos/style.css">
  63. <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  64. <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
  65. <style>
  66. tr:nth-child(even) {background: #ccc}
  67. tr:nth-child(odd) {background: #ccc}
  68. </style>
  69. <link rel="stylesheet" type="text/css" href="../Resources/bootstrap/css/bootstrap.css">
  70. <link rel="stylesheet" type="text/css" href="../Resources/bootstrap/js/bootstrap.js">
  71. <link href="../Resources/startbootstrap/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  72. <!-- Theme CSS -->
  73. <link href="../Resources/startbootstrap/css/freelancer.min.css" rel="stylesheet">
  74. <!-- Custom Fonts -->
  75. <link href="../Resources/startbootstrap/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  76. </head>
  77. <body>
  78. <nav class="navbar navbar-inverse">
  79. <div class="container-fluid">
  80. <div class="navbar-header">
  81. <a class="navbar-brand" href="welcome_admin.php"><img src="../Resources/welcome/img/logo.PNG"width="100" height="30"></a>
  82. </div>
  83. <ul class="nav navbar-nav">
  84. <li><a href="all_doctor.php">All Doctor</a></li>
  85. <li><a href="all_released.php">All Released</a></li>
  86. <li><a href="room_list.php">All Room</a></li>
  87. <li><a href="dept_list.php">All Dept</a></li>
  88. <!--<li><a href="Authenticate/logout.php">Log Out</a></li>-->
  89. <li><form style="margin-top: 13px" role="form" action="patient_info.php" method="get">
  90. <?php if(isset($_GET['search'])){
  91. $catchSearch=$_GET['search'];
  92. }
  93. ?>
  94. <div class="form-group">
  95. <input type="text" name="search"placeholder="Search" value="<?php if(isset($_GET['search'])){echo $catchSearch;}?>" id="search">
  96. <button type="submit" class="glyphicon glyphicon-search"></button>
  97. </div>
  98. </form></li>
  99. <li> <form role="form" action="patient_info.php" style="margin-top: 13px;padding-left: 40px" >
  100. <div class="form-group">
  101. <select class="form-control" id="sel1" name="itemPerPage" onchange="this.form.submit()">
  102. <option <?php if($itemPerPage==5) echo "selected"?>>5</option>
  103. <option <?php if($itemPerPage==10) echo "selected"?>>10</option>
  104. <option <?php if($itemPerPage==15) echo "selected"?>>15</option>
  105. <option <?php if($itemPerPage==20) echo "selected"?>>20</option>
  106. <option <?php if($itemPerPage==25) echo "selected"?>>25</option>
  107. </select>
  108. <!-- <button type="submit">GO!</button>-->
  109. </div>
  110. </form></li>
  111. </ul>
  112. </div>
  113. </nav>
  114. <div class="container">
  115. <h2 class="jumbotron" align="center">All Present Patient</h2>
  116. <div id="message">
  117. <?php
  118. if((array_key_exists('message',$_SESSION))&& !empty($_SESSION['message'])) {
  119. echo Message::message();
  120. }
  121. ?>
  122. </div>
  123. <!--<form role="form" action="patient_info.php">
  124. <div class="form-group">
  125. <label for="sel1">Select item per page (select one):</label>
  126. <select class="form-control" id="sel1" name="itemPerPage">
  127. <option <?php //if($itemPerPage==5) echo "selected"?>>5</option>
  128. <option <?php// if($itemPerPage==10) echo "selected"?>>10</option>
  129. <option <?php// if($itemPerPage==15) echo "selected"?>>15</option>
  130. <option <?php// if($itemPerPage==20) echo "selected"?>>20</option>
  131. <option <?php //if($itemPerPage==25) echo "selected"?>>25</option>
  132. </select>
  133. <button type="submit">GO!</button>
  134. </div>
  135. </form>
  136. <form role="form" action="patient_info.php" method="post">
  137. <?php /*if(isset($_POST['filterByName'])) {
  138. $catchName = $_POST['filterByName'];
  139. }
  140. if(isset($_POST['filterByRoom'])) {
  141. $catchRoom = $_POST['filterByRoom'];
  142. }*/
  143. ?>
  144. <div class="form-group">
  145. <label>Filter by Name:</label>
  146. <input type="text" name="filterByName" value="<?php// if(isset($_POST['filterByName'])) {echo $catchName;}?>" id="title">
  147. <label>Filter by Room:</label>
  148. <input type="text" name="filterByRoom" value="<?php //if(isset($_POST['filterByRoom'])) {echo $catchRoom;}?>" id="description">
  149. <button type="submit">Submit!</button>
  150. </div>
  151. </form>-->
  152. <!-- <form role="form" action="patient_info.php" method="get">
  153. <?//php if(isset($_GET['search'])){
  154. // $catchSearch=$_GET['search'];
  155. // }
  156. ?>
  157. <div class="form-group">
  158. <label>Search:</label>
  159. <input type="text" name="search" value="<?php //if(isset($_GET['search'])){echo $catchSearch;}?>" id="search">
  160. <button type="submit">Search</button>
  161. </div>
  162. </form>-->
  163. <div class="table-responsive">
  164. <table class="table table-bordered table-striped">
  165. <thead>
  166. <tr>
  167. <th>SL#</th>
  168. <th>ID</th>
  169. <th>Name</th>
  170. <th>Room</th>
  171. <th>Action</th>
  172. </tr>
  173. </thead>
  174. <tbody>
  175. <?php
  176. $sl=0;
  177. foreach ($allInfo as $info){
  178. $sl++?>
  179. <tr>
  180. <td><?php echo $sl+$pageStartFrom ?></td>
  181. <td><?php echo $info->patient_id ?></td>
  182. <td><?php echo $info->patient_name ?></td>
  183. <td><?php echo $info->room_id ?></td>
  184. <td><a href="patient_view.php?patient_id=<?php echo $info->patient_id ?>" class="btn btn-info" role="button">View</a>
  185. <a href="patient_edit.php?patient_id=<?php echo $info->patient_id ?>" class="btn btn-primary" role="button">Edit</a>
  186. <a href="patient_delete.php?patient_id=<?php echo $info->patient_id ?>" class="btn btn-danger" role="button">Delete</a>
  187. <a href="create_prescribe.php?patient_id=<?php echo $info->patient_id ?>" class="btn btn-info" role="button">Create Prescription</a>
  188. <a href="prescribe.php?patient_id=<?php echo $info->patient_id ?>" class="btn btn-info" role="button">Prescription</a>
  189. <a href="release_patient.php?patient_id=<?php echo $info->patient_id ?>&room_id=<?php echo $info->room_id ?>" class="btn btn-info" role="button">Release</a>
  190. </td>
  191. </tr>
  192. <?php }?>
  193. </tbody>
  194. </table>
  195. <center>
  196. <?php if((strtoupper($_SERVER['REQUEST_METHOD']=='GET'))&&(empty($_GET['search']))) { ?>
  197. <ul class="pagination">
  198. <?php if($pageNo>1)
  199. {
  200. $prev=$pageNo-1;
  201. echo "<li ><a href = 'patient_info.php?pageNo=$prev'>Prev</a ></li >";
  202. }
  203. ?>
  204. <?php echo $pagination ?>
  205. <?php if($pageNo<$noOfPage)
  206. {
  207. $next=$pageNo+1;
  208. echo "<li ><a href = 'patient_info.php?pageNo=$next'>Next</a ></li >";
  209. }
  210. ?>
  211. </ul>
  212. <?php } ?>
  213. </center>
  214. </div>
  215. </div>
  216. <footer class="text-center" style="margin-top: 215px">
  217. <div class="footer-below">
  218. <div class="container">
  219. <div class="row">
  220. <div class="col-lg-12">
  221. Copyright &copy; PHP HUNTERS 2016
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. </footer>
  227. <script>
  228. $('#message').show().delay(3000).fadeOut();
  229. </script>
  230. <script>
  231. $( function() {
  232. var availableTags = [
  233. <?php echo '"'.$commaSeparated.'"' ?>
  234. ];
  235. $( "#title" ).autocomplete({
  236. source: availableTags
  237. });
  238. } );
  239. </script>
  240. <script>
  241. $( function() {
  242. var availableTags = [
  243. <?php echo '"'.$commaSeparatedString.'"' ?>
  244. ];
  245. $( "#description" ).autocomplete({
  246. source: availableTags
  247. });
  248. } );
  249. </script>
  250. <script>
  251. $( function() {
  252. var availableTags = [
  253. <?php echo $allTD ?>
  254. ];
  255. $( "#search" ).autocomplete({
  256. source: availableTags
  257. });
  258. } );
  259. </script>
  260. </body>
  261. </html>