/views/all_doctor.php
PHP | 264 lines | 221 code | 29 blank | 14 comment | 19 complexity | 9732a444fcd46791a09a01682510808f MD5 | raw file
- <?php
- session_start();
- include_once ('../vendor/autoload.php');
- //var_dump($_POST);
- use App\Doctor\Doctor;
- use App\Utility\Utility;
- use App\Message\Message;
- $doctor = new Doctor();
- $allName= $doctor->allName();
- $allDepartment= $doctor->allDepartment();
- //$allinfo=$book->allTD();
- //Utility::dd($allinfo);
- $commaSeparated= implode('","',$allName);
- $commaSeparatedString= implode('","',$allDepartment);
- //$commaSeparatedStrings= implode('","',$allinfo);
- //Utility::dd($commaSeparatedString);
- $allTD= '"'.$commaSeparated.$commaSeparatedString.'"';
- $totalItem=$doctor->count();
- //Utility::dd($totalItem);
- if(array_key_exists('itemPerPage',$_SESSION)) {
- if(array_key_exists('itemPerPage',$_GET)){
- $_SESSION['itemPerPage']=$_GET['itemPerPage'];
- }
- }
- else{
- $_SESSION['itemPerPage']=5;
- }
- $itemPerPage= $_SESSION['itemPerPage'];
- $noOfPage=ceil($totalItem/$itemPerPage);
- //Utility::d($noOfPage);
- $pagination="";
- if(array_key_exists('pageNo',$_GET)){
- $pageNo= $_GET['pageNo'];
- }else {
- $pageNo = 1;
- }
- for($i=1;$i<=$noOfPage;$i++){
- $active=($i==$pageNo)?"active":"";
- $pagination.="<li class='$active'><a href='doctor_info.php?pageNo=$i'>$i</a></li>";
- }
- $pageStartFrom=$itemPerPage*($pageNo-1);
- if(strtoupper($_SERVER['REQUEST_METHOD']=='GET')) {
- $allInfo = $doctor->paginator($pageStartFrom, $itemPerPage);
- }
- if(strtoupper($_SERVER['REQUEST_METHOD']=='POST')) {
- //Utility::dd($_POST);
- //die();
- $allInfo = $doctor->prepare($_POST)->index();
- }
- if(strtoupper(($_SERVER['REQUEST_METHOD']=='GET')) && isset($_GET['search'])) {
- $allInfo = $doctor->prepare($_GET)->index();
- }
- ?>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/html">
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="../Resources/bootstrap/css/bootstrap.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
- <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
- <link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
- <link rel="stylesheet" href="/resources/demos/style.css">
- <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
- <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
- <style>
- tr:nth-child(even) {background: #ccc}
- tr:nth-child(odd) {background: #ccc}
- </style>
- <link rel="stylesheet" type="text/css" href="../Resources/bootstrap/css/bootstrap.css">
- <link rel="stylesheet" type="text/css" href="../Resources/bootstrap/js/bootstrap.js">
- <link href="../Resources/startbootstrap/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
- <!-- Theme CSS -->
- <link href="../Resources/startbootstrap/css/freelancer.min.css" rel="stylesheet">
- <!-- Custom Fonts -->
- <link href="../Resources/startbootstrap/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <nav class="navbar navbar-inverse">
- <div class="container-fluid">
- <div class="navbar-header">
- <a class="navbar-brand" href="welcome_admin.php"><img src="../Resources/welcome/img/logo.PNG"width="100" height="30"></a>
- </div>
- <ul class="nav navbar-nav">
- <li><a href="all_patient.php">All Patient</a></li>
- <li><a href="all_released.php">All Released</a></li>
- <li><a href="room_list.php">All Room</a></li>
- <li><a href="dept_list.php">All Dept</a></li>
- <!--<li><a href="Authenticate/logout.php">Log Out</a></li>-->
- <li><form style="margin-top: 13px" role="form" action="doctor_info.php" method="get">
- <?php if(isset($_GET['search'])){
- $catchSearch=$_GET['search'];
- }
- ?>
- <div class="form-group">
- <input type="text" name="search"placeholder="Search" value="<?php if(isset($_GET['search'])){echo $catchSearch;}?>" id="search">
- <button type="submit" class="glyphicon glyphicon-search"></button>
- </div>
- </form></li>
- <li> <form role="form" action="doctor_info.php" style="margin-top: 13px;padding-left: 50px" >
- <div class="form-group">
- <select class="form-control" id="sel1" name="itemPerPage" onchange="this.form.submit()">
- <option <?php if($itemPerPage==5) echo "selected"?>>5</option>
- <option <?php if($itemPerPage==10) echo "selected"?>>10</option>
- <option <?php if($itemPerPage==15) echo "selected"?>>15</option>
- <option <?php if($itemPerPage==20) echo "selected"?>>20</option>
- <option <?php if($itemPerPage==25) echo "selected"?>>25</option>
- </select>
- <!-- <button type="submit">GO!</button>-->
- </div>
- </form></li>
- </ul>
- </div>
- </nav>
- <div class="container">
- <h2 class="jumbotron" align="center">All Doctor Info</h2>
- <div id="message">
- <?php
- if((array_key_exists('message',$_SESSION))&& !empty($_SESSION['message'])) {
- echo Message::message();
- }
- ?>
- </div>
- <!--<form role="form" action="doctor_info.php" method="post">
- <?php //if(isset($_POST['filterByName'])) {
- //$catchName = $_POST['filterByName'];
- //}
- //if(isset($_POST['filterByRoom'])) {
- //$catchDepartment = $_POST['filterByDepartment'];
- //}
- ?>
- <div class="form-group">
- <label>Filter by Name:</label>
- <input type="text" name="filterByName" value="<?php //if(isset($_POST['filterByName'])) {echo $catchName;}?>" id="title">
- <label>Filter by Department:</label>
- <input type="text" name="filterByDepartment" value="<?php //if(isset($_POST['filterByDepartment'])) {echo $catchDepartment;}?>" id="description">
- <button type="submit">Submit!</button>
- </div>
- </form>-->
- <div class="table-responsive">
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>SL#</th>
- <th>ID</th>
- <th>Name</th>
- <th>Department</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $sl=0;
- foreach ($allInfo as $info){
- $sl++?>
- <tr>
- <td><?php echo $sl+$pageStartFrom ?></td>
- <td><?php echo $info->doctor_id ?></td>
- <td><?php echo $info->doctor_name ?></td>
- <td><?php $Dept['dept_id']=$info->dept_id;$Info=$doctor->prepare($Dept)->single_dept();echo $Info->dept_name;?></td>
- <td><a href="doctor_view.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-info" role="button">View</a>
- <a href="doctor_edit.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-primary" role="button">Edit</a>
- <a href="doctor_delete.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-danger" role="button">Delete</a>
- <a href="patient_list.php?doctor_id=<?php echo $info->doctor_id ?>" class="btn btn-primary" role="button">Patient List</a>
- </td>
- </tr>
- <?php }?>
- </tbody>
- </table>
- <?php if((strtoupper($_SERVER['REQUEST_METHOD']=='GET'))&&(empty($_GET['search']))) { ?>
- <center>
- <ul class="pagination" >
- <?php if($pageNo>1)
- {
- $prev=$pageNo-1;
- echo "<li ><a href = 'doctor_info.php?pageNo=$prev'>Prev</a ></li >";
- }
- ?>
- <?php echo $pagination ?>
- <?php if($pageNo<$noOfPage)
- {
- $next=$pageNo+1;
- echo "<li ><a href = 'doctor_info.php?pageNo=$next'>Next</a ></li >";
- }
- ?>
- </ul>
- </center>
- <?php } ?>
- </div>
- </div>
- <footer class="text-center" style="margin-top: 215px">
- <div class="footer-below">
- <div class="container">
- <div class="row">
- <div class="col-lg-12">
- Copyright © PHP HUNTERS 2016
- </div>
- </div>
- </div>
- </div>
- </footer>
- <script>
- $('#message').show().delay(3000).fadeOut();
- </script>
- <script>
- $( function() {
- var availableTags = [
- <?php echo '"'.$commaSeparated.'"' ?>
- ];
- $( "#title" ).autocomplete({
- source: availableTags
- });
- } );
- </script>
- <script>
- $( function() {
- var availableTags = [
- <?php echo '"'.$commaSeparatedString.'"' ?>
- ];
- $( "#description" ).autocomplete({
- source: availableTags
- });
- } );
- </script>
- <script>
- $( function() {
- var availableTags = [
- <?php echo $allTD ?>
- ];
- $( "#search" ).autocomplete({
- source: availableTags
- });
- } );
- </script>
- </body>
- </html>