Memberlist.template.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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.0
  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 clearfix" id="memberlist">
  23. <div id="modbuttons_top" class="modbuttons clearfix margintop">
  24. <div class="floatleft middletext">
  25. ', $txt['pages'], ': ', $context['page_index'], '
  26. </div>
  27. ', template_button_strip($memberlist_buttons, 'bottom'), '
  28. </div>';
  29. echo '
  30. <div id="mlist" class="tborder topic_table">
  31. <h4 class="catbg headerpadding clearfix">
  32. <span class="floatleft">', $txt['members_list'], '</span>';
  33. if (!isset($context['old_search']))
  34. echo '
  35. <span class="floatright">', $context['letter_links'], '</span>';
  36. echo '
  37. </h4>
  38. <table class="bordercolor boardsframe" cellspacing="1" cellpadding="4" width="100%">
  39. <thead>
  40. <tr class="titlebg">';
  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 class="headerpadding" scope="col" ', 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 class="headerpadding" scope="col" 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 class="headerpadding" scope="col" ', 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 align="center" 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" align="', $context['right_to_left'] ? 'right' : 'left', '">', $member['link'], '</td>
  75. <td class="windowbg2" align="center">', $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 align="center" 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 align="center" class="windowbg2">', $member['icq']['link'], '</td>';
  83. // AIM?
  84. if (!isset($context['disabled_fields']['aim']))
  85. echo '
  86. <td align="center" class="windowbg2">', $member['aim']['link'], '</td>';
  87. // YIM?
  88. if (!isset($context['disabled_fields']['yim']))
  89. echo '
  90. <td align="center" class="windowbg2">', $member['yim']['link'], '</td>';
  91. // MSN?
  92. if (!isset($context['disabled_fields']['msn']))
  93. echo '
  94. <td align="center" class="windowbg2">', $member['msn']['link'], '</td>';
  95. // Group and date.
  96. echo '
  97. <td class="windowbg" align="', $context['right_to_left'] ? 'right' : 'left', '">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
  98. <td align="center" class="windowbg">', $member['registered_date'], '</td>';
  99. if (!isset($context['disabled_fields']['posts']))
  100. echo '
  101. <td class="windowbg2" align="', $context['right_to_left'] ? 'left' : 'right', '" width="15">', $member['posts'], '</td>
  102. <td class="windowbg" width="100" align="', $context['right_to_left'] ? 'right' : 'left', '">
  103. ', $member['posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $member['post_percent'] . '" height="15" alt="" />' : '', '
  104. </td>';
  105. echo '
  106. </tr>';
  107. }
  108. }
  109. // No members?
  110. else
  111. echo '
  112. <tr>
  113. <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
  114. </tr>';
  115. // Show the page numbers again. (makes 'em easier to find!)
  116. echo '
  117. </tbody>
  118. </table>
  119. </div>';
  120. echo '
  121. <div class="middletext clearfix">
  122. <div class="floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
  123. // If it is displaying the result of a search show a "search again" link to edit their criteria.
  124. if (isset($context['old_search']))
  125. echo '
  126. <div class="floatright">
  127. <a href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>
  128. </div>';
  129. echo '
  130. </div>
  131. </div>';
  132. }
  133. // A page allowing people to search the member list.
  134. function template_search()
  135. {
  136. global $context, $settings, $options, $scripturl, $txt;
  137. // Build the memberlist button array.
  138. $membersearch_buttons = array(
  139. 'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist;sa=all'),
  140. 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist;sa=search', 'active' => true),
  141. );
  142. // Start the submission form for the search!
  143. echo '
  144. <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
  145. <div id="memberlist">
  146. <div id="modbuttons_top" class="modbuttons clearfix margintop">
  147. ', template_button_strip($membersearch_buttons, 'right'), '
  148. </div>
  149. <div class="tborder">
  150. <h3 class="titlebg headerpadding clearfix">
  151. ', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search.gif" alt="" />' : '', $txt['mlist_search'], '
  152. </h3>';
  153. // Display the input boxes for the form.
  154. echo '
  155. <div class="windowbg2">
  156. <span id="mlist_search" class="windowbg2 largepadding clearfix">
  157. <span class="enhanced">
  158. <strong>', $txt['search_for'], ':</strong> <input type="text" name="search" value="', $context['old_search'], '" size="35" class="input_text" /> <input type="submit" name="submit" value="' . $txt['search'] . '" style="margin-left: 20px;" class="button_submit" />
  159. </span>
  160. <span class="floatleft">';
  161. $count = 0;
  162. foreach ($context['search_fields'] as $id => $title)
  163. {
  164. echo '
  165. <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 />';
  166. // Halfway through?
  167. if (round(count($context['search_fields']) / 2) == ++$count)
  168. echo '
  169. </span>
  170. <span class="floatright">';
  171. }
  172. echo '
  173. </span>
  174. </span>
  175. </div>
  176. </div>
  177. </div>
  178. </form>';
  179. }
  180. ?>