users.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. set_include_path(get_include_path() . PATH_SEPARATOR .
  3. dirname(__FILE__) ."/include");
  4. require_once "functions.php";
  5. function format_users() {
  6. $dbh = DB::get();
  7. $sth = $dbh->query("SELECT * FROM ttirc_users ORDER BY login");
  8. $tmp = "";
  9. while ($line = $sth->fetch()) {
  10. $id = $line['id'];
  11. $tmp .= "<li id='U-$id' class='row' user_id='$id'>";
  12. $tmp .= "<input type='checkbox' onchange='select_row(this)'
  13. row_id='U-$id'>";
  14. $tmp .= "&nbsp;<a href=\"#\" title=\"".__('Click to edit user')."\"
  15. onclick=\"edit_user($id)\">".
  16. $line['login']."</a>";
  17. $tmp .= "</li>";
  18. }
  19. return $tmp;
  20. }
  21. function show_users() {
  22. ?>
  23. <div class="modal-header">
  24. <button type="button" onclick="close_infobox()" class="close">&times;</button>
  25. <h3><?php echo __("Edit Users") ?></h3></div>
  26. <div class="modal-body">
  27. <div id="mini-notice" class="alert alert-warning" style='display : none'>&nbsp;</div>
  28. <ul class="list-unstyled scrollable panel panel-default" id="users-list">
  29. <?php echo format_users(); ?>
  30. </ul>
  31. </div>
  32. <div class="modal-footer">
  33. <div style='float : left'>
  34. <button class="btn" onclick="create_user()">
  35. <?php echo __('Add user') ?></button>
  36. <button class="btn" onclick="reset_user()">
  37. <?php echo __('Reset password') ?></button>
  38. <button class="btn btn-danger" onclick="delete_user()">
  39. <?php echo __('Delete') ?></button>
  40. </div>
  41. <button class="btn btn-primary" type="submit" onclick="close_infobox()">
  42. <?php echo __('Close') ?></button></div>
  43. </div>
  44. <?php
  45. }
  46. ?>