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

/day29-home-task/crud/views/index.php

https://gitlab.com/iarafat/web-apps-php-b-26
PHP | 234 lines | 217 code | 14 blank | 3 comment | 19 complexity | 17bb442f8151d06289e0d49221b0ee1c MD5 | raw file
  1. <?php
  2. include_once "../vendor/autoload.php";
  3. use App\Users\Users;
  4. $obj = new Users();
  5. $obj->prepare($_GET);
  6. $alldata = $obj->profileIndex();
  7. $showdata = $obj->show();
  8. //echo "<pre>";
  9. //print_r($showdata);
  10. //echo "</pre>";
  11. if (isset($_SESSION['Login_data']) && !empty($_SESSION['Login_data'])) {
  12. ?>
  13. <html>
  14. <head>
  15. <title>Index | Page</title>
  16. <link rel="stylesheet" href="css/bootstrap.min.css">
  17. <link rel="stylesheet" href="css/style.css">
  18. <script src="js/jquery.min.js"></script>
  19. <script src="js/bootstrap.min.js"></script>
  20. </head>
  21. <body>
  22. <?php include_once "include/log-navbar.php"; ?>
  23. <div class="container">
  24. <div class="row">
  25. <div class="col-md-12" style="margin-top: 50px">
  26. <h4 class="text-success"><?php $obj->Validation("Login"); ?></h4>
  27. <?php
  28. if ($_SESSION['Login_data']['is_admin'] == 1) {
  29. ?>
  30. <h3 class="text-center">User List</h3>
  31. <strong class="text-success"><?php $obj->Validation("Tr_D") ?></strong>
  32. <table class="table table-bordered table-hover mtop">
  33. <thead>
  34. <tr>
  35. <th>SL</th>
  36. <th>ID</th>
  37. <th>User ID</th>
  38. <th>User Name</th>
  39. <th>password</th>
  40. <th>email</th>
  41. <th>is_active</th>
  42. <th>is_admin</th>
  43. <th>is_delete</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. <tr>
  48. <?php
  49. $serial = 1;
  50. if (isset($alldata) && !empty($alldata)) {
  51. foreach ($alldata as $onedata) {
  52. ?>
  53. <td><?php echo $serial++; ?></td>
  54. <td><?php echo $onedata['id'] ?></td>
  55. <td><?php echo $onedata['users_id'] ?></td>
  56. <td><?php echo $onedata['user_name'] ?></td>
  57. <td><?php echo $onedata['password'] ?></td>
  58. <td><?php echo $onedata['email'] ?></td>
  59. <td><?php echo $onedata['is_active'] ?></td>
  60. <td><?php echo $onedata['is_admin'] ?></td>
  61. <td><?php echo $onedata['is_delete'] ?></td>
  62. </tr>
  63. <?php }
  64. } ?>
  65. </tbody>
  66. </table>
  67. <table class="table table-bordered table-hover mtop">
  68. <thead>
  69. <tr>
  70. <th>Full Name</th>
  71. <th>Father Name</th>
  72. <th>Mother Name</th>
  73. <th>Gender</th>
  74. <th>Phone</th>
  75. <th>fax_number</th>
  76. <th>web_address</th>
  77. <th>date of birth</th>
  78. <th>height</th>
  79. </tr>
  80. </thead>
  81. <tbody>
  82. <tr>
  83. <?php
  84. if (isset($alldata) && !empty($alldata)) {
  85. foreach ($alldata as $onedata) {
  86. ?>
  87. <td><?php echo $onedata['full_name'] ?></td>
  88. <td><?php echo $onedata['father_name'] ?></td>
  89. <td><?php echo $onedata['mother_name'] ?></td>
  90. <td><?php echo $onedata['gender'] ?></td>
  91. <td><?php echo $onedata['phone'] ?></td>
  92. <td><?php echo $onedata['fax_number'] ?></td>
  93. <td><?php echo $onedata['web_address'] ?></td>
  94. <td><?php echo $onedata['dateofbirth'] ?></td>
  95. <td><?php echo $onedata['height'] ?></td>
  96. </tr>
  97. <?php }
  98. } ?>
  99. </tbody>
  100. </table>
  101. <table class="table table-bordered table-hover mtop">
  102. <thead>
  103. <tr>
  104. <th>occupation</th>
  105. <th>education_status</th>
  106. <th>religion</th>
  107. <th>marital_status</th>
  108. <th>current_job</th>
  109. <th>nationality</th>
  110. <th>interested</th>
  111. <th>bio</th>
  112. <th>nid</th>
  113. <th>passport_number</th>
  114. </tr>
  115. </thead>
  116. <tbody>
  117. <tr>
  118. <?php
  119. if (isset($alldata) && !empty($alldata)) {
  120. foreach ($alldata as $onedata) {
  121. ?>
  122. <td><?php echo $onedata['occupation'] ?></td>
  123. <td><?php echo $onedata['education_status'] ?></td>
  124. <td><?php echo $onedata['religion'] ?></td>
  125. <td><?php echo $onedata['marital_status'] ?></td>
  126. <td><?php echo $onedata['current_job'] ?></td>
  127. <td><?php echo $onedata['nationality'] ?></td>
  128. <td><?php echo $onedata['interested'] ?></td>
  129. <td><?php echo $onedata['bio'] ?></td>
  130. <td><?php echo $onedata['nid'] ?></td>
  131. <td><?php echo $onedata['passport_number'] ?></td>
  132. </tr>
  133. <?php }
  134. } ?>
  135. </tbody>
  136. </table>
  137. <table class="table table-bordered table-hover mtop">
  138. <thead>
  139. <tr>
  140. <th>skills_area</th>
  141. <th>language_area</th>
  142. <th>Blood_group</th>
  143. <th>address</th>
  144. <th>others</th>
  145. <th>profile_pic</th>
  146. </tr>
  147. </thead>
  148. <tbody>
  149. <tr>
  150. <?php
  151. if (isset($alldata) && !empty($alldata)) {
  152. foreach ($alldata as $onedata) {
  153. ?>
  154. <td><?php echo $onedata['skills_area'] ?></td>
  155. <td><?php echo $onedata['language_area'] ?></td>
  156. <td><?php echo $onedata['Blood_group'] ?></td>
  157. <td><?php $addata = unserialize($onedata['address']);
  158. echo $addata['address_one'] . ", ";
  159. echo $addata['address_two'] . ", ";
  160. echo $addata['post'] . ", ";
  161. echo $addata['state'] . ", ";
  162. echo $addata['city'] . ".";
  163. ?></td>
  164. <td><?php echo $onedata['others'] ?></td>
  165. <td><?php echo "<img style='border: 1px solid #ccc;padding: 2px;' width='100' height='100' src='photo/" . $onedata['profile_pic'] . "' alt='Profile Pic'>"; ?></td>
  166. </tr>
  167. <?php }
  168. } ?>
  169. </tbody>
  170. </table>
  171. <table class="table table-bordered table-hover">
  172. <thead>
  173. <tr>
  174. <th>created</th>
  175. <th>modified</th>
  176. <th>deleted</th>
  177. <th>restore</th>
  178. <th colspan="3" class="text-center">Action</th>
  179. </tr>
  180. </thead>
  181. <tbody>
  182. <?php
  183. if (isset($alldata) && !empty($alldata)) {
  184. foreach ($alldata as $onedata) {
  185. ?>
  186. <td><?php echo $onedata['created'] ?></td>
  187. <td><?php echo $onedata['modified'] ?></td>
  188. <td><?php echo $onedata['deleted'] ?></td>
  189. <td><?php echo $onedata['restore'] ?></td>
  190. <td><a href="profile2.php?id=<?php echo $onedata['users_id'] ?>">View</a></td>
  191. <td><a href="profile.php?id=<?php echo $onedata['users_id'] ?>">Edit</a></td>
  192. <td><?php if ($onedata['is_admin'] == 0) { ?>
  193. <a href="trash.php?id=<?php echo $onedata['users_id'] ?>">Delete</a>
  194. <?php } ?>
  195. </td>
  196. </tr>
  197. <?php }
  198. } else { ?>
  199. <tr>
  200. <td colspan="9">No available data</td>
  201. </tr>
  202. <?php } ?>
  203. </tbody>
  204. </table>
  205. <?php
  206. } else {
  207. echo "<h1 class='text-center'>"."Welcome to Dashboard"."</h1>";
  208. }
  209. ?>
  210. </div>
  211. </div>
  212. </div>
  213. </body>
  214. </html>
  215. <?php
  216. } else {
  217. $_SESSION['Errors_R'] = "User not found :(";
  218. header("location:errors.php");
  219. }
  220. ?>