ManagePaid.template.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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. // The template for adding or editing a subscription.
  13. function template_modify_subscription()
  14. {
  15. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  16. echo '
  17. <div id="admincenter">
  18. <form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modify;sid=', $context['sub_id'], '" method="post">
  19. <div class="cat_bar">
  20. <h3 class="catbg">', $txt['paid_' . $context['action_type'] . '_subscription'], '</h3>
  21. </div>';
  22. if (!empty($context['disable_groups']))
  23. echo '
  24. <div class="information">
  25. <span class="alert">', $txt['paid_mod_edit_note'], '</span>
  26. </div>
  27. ';
  28. echo '
  29. <div class="windowbg">
  30. <span class="topslice"><span></span></span>
  31. <div class="content">
  32. <dl class="settings">
  33. <dt>
  34. ', $txt['paid_mod_name'], ':
  35. </dt>
  36. <dd>
  37. <input type="text" name="name" value="', $context['sub']['name'], '" size="30" class="input_text" />
  38. </dd>
  39. <dt>
  40. ', $txt['paid_mod_desc'], ':
  41. </dt>
  42. <dd>
  43. <textarea name="desc" rows="3" cols="40">', $context['sub']['desc'], '</textarea>
  44. </dd>
  45. <dt>
  46. <label for="repeatable_check">', $txt['paid_mod_repeatable'], '</label>:
  47. </dt>
  48. <dd>
  49. <input type="checkbox" name="repeatable" id="repeatable_check"', empty($context['sub']['repeatable']) ? '' : ' checked="checked"', ' class="input_check" />
  50. </dd>
  51. <dt>
  52. <label for="activated_check">', $txt['paid_mod_active'], '</label>:<br /><span class="smalltext">', $txt['paid_mod_active_desc'], '</span>
  53. </dt>
  54. <dd>
  55. <input type="checkbox" name="active" id="activated_check"', empty($context['sub']['active']) ? '' : ' checked="checked"', ' class="input_check" />
  56. </dd>
  57. </dl>
  58. <hr class="hrcolor" />
  59. <dl class="settings">
  60. <dt>
  61. ', $txt['paid_mod_prim_group'], ':<br /><span class="smalltext">', $txt['paid_mod_prim_group_desc'], '</span>
  62. </dt>
  63. <dd>
  64. <select name="prim_group" ', !empty($context['disable_groups']) ? 'disabled="disabled"' : '', '>
  65. <option value="0" ', $context['sub']['prim_group'] == 0 ? 'selected="selected"' : '', '>', $txt['paid_mod_no_group'], '</option>';
  66. // Put each group into the box.
  67. foreach ($context['groups'] as $id => $name)
  68. echo '
  69. <option value="', $id, '" ', $context['sub']['prim_group'] == $id ? 'selected="selected"' : '', '>', $name, '</option>';
  70. echo '
  71. </select>
  72. </dd>
  73. <dt>
  74. ', $txt['paid_mod_add_groups'], ':<br /><span class="smalltext">', $txt['paid_mod_add_groups_desc'], '</span>
  75. </dt>
  76. <dd>';
  77. // Put a checkbox in for each group
  78. foreach ($context['groups'] as $id => $name)
  79. echo '
  80. <label for="addgroup_', $id, '"><input type="checkbox" id="addgroup_', $id, '" name="addgroup[', $id, ']"', in_array($id, $context['sub']['add_groups']) ? ' checked="checked"' : '', ' ', !empty($context['disable_groups']) ? ' disabled="disabled"' : '', ' class="input_check" />&nbsp;<span class="smalltext">', $name, '</span></label><br />';
  81. echo '
  82. </dd>
  83. <dt>
  84. ', $txt['paid_mod_reminder'], ':<br /><span class="smalltext">', $txt['paid_mod_reminder_desc'], '</span>
  85. </dt>
  86. <dd>
  87. <input type="text" name="reminder" value="', $context['sub']['reminder'], '" size="6" class="input_text" />
  88. </dd>
  89. <dt>
  90. ', $txt['paid_mod_email'], ':<br /><span class="smalltext">', $txt['paid_mod_email_desc'], '</span>
  91. </dt>
  92. <dd>
  93. <textarea name="emailcomplete" rows="6" cols="40">', $context['sub']['email_complete'], '</textarea>
  94. </dd>
  95. </dl>
  96. <hr class="hrcolor" />
  97. <input type="radio" name="duration_type" id="duration_type_fixed" value="fixed" ', empty($context['sub']['duration']) || $context['sub']['duration'] == 'fixed' ? 'checked="checked"' : '', ' class="input_radio" onclick="toggleDuration(\'fixed\');" />
  98. <strong>', $txt['paid_mod_fixed_price'], '</strong>
  99. <br />
  100. <div id="fixed_area" ', empty($context['sub']['duration']) || $context['sub']['duration'] == 'fixed' ? '' : 'style="display: none;"', '>
  101. <fieldset>
  102. <dl class="settings">
  103. <dt>
  104. ', $txt['paid_cost'], ' (', str_replace('%1.2f', '', $modSettings['paid_currency_symbol']), '):
  105. </dt>
  106. <dd>
  107. <input type="text" name="cost" value="', empty($context['sub']['cost']['fixed']) ? '0' : $context['sub']['cost']['fixed'], '" size="4" class="input_text" />
  108. </dd>
  109. <dt>
  110. ', $txt['paid_mod_span'], ':
  111. </dt>
  112. <dd>
  113. <input type="text" name="span_value" value="', $context['sub']['span']['value'], '" size="4" class="input_text" />
  114. <select name="span_unit">
  115. <option value="D" ', $context['sub']['span']['unit'] == 'D' ? 'selected="selected"' : '', '>', $txt['paid_mod_span_days'], '</option>
  116. <option value="W" ', $context['sub']['span']['unit'] == 'W' ? 'selected="selected"' : '', '>', $txt['paid_mod_span_weeks'], '</option>
  117. <option value="M" ', $context['sub']['span']['unit'] == 'M' ? 'selected="selected"' : '', '>', $txt['paid_mod_span_months'], '</option>
  118. <option value="Y" ', $context['sub']['span']['unit'] == 'Y' ? 'selected="selected"' : '', '>', $txt['paid_mod_span_years'], '</option>
  119. </select>
  120. </dd>
  121. </dl>
  122. </fieldset>
  123. </div>
  124. <input type="radio" name="duration_type" id="duration_type_flexible" value="flexible" ', !empty($context['sub']['duration']) && $context['sub']['duration'] == 'flexible' ? 'checked="checked"' : '', ' class="input_radio" onclick="toggleDuration(\'flexible\');" />
  125. <strong>', $txt['paid_mod_flexible_price'], '</strong>
  126. <br />
  127. <div id="flexible_area" ', !empty($context['sub']['duration']) && $context['sub']['duration'] == 'flexible' ? '' : 'style="display: none;"', '>
  128. <fieldset>';
  129. //!! Removed until implemented
  130. if (!empty($sdflsdhglsdjgs))
  131. echo '
  132. <dl class="settings">
  133. <dt>
  134. <label for="allow_partial_check">', $txt['paid_mod_allow_partial'], '</label>:<br /><span class="smalltext">', $txt['paid_mod_allow_partial_desc'], '</span>
  135. </dt>
  136. <dd>
  137. <input type="checkbox" name="allow_partial" id="allow_partial_check"', empty($context['sub']['allow_partial']) ? '' : ' checked="checked"', ' class="input_check" />
  138. </dd>
  139. </dl>';
  140. echo '
  141. <div class="information">
  142. <strong>', $txt['paid_mod_price_breakdown'], '</strong><br />
  143. ', $txt['paid_mod_price_breakdown_desc'], '
  144. </div>
  145. <dl class="settings">
  146. <dt>
  147. <strong>', $txt['paid_duration'], '</strong>
  148. </dt>
  149. <dd>
  150. <strong>', $txt['paid_cost'], ' (', preg_replace('~%[df\.\d]+~', '', $modSettings['paid_currency_symbol']), ')</strong>
  151. </dd>
  152. <dt>
  153. ', $txt['paid_per_day'], ':
  154. </dt>
  155. <dd>
  156. <input type="text" name="cost_day" value="', empty($context['sub']['cost']['day']) ? '0' : $context['sub']['cost']['day'], '" size="5" class="input_text" />
  157. </dd>
  158. <dt>
  159. ', $txt['paid_per_week'], ':
  160. </dt>
  161. <dd>
  162. <input type="text" name="cost_week" value="', empty($context['sub']['cost']['week']) ? '0' : $context['sub']['cost']['week'], '" size="5" class="input_text" />
  163. </dd>
  164. <dt>
  165. ', $txt['paid_per_month'], ':
  166. </dt>
  167. <dd>
  168. <input type="text" name="cost_month" value="', empty($context['sub']['cost']['month']) ? '0' : $context['sub']['cost']['month'], '" size="5" class="input_text" />
  169. </dd>
  170. <dt>
  171. ', $txt['paid_per_year'], ':
  172. </dt>
  173. <dd>
  174. <input type="text" name="cost_year" value="', empty($context['sub']['cost']['year']) ? '0' : $context['sub']['cost']['year'], '" size="5" class="input_text" />
  175. </dd>
  176. </dl>
  177. </fieldset>
  178. </div>
  179. <hr class="hrcolor">
  180. <input type="submit" name="save" value="', $txt['paid_settings_save'], '" class="button_submit" />
  181. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  182. <input type="hidden" name="', $context['admin-pms_token_var'], '" value="', $context['admin-pms_token'], '" />
  183. <br class="clear_right" />
  184. </div>
  185. <span class="botslice"><span></span></span>
  186. </div>
  187. </form>
  188. </div>
  189. <br class="clear" />';
  190. }
  191. function template_delete_subscription()
  192. {
  193. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  194. echo '
  195. <div id="admincenter">
  196. <form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modify;sid=', $context['sub_id'], ';delete" method="post">
  197. <div class="cat_bar">
  198. <h3 class="catbg">', $txt['paid_delete_subscription'], '</h3>
  199. </div>
  200. <div class="windowbg">
  201. <span class="topslice"><span></span></span>
  202. <div class="content">
  203. <p>', $txt['paid_mod_delete_warning'], '</p>
  204. <input type="submit" name="delete_confirm" value="', $txt['paid_delete_subscription'], '" class="button_submit" />
  205. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  206. <input type="hidden" name="', $context['admin-pmsd_token_var'], '" value="', $context['admin-pmsd_token'], '" />
  207. </div>
  208. <span class="botslice"><span></span></span>
  209. </div>
  210. </form>
  211. </div>
  212. <br class="clear" />';
  213. }
  214. // Add or edit an existing subscriber.
  215. function template_modify_user_subscription()
  216. {
  217. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  218. // Some quickly stolen javascript from Post, could do with being more efficient :)
  219. echo '
  220. <script type="text/javascript"><!-- // --><![CDATA[
  221. var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  222. // ]]></script>';
  223. echo '
  224. <div id="admincenter">
  225. <form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;sid=', $context['sub_id'], ';lid=', $context['log_id'], '" method="post">
  226. <div class="cat_bar">
  227. <h3 class="catbg">
  228. ', $txt['paid_' . $context['action_type'] . '_subscription'], ' - ', $context['current_subscription']['name'], '
  229. ', empty($context['sub']['username']) ? '' : ' (' . $txt['user'] . ': ' . $context['sub']['username'] . ')', '
  230. </h3>
  231. </div>
  232. <div class="windowbg">
  233. <span class="topslice"><span></span></span>
  234. <div class="content">
  235. <dl class="settings">';
  236. // Do we need a username?
  237. if ($context['action_type'] == 'add')
  238. echo '
  239. <dt>
  240. <strong>', $txt['paid_username'], ':</strong><br />
  241. <span class="smalltext">', $txt['one_username'], '</span>
  242. </dt>
  243. <dd>
  244. <input type="text" name="name" id="name_control" value="', $context['sub']['username'], '" size="30" class="input_text" />
  245. </dd>';
  246. echo '
  247. <dt>
  248. <strong>', $txt['paid_status'], ':</strong>
  249. </dt>
  250. <dd>
  251. <select name="status">
  252. <option value="0" ', $context['sub']['status'] == 0 ? 'selected="selected"' : '', '>', $txt['paid_finished'], '</option>
  253. <option value="1" ', $context['sub']['status'] == 1 ? 'selected="selected"' : '', '>', $txt['paid_active'], '</option>
  254. </select>
  255. </dd>
  256. </dl>
  257. <fieldset>
  258. <legend>', $txt['start_date_and_time'], '</legend>
  259. <select name="year" id="year" onchange="generateDays(\'\');">';
  260. // Show a list of all the years we allow...
  261. for ($year = 2005; $year <= 2030; $year++)
  262. echo '
  263. <option value="', $year, '"', $year == $context['sub']['start']['year'] ? ' selected="selected"' : '', '>', $year, '</option>';
  264. echo '
  265. </select>&nbsp;
  266. ', (isset($txt['calendar_month']) ? $txt['calendar_month'] : $txt['calendar_month']), '&nbsp;
  267. <select name="month" id="month" onchange="generateDays(\'\');">';
  268. // There are 12 months per year - ensure that they all get listed.
  269. for ($month = 1; $month <= 12; $month++)
  270. echo '
  271. <option value="', $month, '"', $month == $context['sub']['start']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '</option>';
  272. echo '
  273. </select>&nbsp;
  274. ', (isset($txt['calendar_day']) ? $txt['calendar_day'] : $txt['calendar_day']), '&nbsp;
  275. <select name="day" id="day">';
  276. // This prints out all the days in the current month - this changes dynamically as we switch months.
  277. for ($day = 1; $day <= $context['sub']['start']['last_day']; $day++)
  278. echo '
  279. <option value="', $day, '"', $day == $context['sub']['start']['day'] ? ' selected="selected"' : '', '>', $day, '</option>';
  280. echo '
  281. </select>
  282. ', $txt['hour'], ': <input type="text" name="hour" value="', $context['sub']['start']['hour'], '" size="2" class="input_text" />
  283. ', $txt['minute'], ': <input type="text" name="minute" value="', $context['sub']['start']['min'], '" size="2" class="input_text" />
  284. </fieldset>
  285. <fieldset>
  286. <legend>', $txt['end_date_and_time'], '</legend>
  287. <select name="yearend" id="yearend" onchange="generateDays(\'end\');">';
  288. // Show a list of all the years we allow...
  289. for ($year = 2005; $year <= 2030; $year++)
  290. echo '
  291. <option value="', $year, '"', $year == $context['sub']['end']['year'] ? ' selected="selected"' : '', '>', $year, '</option>';
  292. echo '
  293. </select>&nbsp;
  294. ', (isset($txt['calendar_month']) ? $txt['calendar_month'] : $txt['calendar_month']), '&nbsp;
  295. <select name="monthend" id="monthend" onchange="generateDays(\'end\');">';
  296. // There are 12 months per year - ensure that they all get listed.
  297. for ($month = 1; $month <= 12; $month++)
  298. echo '
  299. <option value="', $month, '"', $month == $context['sub']['end']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '</option>';
  300. echo '
  301. </select>&nbsp;
  302. ', (isset($txt['calendar_day']) ? $txt['calendar_day'] : $txt['calendar_day']), '&nbsp;
  303. <select name="dayend" id="dayend">';
  304. // This prints out all the days in the current month - this changes dynamically as we switch months.
  305. for ($day = 1; $day <= $context['sub']['end']['last_day']; $day++)
  306. echo '
  307. <option value="', $day, '"', $day == $context['sub']['end']['day'] ? ' selected="selected"' : '', '>', $day, '</option>';
  308. echo '
  309. </select>
  310. ', $txt['hour'], ': <input type="text" name="hourend" value="', $context['sub']['end']['hour'], '" size="2" class="input_text" />
  311. ', $txt['minute'], ': <input type="text" name="minuteend" value="', $context['sub']['end']['min'], '" size="2" class="input_text" />
  312. </fieldset>
  313. <input type="submit" name="save_sub" value="', $txt['paid_settings_save'], '" class="button_submit" />
  314. </div>
  315. <span class="botslice"><span></span></span>
  316. </div>
  317. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  318. </form>
  319. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  320. <script type="text/javascript"><!-- // --><![CDATA[
  321. var oAddMemberSuggest = new smc_AutoSuggest({
  322. sSelf: \'oAddMemberSuggest\',
  323. sSessionId: smf_session_id,
  324. sSessionVar: smf_session_var,
  325. sSuggestId: \'name_subscriber\',
  326. sControlId: \'name_control\',
  327. sSearchType: \'member\',
  328. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  329. bItemList: false
  330. });
  331. // ]]></script>';
  332. if (!empty($context['pending_payments']))
  333. {
  334. echo '
  335. <div class="cat_bar">
  336. <h3 class="catbg">', $txt['pending_payments'], '</h3>
  337. </div>
  338. <div class="information">
  339. ', $txt['pending_payments_desc'], '
  340. </div>
  341. <div class="cat_bar">
  342. <h3 class="catbg">', $txt['pending_payments_value'], '</h3>
  343. </div>
  344. <div class="windowbg">
  345. <span class="topslice"><span></span></span>
  346. <div class="content">
  347. <ul class="pending_payments">';
  348. foreach ($context['pending_payments'] as $id => $payment)
  349. {
  350. echo '
  351. <li class="reset">
  352. ', $payment['desc'], '
  353. <span class="floatleft"><a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;lid=', $context['log_id'], ';pending=', $id, ';accept">', $txt['pending_payments_accept'], '</a></span>
  354. <span class="floatright"><a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;lid=', $context['log_id'], ';pending=', $id, ';remove">', $txt['pending_payments_remove'], '</a></span>
  355. </li>';
  356. }
  357. echo '
  358. </ul>
  359. </div>
  360. <span class="botslice"><span></span></span>
  361. </div>';
  362. }
  363. echo '
  364. </div>
  365. <br class="clear" />';
  366. }
  367. // Template for a user to edit/pick their subscriptions.
  368. function template_user_subscription()
  369. {
  370. global $context, $txt, $scripturl, $modSettings;
  371. echo '
  372. <div id="paid_subscription">
  373. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=subscriptions;confirm" method="post">
  374. <div class="cat_bar">
  375. <h3 class="catbg">', $txt['subscriptions'], '</h3>
  376. </div>';
  377. if (empty($context['subscriptions']))
  378. {
  379. echo '
  380. <div class="information">
  381. ', $txt['paid_subs_none'], '
  382. </div>';
  383. }
  384. else
  385. {
  386. echo '
  387. <div class="information">
  388. ', $txt['paid_subs_desc'], '
  389. </div>';
  390. // Print out all the subscriptions.
  391. $alternate = false;
  392. foreach ($context['subscriptions'] as $id => $subscription)
  393. {
  394. $alternate = !$alternate;
  395. // Ignore the inactive ones...
  396. if (empty($subscription['active']))
  397. continue;
  398. echo '
  399. <div class="cat_bar">
  400. <h3 class="catbg">', $subscription['name'], '</h3>
  401. </div>
  402. <div class="windowbg', $alternate ? '' : '2', '">
  403. <span class="topslice"><span></span></span>
  404. <div class="content">
  405. <p><strong>', $subscription['name'], '</strong></p>
  406. <p class="smalltext">', $subscription['desc'], '</p>';
  407. if (!$subscription['flexible'])
  408. echo '
  409. <div><strong>', $txt['paid_duration'], ':</strong> ', $subscription['length'], '</div>';
  410. if ($context['user']['is_owner'])
  411. {
  412. echo '
  413. <strong>', $txt['paid_cost'], ':</strong>';
  414. if ($subscription['flexible'])
  415. {
  416. echo '
  417. <select name="cur[', $subscription['id'], ']">';
  418. // Print out the costs for this one.
  419. foreach ($subscription['costs'] as $duration => $value)
  420. echo '
  421. <option value="', $duration, '">', sprintf($modSettings['paid_currency_symbol'], $value), '/', $txt[$duration], '</option>';
  422. echo '
  423. </select>';
  424. }
  425. else
  426. echo '
  427. ', sprintf($modSettings['paid_currency_symbol'], $subscription['costs']['fixed']);
  428. echo '
  429. <hr class="hrcolor" />
  430. <input type="submit" name="sub_id[', $subscription['id'], ']" value="', $txt['paid_order'], '" class="button_submit" />
  431. <br class="clear_right" />';
  432. }
  433. else
  434. echo '
  435. <a href="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;sid=', $subscription['id'], ';uid=', $context['member']['id'], (empty($context['current'][$subscription['id']]) ? '' : ';lid=' . $context['current'][$subscription['id']]['id']), '">', empty($context['current'][$subscription['id']]) ? $txt['paid_admin_add'] : $txt['paid_edit_subscription'], '</a>';
  436. echo '
  437. </div>
  438. <span class="botslice"><span></span></span>
  439. </div>';
  440. }
  441. }
  442. echo '
  443. </form>
  444. <br />
  445. <div class="title_bar">
  446. <h3 class="titlebg">', $txt['paid_current'], '</h3>
  447. </div>
  448. <div class="information">
  449. ', $txt['paid_current_desc'], '
  450. </div>
  451. <table width="100%" class="table_grid">
  452. <thead>
  453. <tr class="catbg">
  454. <th class="first_th" width="30%">', $txt['paid_name'], '</th>
  455. <th align="center">', $txt['paid_status'], '</th>
  456. <th align="center">', $txt['start_date'], '</th>
  457. <th class="last_th" align="center">', $txt['end_date'], '</th>
  458. </tr>
  459. </thead>
  460. <tbody>';
  461. if (empty($context['current']))
  462. echo '
  463. <tr class="windowbg">
  464. <td align="center" colspan="4">
  465. ', $txt['paid_none_yet'], '
  466. </td>
  467. </tr>';
  468. $alternate = false;
  469. foreach ($context['current'] as $sub)
  470. {
  471. $alternate = !$alternate;
  472. if (!$sub['hide'])
  473. echo '
  474. <tr class="windowbg', $alternate ? '' : '2', '">
  475. <td>
  476. ', (allowedTo('admin_forum') ? '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modifyuser;lid=' . $sub['id'] . '">' . $sub['name'] . '</a>' : $sub['name']), '
  477. </td><td>
  478. <span style="color: ', ($sub['status'] == 2 ? 'green' : ($sub['status'] == 1 ? 'red' : 'orange')), '"><strong>', $sub['status_text'], '</strong></span>
  479. </td><td>
  480. ', $sub['start'], '
  481. </td><td>
  482. ', $sub['end'], '
  483. </td>
  484. </tr>';
  485. }
  486. echo '
  487. </tbody>
  488. </table>
  489. </div>
  490. <br class="clear" />';
  491. }
  492. // The "choose payment" dialog.
  493. function template_choose_payment()
  494. {
  495. global $context, $txt, $modSettings, $scripturl;
  496. echo '
  497. <div id="paid_subscription">
  498. <div class="cat_bar">
  499. <h3 class="catbg">', $txt['paid_confirm_payment'], '</h3>
  500. </div>
  501. <div class="information">
  502. ', $txt['paid_confirm_desc'], '
  503. </div>
  504. <div class="windowbg">
  505. <span class="topslice"><span></span></span>
  506. <div class="content">
  507. <dl class="settings">
  508. <dt>
  509. <strong>', $txt['subscription'], ':</strong>
  510. </dt>
  511. <dd>
  512. ', $context['sub']['name'], '
  513. </dd>
  514. <dt>
  515. <strong>', $txt['paid_cost'], ':</strong>
  516. </dt>
  517. <dd>
  518. ', $context['cost'], '
  519. </dd>
  520. </dl>
  521. </div>
  522. <span class="botslice"><span></span></span>
  523. </div>';
  524. // Do all the gateway options.
  525. foreach ($context['gateways'] as $gateway)
  526. {
  527. echo '
  528. <div class="cat_bar">
  529. <h3 class="catbg">', $gateway['title'], '</h3>
  530. </div>
  531. <div class="windowbg">
  532. <span class="topslice"><span></span></span>
  533. <div class="content">
  534. ', $gateway['desc'], '<br />
  535. <form action="', $gateway['form'], '" method="post">';
  536. if (!empty($gateway['javascript']))
  537. echo '
  538. <script type="text/javascript"><!-- // --><![CDATA[
  539. ', $gateway['javascript'], '
  540. // ]]></script>';
  541. foreach ($gateway['hidden'] as $name => $value)
  542. echo '
  543. <input type="hidden" id="', $gateway['id'], '_', $name, '" name="', $name, '" value="', $value, '" />';
  544. echo '
  545. <br /><input type="submit" value="', $gateway['submit'], '" class="button_submit" />
  546. </form>
  547. </div>
  548. <span class="botslice"><span></span></span>
  549. </div>';
  550. }
  551. echo '
  552. </div>
  553. <br class="clear" />';
  554. }
  555. // The "thank you" bit...
  556. function template_paid_done()
  557. {
  558. global $context, $txt, $modSettings, $scripturl;
  559. echo '
  560. <div id="paid_subscription">
  561. <div class="title_bar">
  562. <h3 class="titlebg">', $txt['paid_done'], '</h3>
  563. </div>
  564. <div class="windowbg2">
  565. <span class="topslice"><span></span></span>
  566. <div class="content">
  567. <p>', $txt['paid_done_desc'], '</p>
  568. <br />
  569. <a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=subscriptions">', $txt['paid_sub_return'], '</a>
  570. </div>
  571. <span class="botslice"><span></span></span>
  572. </div>
  573. </div>
  574. <br class="clear" />';
  575. }
  576. ?>