You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.8 KiB
65 lines
1.8 KiB
<?php
|
|
/* For license terms, see /license.txt */
|
|
|
|
/**
|
|
* User Panel
|
|
* @package chamilo.plugin.buycourses
|
|
*/
|
|
|
|
$cidReset = true;
|
|
|
|
require_once __DIR__.'/../../../main/inc/global.inc.php';
|
|
|
|
$plugin = BuyCoursesPlugin::create();
|
|
$includeSessions = $plugin->get('include_sessions') === 'true';
|
|
$includeServices = $plugin->get('include_services') === 'true';
|
|
|
|
$userInfo = api_get_user_info();
|
|
|
|
$productTypes = $plugin->getProductTypes();
|
|
$saleStatuses = $plugin->getSaleStatuses();
|
|
$paymentTypes = $plugin->getPaymentTypes();
|
|
|
|
$sales = $plugin->getSaleListByUserId($userInfo['id']);
|
|
|
|
$saleList = [];
|
|
|
|
foreach ($sales as $sale) {
|
|
if ($sale['product_type'] == 2) {
|
|
$saleList[] = [
|
|
'id' => $sale['id'],
|
|
'reference' => $sale['reference'],
|
|
'date' => api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H),
|
|
'currency' => $sale['iso_code'],
|
|
'price' => $sale['price'],
|
|
'product_name' => $sale['product_name'],
|
|
'product_type' => $productTypes[$sale['product_type']],
|
|
'payment_type' => $paymentTypes[$sale['payment_type']]
|
|
];
|
|
}
|
|
}
|
|
|
|
$toolbar = Display::toolbarButton(
|
|
$plugin->get_lang('CourseListOnSale'),
|
|
'course_catalog.php',
|
|
'search-plus',
|
|
'primary',
|
|
['title' => $plugin->get_lang('CourseListOnSale')]
|
|
);
|
|
|
|
$templateName = get_lang('TabsDashboard');
|
|
$tpl = new Template($templateName);
|
|
$tpl->assign('showing_courses', true);
|
|
$tpl->assign('sessions_are_included', $includeSessions);
|
|
$tpl->assign('services_are_included', $includeServices);
|
|
$tpl->assign('sale_list', $saleList);
|
|
|
|
$content = $tpl->fetch('buycourses/view/session_panel.tpl');
|
|
|
|
$tpl->assign(
|
|
'actions',
|
|
Display::toolbarAction('toolbar', [$toolbar])
|
|
);
|
|
$tpl->assign('header', $templateName);
|
|
$tpl->assign('content', $content);
|
|
$tpl->display_one_col_template();
|
|
|