PageRenderTime 63ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/view/SEIP143467/Email/trashed.php

https://gitlab.com/Princy008/Princy_143467_B_37_Atomic_project
PHP | 256 lines | 176 code | 75 blank | 5 comment | 31 complexity | 80c293bd70a97e026afeac0abc061025 MD5 | raw file
  1. <?php
  2. require_once("../../../vendor/autoload.php");
  3. use App\BITM\SEIP143467\Message\Message;
  4. if(!isset( $_SESSION)) session_start();
  5. $message1=Message::message();
  6. use App\BITM\SEIP143467\Email\Email;
  7. $obj= new Email();
  8. $all_email= $obj->trashed();
  9. ######################## pagination code block#1 of 2 start ######################################
  10. $recordCount= count($all_email);
  11. if(isset($_REQUEST['Page'])) $page = $_REQUEST['Page'];
  12. else if(isset($_SESSION['Page'])) $page = $_SESSION['Page'];
  13. else $page = 1;
  14. $_SESSION['Page']= $page;
  15. if(isset($_REQUEST['ItemsPerPage'])) $itemsPerPage = $_REQUEST['ItemsPerPage'];
  16. else if(isset($_SESSION['ItemsPerPage'])) $itemsPerPage = $_SESSION['ItemsPerPage'];
  17. else $itemsPerPage = 3;
  18. $_SESSION['ItemsPerPage']= $itemsPerPage;
  19. $pages = ceil($recordCount/$itemsPerPage);
  20. $someData = $obj->trashPaginator($page,$itemsPerPage);
  21. $serial = (($page-1) * $itemsPerPage) +1;
  22. ####################### pagination code block#1 of 2 end #########################################
  23. ?>
  24. <!--table-->
  25. <!DOCTYPE html>
  26. <html lang="en">
  27. <head>
  28. <meta charset="utf-8">
  29. <title> </title>
  30. <!-- Latest compiled and minified CSS -->
  31. <!-- Latest compiled and minified CSS -->
  32. <link rel="stylesheet" href="../../../resource/Bootstrap/css/bootstrap.min.css">
  33. <!-- Optional theme -->
  34. <link rel="stylesheet" href="../../../resource/Bootstrap/css/bootstrap-theme.min.css">
  35. <!-- <link rel="stylesheet" href="../../../resource/Bootstrap/css/booktitle.css"> -->
  36. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  37. </head>
  38. <style>
  39. .main{
  40. margin-top: 10%;
  41. margin-left: 15%;
  42. margin-right:15%;
  43. background-color: #679a9f;
  44. }
  45. body{
  46. background-image:url("../../../resource/assets/images/mail.jpg");
  47. background-repeat:no-repeat;
  48. background-size: 100% 925px;
  49. }
  50. </style>
  51. <body >
  52. <div class="container ">
  53. <div style="margin-top: 40px ;float: right;"> <a href="../index.php" class="btn btn-info btn-danger btn-lg" role="button">Atomic Project List</a></br></br></div>
  54. <div class="main">
  55. <div class="panel panel-default" >
  56. <div class="panel-heading">
  57. <div class="panel-heading">
  58. <h1 style="text-align: center"> Trashed List</h1>
  59. </div>
  60. </div>
  61. <div class="panel-body">
  62. <form action="recovermultiple.php" method="post" id="multiple">
  63. <div class="table-responsive" >
  64. </br></br></br></br>
  65. <table class="table">
  66. <thead>
  67. <tr>
  68. <th>Select all <input id="select_all" type="checkbox" value="select all"></th>
  69. <th>#</th>
  70. <th>ID</th>
  71. <th>Name</th>
  72. <th>City</th>
  73. <th>Action</th>
  74. </tr>
  75. </thead>
  76. <tbody>
  77. <tr>
  78. <?php
  79. $serial=0;
  80. foreach($someData as $result){
  81. $serial++; ?>
  82. <td><input type="checkbox" class="checkbox" name="mark[]" value="<?php echo $result['id']?>"></td>
  83. <td><?php echo $serial?></td>
  84. <td><?php echo $result['id']?></td>
  85. <td><?php echo $result['name']?></td>
  86. <td><?php echo $result['email']?></td>
  87. <td><a href="recover.php?id=<?php echo $result['id'] ?>" class="btn btn-primary" role="button">Recover</a>
  88. <a href="delete.php?id=<?php echo $result['id'] ?>" class="btn btn-danger" role="button" id="delete" Onclick="return ConfirmDelete()">Delete</a>
  89. </td>
  90. </tr>
  91. <?php }?>
  92. </tbody>
  93. <a href="index.php" class="btn btn-info" role="button">Home</a> &nbsp;&nbsp;&nbsp;&nbsp;
  94. <button type="submit" class="btn btn-info">Recover Selected</button>&nbsp;&nbsp;&nbsp;&nbsp;
  95. <button type="button" class="btn btn-primary" id="delete">Delete all Selected</button>
  96. </table>
  97. <!-- ######################## pagination code block#2 of 2 start ###################################### -->
  98. <div align="left" class="container">
  99. <ul class="pagination">
  100. <?php
  101. $previous=$page-1;
  102. if($previous>0)
  103. {echo "<li><a href='index.php?Page=$previous'>" . "Previous" . '</a></li>';}
  104. for($i=1;$i<=$pages;$i++)
  105. {
  106. if($i==$page) echo '<li class="active"><a href="">'. $i . '</a></li>';
  107. else echo "<li><a href='?Page=$i'>". $i . '</a></li>';
  108. }
  109. $next=$page+1;
  110. if($next<=$pages)
  111. echo "<li><a href='index.php?Page=$next'>" . "Next" . '</a></li>';
  112. ?>
  113. <select class="form-control" name="ItemsPerPage" id="ItemsPerPage" onchange="javascript:location.href = this.value;" >
  114. <?php
  115. if($itemsPerPage==3 ) echo '<option value="?ItemsPerPage=3" selected >Show 3 Items Per Page</option>';
  116. else echo '<option value="?ItemsPerPage=3">Show 3 Items Per Page</option>';
  117. if($itemsPerPage==4 ) echo '<option value="?ItemsPerPage=4" selected >Show 4 Items Per Page</option>';
  118. else echo '<option value="?ItemsPerPage=4">Show 4 Items Per Page</option>';
  119. if($itemsPerPage==5 ) echo '<option value="?ItemsPerPage=5" selected >Show 5 Items Per Page</option>';
  120. else echo '<option value="?ItemsPerPage=5">Show 5 Items Per Page</option>';
  121. if($itemsPerPage==6 ) echo '<option value="?ItemsPerPage=6"selected >Show 6 Items Per Page</option>';
  122. else echo '<option value="?ItemsPerPage=6">Show 6 Items Per Page</option>';
  123. if($itemsPerPage==10 ) echo '<option value="?ItemsPerPage=10"selected >Show 10 Items Per Page</option>';
  124. else echo '<option value="?ItemsPerPage=10">Show 10 Items Per Page</option>';
  125. if($itemsPerPage==15 ) echo '<option value="?ItemsPerPage=15"selected >Show 15 Items Per Page</option>';
  126. else echo '<option value="?ItemsPerPage=15">Show 15 Items Per Page</option>';
  127. ?>
  128. </select>
  129. </ul>
  130. </div>
  131. <!-- ######################## pagination code block#2 of 2 end ###################################### -->
  132. <div id="confirmation_message" style="color:red;">
  133. <?php echo $message1 ?>
  134. </div>
  135. </div>
  136. </form>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. <script>
  142. $(document).ready(function(){
  143. $(function() {
  144. $('#confirmation_message').delay(3000).fadeOut();
  145. });
  146. });
  147. function ConfirmDelete()
  148. {
  149. var x = confirm("Are you sure you want to delete?");
  150. if (x)
  151. return true;
  152. else
  153. return false;
  154. }
  155. $('#delete').on('click',function(){
  156. document.forms[0].action="deletemultiple.php";
  157. $('#multiple').submit();
  158. });
  159. //select all checkboxes
  160. $("#select_all").change(function(){ //"select all" change
  161. var status = this.checked; // "select all" checked status
  162. $('.checkbox').each(function(){ //iterate all listed checkbox items
  163. this.checked = status; //change ".checkbox" checked status
  164. });
  165. });
  166. $('.checkbox').change(function(){ //".checkbox" change
  167. //uncheck "select all", if one of the listed checkbox item is unchecked
  168. if(this.checked == false){ //if this item is unchecked
  169. $("#select_all")[0].checked = false; //change "select all" checked status to false
  170. }
  171. //check "select all" if all checkbox items are checked
  172. if ($('.checkbox:checked').length == $('.checkbox').length ){
  173. $("#select_all")[0].checked = true; //change "select all" checked status to true
  174. }
  175. });
  176. </script>
  177. <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
  178. <!-- Latest compiled and minified JavaScript -->
  179. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  180. </body>
  181. </html>