/system/application/views/admin/user/index.php

https://github.com/JeffreyDD/webzash · PHP · 76 lines · 66 code · 8 blank · 2 comment · 8 complexity · 615026178a764dd949ebc805370b1c50 MD5 · raw file

  1. <?php
  2. echo "<p>";
  3. echo "<b>You are logged in as : </b>";
  4. echo $this->session->userdata('user_name');
  5. echo "</p>";
  6. echo "<table border=0 cellpadding=5 class=\"simple-table manage-account-table\">";
  7. echo "<thead><tr><th>Username</th><th>Email</th><th>Role</th><th>Status</th><th></th></tr></thead>";
  8. echo "<tbody>";
  9. $odd_even = "odd";
  10. foreach ($users as $row)
  11. {
  12. $ini_file = $this->config->item('config_path') . "users/" . $row . ".ini";
  13. /* Check if database ini file exists */
  14. if (get_file_info($ini_file))
  15. {
  16. /* Parsing database ini file */
  17. $active_users = parse_ini_file($ini_file);
  18. if ($active_users)
  19. {
  20. $username = isset($active_users['username']) ? $active_users['username'] : "-";
  21. $email = isset($active_users['email']) ? $active_users['email'] : "-";
  22. $role = isset($active_users['role']) ? $active_users['role'] : "-";
  23. $status = isset($active_users['status']) ? $active_users['status'] : "-";
  24. }
  25. }
  26. echo "<tr class=\"tr-" . $odd_even;
  27. if ($this->session->userdata('user_name') == $row)
  28. echo " tr-active";
  29. echo "\">";
  30. echo "<td>" . $username . "</td>";
  31. echo "<td>" . $email . "</td>";
  32. echo "<td>";
  33. switch ($role)
  34. {
  35. case "administrator": echo "administrator"; break;
  36. case "manager": echo "manager"; break;
  37. case "accountant": echo "accountant"; break;
  38. case "dataentry": echo "dataentry"; break;
  39. case "guest": echo "guest"; break;
  40. default: echo "(unknown)"; break;
  41. }
  42. echo "</td>";
  43. echo "<td>";
  44. switch ($status)
  45. {
  46. case 0: echo "Disabled"; break;
  47. case 1: echo "Active"; break;
  48. default: echo "(unknown)"; break;
  49. }
  50. echo "</td>";
  51. if ($this->session->userdata('user_name') == $row)
  52. {
  53. echo "<td>";
  54. echo anchor("admin/user/edit/" . $row, "Edit", array('title' => 'Edit User', 'class' => 'red-link'));
  55. echo "</td>";
  56. } else {
  57. echo "<td>";
  58. echo anchor("admin/user/edit/" . $row, "Edit", array('title' => 'Edit User', 'class' => 'red-link'));
  59. echo " &nbsp;" . anchor('admin/user/delete/' . $row, img(array('src' => asset_url() . "images/icons/delete.png", 'border' => '0', 'alt' => 'Delete User', 'class' => "confirmClick", 'title' => "Delete User")), array('title' => 'Delete User')) . " ";
  60. echo "</td>";
  61. }
  62. echo "</tr>";
  63. $odd_even = ($odd_even == "odd") ? "even" : "odd";
  64. }
  65. echo "</tbody>";
  66. echo "</table>";
  67. echo "<br />";
  68. echo anchor('admin', 'Back', array('title' => 'Back to admin'));