show_users.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <script type="text/javascript" src="js/modules/show_users.js"></script>
  2. <style type="text/css">
  3. tr.hide{
  4. display: none;
  5. }
  6. table.userListTable{
  7. border-collapse: collapse;
  8. border: 0px;
  9. }
  10. table.userListTable td{
  11. padding-left: 5px;
  12. }
  13. tr.subusersShowHide{cursor: pointer;}
  14. th.subuserColumn{
  15. width: 140px;
  16. }
  17. td.actions{
  18. cursor: default;
  19. }
  20. </style>
  21. <?php
  22. /*
  23. *
  24. * OGP - Open Game Panel
  25. * Copyright (C) Copyright (C) 2008 - 2013 The OGP Development Team
  26. *
  27. * http://www.opengamepanel.org/
  28. *
  29. * This program is free software; you can redistribute it and/or
  30. * modify it under the terms of the GNU General Public License
  31. * as published by the Free Software Foundation; either version 2
  32. * of the License, or any later version.
  33. *
  34. * This program is distributed in the hope that it will be useful,
  35. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  36. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  37. * GNU General Public License for more details.
  38. *
  39. * You should have received a copy of the GNU General Public License
  40. * along with this program; if not, write to the Free Software
  41. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  42. *
  43. */
  44. function exec_ogp_module() {
  45. global $db;
  46. $page_user = isset($_GET['page']) ? $_GET['page'] : 1;
  47. $limit_user = isset($_GET['limit']) ? $_GET['limit'] : 10;
  48. echo '<h2>'.get_lang('users')."</h2>";
  49. echo "<p><a href='?m=user_admin&amp;p=add'>".get_lang('add_new_user')."</a></p>";
  50. echo '<table class="userListTable center" style="width: 100%;">';
  51. echo '<tr><th>'.get_lang('actions')."</th><th>".get_lang('username')."</th>";
  52. echo "<th>".get_lang('user_role')."</th>";
  53. echo "<th>".get_lang('email_address')."</th>";
  54. echo "<th>".get_lang('expires')."</th>";
  55. echo "<th class='subuserColumn'>".get_lang('subusers')."</th></tr>";
  56. $result = $db->getUserList_limit($page_user,$limit_user);
  57. $i = 0;
  58. foreach ( $result as $row )
  59. {
  60. // Show user's parent
  61. $ownedBy = "";
  62. if(!is_null($row['users_parent'])){
  63. $ownedBy = $row['users_parent'];
  64. }
  65. $user_expires = read_expire($row['user_expires']);
  66. print "<tr class='tr".($i++%2)." ";
  67. print $row['users_role'] . " ";
  68. if(!empty($ownedBy)){
  69. print "hide";
  70. }else{
  71. print "subusersShowHide";
  72. }
  73. print "' uid='" . $row['user_id'] . "'";
  74. if(!empty($ownedBy)){
  75. print "ownedby='" . $ownedBy . "'";
  76. }
  77. print ">";
  78. print "<td class='actions'><a href='?m=user_games&amp;p=assign&amp;user_id=$row[user_id]'>[".
  79. get_lang('assign_homes')."]</a><br />
  80. <a href='?m=user_admin&amp;p=del&amp;user_id=$row[user_id]'>[".get_lang('delete')."]</a><br />
  81. <a href='?m=user_admin&amp;p=edit_user&amp;user_id=$row[user_id]'>[".get_lang('edit_profile')."]</a></td>
  82. <td>".htmlentities($row['users_login'])."</td><td>".htmlentities($row['users_role'])."</td>
  83. <td>".htmlentities($row['users_email'])."</td>
  84. <td>$user_expires</td>";
  85. if(!empty($ownedBy)){
  86. print "<td></td>";
  87. }else{
  88. print "<td class='subUserShowHideTextTd expand' showtext='" . get_lang('show_subusers') . "' hidetext='" . get_lang('hide_subusers') . "'>" . get_lang('show_subusers') . " &darr;</td>";
  89. }
  90. print "</tr>";
  91. }
  92. echo '</table><br>';
  93. $count_users = $db->get_user_count();
  94. if($count_users > $limit_user)
  95. {
  96. $total_pages = $count_users[0]['total'] / $limit_user;
  97. $pagination = "";
  98. for($page=1; $page <= $total_pages+1; $page++)
  99. {
  100. if($page == $page_user){
  101. $pagination .= " <b>$page</b>,";
  102. }else{
  103. if(isset($_GET['limit'])){
  104. $limits = $_GET['limit'];
  105. $pagination .= "<a href='?m=user_admin&page=$page&limit=$limits'>$page</a>,";
  106. }else{
  107. $pagination .= " <a href='?m=user_admin&page=$page' >$page</a>,";
  108. }
  109. }
  110. }
  111. echo rtrim($pagination, ",");
  112. }
  113. }
  114. ?>