PageRenderTime 48ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/views/SEIP149551/SummaryOfOrganization/trashed.php

https://gitlab.com/avijit_kar/avijit_kar_149551_B35_atomic_project
PHP | 130 lines | 88 code | 40 blank | 2 comment | 23 complexity | 46ee9cf3b0b532f321864d63e2b4ae6b MD5 | raw file
  1. <?php
  2. require_once("../../../vendor/autoload.php");
  3. use App\BookTitle\BookTitle;
  4. use App\Message\Message;
  5. $objBookTitle = new BookTitle();
  6. $allData = $objBookTitle->trashed("obj");
  7. ######################## pagination code block#1 of 2 start ######################################
  8. $recordCount= count($allData);
  9. if(isset($_REQUEST['Page'])) $page = $_REQUEST['Page'];
  10. else if(isset($_SESSION['Page'])) $page = $_SESSION['Page'];
  11. else $page = 1;
  12. $_SESSION['Page']= $page;
  13. if(isset($_REQUEST['ItemsPerPage'])) $itemsPerPage = $_REQUEST['ItemsPerPage'];
  14. else if(isset($_SESSION['ItemsPerPage'])) $itemsPerPage = $_SESSION['ItemsPerPage'];
  15. else $itemsPerPage = 3;
  16. $_SESSION['ItemsPerPage']= $itemsPerPage;
  17. $pages = ceil($recordCount/$itemsPerPage);
  18. $someData = $objBookTitle->trashedPaginator($page,$itemsPerPage);
  19. $serial = (($page-1) * $itemsPerPage) +1;
  20. ####################### pagination code block#1 of 2 end #########################################
  21. ?>
  22. <!DOCTYPE html>
  23. <html lang="en">
  24. <head>
  25. <link rel="stylesheet" href="../../../resource/assets/bootstrap/css/bootstrap.min.css">
  26. <link rel="stylesheet" href="../../../resource/assets/font-awesome/css/font-awesome.min.css">
  27. <script src="../../../resource/assets/js/jquery-1.11.1.min.js"></script>
  28. <script src="../../../resource/assets/bootstrap/js/bootstrap.min.js"></script>
  29. </head>
  30. <body>
  31. <div id="TopMenuBar">
  32. <button type="button" onclick="window.location.href='../index.php'" class=" btn-primary btn-lg">Home</button>
  33. <button type="button" onclick="window.location.href='index.php?Page=1'" class=" btn-success btn-lg">Active List</button>
  34. </div>
  35. <h1> Trashed List</h1>
  36. <?php
  37. echo "<table border='5px' >";
  38. echo "<th> Serial </th>";
  39. echo "<th> ID </th>";
  40. echo "<th> Book Title </th>";
  41. echo "<th> Author Name </th>";
  42. echo "<th> Action </th>";
  43. foreach($someData as $oneData){ ########### Traversing $someData is Required for pagination #############
  44. echo "<tr style='height: 40px'>";
  45. echo "<td>".$serial."</td>";
  46. echo "<td>".$oneData->id."</td>";
  47. echo "<td>".$oneData->book_title."</td>";
  48. echo "<td>".$oneData->author_name."</td>";
  49. echo "<td>";
  50. echo "<a href='recover.php?id=$oneData->id'><button class='btn btn-success'>Recover</button></a> ";
  51. echo "<a href='delete.php?id=$oneData->id'><button class='btn btn-danger'>Delete</button></a> ";
  52. echo "</td>";
  53. echo "</tr>";
  54. $serial++;
  55. }
  56. echo "</table>";
  57. ?>
  58. <!-- ######################## pagination code block#2/2 start ###################################### -->
  59. <div align="left" class="container">
  60. <ul class="pagination">
  61. <?php
  62. echo '<li><a href="">' . "Previous" . '</a></li>';
  63. for($i=1;$i<=$pages;$i++)
  64. {
  65. if($i==$page) echo '<li class="active"><a href="">'. $i . '</a></li>';
  66. else echo "<li><a href='?Page=$i'>". $i . '</a></li>';
  67. }
  68. echo '<li><a href="">' . "Next" . '</a></li>';
  69. ?>
  70. <select class="form-control" name="ItemsPerPage" id="ItemsPerPage" onchange="javascript:location.href = this.value;" >
  71. <?php
  72. if($itemsPerPage==3 ) echo '<option value="?ItemsPerPage=3" selected >Show 3 Items Per Page</option>';
  73. else echo '<option value="?ItemsPerPage=3">Show 3 Items Per Page</option>';
  74. if($itemsPerPage==4 ) echo '<option value="?ItemsPerPage=4" selected >Show 4 Items Per Page</option>';
  75. else echo '<option value="?ItemsPerPage=4">Show 4 Items Per Page</option>';
  76. if($itemsPerPage==5 ) echo '<option value="?ItemsPerPage=5" selected >Show 5 Items Per Page</option>';
  77. else echo '<option value="?ItemsPerPage=5">Show 5 Items Per Page</option>';
  78. if($itemsPerPage==6 ) echo '<option value="?ItemsPerPage=6"selected >Show 6 Items Per Page</option>';
  79. else echo '<option value="?ItemsPerPage=6">Show 6 Items Per Page</option>';
  80. if($itemsPerPage==10 ) echo '<option value="?ItemsPerPage=10"selected >Show 10 Items Per Page</option>';
  81. else echo '<option value="?ItemsPerPage=10">Show 10 Items Per Page</option>';
  82. if($itemsPerPage==15 ) echo '<option value="?ItemsPerPage=15"selected >Show 15 Items Per Page</option>';
  83. else echo '<option value="?ItemsPerPage=15">Show 15 Items Per Page</option>';
  84. ?>
  85. </select>
  86. </ul>
  87. </div>
  88. <!-- ######################## pagination code block#2/2 end ###################################### -->
  89. </body>
  90. </html>