comparison forum/Themes/Vamp/Who.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 // The only template in the file.
14 function template_main()
15 {
16 global $context, $settings, $options, $scripturl, $txt;
17
18 // Display the table header and linktree.
19 echo '
20 <div class="main_section" id="whos_online">
21 <form action="', $scripturl, '?action=who" method="post" id="whoFilter" accept-charset="', $context['character_set'], '">
22 <div class="title_bar">
23 <h4 class="titlebg margin_lower">', $txt['who_title'], '</h4>
24 </div>
25 <div class="topic_table" id="mlist">
26 <div class="pagesection">
27 <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
28 echo '
29 <div class="selectbox floatright">', $txt['who_show1'], '
30 <select name="show_top" onchange="document.forms.whoFilter.show.value = this.value; document.forms.whoFilter.submit();">';
31
32 foreach ($context['show_methods'] as $value => $label)
33 echo '
34 <option value="', $value, '" ', $value == $context['show_by'] ? ' selected="selected"' : '', '>', $label, '</option>';
35 echo '
36 </select>
37 <noscript>
38 <input type="submit" name="submit_top" value="', $txt['go'], '" class="button_submit" />
39 </noscript>
40 </div>
41 </div>
42 <table class="table_grid" cellspacing="0">
43 <thead>
44 <tr class="catbg">
45 <th scope="col" class="lefttext first_th" width="40%"><a href="', $scripturl, '?action=who;start=', $context['start'], ';show=', $context['show_by'], ';sort=user', $context['sort_direction'] != 'down' && $context['sort_by'] == 'user' ? '' : ';asc', '" rel="nofollow">', $txt['who_user'], ' ', $context['sort_by'] == 'user' ? '<img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
46 <th scope="col" class="lefttext" width="10%"><a href="', $scripturl, '?action=who;start=', $context['start'], ';show=', $context['show_by'], ';sort=time', $context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ? ';asc' : '', '" rel="nofollow">', $txt['who_time'], ' ', $context['sort_by'] == 'time' ? '<img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
47 <th scope="col" class="lefttext last_th" width="50%">', $txt['who_action'], '</th>
48 </tr>
49 </thead>
50 <tbody>';
51
52 // For every member display their name, time and action (and more for admin).
53 $alternate = 0;
54
55 foreach ($context['members'] as $member)
56 {
57 // $alternate will either be true or false. If it's true, use "windowbg2" and otherwise use "windowbg".
58 echo '
59 <tr class="windowbg', $alternate ? '2' : '', '">
60 <td>';
61
62 // Guests don't have information like icq, msn, y!, and aim... and they can't be messaged.
63 if (!$member['is_guest'])
64 {
65 echo '
66 <span class="contact_info floatright">
67 ', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="bottom" />' : $member['online']['text'], $context['can_send_pm'] ? '</a>' : '', '
68 ', isset($context['disabled_fields']['icq']) ? '' : $member['icq']['link'] , ' ', isset($context['disabled_fields']['msn']) ? '' : $member['msn']['link'], ' ', isset($context['disabled_fields']['yim']) ? '' : $member['yim']['link'], ' ', isset($context['disabled_fields']['aim']) ? '' : $member['aim']['link'], '
69 </span>';
70 }
71
72 echo '
73 <span class="member', $member['is_hidden'] ? ' hidden' : '', '">
74 ', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt['profile_of'] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '
75 </span>';
76
77 if (!empty($member['ip']))
78 echo '
79 (<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>)';
80
81 echo '
82 </td>
83 <td nowrap="nowrap">', $member['time'], '</td>
84 <td>', $member['action'], '</td>
85 </tr>';
86
87 // Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)
88 $alternate = !$alternate;
89 }
90
91 // No members?
92 if (empty($context['members']))
93 {
94 echo '
95 <tr class="windowbg2">
96 <td colspan="3" align="center">
97 ', $txt['who_no_online_' . ($context['show_by'] == 'guests' || $context['show_by'] == 'spiders' ? $context['show_by'] : 'members')], '
98 </td>
99 </tr>';
100 }
101
102 echo '
103 </tbody>
104 </table>
105 </div>
106 <div class="pagesection">
107 <div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
108
109 echo '
110 <div class="selectbox floatright">', $txt['who_show1'], '
111 <select name="show" onchange="document.forms.whoFilter.submit();">';
112
113 foreach ($context['show_methods'] as $value => $label)
114 echo '
115 <option value="', $value, '" ', $value == $context['show_by'] ? ' selected="selected"' : '', '>', $label, '</option>';
116 echo '
117 </select>
118 <noscript>
119 <input type="submit" value="', $txt['go'], '" class="button_submit" />
120 </noscript>
121 </div>
122 </div>
123 </form>
124 </div>';
125 }
126
127 function template_credits()
128 {
129 global $context, $txt;
130
131 // The most important part - the credits :P.
132 echo '
133 <div class="main_section" id="credits">
134 <div class="cat_bar">
135 <h3 class="catbg">', $txt['credits'], '</h3>
136 </div>';
137
138 foreach ($context['credits'] as $section)
139 {
140 if (isset($section['pretext']))
141 echo '
142 <div class="windowbg">
143 <span class="topslice"><span></span></span>
144 <div class="content">
145 <p>', $section['pretext'], '</p>
146 </div>
147 <span class="botslice"><span></span></span>
148 </div>';
149
150 if (isset($section['title']))
151 echo '
152 <div class="cat_bar">
153 <h3 class="catbg">', $section['title'], '</h3>
154 </div>';
155
156 echo '
157 <div class="windowbg2">
158 <span class="topslice"><span></span></span>
159 <div class="content">
160 <dl>';
161
162 foreach ($section['groups'] as $group)
163 {
164 if (isset($group['title']))
165 echo '
166 <dt>
167 <strong>', $group['title'], '</strong>
168 </dt>
169 <dd>';
170
171 // Try to make this read nicely.
172 if (count($group['members']) <= 2)
173 echo implode(' ' . $txt['credits_and'] . ' ', $group['members']);
174 else
175 {
176 $last_peep = array_pop($group['members']);
177 echo implode(', ', $group['members']), ' ', $txt['credits_and'], ' ', $last_peep;
178 }
179
180 echo '
181 </dd>';
182 }
183
184 echo '
185 </dl>';
186
187 if (isset($section['posttext']))
188 echo '
189 <p class="posttext">', $section['posttext'], '</p>';
190
191 echo '
192 </div>
193 <span class="botslice"><span></span></span>
194 </div>';
195 }
196
197 echo '
198 <div class="cat_bar">
199 <h3 class="catbg">', $txt['credits_copyright'], '</h3>
200 </div>
201 <div class="windowbg">
202 <span class="topslice"><span></span></span>
203 <div class="content">
204 <dl>
205 <dt><strong>', $txt['credits_forum'], '</strong></dt>', '
206 <dd>', $context['copyrights']['smf'];
207
208 echo '
209 </dd>
210 </dl>';
211
212 if (!empty($context['copyrights']['mods']))
213 {
214 echo '
215 <dl>
216 <dt><strong>', $txt['credits_modifications'], '</strong></dt>
217 <dd>', implode('</dd><dd>', $context['copyrights']['mods']), '</dd>
218 </dl>';
219 }
220
221 echo '
222 </div>
223 <span class="botslice"><span></span></span>
224 </div>
225 </div>';
226 }
227 ?>