Memberlist.template.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all', 'active'=> true),
  19. 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.gif', '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. // We're not able (through the template) to sort the search results right now...
  45. if (isset($context['old_search']))
  46. echo '
  47. <th scope="col" class="', isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
  48. ', $column['label'], '</th>';
  49. // This is a selected column, so underline it or some such.
  50. elseif ($column['selected'])
  51. echo '
  52. <th scope="col" class="', isset($column['class']) ? ' ' . $column['class'] : '', '" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . ' nowrap="nowrap">
  53. <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" /></a></th>';
  54. // This is just some column... show the link and be done with it.
  55. else
  56. echo '
  57. <th scope="col" class="', isset($column['class']) ? ' ' . $column['class'] : '', '"', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
  58. ', $column['link'], '</th>';
  59. }
  60. echo '
  61. </tr>
  62. </thead>
  63. <tbody>';
  64. // Assuming there are members loop through each one displaying their data.
  65. if (!empty($context['members']))
  66. {
  67. foreach ($context['members'] as $member)
  68. {
  69. echo '
  70. <tr ', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>
  71. <td class="windowbg2">
  72. ', $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'] . '" align="middle" />' : $member['online']['label'], $context['can_send_pm'] ? '</a>' : '', '
  73. </td>
  74. <td class="windowbg lefttext">', $member['link'], '</td>
  75. <td class="windowbg2">', $member['show_email'] == 'no' ? '' : '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '" rel="nofollow"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . ' ' . $member['name'] . '" /></a>', '</td>';
  76. if (!isset($context['disabled_fields']['website']))
  77. echo '
  78. <td class="windowbg">', $member['website']['url'] != '' ? '<a href="' . $member['website']['url'] . '" target="_blank" class="new_win"><img src="' . $settings['images_url'] . '/www.gif" alt="' . $member['website']['title'] . '" title="' . $member['website']['title'] . '" /></a>' : '', '</td>';
  79. // ICQ?
  80. if (!isset($context['disabled_fields']['icq']))
  81. echo '
  82. <td class="windowbg2">', $member['icq']['link'], '</td>';
  83. // AIM?
  84. if (!isset($context['disabled_fields']['aim']))
  85. echo '
  86. <td class="windowbg2">', $member['aim']['link'], '</td>';
  87. // YIM?
  88. if (!isset($context['disabled_fields']['yim']))
  89. echo '
  90. <td class="windowbg2">', $member['yim']['link'], '</td>';
  91. // MSN?
  92. if (!isset($context['disabled_fields']['msn']))
  93. echo '
  94. <td class="windowbg2">', $member['msn']['link'], '</td>';
  95. // Group and date.
  96. echo '
  97. <td class="windowbg lefttext">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
  98. <td class="windowbg lefttext">', $member['registered_date'], '</td>';
  99. if (!isset($context['disabled_fields']['posts']))
  100. {
  101. echo '
  102. <td class="windowbg2" style="white-space: nowrap" width="15">', $member['posts'], '</td>
  103. <td class="windowbg statsbar" width="120">';
  104. if (!empty($member['post_percent']))
  105. echo '
  106. <div class="bar" style="width: ', $member['post_percent'] + 4, 'px;">
  107. <div style="width: ', $member['post_percent'], 'px;"></div>
  108. </div>';
  109. echo '
  110. </td>';
  111. }
  112. echo '
  113. </tr>';
  114. }
  115. }
  116. // No members?
  117. else
  118. echo '
  119. <tr>
  120. <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
  121. </tr>';
  122. // Show the page numbers again. (makes 'em easier to find!)
  123. echo '
  124. </tbody>
  125. </table>
  126. </div>';
  127. echo '
  128. <div class="pagesection">
  129. <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
  130. // If it is displaying the result of a search show a "search again" link to edit their criteria.
  131. if (isset($context['old_search']))
  132. echo '
  133. <div class="floatright">
  134. <a href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>
  135. </div>';
  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.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all'),
  147. 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.gif', '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.gif" 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. <div class="roundframe">
  165. <div id="mlist_search" class="flow_hidden">
  166. <div id="search_term_input"><br />
  167. <strong>', $txt['search_for'], ':</strong>
  168. <input type="text" name="search" value="', $context['old_search'], '" size="35" class="input_text" /> <input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
  169. </div>
  170. <span class="floatleft">';
  171. $count = 0;
  172. foreach ($context['search_fields'] as $id => $title)
  173. {
  174. echo '
  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" />', $title, '</label><br />';
  176. // Half way through?
  177. if (round(count($context['search_fields']) / 2) == ++$count)
  178. echo '
  179. </span>
  180. <span class="floatleft">';
  181. }
  182. echo '
  183. </span>
  184. </div>
  185. </div>
  186. <span class="lowerframe"><span></span></span>
  187. </div>
  188. </div>
  189. </form>';
  190. }
  191. ?>