users.php 1.5 KB

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