Memberlist.template.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. // ICQ?
  73. if (!isset($context['disabled_fields']['icq']))
  74. echo '
  75. <td class="centertext">', $member['icq']['link'], '</td>';
  76. // AIM?
  77. if (!isset($context['disabled_fields']['aim']))
  78. echo '
  79. <td class="centertext">', $member['aim']['link'], '</td>';
  80. // YIM?
  81. if (!isset($context['disabled_fields']['yim']))
  82. echo '
  83. <td class="centertext">', $member['yim']['link'], '</td>';
  84. // Skype?
  85. if (!isset($context['disabled_fields']['skype']))
  86. echo '
  87. <td class="centertext">', $member['skype']['link'], '</td>';
  88. // Group and date.
  89. echo '
  90. <td class="lefttext">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
  91. <td class="lefttext">', $member['registered_date'], '</td>';
  92. if (!isset($context['disabled_fields']['posts']))
  93. {
  94. echo '
  95. <td style="white-space: nowrap; width: 15px">', $member['posts'], '</td>
  96. <td class="statsbar" style="width: 120px">';
  97. if (!empty($member['post_percent']))
  98. echo '
  99. <div class="bar" style="width: ', $member['post_percent'] + 4, 'px;">
  100. <div style="width: ', $member['post_percent'], 'px;"></div>
  101. </div>';
  102. echo '
  103. </td>';
  104. }
  105. echo '
  106. </tr>';
  107. $alternate = !$alternate;
  108. }
  109. }
  110. // No members?
  111. else
  112. echo '
  113. <tr>
  114. <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
  115. </tr>';
  116. echo '
  117. </tbody>
  118. </table>
  119. </div>';
  120. // Show the page numbers again. (makes 'em easier to find!)
  121. echo '
  122. <div class="pagesection">
  123. <div class="pagelinks floatleft">', $context['page_index'], '</div>';
  124. // If it is displaying the result of a search show a "search again" link to edit their criteria.
  125. if (isset($context['old_search']))
  126. echo '
  127. <a class="button_link" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>';
  128. echo '
  129. </div>
  130. </div>';
  131. }
  132. // A page allowing people to search the member list.
  133. function template_search()
  134. {
  135. global $context, $settings, $scripturl, $txt;
  136. // Start the submission form for the search!
  137. echo '
  138. <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
  139. <div id="memberlist">
  140. <div class="pagesection">
  141. ', template_button_strip($context['memberlist_buttons'], 'right'), '
  142. </div>
  143. <div class="cat_bar">
  144. <h3 class="catbg mlist">
  145. ', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search_hd.png" alt="" class="icon">' : '', $txt['mlist_search'], '
  146. </h3>
  147. </div>
  148. <div id="memberlist_search" class="clear">
  149. <div class="roundframe">
  150. <dl id="mlist_search" class="settings">
  151. <dt>
  152. <label><strong>', $txt['search_for'], ':</strong></label>
  153. </dt>
  154. <dd>
  155. <input type="text" name="search" value="', $context['old_search'], '" size="40" class="input_text">
  156. </dd>
  157. <dt>
  158. <label><strong>', $txt['mlist_search_filter'], ':</strong></label>
  159. </dt>';
  160. foreach ($context['search_fields'] as $id => $title)
  161. {
  162. echo '
  163. <dd>
  164. <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>
  165. </dd>';
  166. }
  167. echo '
  168. </dl>
  169. <div class="flow_auto">
  170. <input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit">
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </form>';
  176. }
  177. ?>