Memberlist.template.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. // Show custom fields marked to be shown here
  90. if (!empty($context['custom_profile_fields']['columns']))
  91. {
  92. foreach ($context['custom_profile_fields']['columns'] as $key => $column)
  93. echo '
  94. <td class="lefttext">', $member['options'][$key], '</td>';
  95. }
  96. echo '
  97. </tr>';
  98. $alternate = !$alternate;
  99. }
  100. }
  101. // No members?
  102. else
  103. echo '
  104. <tr>
  105. <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
  106. </tr>';
  107. echo '
  108. </tbody>
  109. </table>
  110. </div>';
  111. // Show the page numbers again. (makes 'em easier to find!)
  112. echo '
  113. <div class="pagesection">
  114. <div class="pagelinks floatleft">', $context['page_index'], '</div>';
  115. // If it is displaying the result of a search show a "search again" link to edit their criteria.
  116. if (isset($context['old_search']))
  117. echo '
  118. <a class="button_link" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>';
  119. echo '
  120. </div>
  121. </div>';
  122. }
  123. // A page allowing people to search the member list.
  124. function template_search()
  125. {
  126. global $context, $settings, $scripturl, $txt;
  127. // Start the submission form for the search!
  128. echo '
  129. <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
  130. <div id="memberlist">
  131. <div class="pagesection">
  132. ', template_button_strip($context['memberlist_buttons'], 'right'), '
  133. </div>
  134. <div class="cat_bar">
  135. <h3 class="catbg mlist">
  136. ', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search_hd.png" alt="" class="icon">' : '', $txt['mlist_search'], '
  137. </h3>
  138. </div>
  139. <div id="memberlist_search" class="clear">
  140. <div class="roundframe">
  141. <dl id="mlist_search" class="settings">
  142. <dt>
  143. <label><strong>', $txt['search_for'], ':</strong></label>
  144. </dt>
  145. <dd>
  146. <input type="text" name="search" value="', $context['old_search'], '" size="40" class="input_text">
  147. </dd>
  148. <dt>
  149. <label><strong>', $txt['mlist_search_filter'], ':</strong></label>
  150. </dt>';
  151. foreach ($context['search_fields'] as $id => $title)
  152. {
  153. echo '
  154. <dd>
  155. <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>
  156. </dd>';
  157. }
  158. echo '
  159. </dl>
  160. <div class="flow_auto">
  161. <input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit">
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. </form>';
  167. }
  168. ?>