Memberlist.template.php 6.9 KB

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