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

/views/all_doctor.php

https://gitlab.com/sharadmohajan/xyz
PHP | 264 lines | 221 code | 29 blank | 14 comment | 19 complexity | 9732a444fcd46791a09a01682510808f MD5 | raw file
  1. <?php
  2. session_start();
  3. include_once ('../vendor/autoload.php');
  4. //var_dump($_POST);
  5. use App\Doctor\Doctor;
  6. use App\Utility\Utility;
  7. use App\Message\Message;
  8. $doctor = new Doctor();
  9. $allName= $doctor->allName();
  10. $allDepartment= $doctor->allDepartment();
  11. //$allinfo=$book->allTD();
  12. //Utility::dd($allinfo);
  13. $commaSeparated= implode('","',$allName);
  14. $commaSeparatedString= implode('","',$allDepartment);
  15. //$commaSeparatedStrings= implode('","',$allinfo);
  16. //Utility::dd($commaSeparatedString);
  17. $allTD= '"'.$commaSeparated.$commaSeparatedString.'"';
  18. $totalItem=$doctor->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='doctor_info.php?pageNo=$i'>$i</a></li>";
  40. }
  41. $pageStartFrom=$itemPerPage*($pageNo-1);
  42. if(strtoupper($_SERVER['REQUEST_METHOD']=='GET')) {
  43. $allInfo = $doctor->paginator($pageStartFrom, $itemPerPage);
  44. }
  45. if(strtoupper($_SERVER['REQUEST_METHOD']=='POST')) {
  46. //Utility::dd($_POST);
  47. //die();
  48. $allInfo = $doctor->prepare($_POST)->index();
  49. }
  50. if(strtoupper(($_SERVER['REQUEST_METHOD']=='GET')) && isset($_GET['search'])) {
  51. $allInfo = $doctor->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_patient.php">All Patient</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="doctor_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="doctor_info.php" style="margin-top: 13px;padding-left: 50px" >
  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 Doctor Info</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="doctor_info.php" method="post">
  124. <?php //if(isset($_POST['filterByName'])) {
  125. //$catchName = $_POST['filterByName'];
  126. //}
  127. //if(isset($_POST['filterByRoom'])) {
  128. //$catchDepartment = $_POST['filterByDepartment'];
  129. //}
  130. ?>
  131. <div class="form-group">
  132. <label>Filter by Name:</label>
  133. <input type="text" name="filterByName" value="<?php //if(isset($_POST['filterByName'])) {echo $catchName;}?>" id="title">
  134. <label>Filter by Department:</label>
  135. <input type="text" name="filterByDepartment" value="<?php //if(isset($_POST['filterByDepartment'])) {echo $catchDepartment;}?>" id="description">
  136. <button type="submit">Submit!</button>
  137. </div>
  138. </form>-->
  139. <div class="table-responsive">
  140. <table class="table table-bordered table-striped">
  141. <thead>
  142. <tr>
  143. <th>SL#</th>
  144. <th>ID</th>
  145. <th>Name</th>
  146. <th>Department</th>
  147. <th>Action</th>
  148. </tr>
  149. </thead>
  150. <tbody>
  151. <?php
  152. $sl=0;
  153. foreach ($allInfo as $info){
  154. $sl++?>
  155. <tr>
  156. <td><?php echo $sl+$pageStartFrom ?></td>
  157. <td><?php echo $info->doctor_id ?></td>
  158. <td><?php echo $info->doctor_name ?></td>
  159. <td><?php $Dept['dept_id']=$info->dept_id;$Info=$doctor->prepare($Dept)->single_dept();echo $Info->dept_name;?></td>
  160. <td><a href="doctor_view.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-info" role="button">View</a>
  161. <a href="doctor_edit.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-primary" role="button">Edit</a>
  162. <a href="doctor_delete.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-danger" role="button">Delete</a>
  163. <a href="patient_list.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-primary" role="button">Patient List</a>
  164. </td>
  165. </tr>
  166. <?php }?>
  167. </tbody>
  168. </table>
  169. <?php if((strtoupper($_SERVER['REQUEST_METHOD']=='GET'))&&(empty($_GET['search']))) { ?>
  170. <center>
  171. <ul class="pagination" >
  172. <?php if($pageNo>1)
  173. {
  174. $prev=$pageNo-1;
  175. echo "<li ><a href = 'doctor_info.php?pageNo=$prev'>Prev</a ></li >";
  176. }
  177. ?>
  178. <?php echo $pagination ?>
  179. <?php if($pageNo<$noOfPage)
  180. {
  181. $next=$pageNo+1;
  182. echo "<li ><a href = 'doctor_info.php?pageNo=$next'>Next</a ></li >";
  183. }
  184. ?>
  185. </ul>
  186. </center>
  187. <?php } ?>
  188. </div>
  189. </div>
  190. <footer class="text-center" style="margin-top: 215px">
  191. <div class="footer-below">
  192. <div class="container">
  193. <div class="row">
  194. <div class="col-lg-12">
  195. Copyright &copy; PHP HUNTERS 2016
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. </footer>
  201. <script>
  202. $('#message').show().delay(3000).fadeOut();
  203. </script>
  204. <script>
  205. $( function() {
  206. var availableTags = [
  207. <?php echo '"'.$commaSeparated.'"' ?>
  208. ];
  209. $( "#title" ).autocomplete({
  210. source: availableTags
  211. });
  212. } );
  213. </script>
  214. <script>
  215. $( function() {
  216. var availableTags = [
  217. <?php echo '"'.$commaSeparatedString.'"' ?>
  218. ];
  219. $( "#description" ).autocomplete({
  220. source: availableTags
  221. });
  222. } );
  223. </script>
  224. <script>
  225. $( function() {
  226. var availableTags = [
  227. <?php echo $allTD ?>
  228. ];
  229. $( "#search" ).autocomplete({
  230. source: availableTags
  231. });
  232. } );
  233. </script>
  234. </body>
  235. </html>