Memberlist.template.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  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, $options, $scripturl, $txt;
  16. // Build the memberlist button array.
  17. $memberlist_buttons = array(
  18. 'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all', 'active'=> true),
  19. 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=search'),
  20. );
  21. echo '
  22. <div class="main_section" id="memberlist">
  23. <div class="cat_bar">
  24. <h4 class="catbg">
  25. <span class="floatleft">', $txt['members_list'], '</span>';
  26. if (!isset($context['old_search']))
  27. echo '
  28. <span class="floatright">', $context['letter_links'], '</span>';
  29. echo '
  30. </h4>
  31. </div>
  32. <div class="pagesection">
  33. ', template_button_strip($memberlist_buttons, 'right'), '
  34. <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>
  35. </div>';
  36. echo '
  37. <div id="mlist" class="tborder topic_table">
  38. <table class="table_grid" cellspacing="0" width="100%">
  39. <thead>
  40. <tr class="catbg">';
  41. // Display each of the column headers of the table.
  42. foreach ($context['columns'] as $column)
  43. {
  44. // This is a selected column, so underline it or some such.
  45. if ($column['selected'])
  46. echo '
  47. <th scope="col" class="', isset($column['class']) ? ' ' . $column['class'] : '', '" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . ' nowrap="nowrap">
  48. <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . '</a><img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" /></th>';
  49. // This is just some column... show the link and be done with it.
  50. else
  51. echo '
  52. <th scope="col" class="', isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
  53. ', $column['link'], '</th>';
  54. }
  55. echo '
  56. </tr>
  57. </thead>
  58. <tbody>';
  59. // Assuming there are members loop through each one displaying their data.
  60. $alternate = true;
  61. if (!empty($context['members']))
  62. {
  63. foreach ($context['members'] as $member)
  64. {
  65. echo '
  66. <tr class="windowbg', $alternate ? '2' : '', '"', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>
  67. <td class="centertext">
  68. ', $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>' : '', '
  69. </td>
  70. <td class="lefttext">', $member['link'], '</td>
  71. <td class="centertext">', $member['show_email'] == 'no' ? '' : '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '" rel="nofollow"><img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . ' ' . $member['name'] . '" /></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"><img src="' . $settings['images_url'] . '/www.png" alt="' . $member['website']['title'] . '" title="' . $member['website']['title'] . '" /></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. // MSN?
  88. if (!isset($context['disabled_fields']['msn']))
  89. echo '
  90. <td class="centertext">', $member['msn']['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="15">', $member['posts'], '</td>
  99. <td class="statsbar" width="120">';
  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">', $txt['pages'], ': ', $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, $options, $scripturl, $txt;
  139. // Build the memberlist button array.
  140. $memberlist_buttons = array(
  141. 'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all'),
  142. 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=search', 'active' => true),
  143. );
  144. // Start the submission form for the search!
  145. echo '
  146. <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
  147. <div id="memberlist">
  148. <div class="cat_bar">
  149. <h3 class="catbg mlist">
  150. <span class="ie6_header floatleft">', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search.png" alt="" class="icon" />' : '', $txt['mlist_search'], '</span>
  151. </h3>
  152. </div>
  153. <div class="pagesection">
  154. ', template_button_strip($memberlist_buttons, 'right'), '
  155. </div>';
  156. // Display the input boxes for the form.
  157. echo ' <div id="memberlist_search" class="clear">
  158. <span class="upperframe"><span></span></span>';
  159. echo '
  160. <div class="roundframe">
  161. <dl id="mlist_search" class="settings">
  162. <dt>
  163. <label><strong>', $txt['search_for'], ':</strong></label>
  164. </dt>
  165. <dd>
  166. <input type="text" name="search" value="', $context['old_search'], '" size="40" class="input_text" />
  167. </dd>
  168. <dt>
  169. <label><strong>', $txt['mlist_search_filter'], ':</strong></label>
  170. </dt>';
  171. foreach ($context['search_fields'] as $id => $title)
  172. {
  173. echo '
  174. <dd>
  175. <label for="fields-', $id, '"><input type="checkbox" name="fields[]" id="fields-', $id, '" value="', $id, '" ', in_array($id, $context['search_defaults']) ? 'checked="checked"' : '', ' class="input_check floatright" />', $title, '</label>
  176. </dd>';
  177. }
  178. echo '
  179. </dl>
  180. <hr class="hrcolor" />
  181. <input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
  182. <br class="clear_right" />
  183. </div>';
  184. echo '
  185. <span class="lowerframe"><span></span></span>
  186. </div>
  187. </div>
  188. </form>';
  189. }
  190. ?>