ManageMembergroups.template.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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.1 Alpha 1
  11. */
  12. function template_main()
  13. {
  14. global $context, $settings, $options, $scripturl, $txt;
  15. template_show_list('regular_membergroups_list');
  16. echo '<br /><br />';
  17. template_show_list('post_count_membergroups_list');
  18. }
  19. function template_new_group()
  20. {
  21. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  22. echo '
  23. <div id="admincenter">
  24. <form action="', $scripturl, '?action=admin;area=membergroups;sa=add" method="post" accept-charset="', $context['character_set'], '">
  25. <div class="cat_bar">
  26. <h3 class="catbg">', $txt['membergroups_new_group'], '</h3>
  27. </div>
  28. <div class="windowbg">
  29. <span class="topslice"><span></span></span>
  30. <div class="content">
  31. <dl class="settings">
  32. <dt>
  33. <label for="group_name_input"><strong>', $txt['membergroups_group_name'], ':</strong></label>
  34. </dt>
  35. <dd>
  36. <input type="text" name="group_name" id="group_name_input" size="30" class="input_text" />
  37. </dd>';
  38. if ($context['undefined_group'])
  39. {
  40. echo '
  41. <dt>
  42. <label for="group_type"><strong>', $txt['membergroups_edit_group_type'], '</strong>:</label>
  43. </dt>
  44. <dd>
  45. <fieldset id="group_type">
  46. <legend>', $txt['membergroups_edit_select_group_type'], '</legend>
  47. <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" checked="checked" class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_private'], '</label><br />';
  48. if ($context['allow_protected'])
  49. echo '
  50. <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_protected'], '</label><br />';
  51. echo '
  52. <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_request'], '</label><br />
  53. <label for="group_type_free"><input type="radio" name="group_type" id="group_type_free" value="3" class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_free'], '</label><br />
  54. <label for="group_type_post"><input type="radio" name="group_type" id="group_type_post" value="-1" class="input_radio" onclick="swapPostGroup(1);" />', $txt['membergroups_group_type_post'], '</label><br />
  55. </fieldset>
  56. </dd>';
  57. }
  58. if ($context['post_group'] || $context['undefined_group'])
  59. echo '
  60. <dt id="min_posts_text">
  61. <strong>', $txt['membergroups_min_posts'], ':</strong>
  62. </dt>
  63. <dd>
  64. <input type="text" name="min_posts" id="min_posts_input" size="5" class="input_text" />
  65. </dd>';
  66. if (!$context['post_group'] || !empty($modSettings['permission_enable_postgroups']))
  67. {
  68. echo '
  69. <dt>
  70. <label for="permission_base"><strong>', $txt['membergroups_permissions'], ':</strong></label><br />
  71. <span class="smalltext">', $txt['membergroups_can_edit_later'], '</span>
  72. </dt>
  73. <dd>
  74. <fieldset id="permission_base">
  75. <legend>', $txt['membergroups_select_permission_type'], '</legend>
  76. <input type="radio" name="perm_type" id="perm_type_inherit" value="inherit" checked="checked" class="input_radio" />
  77. <label for="perm_type_inherit">', $txt['membergroups_new_as_inherit'], ':</label>
  78. <select name="inheritperm" id="inheritperm_select" onclick="document.getElementById(\'perm_type_inherit\').checked = true;">
  79. <option value="-1">', $txt['membergroups_guests'], '</option>
  80. <option value="0" selected="selected">', $txt['membergroups_members'], '</option>';
  81. foreach ($context['groups'] as $group)
  82. echo '
  83. <option value="', $group['id'], '">', $group['name'], '</option>';
  84. echo '
  85. </select><br />
  86. <input type="radio" name="perm_type" id="perm_type_copy" value="copy" class="input_radio" />
  87. <label for="perm_type_copy">', $txt['membergroups_new_as_copy'], ':</label>
  88. <select name="copyperm" id="copyperm_select" onclick="document.getElementById(\'perm_type_copy\').checked = true;">
  89. <option value="-1">', $txt['membergroups_guests'], '</option>
  90. <option value="0" selected="selected">', $txt['membergroups_members'], '</option>';
  91. foreach ($context['groups'] as $group)
  92. echo '
  93. <option value="', $group['id'], '">', $group['name'], '</option>';
  94. echo '
  95. </select><br />
  96. <input type="radio" name="perm_type" id="perm_type_predefined" value="predefined" class="input_radio" />
  97. <label for="perm_type_predefined">', $txt['membergroups_new_as_type'], ':</label>
  98. <select name="level" id="level_select" onclick="document.getElementById(\'perm_type_predefined\').checked = true;">
  99. <option value="restrict">', $txt['permitgroups_restrict'], '</option>
  100. <option value="standard" selected="selected">', $txt['permitgroups_standard'], '</option>
  101. <option value="moderator">', $txt['permitgroups_moderator'], '</option>
  102. <option value="maintenance">', $txt['permitgroups_maintenance'], '</option>
  103. </select>
  104. </fieldset>
  105. </dd>';
  106. }
  107. echo '
  108. <dt>
  109. <strong>', $txt['membergroups_new_board'], ':</strong>', $context['post_group'] ? '<br />
  110. <span class="smalltext" style="font-weight: normal">' . $txt['membergroups_new_board_post_groups'] . '</span>' : '', '
  111. </dt>
  112. <dd>
  113. <fieldset id="visible_boards">
  114. <legend>', $txt['membergroups_new_board_desc'], '</legend>';
  115. foreach ($context['boards'] as $board)
  116. echo '
  117. <div style="margin-left: ', $board['child_level'], 'em;"><input type="checkbox" name="boardaccess[]" id="boardaccess_', $board['id'], '" value="', $board['id'], '" ', $board['selected'] ? ' checked="checked" disabled="disabled"' : '', ' class="input_check" /> <label for="boardaccess_', $board['id'], '">', $board['name'], '</label></div>';
  118. echo '
  119. <br />
  120. <input type="checkbox" id="checkall_check" class="input_check" onclick="invertAll(this, this.form, \'boardaccess\');" /> <label for="checkall_check"><em>', $txt['check_all'], '</em></label>
  121. </fieldset>
  122. </dd>
  123. </dl>
  124. <div class="righttext">
  125. <input type="submit" value="', $txt['membergroups_add_group'], '" class="button_submit" />
  126. </div>
  127. </div>
  128. <span class="botslice"><span></span></span>
  129. </div>';
  130. if ($context['undefined_group'])
  131. {
  132. echo '
  133. <script type="text/javascript"><!-- // --><![CDATA[
  134. function swapPostGroup(isChecked)
  135. {
  136. var min_posts_text = document.getElementById(\'min_posts_text\');
  137. document.getElementById(\'min_posts_input\').disabled = !isChecked;
  138. min_posts_text.style.color = isChecked ? "" : "#888888";
  139. }
  140. swapPostGroup(', $context['post_group'] ? 'true' : 'false', ');
  141. // ]]></script>';
  142. }
  143. echo '
  144. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  145. <input type="hidden" name="', $context['admin-mmg_token_var'], '" value="', $context['admin-mmg_token'], '" />
  146. </form>
  147. </div>
  148. <br class="clear" />';
  149. }
  150. function template_edit_group()
  151. {
  152. global $context, $settings, $options, $scripturl, $txt;
  153. echo '
  154. <div id="admincenter">
  155. <form action="', $scripturl, '?action=admin;area=membergroups;sa=edit;group=', $context['group']['id'], '" method="post" accept-charset="', $context['character_set'], '" name="groupForm" id="groupForm">
  156. <div class="cat_bar">
  157. <h3 class="catbg">', $txt['membergroups_edit_group'], ' - ', $context['group']['name'], '
  158. </h3>
  159. </div>
  160. <div class="windowbg2">
  161. <span class="topslice"><span></span></span>
  162. <div class="content">
  163. <dl class="settings">
  164. <dt>
  165. <label for="group_name_input"><strong>', $txt['membergroups_edit_name'], ':</strong></label>
  166. </dt>
  167. <dd>
  168. <input type="text" name="group_name" id="group_name_input" value="', $context['group']['editable_name'], '" size="30" class="input_text" />
  169. </dd>';
  170. if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
  171. echo '
  172. <dt id="group_desc_text">
  173. <label for="group_desc_input"><strong>', $txt['membergroups_edit_desc'], ':</strong></label>
  174. </dt>
  175. <dd>
  176. <textarea name="group_desc" id="group_desc_input" rows="4" cols="40">', $context['group']['description'], '</textarea>
  177. </dd>';
  178. // Group type...
  179. if ($context['group']['allow_post_group'])
  180. {
  181. echo '
  182. <dt>
  183. <label for="group_type"><strong>', $txt['membergroups_edit_group_type'], ':</strong></label>
  184. </dt>
  185. <dd>
  186. <fieldset id="group_type">
  187. <legend>', $txt['membergroups_edit_select_group_type'], '</legend>
  188. <label for="group_type_private"><input type="radio" name="group_type" id="group_type_private" value="0" ', !$context['group']['is_post_group'] && $context['group']['type'] == 0 ? 'checked="checked"' : '', ' class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_private'], '</label><br />';
  189. if ($context['group']['allow_protected'])
  190. echo '
  191. <label for="group_type_protected"><input type="radio" name="group_type" id="group_type_protected" value="1" ', $context['group']['type'] == 1 ? 'checked="checked"' : '', ' class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_protected'], '</label><br />';
  192. echo '
  193. <label for="group_type_request"><input type="radio" name="group_type" id="group_type_request" value="2" ', $context['group']['type'] == 2 ? 'checked="checked"' : '', ' class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_request'], '</label><br />
  194. <label for="group_type_free"><input type="radio" name="group_type" id="group_type_free" value="3" ', $context['group']['type'] == 3 ? 'checked="checked"' : '', ' class="input_radio" onclick="swapPostGroup(0);" />', $txt['membergroups_group_type_free'], '</label><br />
  195. <label for="group_type_post"><input type="radio" name="group_type" id="group_type_post" value="-1" ', $context['group']['is_post_group'] ? 'checked="checked"' : '', ' class="input_radio" onclick="swapPostGroup(1);" />', $txt['membergroups_group_type_post'], '</label><br />
  196. </fieldset>
  197. </dd>';
  198. }
  199. if ($context['group']['id'] != 3 && $context['group']['id'] != 4)
  200. echo '
  201. <dt id="group_moderators_text">
  202. <label for="group_moderators"><strong>', $txt['moderators'], ':</strong></label>
  203. </dt>
  204. <dd>
  205. <input type="text" name="group_moderators" id="group_moderators" value="', $context['group']['moderator_list'], '" size="30" class="input_text" />
  206. <div id="moderator_container"></div>
  207. </dd>
  208. <dt id="group_hidden_text">
  209. <label for="group_hidden_input"><strong>', $txt['membergroups_edit_hidden'], ':</strong></label>
  210. </dt>
  211. <dd>
  212. <select name="group_hidden" id="group_hidden_input" onchange="if (this.value == 2 &amp;&amp; !confirm(\'', $txt['membergroups_edit_hidden_warning'], '\')) this.value = 0;">
  213. <option value="0" ', $context['group']['hidden'] ? '' : 'selected="selected"', '>', $txt['membergroups_edit_hidden_no'], '</option>
  214. <option value="1" ', $context['group']['hidden'] == 1 ? 'selected="selected"' : '', '>', $txt['membergroups_edit_hidden_boardindex'], '</option>
  215. <option value="2" ', $context['group']['hidden'] == 2 ? 'selected="selected"' : '', '>', $txt['membergroups_edit_hidden_all'], '</option>
  216. </select>
  217. </dd>';
  218. // Can they inherit permissions?
  219. if ($context['group']['id'] > 1 && $context['group']['id'] != 3)
  220. {
  221. echo '
  222. <dt id="group_inherit_text">
  223. <label for="group_inherit_input"><strong>', $txt['membergroups_edit_inherit_permissions'], '</strong></label>:<br />
  224. <span class="smalltext">', $txt['membergroups_edit_inherit_permissions_desc'], '</span>
  225. </dt>
  226. <dd>
  227. <select name="group_inherit" id="group_inherit_input">
  228. <option value="-2">', $txt['membergroups_edit_inherit_permissions_no'], '</option>
  229. <option value="-1" ', $context['group']['inherited_from'] == -1 ? 'selected="selected"' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_guests'], '</option>
  230. <option value="0" ', $context['group']['inherited_from'] == 0 ? 'selected="selected"' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $txt['membergroups_members'], '</option>';
  231. // For all the inheritable groups show an option.
  232. foreach ($context['inheritable_groups'] as $id => $group)
  233. echo '
  234. <option value="', $id, '" ', $context['group']['inherited_from'] == $id ? 'selected="selected"' : '', '>', $txt['membergroups_edit_inherit_permissions_from'], ': ', $group, '</option>';
  235. echo '
  236. </select>
  237. <input type="hidden" name="old_inherit" value="', $context['group']['inherited_from'], '" />
  238. </dd>';
  239. }
  240. if ($context['group']['allow_post_group'])
  241. echo '
  242. <dt id="min_posts_text">
  243. <label for="min_posts_input"><strong>', $txt['membergroups_min_posts'], ':</strong></label>
  244. </dt>
  245. <dd>
  246. <input type="text" name="min_posts" id="min_posts_input"', $context['group']['is_post_group'] ? ' value="' . $context['group']['min_posts'] . '"' : '', ' size="6" class="input_text" />
  247. </dd>';
  248. echo '
  249. <dt>
  250. <label for="online_color_input"><strong>', $txt['membergroups_online_color'], ':</strong></label>
  251. </dt>
  252. <dd>
  253. <input type="text" name="online_color" id="online_color_input" value="', $context['group']['color'], '" size="20" class="input_text" />
  254. </dd>
  255. <dt>
  256. <label for="star_count_input"><strong>', $txt['membergroups_star_count'], ':</strong></label>
  257. </dt>
  258. <dd>
  259. <input type="text" name="star_count" id="star_count_input" value="', $context['group']['star_count'], '" size="4" onkeyup="if (this.value.length > 2) this.value = 99;" onkeydown="this.onkeyup();" onchange="if (this.value != 0) this.form.star_image.onchange();" class="input_text" />
  260. </dd>
  261. <dt>
  262. <label for="star_image_input"><strong>', $txt['membergroups_star_image'], ':</strong></label><br />
  263. <span class="smalltext">', $txt['membergroups_star_image_note'], '</span>
  264. </dt>
  265. <dd>
  266. ', $txt['membergroups_images_url'], '
  267. <input type="text" name="star_image" id="star_image_input" value="', $context['group']['star_image'], '" onchange="if (this.value &amp;&amp; this.form.star_count.value == 0) this.form.star_count.value = 1; else if (!this.value) this.form.star_count.value = 0; document.getElementById(\'star_preview\').src = smf_images_url + \'/\' + (this.value &amp;&amp; this.form.star_count.value > 0 ? this.value.replace(/\$language/g, \'', $context['user']['language'], '\') : \'blank.gif\');" size="20" class="input_text" />
  268. <img id="star_preview" src="', $settings['images_url'], '/', $context['group']['star_image'] == '' ? 'blank.gif' : $context['group']['star_image'], '" alt="*" />
  269. </dd>
  270. <dt>
  271. <label for="max_messages_input"><strong>', $txt['membergroups_max_messages'], ':</strong></label><br />
  272. <span class="smalltext">', $txt['membergroups_max_messages_note'], '</span>
  273. </dt>
  274. <dd>
  275. <input type="text" name="max_messages" id="max_messages_input" value="', $context['group']['id'] == 1 ? 0 : $context['group']['max_messages'], '" size="6"', $context['group']['id'] == 1 ? ' disabled="disabled"' : '', ' class="input_text" />
  276. </dd>';
  277. if (!empty($context['boards']))
  278. {
  279. echo '
  280. <dt>
  281. <strong>', $txt['membergroups_new_board'], ':</strong>', $context['group']['is_post_group'] ? '<br />
  282. <span class="smalltext">' . $txt['membergroups_new_board_post_groups'] . '</span>' : '', '
  283. </dt>
  284. <dd>
  285. <fieldset id="visible_boards" style="width: 95%;">
  286. <legend><a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'none\';document.getElementById(\'visible_boards_link\').style.display = \'block\'; return false;">', $txt['membergroups_new_board_desc'], '</a></legend>';
  287. foreach ($context['boards'] as $board)
  288. echo '
  289. <div style="margin-left: ', $board['child_level'], 'em;"><input type="checkbox" name="boardaccess[]" id="boardaccess_', $board['id'], '" value="', $board['id'], '" ', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="boardaccess_', $board['id'], '">', $board['name'], '</label></div>';
  290. echo '
  291. <br />
  292. <input type="checkbox" id="checkall_check" class="input_check" onclick="invertAll(this, this.form, \'boardaccess\');" /> <label for="checkall_check"><em>', $txt['check_all'], '</em></label>
  293. </fieldset>
  294. <a href="javascript:void(0);" onclick="document.getElementById(\'visible_boards\').style.display = \'block\'; document.getElementById(\'visible_boards_link\').style.display = \'none\'; return false;" id="visible_boards_link" style="display: none;">[ ', $txt['membergroups_select_visible_boards'], ' ]</a>
  295. <script type="text/javascript"><!-- // --><![CDATA[
  296. document.getElementById("visible_boards_link").style.display = "";
  297. document.getElementById("visible_boards").style.display = "none";
  298. // ]]></script>
  299. </dd>';
  300. }
  301. echo '
  302. </dl>
  303. <div class="righttext">
  304. <input type="submit" name="submit" value="', $txt['membergroups_edit_save'], '" class="button_submit" />', $context['group']['allow_delete'] ? '
  305. <input type="submit" name="delete" value="' . $txt['membergroups_delete'] . '" onclick="return confirm(\'' . $txt['membergroups_confirm_delete'] . '\');" class="button_submit" />' : '', '
  306. </div>
  307. </div>
  308. <span class="botslice"><span></span></span>
  309. </div>
  310. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  311. <input type="hidden" name="', $context['admin-mmg_token_var'], '" value="', $context['admin-mmg_token'], '" />
  312. </form>
  313. </div>
  314. <br class="clear" />
  315. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  316. <script type="text/javascript"><!-- // --><![CDATA[
  317. var oModeratorSuggest = new smc_AutoSuggest({
  318. sSelf: \'oModeratorSuggest\',
  319. sSessionId: \'', $context['session_id'], '\',
  320. sSessionVar: \'', $context['session_var'], '\',
  321. sSuggestId: \'group_moderators\',
  322. sControlId: \'group_moderators\',
  323. sSearchType: \'member\',
  324. bItemList: true,
  325. sPostName: \'moderator_list\',
  326. sURLMask: \'action=profile;u=%item_id%\',
  327. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  328. sItemListContainerId: \'moderator_container\',
  329. aListItems: [';
  330. foreach ($context['group']['moderators'] as $id_member => $member_name)
  331. echo '
  332. {
  333. sItemId: ', JavaScriptEscape($id_member), ',
  334. sItemName: ', JavaScriptEscape($member_name), '
  335. }', $id_member == $context['group']['last_moderator_id'] ? '' : ',';
  336. echo '
  337. ]
  338. });
  339. // ]]></script>';
  340. if ($context['group']['allow_post_group'])
  341. echo '
  342. <script type="text/javascript"><!-- // --><![CDATA[
  343. function swapPostGroup(isChecked)
  344. {
  345. var min_posts_text = document.getElementById(\'min_posts_text\');
  346. var group_desc_text = document.getElementById(\'group_desc_text\');
  347. var group_hidden_text = document.getElementById(\'group_hidden_text\');
  348. var group_moderators_text = document.getElementById(\'group_moderators_text\');
  349. document.forms.groupForm.min_posts.disabled = !isChecked;
  350. min_posts_text.style.color = isChecked ? "" : "#888888";
  351. document.forms.groupForm.group_desc_input.disabled = isChecked;
  352. group_desc_text.style.color = !isChecked ? "" : "#888888";
  353. document.forms.groupForm.group_hidden_input.disabled = isChecked;
  354. group_hidden_text.style.color = !isChecked ? "" : "#888888";
  355. document.forms.groupForm.group_moderators.disabled = isChecked;
  356. group_moderators_text.style.color = !isChecked ? "" : "#888888";
  357. }
  358. swapPostGroup(', $context['group']['is_post_group'] ? 'true' : 'false', ');
  359. // ]]></script>';
  360. }
  361. // Templating for viewing the members of a group.
  362. function template_group_members()
  363. {
  364. global $context, $settings, $options, $scripturl, $txt;
  365. echo '
  366. <div id="admincenter">
  367. <form action="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '') , ';sa=members;group=', $context['group']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  368. <div class="cat_bar">
  369. <h3 class="catbg">', $context['page_title'], '</h3>
  370. </div>
  371. <div class="windowbg">
  372. <span class="topslice"><span></span></span>
  373. <div class="content">
  374. <dl class="settings">
  375. <dt>
  376. <strong>', $txt['name'], ':</strong>
  377. </dt>
  378. <dd>
  379. <span ', $context['group']['online_color'] ? 'style="color: ' . $context['group']['online_color'] . ';"' : '', '>', $context['group']['name'], '</span> ', $context['group']['stars'], '
  380. </dd>';
  381. //Any description to show?
  382. if (!empty($context['group']['description']))
  383. echo '
  384. <dt>
  385. <strong>' . $txt['membergroups_members_description'] . ':</strong>
  386. </dt>
  387. <dd>
  388. ', $context['group']['description'] ,'
  389. </dd>';
  390. echo '
  391. <dt>
  392. <strong>', $txt['membergroups_members_top'], ':</strong>
  393. </dt>
  394. <dd>
  395. ', $context['total_members'] ,'
  396. </dd>';
  397. // Any group moderators to show?
  398. if (!empty($context['group']['moderators']))
  399. {
  400. $moderators = array();
  401. foreach ($context['group']['moderators'] as $moderator)
  402. $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>';
  403. echo '
  404. <dt>
  405. <strong>', $txt['membergroups_members_group_moderators'], ':</strong>
  406. </dt>
  407. <dd>
  408. ', implode(', ', $moderators) ,'
  409. </dd>';
  410. }
  411. echo '
  412. </dl>
  413. </div>
  414. <span class="botslice"><span></span></span>
  415. </div>
  416. <br />
  417. <div class="title_bar">
  418. <h4 class="titlebg">', $txt['membergroups_members_group_members'], '</h4>
  419. </div>
  420. <br />
  421. <div class="pagesection">', $txt['pages'], ': ', $context['page_index'], '</div>
  422. <table width="100%" class="table_grid">
  423. <thead>
  424. <tr class="catbg">
  425. <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  426. <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  427. <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  428. <th><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=registered', $context['sort_by'] == 'registered' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['date_registered'], $context['sort_by'] == 'registered' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
  429. <th', empty($context['group']['assignable']) ? ' colspan="2"' : '', '><a href="', $scripturl, '?action=', $context['current_action'], (isset($context['admin_area']) ? ';area=' . $context['admin_area'] : ''), ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>';
  430. if (!empty($context['group']['assignable']))
  431. echo '
  432. <td width="4%" align="center"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" /></td>';
  433. echo '
  434. </tr>
  435. </thead>
  436. <tbody>';
  437. if (empty($context['members']))
  438. echo '
  439. <tr class="windowbg2">
  440. <td colspan="6" align="center">', $txt['membergroups_members_no_members'], '</td>
  441. </tr>';
  442. foreach ($context['members'] as $member)
  443. {
  444. echo '
  445. <tr class="windowbg2">
  446. <td>', $member['name'], '</td>
  447. <td', $member['show_email'] == 'no_through_forum' && $settings['use_image_buttons'] ? ' align="center"' : '', '>';
  448. // Is it totally hidden?
  449. if ($member['show_email'] == 'no')
  450. echo '
  451. <em>', $txt['hidden'], '</em>';
  452. // ... otherwise they want it hidden but it's not to this person?
  453. elseif ($member['show_email'] == 'yes_permission_override')
  454. echo '
  455. <a href="mailto:', $member['email'], '"><em>', $member['email'], '</em></a>';
  456. // ... otherwise it's visible - but only via an image?
  457. elseif ($member['show_email'] == 'no_through_forum')
  458. echo '
  459. <a href="', $scripturl, '?action=emailuser;sa=email;uid=', $member['id'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email']), '</a>';
  460. // ... otherwise it must be a 'yes', show it and show it fully.
  461. else
  462. echo '
  463. <a href="mailto:', $member['email'], '">', $member['email'], '</a>';
  464. echo '
  465. </td>
  466. <td class="windowbg">', $member['last_online'], '</td>
  467. <td class="windowbg">', $member['registered'], '</td>
  468. <td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>';
  469. if (!empty($context['group']['assignable']))
  470. echo '
  471. <td align="center" width="4%"><input type="checkbox" name="rem[]" value="', $member['id'], '" class="input_check" ', ($context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : ''), '/></td>';
  472. echo '
  473. </tr>';
  474. }
  475. echo '
  476. </tbody>
  477. </table>
  478. <div class="pagesection flow_hidden">
  479. <div class="floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
  480. if (!empty($context['group']['assignable']))
  481. echo '
  482. <div class="floatright"><input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button_submit" /></div>';
  483. echo '
  484. </div>
  485. <br />';
  486. if (!empty($context['group']['assignable']))
  487. {
  488. echo '
  489. <div class="cat_bar">
  490. <h3 class="catbg">', $txt['membergroups_members_add_title'], '</h3>
  491. </div>
  492. <div class="windowbg">
  493. <span class="topslice"><span></span></span>
  494. <div class="content">
  495. <strong>', $txt['membergroups_members_add_desc'], ':</strong>
  496. <input type="text" name="toAdd" id="toAdd" value="" class="input_text" />
  497. <div id="toAddItemContainer"></div>
  498. <input type="submit" name="add" value="', $txt['membergroups_members_add'], '" class="button_submit" />
  499. </div>
  500. <span class="botslice"><span></span></span>
  501. </div>';
  502. }
  503. echo '
  504. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  505. <input type="hidden" name="', $context['mod-mgm_token_var'], '" value="', $context['mod-mgm_token'], '" />
  506. </form>
  507. </div>
  508. <br class="clear" />';
  509. if (!empty($context['group']['assignable']))
  510. echo '
  511. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  512. <script type="text/javascript"><!-- // --><![CDATA[
  513. var oAddMemberSuggest = new smc_AutoSuggest({
  514. sSelf: \'oAddMemberSuggest\',
  515. sSessionId: \'', $context['session_id'], '\',
  516. sSessionVar: \'', $context['session_var'], '\',
  517. sSuggestId: \'to_suggest\',
  518. sControlId: \'toAdd\',
  519. sSearchType: \'member\',
  520. sPostName: \'member_add\',
  521. sURLMask: \'action=profile;u=%item_id%\',
  522. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  523. bItemList: true,
  524. sItemListContainerId: \'toAddItemContainer\'
  525. });
  526. // ]]></script>';
  527. }
  528. // Allow the moderator to enter a reason to each user being rejected.
  529. function template_group_request_reason()
  530. {
  531. global $settings, $options, $context, $txt, $scripturl;
  532. // Show a welcome message to the user.
  533. echo '
  534. <div id="moderationcenter">
  535. <form action="', $scripturl, '?action=groups;sa=requests" method="post" accept-charset="', $context['character_set'], '">
  536. <div class="cat_bar">
  537. <h3 class="catbg">', $txt['mc_groups_reason_title'], '</h3>
  538. </div>
  539. <div class="windowbg">
  540. <span class="topslice"><span></span></span>
  541. <div class="content">
  542. <dl class="settings">';
  543. // Loop through and print out a reason box for each...
  544. foreach ($context['group_requests'] as $request)
  545. echo '
  546. <dt>
  547. <strong>', sprintf($txt['mc_groupr_reason_desc'], $request['member_link'], $request['group_link']), ':</strong>
  548. </dt>
  549. <dd>
  550. <input type="hidden" name="groupr[]" value="', $request['id'], '" />
  551. <textarea name="groupreason[', $request['id'], ']" rows="3" cols="40" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 96%; min-width: 96%' : 'width: 96%') . ';"></textarea>
  552. </dd>';
  553. echo '
  554. </dl>
  555. <input type="submit" name="go" value="', $txt['mc_groupr_submit'], '" class="button_submit" />
  556. <input type="hidden" name="req_action" value="got_reason" />
  557. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  558. </div>
  559. <span class="botslice"><span></span></span>
  560. </div>
  561. </form>
  562. </div>
  563. <br class="clear" />';
  564. }
  565. ?>