PageRenderTime 54ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/views/SEIP129150/Education_level/index.php

https://gitlab.com/0sajib0/AtomicProject
PHP | 163 lines | 142 code | 20 blank | 1 comment | 12 complexity | 4761c35b37f14e22317e45051d1651b8 MD5 | raw file
  1. <?php
  2. session_start();
  3. include_once('../../../vendor/autoload.php');
  4. use App\BITM\SEIP129150\Education_level\Education_level;
  5. use App\BITM\SEIP129150\Book\Message;
  6. use APP\BITM\SEIP129150\Book\Utility;
  7. $education=new Education_level();
  8. $totalIteam=$education->count();
  9. if(array_key_exists("iteamPerPage",$_SESSION))
  10. {
  11. if(array_key_exists("iteamPerPage",$_GET))
  12. {
  13. $_SESSION['iteamPerPage']=$_GET['iteamPerPage'];
  14. }
  15. }
  16. else
  17. $_SESSION['iteamPerPage']=5;
  18. $iteamPerPage=$_SESSION['iteamPerPage'];
  19. $noOfPage=ceil($totalIteam/$iteamPerPage);
  20. $pagination="";
  21. if(array_key_exists('pageNumber',$_GET))
  22. {
  23. $pageNo=$_GET['pageNumber'];
  24. }
  25. else $pageNo=1;
  26. for($i=1;$i<=$noOfPage;$i++)
  27. {
  28. $active=($pageNo==$i)? "active":"";
  29. $pagination.="<li class='$active'><a href='index.php?pageNumber=$i'>$i</a></li>";
  30. }
  31. $pageStartFrom=$iteamPerPage*($pageNo-1);
  32. $aleducation=$education->paginator($pageStartFrom,$iteamPerPage);
  33. ?>
  34. <!DOCTYPE html>
  35. <html>
  36. <head>
  37. <meta name="viewport" content="width=device-width, initial-scale=1">
  38. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  39. <link rel="stylesheet" type="text/css" href="../../../resources/bootstrap/css/bootstrap.css">
  40. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  41. <!-- <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>-->
  42. </head >
  43. <!--<body background="city.jpg">-->
  44. <body>
  45. <nav class="navbar navbar-inverse">
  46. <div class="container-fluid">
  47. <ul class="nav navbar-nav">
  48. <li class="active"><a href="../../../index.php">Home</a></li>
  49. <li><a href="../Book/index.php">Book</a></li>
  50. <li><a href="../Birthday/index.php">Birthday</a></li>
  51. <li><a href="../City/index.php">City</a></li>
  52. <li><a href="../Education_level/index.php">Education Level</a></li>
  53. <li><a href="../Email/index.php">Email</a></li>
  54. <li><a href="../Hobby/index.php">Hobby</a></li>
  55. <li><a href="../Profile_picture/index.php">Profile Picture</a></li>
  56. <li><a href="../Summary_of_organizations/index.php">Organization</a></li>
  57. </ul>
  58. </div>
  59. </nav>
  60. <div class="container">
  61. <h1>Education Level List</h1>
  62. <a href="create.php" class="btn btn-info" role="button">Add new Education level</a>
  63. <a href="trashVeiw.php" class="btn btn-primary" role="button">Trash List</a>
  64. <div id="message">
  65. <?php
  66. if(array_key_exists("message",$_SESSION))
  67. echo Message::message();
  68. ?>
  69. </div>
  70. <form action="index.php">
  71. <select name="iteamPerPage">
  72. <option value="" style="display: none"> select</option>
  73. <option <?php if($_SESSION['iteamPerPage']==5) echo "selected"?>>5</option>
  74. <option <?php if($_SESSION['iteamPerPage']==10) echo "selected"?>>10</option>
  75. <option <?php if($_SESSION['iteamPerPage']==15) echo "selected"?>>15</option>
  76. <option <?php if($_SESSION['iteamPerPage']==20) echo "selected"?>>20</option>
  77. </select>
  78. <input type="submit" value="GO" class="btn btn-primary">
  79. </form>
  80. <div class="table-responsive">
  81. <table class="table">
  82. <thead>
  83. <tr>
  84. <td>
  85. SL#
  86. </td>
  87. <td>
  88. ID
  89. </td>
  90. <td>
  91. name
  92. </td>
  93. <td>
  94. Education Level
  95. </td>
  96. <td>
  97. Action
  98. </td>
  99. </tr>
  100. </thead>
  101. <tbody>
  102. <?php
  103. $sl=1;
  104. foreach ($aleducation as $education) {
  105. ?>
  106. <tr>
  107. <td><?php echo $sl+$pageStartFrom?></td>
  108. <td> <?php echo $education['id']?></td>
  109. <td> <?php echo $education['name']?></td>
  110. <td> <?php echo $education['level']?></td>
  111. <td>
  112. <a href="veiw.php?id=<?php echo $education['id']?>" class="btn btn-info" role="button">View</a>
  113. <a href="edit.php?id=<?php echo $education['id']?>" class="btn btn-primary" role="button">Edit</a>
  114. <a href="delete.php?id=<?php echo $education['id']?>" class="btn btn-danger" role="button">Delete</a>
  115. <a href="trash.php?id=<?php echo $education['id']?>" class="btn btn-success" role="button">Trash</a>
  116. </td>
  117. </tr>
  118. </tbody>
  119. <?php $sl++; } ?>
  120. </table>
  121. <ul class="pagination">
  122. <?php
  123. if($pageNo>1)
  124. {
  125. $pageNo--;
  126. echo "<li class='active'><a href='index.php?pageNumber=$pageNo'>Prev</a></li>";
  127. }
  128. ?>
  129. <?php echo $pagination;
  130. if(isset($_GET['pageNumber'])&&$_GET['pageNumber']<$noOfPage) {
  131. $next_item=$_GET['pageNumber']+1;
  132. echo "<li><a href='index.php?pageNumber=$next_item'>Next</a></li>";
  133. // Utility::dd($next_item);
  134. }
  135. ?>
  136. </ul>
  137. </div>
  138. </div>
  139. <script>
  140. $('#message').show().delay(3000).fadeOut();
  141. </script>
  142. </body>
  143. </html>