Memberlist.template.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 $key => $column)
  43. {
  44. // @TODO maybe find something nicer?
  45. if ($key == 'email_address' && !$context['can_send_email'])
  46. continue;
  47. // This is a selected column, so underline it or some such.
  48. if ($column['selected'])
  49. echo '
  50. <th scope="col" class="', isset($column['class']) ? ' ' . $column['class'] : '', '" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . ' nowrap="nowrap">
  51. <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . '</a><img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" /></th>';
  52. // This is just some column... show the link and be done with it.
  53. else
  54. echo '
  55. <th scope="col" class="', isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
  56. ', $column['link'], '</th>';
  57. }
  58. echo '
  59. </tr>
  60. </thead>
  61. <tbody>';
  62. // Assuming there are members loop through each one displaying their data.
  63. $alternate = true;
  64. if (!empty($context['members']))
  65. {
  66. foreach ($context['members'] as $member)
  67. {
  68. echo '
  69. <tr class="windowbg', $alternate ? '2' : '', '"', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>
  70. <td class="centertext">
  71. ', $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>' : '', '
  72. </td>
  73. <td class="lefttext">', $member['link'], '</td>';
  74. if ($context['can_send_email'])
  75. echo '
  76. <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>';
  77. if (!isset($context['disabled_fields']['website']))
  78. echo '
  79. <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>';
  80. // ICQ?
  81. if (!isset($context['disabled_fields']['icq']))
  82. echo '
  83. <td class="centertext">', $member['icq']['link'], '</td>';
  84. // AIM?
  85. if (!isset($context['disabled_fields']['aim']))
  86. echo '
  87. <td class="centertext">', $member['aim']['link'], '</td>';
  88. // YIM?
  89. if (!isset($context['disabled_fields']['yim']))
  90. echo '
  91. <td class="centertext">', $member['yim']['link'], '</td>';
  92. // MSN?
  93. if (!isset($context['disabled_fields']['msn']))
  94. echo '
  95. <td class="centertext">', $member['msn']['link'], '</td>';
  96. // Group and date.
  97. echo '
  98. <td class="lefttext">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
  99. <td class="lefttext">', $member['registered_date'], '</td>';
  100. if (!isset($context['disabled_fields']['posts']))
  101. {
  102. echo '
  103. <td style="white-space: nowrap" width="15">', $member['posts'], '</td>
  104. <td class="statsbar" width="120">';
  105. if (!empty($member['post_percent']))
  106. echo '
  107. <div class="bar" style="width: ', $member['post_percent'] + 4, 'px;">
  108. <div style="width: ', $member['post_percent'], 'px;"></div>
  109. </div>';
  110. echo '
  111. </td>';
  112. }
  113. echo '
  114. </tr>';
  115. $alternate = !$alternate;
  116. }
  117. }
  118. // No members?
  119. else
  120. echo '
  121. <tr>
  122. <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
  123. </tr>';
  124. echo '
  125. </tbody>
  126. </table>
  127. </div>';
  128. // Show the page numbers again. (makes 'em easier to find!)
  129. echo '
  130. <div class="pagesection">
  131. <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
  132. // If it is displaying the result of a search show a "search again" link to edit their criteria.
  133. if (isset($context['old_search']))
  134. echo '
  135. <a class="button_link" href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>';
  136. echo '
  137. </div>
  138. </div>';
  139. }
  140. // A page allowing people to search the member list.
  141. function template_search()
  142. {
  143. global $context, $settings, $options, $scripturl, $txt;
  144. // Build the memberlist button array.
  145. $memberlist_buttons = array(
  146. 'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all'),
  147. 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=search', 'active' => true),
  148. );
  149. // Start the submission form for the search!
  150. echo '
  151. <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
  152. <div id="memberlist">
  153. <div class="cat_bar">
  154. <h3 class="catbg mlist">
  155. <span class="ie6_header floatleft">', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search.png" alt="" class="icon" />' : '', $txt['mlist_search'], '</span>
  156. </h3>
  157. </div>
  158. <div class="pagesection">
  159. ', template_button_strip($memberlist_buttons, 'right'), '
  160. </div>';
  161. // Display the input boxes for the form.
  162. echo ' <div id="memberlist_search" class="clear">
  163. <span class="upperframe"><span></span></span>';
  164. echo '
  165. <div class="roundframe">
  166. <dl id="mlist_search" class="settings">
  167. <dt>
  168. <label><strong>', $txt['search_for'], ':</strong></label>
  169. </dt>
  170. <dd>
  171. <input type="text" name="search" value="', $context['old_search'], '" size="40" class="input_text" />
  172. </dd>
  173. <dt>
  174. <label><strong>', $txt['mlist_search_filter'], ':</strong></label>
  175. </dt>';
  176. foreach ($context['search_fields'] as $id => $title)
  177. {
  178. echo '
  179. <dd>
  180. <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>
  181. </dd>';
  182. }
  183. echo '
  184. </dl>
  185. <hr class="hrcolor" />
  186. <input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
  187. <br class="clear_right" />
  188. </div>';
  189. echo '
  190. <span class="lowerframe"><span></span></span>
  191. </div>
  192. </div>
  193. </form>';
  194. }
  195. ?>