ManagePaid.template.php 23 KB

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