Memberlist.template.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2014 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // Displays a sortable listing of all members registered on the forum.
  13. function template_main()
  14. {
  15. global $context, $settings, $scripturl, $txt;
  16. echo '
  17. <div class="main_section" id="memberlist">
  18. <div class="pagesection">
  19. ', template_button_strip($context['memberlist_buttons'], 'right'), '
  20. <div class="pagelinks floatleft">', $context['page_index'], '</div>
  21. </div>
  22. <div class="cat_bar">
  23. <h4 class="catbg">
  24. <span class="floatleft">', $txt['members_list'], '</span>';
  25. if (!isset($context['old_search']))
  26. echo '
  27. <span class="floatright">', $context['letter_links'], '</span>';
  28. echo '
  29. </h4>
  30. </div>';
  31. echo '
  32. <div id="mlist">
  33. <table class="table_grid">
  34. <thead>
  35. <tr class="catbg">';
  36. // Display each of the column headers of the table.
  37. foreach ($context['columns'] as $key => $column)
  38. {
  39. // @TODO maybe find something nicer?
  40. if ($key == 'email_address' && !$context['can_send_email'])
  41. continue;
  42. // This is a selected column, so underline it or some such.
  43. if ($column['selected'])
  44. echo '
  45. <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', ' selected" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . '>
  46. <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . '</a><span class="sort sort_' . $context['sort_direction'] . '"></span></th>';
  47. // This is just some column... show the link and be done with it.
  48. else
  49. echo '
  50. <th scope="col" class="', $key, isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' style="width: ' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
  51. ', $column['link'], '</th>';
  52. }
  53. echo '
  54. </tr>
  55. </thead>
  56. <tbody>';
  57. // Assuming there are members loop through each one displaying their data.
  58. $alternate = true;
  59. if (!empty($context['members']))
  60. {
  61. foreach ($context['members'] as $member)
  62. {
  63. echo '
  64. <tr class="windowbg', $alternate ? '2' : '', '"', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>
  65. <td class="centertext">
  66. ', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['text'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" class="centericon">' : $member['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
  67. </td>
  68. <td class="lefttext">', $member['link'], '</td>';
  69. if (!isset($context['disabled_fields']['website']))
  70. echo '
  71. <td class="centertext">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank" class="new_win"><span class="generic_icons www" title="' . $member['website']['title'] . '"></span></a>' : '', '</td>';
  72. // Group and date.
  73. echo '
  74. <td class="lefttext">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
  75. <td class="lefttext">', $member['registered_date'], '</td>';
  76. if (!isset($context['disabled_fields']['posts']))
  77. {
  78. echo '
  79. <td style="white-space: nowrap; width: 15px">', $member['posts'], '</td>
  80. <td class="statsbar" style="width: 120px">';
  81. if (!empty($member['post_percent']))
  82. echo '
  83. <div class="bar" style="width: ', $member['post_percent'] + 4, 'px;">
  84. <div style="width: ', $member['post_percent'], 'px;"></div>
  85. </div>';
  86. echo '
  87. </td>';
  88. }
  89. echo '
  90. </tr>';
  91. $alternate = !$alternate;
  92. }
  93. }
  94. // No members?
  95. else
  96. echo '
  97. <tr>
  98. <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
  99. </tr>';
  100. echo '
  101. </tbody>
  102. </table>
  103. </div>';
  104. // Show the page numbers again. (makes 'em easier to find!)
  105. echo '
  106. <div class="pagesection">
  107. <div class="pagelinks floatleft">', $context['page_index'], '</div>';
  108. // If it is displaying the result of a search show a "search again" link to edit their criteria.
  109. if (isset($context['old_search']))
  110. echo '
  111. <a class="button_link" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>';
  112. echo '
  113. </div>
  114. </div>';
  115. }
  116. // A page allowing people to search the member list.
  117. function template_search()
  118. {
  119. global $context, $settings, $scripturl, $txt;
  120. // Start the submission form for the search!
  121. echo '
  122. <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
  123. <div id="memberlist">
  124. <div class="pagesection">
  125. ', template_button_strip($context['memberlist_buttons'], 'right'), '
  126. </div>
  127. <div class="cat_bar">
  128. <h3 class="catbg mlist">
  129. ', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search_hd.png" alt="" class="icon">' : '', $txt['mlist_search'], '
  130. </h3>
  131. </div>
  132. <div id="memberlist_search" class="clear">
  133. <div class="roundframe">
  134. <dl id="mlist_search" class="settings">
  135. <dt>
  136. <label><strong>', $txt['search_for'], ':</strong></label>
  137. </dt>
  138. <dd>
  139. <input type="text" name="search" value="', $context['old_search'], '" size="40" class="input_text">
  140. </dd>
  141. <dt>
  142. <label><strong>', $txt['mlist_search_filter'], ':</strong></label>
  143. </dt>';
  144. foreach ($context['search_fields'] as $id => $title)
  145. {
  146. echo '
  147. <dd>
  148. <label for="fields-', $id, '"><input type="checkbox" name="fields[]" id="fields-', $id, '" value="', $id, '"', in_array($id, $context['search_defaults']) ? ' checked' : '', ' class="input_check floatright">', $title, '</label>
  149. </dd>';
  150. }
  151. echo '
  152. </dl>
  153. <div class="flow_auto">
  154. <input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit">
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </form>';
  160. }
  161. ?>