comparison forum/Themes/core/Memberlist.template.php @ 76:e3e11437ecea website

Add forum code
author Chris Cannam
date Sun, 07 Jul 2013 11:25:48 +0200
parents
children
comparison
equal deleted inserted replaced
75:72f59aa7e503 76:e3e11437ecea
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
13 // Displays a sortable listing of all members registered on the forum.
14 function template_main()
15 {
16 global $context, $settings, $options, $scripturl, $txt;
17
18 // Build the memberlist button array.
19 $memberlist_buttons = array(
20 'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all', 'active' => true),
21 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist;sa=search'),
22 );
23
24 echo '
25 <div class="main_section clearfix" id="memberlist">
26 <div id="modbuttons_top" class="modbuttons clearfix margintop">
27 <div class="floatleft middletext">
28 ', $txt['pages'], ': ', $context['page_index'], '
29 </div>
30 ', template_button_strip($memberlist_buttons, 'bottom'), '
31 </div>';
32
33 echo '
34 <div id="mlist" class="tborder topic_table">
35 <h4 class="catbg headerpadding clearfix">
36 <span class="floatleft">', $txt['members_list'], '</span>';
37 if (!isset($context['old_search']))
38 echo '
39 <span class="floatright">', $context['letter_links'], '</span>';
40 echo '
41 </h4>
42 <table class="bordercolor boardsframe" cellspacing="1" cellpadding="4" width="100%">
43 <thead>
44 <tr class="titlebg">';
45
46 // Display each of the column headers of the table.
47 foreach ($context['columns'] as $column)
48 {
49 // We're not able (through the template) to sort the search results right now...
50 if (isset($context['old_search']))
51 echo '
52 <th class="headerpadding" scope="col" ', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
53 ', $column['label'], '</th>';
54 // This is a selected column, so underline it or some such.
55 elseif ($column['selected'])
56 echo '
57 <th class="headerpadding" scope="col" style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . ' nowrap="nowrap">
58 <a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" /></a></th>';
59 // This is just some column... show the link and be done with it.
60 else
61 echo '
62 <th class="headerpadding" scope="col" ', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
63 ', $column['link'], '</th>';
64 }
65 echo '
66 </tr>
67 </thead>
68 <tbody>';
69
70 // Assuming there are members loop through each one displaying their data.
71 if (!empty($context['members']))
72 {
73 foreach ($context['members'] as $member)
74 {
75 echo '
76 <tr ', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>
77 <td align="center" class="windowbg2">
78 ', $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>' : '', '
79 </td>
80 <td class="windowbg" align="', $context['right_to_left'] ? 'right' : 'left', '">', $member['link'], '</td>
81 <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>';
82
83 if (!isset($context['disabled_fields']['website']))
84 echo '
85 <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>';
86
87 // ICQ?
88 if (!isset($context['disabled_fields']['icq']))
89 echo '
90 <td align="center" class="windowbg2">', $member['icq']['link'], '</td>';
91
92 // AIM?
93 if (!isset($context['disabled_fields']['aim']))
94 echo '
95 <td align="center" class="windowbg2">', $member['aim']['link'], '</td>';
96
97 // YIM?
98 if (!isset($context['disabled_fields']['yim']))
99 echo '
100 <td align="center" class="windowbg2">', $member['yim']['link'], '</td>';
101
102 // MSN?
103 if (!isset($context['disabled_fields']['msn']))
104 echo '
105 <td align="center" class="windowbg2">', $member['msn']['link'], '</td>';
106
107 // Group and date.
108 echo '
109 <td class="windowbg" align="', $context['right_to_left'] ? 'right' : 'left', '">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
110 <td align="center" class="windowbg">', $member['registered_date'], '</td>';
111
112 if (!isset($context['disabled_fields']['posts']))
113 echo '
114 <td class="windowbg2" align="', $context['right_to_left'] ? 'left' : 'right', '" width="15">', $member['posts'], '</td>
115 <td class="windowbg" width="100" align="', $context['right_to_left'] ? 'right' : 'left', '">
116 ', $member['posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $member['post_percent'] . '" height="15" alt="" />' : '', '
117 </td>';
118
119 echo '
120 </tr>';
121 }
122 }
123 // No members?
124 else
125 echo '
126 <tr>
127 <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
128 </tr>';
129
130 // Show the page numbers again. (makes 'em easier to find!)
131 echo '
132 </tbody>
133 </table>
134 </div>';
135
136 echo '
137 <div class="middletext clearfix">
138 <div class="floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
139
140 // If it is displaying the result of a search show a "search again" link to edit their criteria.
141 if (isset($context['old_search']))
142 echo '
143 <div class="floatright">
144 <a href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>
145 </div>';
146 echo '
147 </div>
148 </div>';
149 }
150
151 // A page allowing people to search the member list.
152 function template_search()
153 {
154 global $context, $settings, $options, $scripturl, $txt;
155
156 // Build the memberlist button array.
157 $membersearch_buttons = array(
158 'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist;sa=all'),
159 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist;sa=search', 'active' => true),
160 );
161
162 // Start the submission form for the search!
163 echo '
164 <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
165 <div id="memberlist">
166 <div id="modbuttons_top" class="modbuttons clearfix margintop">
167 ', template_button_strip($membersearch_buttons, 'right'), '
168 </div>
169 <div class="tborder">
170 <h3 class="titlebg headerpadding clearfix">
171 ', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search.gif" alt="" />' : '', $txt['mlist_search'], '
172 </h3>';
173
174 // Display the input boxes for the form.
175 echo '
176 <div class="windowbg2">
177 <span id="mlist_search" class="windowbg2 largepadding clearfix">
178 <span class="enhanced">
179 <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" />
180 </span>
181 <span class="floatleft">';
182
183 $count = 0;
184 foreach ($context['search_fields'] as $id => $title)
185 {
186 echo '
187 <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 />';
188 // Halfway through?
189 if (round(count($context['search_fields']) / 2) == ++$count)
190 echo '
191 </span>
192 <span class="floatright">';
193 }
194 echo '
195 </span>
196 </span>
197 </div>
198 </div>
199 </div>
200 </form>';
201 }
202
203 ?>