annotate 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
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 clearfix" id="memberlist">
Chris@76 26 <div id="modbuttons_top" class="modbuttons clearfix margintop">
Chris@76 27 <div class="floatleft middletext">
Chris@76 28 ', $txt['pages'], ': ', $context['page_index'], '
Chris@76 29 </div>
Chris@76 30 ', template_button_strip($memberlist_buttons, 'bottom'), '
Chris@76 31 </div>';
Chris@76 32
Chris@76 33 echo '
Chris@76 34 <div id="mlist" class="tborder topic_table">
Chris@76 35 <h4 class="catbg headerpadding clearfix">
Chris@76 36 <span class="floatleft">', $txt['members_list'], '</span>';
Chris@76 37 if (!isset($context['old_search']))
Chris@76 38 echo '
Chris@76 39 <span class="floatright">', $context['letter_links'], '</span>';
Chris@76 40 echo '
Chris@76 41 </h4>
Chris@76 42 <table class="bordercolor boardsframe" cellspacing="1" cellpadding="4" width="100%">
Chris@76 43 <thead>
Chris@76 44 <tr class="titlebg">';
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 class="headerpadding" scope="col" ', 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 class="headerpadding" scope="col" 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 class="headerpadding" scope="col" ', 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 align="center" 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" align="', $context['right_to_left'] ? 'right' : 'left', '">', $member['link'], '</td>
Chris@76 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>';
Chris@76 82
Chris@76 83 if (!isset($context['disabled_fields']['website']))
Chris@76 84 echo '
Chris@76 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>';
Chris@76 86
Chris@76 87 // ICQ?
Chris@76 88 if (!isset($context['disabled_fields']['icq']))
Chris@76 89 echo '
Chris@76 90 <td align="center" 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 align="center" 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 align="center" 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 align="center" 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" align="', $context['right_to_left'] ? 'right' : 'left', '">', empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
Chris@76 110 <td align="center" class="windowbg">', $member['registered_date'], '</td>';
Chris@76 111
Chris@76 112 if (!isset($context['disabled_fields']['posts']))
Chris@76 113 echo '
Chris@76 114 <td class="windowbg2" align="', $context['right_to_left'] ? 'left' : 'right', '" width="15">', $member['posts'], '</td>
Chris@76 115 <td class="windowbg" width="100" align="', $context['right_to_left'] ? 'right' : 'left', '">
Chris@76 116 ', $member['posts'] > 0 ? '<img src="' . $settings['images_url'] . '/bar.gif" width="' . $member['post_percent'] . '" height="15" alt="" />' : '', '
Chris@76 117 </td>';
Chris@76 118
Chris@76 119 echo '
Chris@76 120 </tr>';
Chris@76 121 }
Chris@76 122 }
Chris@76 123 // No members?
Chris@76 124 else
Chris@76 125 echo '
Chris@76 126 <tr>
Chris@76 127 <td colspan="', $context['colspan'], '" class="windowbg">', $txt['search_no_results'], '</td>
Chris@76 128 </tr>';
Chris@76 129
Chris@76 130 // Show the page numbers again. (makes 'em easier to find!)
Chris@76 131 echo '
Chris@76 132 </tbody>
Chris@76 133 </table>
Chris@76 134 </div>';
Chris@76 135
Chris@76 136 echo '
Chris@76 137 <div class="middletext clearfix">
Chris@76 138 <div class="floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
Chris@76 139
Chris@76 140 // If it is displaying the result of a search show a "search again" link to edit their criteria.
Chris@76 141 if (isset($context['old_search']))
Chris@76 142 echo '
Chris@76 143 <div class="floatright">
Chris@76 144 <a href="', $scripturl, '?action=mlist;sa=search;search=', $context['old_search_value'], '">', $txt['mlist_search_again'], '</a>
Chris@76 145 </div>';
Chris@76 146 echo '
Chris@76 147 </div>
Chris@76 148 </div>';
Chris@76 149 }
Chris@76 150
Chris@76 151 // A page allowing people to search the member list.
Chris@76 152 function template_search()
Chris@76 153 {
Chris@76 154 global $context, $settings, $options, $scripturl, $txt;
Chris@76 155
Chris@76 156 // Build the memberlist button array.
Chris@76 157 $membersearch_buttons = array(
Chris@76 158 'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist;sa=all'),
Chris@76 159 'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.gif', 'lang' => true, 'url' => $scripturl . '?action=mlist;sa=search', 'active' => true),
Chris@76 160 );
Chris@76 161
Chris@76 162 // Start the submission form for the search!
Chris@76 163 echo '
Chris@76 164 <form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
Chris@76 165 <div id="memberlist">
Chris@76 166 <div id="modbuttons_top" class="modbuttons clearfix margintop">
Chris@76 167 ', template_button_strip($membersearch_buttons, 'right'), '
Chris@76 168 </div>
Chris@76 169 <div class="tborder">
Chris@76 170 <h3 class="titlebg headerpadding clearfix">
Chris@76 171 ', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search.gif" alt="" />' : '', $txt['mlist_search'], '
Chris@76 172 </h3>';
Chris@76 173
Chris@76 174 // Display the input boxes for the form.
Chris@76 175 echo '
Chris@76 176 <div class="windowbg2">
Chris@76 177 <span id="mlist_search" class="windowbg2 largepadding clearfix">
Chris@76 178 <span class="enhanced">
Chris@76 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" />
Chris@76 180 </span>
Chris@76 181 <span class="floatleft">';
Chris@76 182
Chris@76 183 $count = 0;
Chris@76 184 foreach ($context['search_fields'] as $id => $title)
Chris@76 185 {
Chris@76 186 echo '
Chris@76 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 />';
Chris@76 188 // Halfway through?
Chris@76 189 if (round(count($context['search_fields']) / 2) == ++$count)
Chris@76 190 echo '
Chris@76 191 </span>
Chris@76 192 <span class="floatright">';
Chris@76 193 }
Chris@76 194 echo '
Chris@76 195 </span>
Chris@76 196 </span>
Chris@76 197 </div>
Chris@76 198 </div>
Chris@76 199 </div>
Chris@76 200 </form>';
Chris@76 201 }
Chris@76 202
Chris@76 203 ?>