annotate forum/Themes/default/Memberlist.template.php @ 76:e3e11437ecea website

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