ManagePaid.template.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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. // 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. <input type="hidden" name="', $context['admin-pms_token_var'], '" value="', $context['admin-pms_token'], '" />
  200. </div>
  201. </div>
  202. <span class="botslice"><span></span></span>
  203. </div>
  204. </form>
  205. </div>
  206. <br class="clear" />';
  207. }
  208. function template_delete_subscription()
  209. {
  210. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  211. echo '
  212. <div id="admincenter">
  213. <form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modify;sid=', $context['sub_id'], ';delete" method="post">
  214. <div class="cat_bar">
  215. <h3 class="catbg">', $txt['paid_delete_subscription'], '</h3>
  216. </div>
  217. <div class="windowbg">
  218. <span class="topslice"><span></span></span>
  219. <div class="content">
  220. <p>', $txt['paid_mod_delete_warning'], '</p>
  221. <input type="submit" name="delete_confirm" value="', $txt['paid_delete_subscription'], '" class="button_submit" />
  222. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  223. <input type="hidden" name="', $context['admin-pmsd_token_var'], '" value="', $context['admin-pmsd_token'], '" />
  224. </div>
  225. <span class="botslice"><span></span></span>
  226. </div>
  227. </form>
  228. </div>
  229. <br class="clear" />';
  230. }
  231. // Add or edit an existing subscriber.
  232. function template_modify_user_subscription()
  233. {
  234. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  235. // Some quickly stolen javascript from Post, could do with being more efficient :)
  236. echo '
  237. <script type="text/javascript"><!-- // --><![CDATA[
  238. var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  239. function generateDays(offset)
  240. {
  241. var days = 0, selected = 0;
  242. var dayElement = document.getElementById("day" + offset), yearElement = document.getElementById("year" + offset), monthElement = document.getElementById("month" + offset);
  243. monthLength[1] = 28;
  244. if (yearElement.options[yearElement.selectedIndex].value % 4 == 0)
  245. monthLength[1] = 29;
  246. selected = dayElement.selectedIndex;
  247. while (dayElement.options.length)
  248. dayElement.options[0] = null;
  249. days = monthLength[monthElement.value - 1];
  250. for (i = 1; i <= days; i++)
  251. dayElement.options[dayElement.length] = new Option(i, i);
  252. if (selected < days)
  253. dayElement.selectedIndex = selected;
  254. }
  255. // ]]></script>';
  256. echo '
  257. <div id="admincenter">
  258. <form action="', $scripturl, '?action=admin;area=paidsubscribe;sa=modifyuser;sid=', $context['sub_id'], ';lid=', $context['log_id'], '" method="post">
  259. <div class="cat_bar">
  260. <h3 class="catbg">
  261. ', $txt['paid_' . $context['action_type'] . '_subscription'], ' - ', $context['current_subscription']['name'], '
  262. ', empty($context['sub']['username']) ? '' : ' (' . $txt['user'] . ': ' . $context['sub']['username'] . ')', '
  263. </h3>
  264. </div>
  265. <div class="windowbg">
  266. <span class="topslice"><span></span></span>
  267. <div class="content">
  268. <dl class="settings">';
  269. // Do we need a username?
  270. if ($context['action_type'] == 'add')
  271. echo '
  272. <dt>
  273. <strong>', $txt['paid_username'], ':</strong><br />
  274. <span class="smalltext">', $txt['one_username'], '</span>
  275. </dt>
  276. <dd>
  277. <input type="text" name="name" id="name_control" value="', $context['sub']['username'], '" size="30" class="input_text" />
  278. </dd>';
  279. echo '
  280. <dt>
  281. <strong>', $txt['paid_status'], ':</strong>
  282. </dt>
  283. <dd>
  284. <select name="status">
  285. <option value="0" ', $context['sub']['status'] == 0 ? 'selected="selected"' : '', '>', $txt['paid_finished'], '</option>
  286. <option value="1" ', $context['sub']['status'] == 1 ? 'selected="selected"' : '', '>', $txt['paid_active'], '</option>
  287. </select>
  288. </dd>
  289. </dl>
  290. <fieldset>
  291. <legend>', $txt['start_date_and_time'], '</legend>
  292. <select name="year" id="year" onchange="generateDays(\'\');">';
  293. // Show a list of all the years we allow...
  294. for ($year = 2005; $year <= 2030; $year++)
  295. echo '
  296. <option value="', $year, '"', $year == $context['sub']['start']['year'] ? ' selected="selected"' : '', '>', $year, '</option>';
  297. echo '
  298. </select>&nbsp;
  299. ', (isset($txt['calendar_month']) ? $txt['calendar_month'] : $txt['calendar_month']), '&nbsp;
  300. <select name="month" id="month" onchange="generateDays(\'\');">';
  301. // There are 12 months per year - ensure that they all get listed.
  302. for ($month = 1; $month <= 12; $month++)
  303. echo '
  304. <option value="', $month, '"', $month == $context['sub']['start']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '</option>';
  305. echo '
  306. </select>&nbsp;
  307. ', (isset($txt['calendar_day']) ? $txt['calendar_day'] : $txt['calendar_day']), '&nbsp;
  308. <select name="day" id="day">';
  309. // This prints out all the days in the current month - this changes dynamically as we switch months.
  310. for ($day = 1; $day <= $context['sub']['start']['last_day']; $day++)
  311. echo '
  312. <option value="', $day, '"', $day == $context['sub']['start']['day'] ? ' selected="selected"' : '', '>', $day, '</option>';
  313. echo '
  314. </select>
  315. ', $txt['hour'], ': <input type="text" name="hour" value="', $context['sub']['start']['hour'], '" size="2" class="input_text" />
  316. ', $txt['minute'], ': <input type="text" name="minute" value="', $context['sub']['start']['min'], '" size="2" class="input_text" />
  317. </fieldset>
  318. <fieldset>
  319. <legend>', $txt['end_date_and_time'], '</legend>
  320. <select name="yearend" id="yearend" onchange="generateDays(\'end\');">';
  321. // Show a list of all the years we allow...
  322. for ($year = 2005; $year <= 2030; $year++)
  323. echo '
  324. <option value="', $year, '"', $year == $context['sub']['end']['year'] ? ' selected="selected"' : '', '>', $year, '</option>';
  325. echo '
  326. </select>&nbsp;
  327. ', (isset($txt['calendar_month']) ? $txt['calendar_month'] : $txt['calendar_month']), '&nbsp;
  328. <select name="monthend" id="monthend" onchange="generateDays(\'end\');">';
  329. // There are 12 months per year - ensure that they all get listed.
  330. for ($month = 1; $month <= 12; $month++)
  331. echo '
  332. <option value="', $month, '"', $month == $context['sub']['end']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '</option>';
  333. echo '
  334. </select>&nbsp;
  335. ', (isset($txt['calendar_day']) ? $txt['calendar_day'] : $txt['calendar_day']), '&nbsp;
  336. <select name="dayend" id="dayend">';
  337. // This prints out all the days in the current month - this changes dynamically as we switch months.
  338. for ($day = 1; $day <= $context['sub']['end']['last_day']; $day++)
  339. echo '
  340. <option value="', $day, '"', $day == $context['sub']['end']['day'] ? ' selected="selected"' : '', '>', $day, '</option>';
  341. echo '
  342. </select>
  343. ', $txt['hour'], ': <input type="text" name="hourend" value="', $context['sub']['end']['hour'], '" size="2" class="input_text" />
  344. ', $txt['minute'], ': <input type="text" name="minuteend" value="', $context['sub']['end']['min'], '" size="2" class="input_text" />
  345. </fieldset>
  346. <input type="submit" name="save_sub" value="', $txt['paid_settings_save'], '" class="button_submit" />
  347. </div>
  348. <span class="botslice"><span></span></span>
  349. </div>
  350. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  351. </form>
  352. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  353. <script type="text/javascript"><!-- // --><![CDATA[
  354. var oAddMemberSuggest = new smc_AutoSuggest({
  355. sSelf: \'oAddMemberSuggest\',
  356. sSessionId: \'', $context['session_id'], '\',
  357. sSessionVar: \'', $context['session_var'], '\',
  358. sSuggestId: \'name_subscriber\',
  359. sControlId: \'name_control\',
  360. sSearchType: \'member\',
  361. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  362. bItemList: false
  363. });
  364. // ]]></script>';
  365. if (!empty($context['pending_payments']))
  366. {
  367. echo '
  368. <div class="cat_bar">
  369. <h3 class="catbg">', $txt['pending_payments'], '</h3>
  370. </div>
  371. <div class="information">
  372. ', $txt['pending_payments_desc'], '
  373. </div>
  374. <div class="cat_bar">
  375. <h3 class="catbg">', $txt['pending_payments_value'], '</h3>
  376. </div>
  377. <div class="windowbg">
  378. <span class="topslice"><span></span></span>
  379. <div class="content">
  380. <ul class="pending_payments">';
  381. foreach ($context['pending_payments'] as $id => $payment)
  382. {
  383. echo '
  384. <li class="reset">
  385. ', $payment['desc'], '
  386. <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>
  387. <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>
  388. </li>';
  389. }
  390. echo '
  391. </ul>
  392. </div>
  393. <span class="botslice"><span></span></span>
  394. </div>';
  395. }
  396. echo '
  397. </div>
  398. <br class="clear" />';
  399. }
  400. // Template for a user to edit/pick their subscriptions.
  401. function template_user_subscription()
  402. {
  403. global $context, $txt, $scripturl, $modSettings;
  404. echo '
  405. <div id="paid_subscription">
  406. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=subscriptions;confirm" method="post">
  407. <div class="cat_bar">
  408. <h3 class="catbg">', $txt['subscriptions'], '</h3>
  409. </div>';
  410. if (empty($context['subscriptions']))
  411. {
  412. echo '
  413. <div class="information">
  414. ', $txt['paid_subs_none'], '
  415. </div>';
  416. }
  417. else
  418. {
  419. echo '
  420. <div class="information">
  421. ', $txt['paid_subs_desc'], '
  422. </div>';
  423. // Print out all the subscriptions.
  424. $alternate = false;
  425. foreach ($context['subscriptions'] as $id => $subscription)
  426. {
  427. $alternate = !$alternate;
  428. // Ignore the inactive ones...
  429. if (empty($subscription['active']))
  430. continue;
  431. echo '
  432. <div class="cat_bar">
  433. <h3 class="catbg">', $subscription['name'], '</h3>
  434. </div>
  435. <div class="windowbg', $alternate ? '' : '2', '">
  436. <span class="topslice"><span></span></span>
  437. <div class="content">
  438. <p><strong>', $subscription['name'], '</strong></p>
  439. <p class="smalltext">', $subscription['desc'], '</p>';
  440. if (!$subscription['flexible'])
  441. echo '
  442. <div><strong>', $txt['paid_duration'], ':</strong> ', $subscription['length'], '</div>';
  443. if ($context['user']['is_owner'])
  444. {
  445. echo '
  446. <strong>', $txt['paid_cost'], ':</strong>';
  447. if ($subscription['flexible'])
  448. {
  449. echo '
  450. <select name="cur[', $subscription['id'], ']">';
  451. // Print out the costs for this one.
  452. foreach ($subscription['costs'] as $duration => $value)
  453. echo '
  454. <option value="', $duration, '">', sprintf($modSettings['paid_currency_symbol'], $value), '/', $txt[$duration], '</option>';
  455. echo '
  456. </select>';
  457. }
  458. else
  459. echo '
  460. ', sprintf($modSettings['paid_currency_symbol'], $subscription['costs']['fixed']);
  461. echo '
  462. <br />
  463. <input type="submit" name="sub_id[', $subscription['id'], ']" value="', $txt['paid_order'], '" class="button_submit" />';
  464. }
  465. else
  466. echo '
  467. <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>';
  468. echo '
  469. </div>
  470. <span class="botslice"><span></span></span>
  471. </div>';
  472. }
  473. }
  474. echo '
  475. </form>
  476. <br />
  477. <div class="title_bar">
  478. <h3 class="titlebg">', $txt['paid_current'], '</h3>
  479. </div>
  480. <div class="information">
  481. ', $txt['paid_current_desc'], '
  482. </div>
  483. <table width="100%" class="table_grid">
  484. <thead>
  485. <tr class="catbg">
  486. <th class="first_th" width="30%">', $txt['paid_name'], '</th>
  487. <th align="center">', $txt['paid_status'], '</th>
  488. <th align="center">', $txt['start_date'], '</th>
  489. <th class="last_th" align="center">', $txt['end_date'], '</th>
  490. </tr>
  491. </thead>
  492. <tbody>';
  493. if (empty($context['current']))
  494. echo '
  495. <tr class="windowbg">
  496. <td align="center" colspan="4">
  497. ', $txt['paid_none_yet'], '
  498. </td>
  499. </tr>';
  500. $alternate = false;
  501. foreach ($context['current'] as $sub)
  502. {
  503. $alternate = !$alternate;
  504. if (!$sub['hide'])
  505. echo '
  506. <tr class="windowbg', $alternate ? '' : '2', '">
  507. <td>
  508. ', (allowedTo('admin_forum') ? '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modifyuser;lid=' . $sub['id'] . '">' . $sub['name'] . '</a>' : $sub['name']), '
  509. </td><td>
  510. <span style="color: ', ($sub['status'] == 2 ? 'green' : ($sub['status'] == 1 ? 'red' : 'orange')), '"><strong>', $sub['status_text'], '</strong></span>
  511. </td><td>
  512. ', $sub['start'], '
  513. </td><td>
  514. ', $sub['end'], '
  515. </td>
  516. </tr>';
  517. }
  518. echo '
  519. </tbody>
  520. </table>
  521. </div>
  522. <br class="clear" />';
  523. }
  524. // The "choose payment" dialog.
  525. function template_choose_payment()
  526. {
  527. global $context, $txt, $modSettings, $scripturl;
  528. echo '
  529. <div id="paid_subscription">
  530. <div class="cat_bar">
  531. <h3 class="catbg">', $txt['paid_confirm_payment'], '</h3>
  532. </div>
  533. <div class="information">
  534. ', $txt['paid_confirm_desc'], '
  535. </div>
  536. <div class="windowbg">
  537. <span class="topslice"><span></span></span>
  538. <div class="content">
  539. <dl class="settings">
  540. <dt>
  541. <strong>', $txt['subscription'], ':</strong>
  542. </dt>
  543. <dd>
  544. ', $context['sub']['name'], '
  545. </dd>
  546. <dt>
  547. <strong>', $txt['paid_cost'], ':</strong>
  548. </dt>
  549. <dd>
  550. ', $context['cost'], '
  551. </dd>
  552. </dl>
  553. </div>
  554. <span class="botslice"><span></span></span>
  555. </div>';
  556. // Do all the gateway options.
  557. foreach ($context['gateways'] as $gateway)
  558. {
  559. echo '
  560. <div class="cat_bar">
  561. <h3 class="catbg">', $gateway['title'], '</h3>
  562. </div>
  563. <div class="windowbg">
  564. <span class="topslice"><span></span></span>
  565. <div class="content">
  566. ', $gateway['desc'], '<br />
  567. <form action="', $gateway['form'], '" method="post">';
  568. if (!empty($gateway['javascript']))
  569. echo '
  570. <script type="text/javascript"><!-- // --><![CDATA[
  571. ', $gateway['javascript'], '
  572. // ]]></script>';
  573. foreach ($gateway['hidden'] as $name => $value)
  574. echo '
  575. <input type="hidden" id="', $gateway['id'], '_', $name, '" name="', $name, '" value="', $value, '" />';
  576. echo '
  577. <br /><input type="submit" value="', $gateway['submit'], '" class="button_submit" />
  578. </form>
  579. </div>
  580. <span class="botslice"><span></span></span>
  581. </div>';
  582. }
  583. echo '
  584. </div>
  585. <br class="clear" />';
  586. }
  587. // The "thank you" bit...
  588. function template_paid_done()
  589. {
  590. global $context, $txt, $modSettings, $scripturl;
  591. echo '
  592. <div id="paid_subscription">
  593. <div class="title_bar">
  594. <h3 class="titlebg">', $txt['paid_done'], '</h3>
  595. </div>
  596. <div class="windowbg2">
  597. <span class="topslice"><span></span></span>
  598. <div class="content">
  599. <p>', $txt['paid_done_desc'], '</p>
  600. <br />
  601. <a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=subscriptions">', $txt['paid_sub_return'], '</a>
  602. </div>
  603. <span class="botslice"><span></span></span>
  604. </div>
  605. </div>
  606. <br class="clear" />';
  607. }
  608. ?>