paypal_payout.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /* For license terms, see /license.txt */
  3. /**
  4. * List page for Paypal Payout for the Buy Courses plugin.
  5. *
  6. * @package chamilo.plugin.buycourses
  7. */
  8. /**
  9. * Initialization.
  10. */
  11. $cidReset = true;
  12. require_once __DIR__.'/../../../main/inc/global.inc.php';
  13. $htmlHeadXtra[] = '<link rel="stylesheet" href="../resources/css/style.css" type="text/css">';
  14. api_protect_admin_script(true);
  15. $plugin = BuyCoursesPlugin::create();
  16. $paypalEnable = $plugin->get('paypal_enable');
  17. $commissionsEnable = $plugin->get('commissions_enable');
  18. if ($paypalEnable !== "true" && $commissionsEnable !== "true") {
  19. api_not_allowed(true);
  20. }
  21. $payouts = $plugin->getPayouts();
  22. $payoutList = [];
  23. foreach ($payouts as $payout) {
  24. $payoutList[] = [
  25. 'id' => $payout['id'],
  26. 'reference' => $payout['sale_reference'],
  27. 'date' => api_format_date($payout['date'], DATE_TIME_FORMAT_LONG_24H),
  28. 'currency' => $payout['iso_code'],
  29. 'price' => $payout['item_price'],
  30. 'commission' => $payout['commission'],
  31. 'paypal_account' => $payout['paypal_account'],
  32. ];
  33. }
  34. $templateName = $plugin->get_lang('PaypalPayoutCommissions');
  35. $template = new Template($templateName);
  36. $template->assign('payout_list', $payoutList);
  37. $content = $template->fetch('buycourses/view/paypal_payout.tpl');
  38. $template->assign('header', $templateName);
  39. $template->assign('content', $content);
  40. $template->display_one_col_template();