payout_panel.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * User Panel.
  4. *
  5. * @package chamilo.plugin.buycourses
  6. */
  7. /**
  8. * Initialization.
  9. */
  10. $cidReset = true;
  11. require_once __DIR__.'/../../../main/inc/global.inc.php';
  12. $plugin = BuyCoursesPlugin::create();
  13. $includeSessions = $plugin->get('include_sessions') === 'true';
  14. $userInfo = api_get_user_info();
  15. $payouts = $plugin->getPayouts(BuyCoursesPlugin::PAYOUT_STATUS_COMPLETED, false, $userInfo['id']);
  16. $payoutList = [];
  17. foreach ($payouts as $payout) {
  18. $payoutList[] = [
  19. 'id' => $payout['id'],
  20. 'sale_id' => $payout['sale_id'],
  21. 'reference' => $payout['sale_reference'],
  22. 'date' => api_format_date($payout['date'], DATE_TIME_FORMAT_LONG_24H),
  23. 'payout_date' => ($payout['payout_date'] === '0000-00-00 00:00:00')
  24. ? '-'
  25. : api_format_date($payout['payout_date'], DATE_TIME_FORMAT_LONG_24H),
  26. 'currency' => $payout['iso_code'],
  27. 'price' => $payout['item_price'],
  28. 'commission' => $payout['commission'],
  29. 'paypal_account' => $payout['paypal_account'],
  30. 'status' => $payout['status'],
  31. ];
  32. }
  33. $toolbar = Display::toolbarButton(
  34. $plugin->get_lang('CourseListOnSale'),
  35. 'course_catalog.php',
  36. 'search-plus',
  37. 'primary',
  38. ['title' => $plugin->get_lang('CourseListOnSale')]
  39. );
  40. $templateName = get_lang('TabsDashboard');
  41. $tpl = new Template($templateName);
  42. $tpl->assign('showing_courses', true);
  43. $tpl->assign('sessions_are_included', $includeSessions);
  44. $tpl->assign('payout_list', $payoutList);
  45. $content = $tpl->fetch('buycourses/view/payout_panel.tpl');
  46. $tpl->assign(
  47. 'actions',
  48. Display::toolbarAction('toolbar', [$toolbar])
  49. );
  50. $tpl->assign('header', $templateName);
  51. $tpl->assign('content', $content);
  52. $tpl->display_one_col_template();