After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1,115 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
|
||||
/** |
||||
* Configuration page for subscriptions for the Buy Courses plugin. |
||||
* |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
$cidReset = true; |
||||
|
||||
require_once __DIR__.'/../../../main/inc/global.inc.php'; |
||||
|
||||
api_protect_admin_script(true); |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
|
||||
if (isset($_GET['action'], $_GET['d'], $_GET['n'])) { |
||||
if ($_GET['action'] == 'delete_frequency') { |
||||
|
||||
$frequency = $plugin->selectFrequency($_GET['d']); |
||||
|
||||
if (!empty($frequency)) { |
||||
$subscriptionsItems = $plugin->getSubscriptiosnItemsByDuration($_GET['d']); |
||||
|
||||
if (empty($subscriptionsItems)) { |
||||
$plugin->deleteFrequency($_GET['d']); |
||||
|
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('FrequencyRemoved'), 'success') |
||||
); |
||||
} else { |
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('SubscriptionPeriodOnUse'), 'error') |
||||
); |
||||
} |
||||
} |
||||
else{ |
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('FrequencyNotExits'), 'error') |
||||
); |
||||
} |
||||
|
||||
header('Location: '.api_get_self()); |
||||
exit; |
||||
} |
||||
} |
||||
|
||||
$frequencies = $plugin->getFrequenciesList(); |
||||
|
||||
$globalSettingsParams = $plugin->getGlobalParameters(); |
||||
|
||||
$form = new FormValidator('add_frequency'); |
||||
|
||||
$form->addText('name', get_lang('Name'), false); |
||||
|
||||
$form->addElement( |
||||
'number', |
||||
'duration', |
||||
[$plugin->get_lang('Duration'), $plugin->get_lang('Days')], |
||||
['step' => 1, 'placeholder' => $plugin->get_lang('SubscriptionFrequencyValueDays')] |
||||
); |
||||
|
||||
$button = $form->addButtonSave(get_lang('Save')); |
||||
|
||||
if ($form->validate()) { |
||||
$formValues = $form->getSubmitValues(); |
||||
$duration = $formValues['duration']; |
||||
$name = $formValues['name']; |
||||
|
||||
$frequency = $plugin->selectFrequency($duration); |
||||
|
||||
if (!empty($frequency)) { |
||||
$result = $plugin->updateFrequency($duration, $name); |
||||
|
||||
if (!isset($result)) { |
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('FrequencyNotUpdated'), 'error') |
||||
); |
||||
} |
||||
} else { |
||||
$result = $plugin->addFrequency($duration, $name); |
||||
|
||||
if (!isset($result)) { |
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('FrequencyNotSaved'), 'error') |
||||
); |
||||
} |
||||
} |
||||
|
||||
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/configure_frequency.php'); |
||||
|
||||
exit; |
||||
} |
||||
|
||||
$form->setDefaults($formDefaults); |
||||
|
||||
$templateName = $plugin->get_lang('FrequencyAdd'); |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'subscriptions_courses.php', |
||||
'name' => get_lang('Configuration'), |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'subscriptions_courses.php', |
||||
'name' => $plugin->get_lang('SubscriptionList'), |
||||
]; |
||||
|
||||
$template = new Template($templateName); |
||||
$template->assign('header', $templateName); |
||||
$template->assign('items_form', $form->returnForm()); |
||||
$template->assign('frequencies_list', $frequencies); |
||||
|
||||
$content = $template->fetch('buycourses/view/configure_frequency.tpl'); |
||||
$template->assign('content', $content); |
||||
|
||||
$template->display_one_col_template(); |
@ -0,0 +1,246 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
|
||||
/** |
||||
* Configuration page for subscriptions for the Buy Courses plugin. |
||||
* |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
$cidReset = true; |
||||
|
||||
require_once __DIR__.'/../../../main/inc/global.inc.php'; |
||||
|
||||
api_protect_admin_script(true); |
||||
|
||||
$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
||||
$type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0; |
||||
|
||||
if (!isset($id) || !isset($type)) { |
||||
api_not_allowed(); |
||||
} |
||||
|
||||
$queryString = 'id='.intval($_REQUEST['id']).'&type='.intval($_REQUEST['type']); |
||||
|
||||
$editingCourse = $type === BuyCoursesPlugin::PRODUCT_TYPE_COURSE; |
||||
$editingSession = $type === BuyCoursesPlugin::PRODUCT_TYPE_SESSION; |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
|
||||
$includeSession = $plugin->get('include_sessions') === 'true'; |
||||
|
||||
if (isset($_GET['action'], $_GET['d'])) { |
||||
if ($_GET['action'] == 'delete_frequency') { |
||||
$plugin->deleteSubscription($type, $id, $_GET['d']); |
||||
|
||||
Display::addFlash( |
||||
Display::return_message(get_lang('ItemRemoved'), 'success') |
||||
); |
||||
|
||||
header('Location: '.api_get_self().'?'.$queryString); |
||||
exit; |
||||
} |
||||
} |
||||
|
||||
$entityManager = Database::getManager(); |
||||
$userRepo = UserManager::getRepository(); |
||||
$currency = $plugin->getSelectedCurrency(); |
||||
|
||||
if (empty($currency)) { |
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('CurrencyIsNotConfigured'), 'error') |
||||
); |
||||
} |
||||
|
||||
$subscriptions = $plugin->getSubscriptions($type, $id ); |
||||
|
||||
$taxtPerc = 0; |
||||
|
||||
if (isset($subscriptions) && !empty($subscriptions )) { |
||||
$taxtPerc = $subscriptions[0]['tax_perc']; |
||||
} |
||||
|
||||
$currencyIso = null; |
||||
|
||||
if ($editingCourse) { |
||||
$course = $entityManager->find('ChamiloCoreBundle:Course', $id); |
||||
if (!$course) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$courseItem = $plugin->getCourseForConfiguration($course, $currency); |
||||
|
||||
$currencyIso = $courseItem['currency']; |
||||
$formDefaults = [ |
||||
'product_type' => get_lang('Course'), |
||||
'id' => $courseItem['course_id'], |
||||
'type' => BuyCoursesPlugin::PRODUCT_TYPE_COURSE, |
||||
'name' => $courseItem['course_title'], |
||||
'visible' => $courseItem['visible'], |
||||
'tax_perc' => $taxtPerc, |
||||
]; |
||||
} else if ($editingSession) { |
||||
if (!$includeSession) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$session = $entityManager->find('ChamiloCoreBundle:Session', $id); |
||||
if (!$session) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$sessionItem = $plugin->getSessionForConfiguration($session, $currency); |
||||
|
||||
$currencyIso = $sessionItem['currency']; |
||||
$formDefaults = [ |
||||
'product_type' => get_lang('Session'), |
||||
'id' => $session->getId(), |
||||
'type' => BuyCoursesPlugin::PRODUCT_TYPE_SESSION, |
||||
'name' => $sessionItem['session_name'], |
||||
'visible' => $sessionItem['visible'], |
||||
'tax_perc' => $taxtPerc, |
||||
]; |
||||
} else { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$globalSettingsParams = $plugin->getGlobalParameters(); |
||||
|
||||
$form = new FormValidator('add_subscription'); |
||||
|
||||
$form->addText('product_type', $plugin->get_lang('ProductType'), false); |
||||
$form->addText('name', get_lang('Name'), false); |
||||
|
||||
$form->freeze(['product_type', 'name']); |
||||
|
||||
$form->addElement( |
||||
'number', |
||||
'tax_perc', |
||||
[$plugin->get_lang('TaxPerc'), $plugin->get_lang('TaxPercDescription'), '%'], |
||||
['step' => 1, 'placeholder' => $globalSettingsParams['global_tax_perc'].'% '.$plugin->get_lang('ByDefault')] |
||||
); |
||||
|
||||
$frequenciesOptions = $plugin->getFrequencies(); |
||||
|
||||
$frequencyForm = new FormValidator('frequency_config', 'post', api_get_self().'?'.$queryString); |
||||
|
||||
$frequencyFormDefaults = [ |
||||
'id' => $id, |
||||
'type' => $type, |
||||
'tax_perc' => $taxtPerc, |
||||
'currency_id' => $currency['id'], |
||||
]; |
||||
|
||||
$frequencyForm->setDefaults($frequencyFormDefaults); |
||||
|
||||
if ($frequencyForm->validate()) { |
||||
$frequencyFormValues = $frequencyForm->getSubmitValues(); |
||||
|
||||
$subscription['product_id'] = $frequencyFormValues['id']; |
||||
$subscription['product_type'] = $frequencyFormValues['type']; |
||||
$subscription['tax_perc'] = $frequencyFormValues['tax_perc'] != '' ? (int) $frequencyFormValues['tax_perc'] : null; |
||||
$subscription['currency_id'] = $currency['id']; |
||||
$duration = $frequencyFormValues['duration']; |
||||
$price = $frequencyFormValues['price']; |
||||
|
||||
for ($i = 0; $i <= count($subscriptions); $i++) { |
||||
if ($subscriptions[$i]['duration'] == $duration) { |
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('SubscriptionAlreadyExists'), 'error') |
||||
); |
||||
|
||||
header('Location:'.api_get_self().'?'.$queryString); |
||||
exit; |
||||
} |
||||
} |
||||
|
||||
$subscription['frequencies'] = [['duration' => $duration, 'price' => $price]]; |
||||
|
||||
$result = $plugin->addNewSubscription($subscription); |
||||
|
||||
Display::addFlash( |
||||
Display::return_message(get_lang('Saved'), 'success') |
||||
); |
||||
|
||||
header('Location:'.api_get_self().'?'.$queryString); |
||||
exit; |
||||
} |
||||
|
||||
$frequencyForm->addElement( |
||||
'select', |
||||
'duration', |
||||
$plugin->get_lang('Duration'), |
||||
$frequenciesOptions, |
||||
['cols-size' => [2, 8, 2]] |
||||
); |
||||
|
||||
$frequencyForm->addElement( |
||||
'number', |
||||
'price', |
||||
[$plugin->get_lang('Price'), null, $currencyIso], |
||||
false, |
||||
[ |
||||
'step' => 1, |
||||
'cols-size' => [3, 8, 1] |
||||
] |
||||
); |
||||
|
||||
$frequencyForm->addHidden('type', $type); |
||||
$frequencyForm->addHidden('id', $id); |
||||
$frequencyForm->addHidden('tax_perc', $taxtPerc); |
||||
$frequencyForm->addHidden('currency_id', $currency['id']); |
||||
$frequencyForm->addButtonCreate('Add'); |
||||
|
||||
for ($i = 0; $i <= count($subscriptions); $i++) { |
||||
if ($subscriptions[$i]['duration'] > 0) { |
||||
$subscriptions[$i]['durationName'] = $frequenciesOptions[$subscriptions[$i]['duration']]; |
||||
} |
||||
} |
||||
|
||||
$form->addHidden('type', $type); |
||||
$form->addHidden('id', $id); |
||||
$button = $form->addButtonSave(get_lang('Save')); |
||||
|
||||
if (empty($currency)) { |
||||
$button->setAttribute('disabled'); |
||||
} |
||||
|
||||
if ($form->validate()) { |
||||
$formValues = $form->getSubmitValues(); |
||||
$id = $formValues['id']; |
||||
$type = $formValues['type']; |
||||
$taxPerc = $formValues['tax_perc'] != '' ? (int) $formValues['tax_perc'] : null; |
||||
|
||||
$result = $plugin->updateSubscriptions($type, $id, $taxPerc); |
||||
|
||||
if ($result) { |
||||
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/subscriptions_courses.php'); |
||||
} else { |
||||
header('Location:'.api_get_self().'?'.$queryString); |
||||
} |
||||
|
||||
exit; |
||||
} |
||||
|
||||
$form->setDefaults($formDefaults); |
||||
|
||||
$templateName = $plugin->get_lang('SubscriptionAdd'); |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'subscriptions_courses.php', |
||||
'name' => get_lang('Configuration'), |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => 'subscriptions_courses.php', |
||||
'name' => $plugin->get_lang('SubscriptionList'), |
||||
]; |
||||
|
||||
$template = new Template($templateName); |
||||
$template->assign('header', $templateName); |
||||
$template->assign('items_form', $form->returnForm()); |
||||
$template->assign('frequency_form', $frequencyForm->returnForm()); |
||||
$template->assign('subscriptions', $subscriptions); |
||||
$template->assign('currencyIso', $currencyIso); |
||||
|
||||
$content = $template->fetch('buycourses/view/configure_subscription.tpl'); |
||||
$template->assign('content', $content); |
||||
|
||||
$template->display_one_col_template(); |
@ -0,0 +1,63 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
//Initialization |
||||
$cidReset = true; |
||||
|
||||
require_once '../config.php'; |
||||
|
||||
api_protect_admin_script(); |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
$form = new FormValidator('export_validate'); |
||||
|
||||
$form->addDatePicker('date_start', get_lang('DateStart'), false); |
||||
$form->addDatePicker('date_end', get_lang('DateEnd'), false); |
||||
$form->addButton('export_sales', get_lang('ExportExcel'), 'check', 'primary'); |
||||
$salesStatus = []; |
||||
|
||||
if ($form->validate()) { |
||||
$reportValues = $form->getSubmitValues(); |
||||
|
||||
$dateStart = $reportValues['date_start']; |
||||
$dateEnd = $reportValues['date_end']; |
||||
|
||||
if ($dateStart == null || $dateEnd == null) { |
||||
Display::addFlash( |
||||
Display::return_message($plugin->get_lang('SelectDateRange'), 'error', false) |
||||
); |
||||
} elseif ($dateStart > $dateEnd) { |
||||
Display::addFlash( |
||||
Display::return_message(get_lang('EndDateCannotBeBeforeTheStartDate'), 'error', false) |
||||
); |
||||
} else { |
||||
$salesStatus = $plugin->getSubscriptionSaleListReport($dateStart, $dateEnd); |
||||
} |
||||
} |
||||
|
||||
if (!empty($salesStatus)) { |
||||
$archiveFile = 'export_report_sales_'.api_get_local_time(); |
||||
Export::arrayToXls($salesStatus, $archiveFile); |
||||
} |
||||
$interbreadcrumb[] = [ |
||||
'url' => '../index.php', 'name' => $plugin->get_lang('plugin_title'), |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => api_get_path(WEB_PLUGIN_PATH).'buycourses/src/subscription_sales_report.php', |
||||
'name' => $plugin->get_lang('SubscriptionSalesReport'), |
||||
]; |
||||
|
||||
$templateName = $plugin->get_lang('ExportReport'); |
||||
$toolbar = Display::url( |
||||
Display::return_icon('back.png', get_lang('GoBack'), [], ICON_SIZE_MEDIUM), |
||||
api_get_path(WEB_PLUGIN_PATH).'buycourses/src/subscription_sales_report.php' |
||||
); |
||||
$template = new Template($templateName); |
||||
$template->assign( |
||||
'actions', |
||||
Display::toolbarAction('toolbar', [$toolbar]) |
||||
); |
||||
$template->assign('form', $form->returnForm()); |
||||
$content = $template->fetch('buycourses/view/export_report.tpl'); |
||||
$template->assign('header', $templateName); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
@ -0,0 +1,375 @@ |
||||
<?php |
||||
/* For license terms, see /license.txt */ |
||||
|
||||
/** |
||||
* Process purchase confirmation script for the Buy Courses plugin. |
||||
* |
||||
* @package chamilo.plugin.buycourses |
||||
*/ |
||||
require_once '../config.php'; |
||||
|
||||
$plugin = BuyCoursesPlugin::create(); |
||||
|
||||
$saleId = $_SESSION['bc_sale_id']; |
||||
$couponId = $_SESSION['bc_coupon_id']; |
||||
|
||||
if (empty($saleId)) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$sale = $plugin->getSubscriptionSale($saleId); |
||||
|
||||
if (!empty($couponId)) { |
||||
$coupon = $plugin->getCoupon($couponId, $sale['product_type'], $sale['product_id']); |
||||
} |
||||
|
||||
$userInfo = api_get_user_info($sale['user_id']); |
||||
|
||||
if (empty($sale)) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$currency = $plugin->getCurrency($sale['currency_id']); |
||||
$globalParameters = $plugin->getGlobalParameters(); |
||||
|
||||
switch ($sale['payment_type']) { |
||||
case BuyCoursesPlugin::PAYMENT_TYPE_PAYPAL: |
||||
$paypalParams = $plugin->getPaypalParams(); |
||||
|
||||
$pruebas = $paypalParams['sandbox'] == 1; |
||||
$paypalUsername = $paypalParams['username']; |
||||
$paypalPassword = $paypalParams['password']; |
||||
$paypalSignature = $paypalParams['signature']; |
||||
|
||||
require_once "paypalfunctions.php"; |
||||
|
||||
$i = 0; |
||||
$extra = "&L_PAYMENTREQUEST_0_NAME0={$sale['product_name']}"; |
||||
$extra .= "&L_PAYMENTREQUEST_0_AMT0={$sale['price']}"; |
||||
$extra .= "&L_PAYMENTREQUEST_0_QTY0=1"; |
||||
|
||||
$expressCheckout = CallShortcutExpressCheckout( |
||||
$sale['price'], |
||||
$currency['iso_code'], |
||||
'paypal', |
||||
api_get_path(WEB_PLUGIN_PATH).'buycourses/src/success.php', |
||||
api_get_path(WEB_PLUGIN_PATH).'buycourses/src/error.php', |
||||
$extra |
||||
); |
||||
|
||||
if ($expressCheckout["ACK"] !== 'Success') { |
||||
$erroMessage = vsprintf( |
||||
$plugin->get_lang('ErrorOccurred'), |
||||
[$expressCheckout['L_ERRORCODE0'], $expressCheckout['L_LONGMESSAGE0']] |
||||
); |
||||
Display::addFlash( |
||||
Display::return_message($erroMessage, 'error', false) |
||||
); |
||||
header('Location: ../index.php'); |
||||
exit; |
||||
} |
||||
|
||||
if (!empty($globalParameters['sale_email'])) { |
||||
$messageConfirmTemplate = new Template(); |
||||
$messageConfirmTemplate->assign('user', $userInfo); |
||||
$messageConfirmTemplate->assign( |
||||
'sale', |
||||
[ |
||||
'date' => $sale['date'], |
||||
'product' => $sale['product_name'], |
||||
'currency' => $currency['iso_code'], |
||||
'price' => $sale['price'], |
||||
'reference' => $sale['reference'], |
||||
] |
||||
); |
||||
|
||||
api_mail_html( |
||||
'', |
||||
$globalParameters['sale_email'], |
||||
$plugin->get_lang('bc_subject'), |
||||
$messageConfirmTemplate->fetch('buycourses/view/message_confirm.tpl') |
||||
); |
||||
} |
||||
|
||||
RedirectToPayPal($expressCheckout["TOKEN"]); |
||||
break; |
||||
case BuyCoursesPlugin::PAYMENT_TYPE_TRANSFER: |
||||
$buyingCourse = false; |
||||
$buyingSession = false; |
||||
|
||||
switch ($sale['product_type']) { |
||||
case BuyCoursesPlugin::PRODUCT_TYPE_COURSE: |
||||
$buyingCourse = true; |
||||
$course = $plugin->getSubscriptionCourseInfo($sale['product_id'], $coupon); |
||||
break; |
||||
case BuyCoursesPlugin::PRODUCT_TYPE_SESSION: |
||||
$buyingSession = true; |
||||
$session = $plugin->getSubscriptionSessionInfo($sale['product_id'], $coupon); |
||||
break; |
||||
} |
||||
|
||||
$transferAccounts = $plugin->getTransferAccounts(); |
||||
$infoEmailExtra = $plugin->getTransferInfoExtra()['tinfo_email_extra']; |
||||
|
||||
$form = new FormValidator( |
||||
'success', |
||||
'POST', |
||||
api_get_self(), |
||||
null, |
||||
null, |
||||
FormValidator::LAYOUT_INLINE |
||||
); |
||||
|
||||
if ($form->validate()) { |
||||
$formValues = $form->getSubmitValues(); |
||||
|
||||
if (isset($formValues['cancel'])) { |
||||
$plugin->cancelSubscriptionSale($sale['id']); |
||||
|
||||
unset($_SESSION['bc_sale_id']); |
||||
unset($_SESSION['bc_coupon_id']); |
||||
|
||||
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/index.php'); |
||||
exit; |
||||
} |
||||
|
||||
$messageTemplate = new Template(); |
||||
$messageTemplate->assign('user', $userInfo); |
||||
$messageTemplate->assign( |
||||
'sale', |
||||
[ |
||||
'date' => $sale['date'], |
||||
'product' => $sale['product_name'], |
||||
'currency' => $currency['iso_code'], |
||||
'price' => $sale['price'], |
||||
'reference' => $sale['reference'], |
||||
] |
||||
); |
||||
$messageTemplate->assign('transfer_accounts', $transferAccounts); |
||||
$messageTemplate->assign('info_email_extra', $infoEmailExtra); |
||||
|
||||
MessageManager::send_message_simple( |
||||
$userInfo['user_id'], |
||||
$plugin->get_lang('bc_subject'), |
||||
$messageTemplate->fetch('buycourses/view/message_transfer.tpl') |
||||
); |
||||
|
||||
if (!empty($globalParameters['sale_email'])) { |
||||
$messageConfirmTemplate = new Template(); |
||||
$messageConfirmTemplate->assign('user', $userInfo); |
||||
$messageConfirmTemplate->assign( |
||||
'sale', |
||||
[ |
||||
'date' => $sale['date'], |
||||
'product' => $sale['product_name'], |
||||
'currency' => $currency['iso_code'], |
||||
'price' => $sale['price'], |
||||
'reference' => $sale['reference'], |
||||
] |
||||
); |
||||
|
||||
api_mail_html( |
||||
'', |
||||
$globalParameters['sale_email'], |
||||
$plugin->get_lang('bc_subject'), |
||||
$messageConfirmTemplate->fetch('buycourses/view/message_confirm.tpl') |
||||
); |
||||
} |
||||
|
||||
Display::addFlash( |
||||
Display::return_message( |
||||
sprintf( |
||||
$plugin->get_lang('PurchaseStatusX'), |
||||
$plugin->get_lang('PendingReasonByTransfer') |
||||
), |
||||
'success', |
||||
false |
||||
) |
||||
); |
||||
|
||||
unset($_SESSION['bc_sale_id']); |
||||
unset($_SESSION['bc_coupon_id']); |
||||
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/course_catalog.php'); |
||||
exit; |
||||
} |
||||
|
||||
$form->addButton( |
||||
'confirm', |
||||
$plugin->get_lang('ConfirmOrder'), |
||||
'check', |
||||
'success', |
||||
'default', |
||||
null, |
||||
['id' => 'confirm'] |
||||
); |
||||
$form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel'); |
||||
|
||||
$template = new Template(); |
||||
|
||||
if ($buyingCourse) { |
||||
$template->assign('course', $course); |
||||
} elseif ($buyingSession) { |
||||
$template->assign('session', $session); |
||||
} |
||||
|
||||
$template->assign('buying_course', $buyingCourse); |
||||
$template->assign('buying_session', $buyingSession); |
||||
$template->assign('terms', $globalParameters['terms_and_conditions']); |
||||
$template->assign('title', $sale['product_name']); |
||||
$template->assign('price', $sale['price']); |
||||
$template->assign('currency', $sale['currency_id']); |
||||
$template->assign('user', $userInfo); |
||||
$template->assign('transfer_accounts', $transferAccounts); |
||||
$template->assign('form', $form->returnForm()); |
||||
$template->assign('is_bank_transfer', true); |
||||
|
||||
$content = $template->fetch('buycourses/view/subscription_process_confirm.tpl'); |
||||
|
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
break; |
||||
case BuyCoursesPlugin::PAYMENT_TYPE_CULQI: |
||||
// We need to include the main online script, acording to the Culqi documentation the JS needs to be loeaded |
||||
// directly from the main url "https://integ-pago.culqi.com" because a local copy of this JS is not supported |
||||
$htmlHeadXtra[] = '<script src="//integ-pago.culqi.com/js/v1"></script>'; |
||||
|
||||
$buyingCourse = false; |
||||
$buyingSession = false; |
||||
|
||||
switch ($sale['product_type']) { |
||||
case BuyCoursesPlugin::PRODUCT_TYPE_COURSE: |
||||
$buyingCourse = true; |
||||
$course = $plugin->getSubscriptionCourseInfo($sale['product_id'], $coupon); |
||||
break; |
||||
case BuyCoursesPlugin::PRODUCT_TYPE_SESSION: |
||||
$buyingSession = true; |
||||
$session = $plugin->getSubscriptionSessionInfo($sale['product_id'], $coupon); |
||||
break; |
||||
} |
||||
|
||||
$form = new FormValidator( |
||||
'success', |
||||
'POST', |
||||
api_get_self(), |
||||
null, |
||||
null, |
||||
FormValidator::LAYOUT_INLINE |
||||
); |
||||
|
||||
if ($form->validate()) { |
||||
$formValues = $form->getSubmitValues(); |
||||
|
||||
if (isset($formValues['cancel'])) { |
||||
$plugin->cancelSubscriptionSale($sale['id']); |
||||
|
||||
unset($_SESSION['bc_sale_id']); |
||||
unset($_SESSION['bc_coupon_id']); |
||||
|
||||
Display::addFlash( |
||||
Display::return_message( |
||||
$plugin->get_lang('OrderCanceled'), |
||||
'warning', |
||||
false |
||||
) |
||||
); |
||||
|
||||
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/index.php'); |
||||
exit; |
||||
} |
||||
} |
||||
$form->addButton( |
||||
'confirm', |
||||
$plugin->get_lang('ConfirmOrder'), |
||||
'check', |
||||
'success', |
||||
'default', |
||||
null, |
||||
['id' => 'confirm'] |
||||
); |
||||
$form->addButton( |
||||
'cancel', |
||||
$plugin->get_lang('CancelOrder'), |
||||
'times', |
||||
'danger', |
||||
'default', |
||||
null, |
||||
['id' => 'cancel'] |
||||
); |
||||
|
||||
$template = new Template(); |
||||
|
||||
if ($buyingCourse) { |
||||
$template->assign('course', $course); |
||||
} elseif ($buyingSession) { |
||||
$template->assign('session', $session); |
||||
} |
||||
|
||||
$template->assign('buying_course', $buyingCourse); |
||||
$template->assign('buying_session', $buyingSession); |
||||
$template->assign('terms', $globalParameters['terms_and_conditions']); |
||||
$template->assign('title', $sale['product_name']); |
||||
$template->assign('price', floatval($sale['price'])); |
||||
$template->assign('currency', $plugin->getSelectedCurrency()); |
||||
$template->assign('user', $userInfo); |
||||
$template->assign('sale', $sale); |
||||
$template->assign('form', $form->returnForm()); |
||||
$template->assign('is_culqi_payment', true); |
||||
$template->assign('culqi_params', $culqiParams = $plugin->getCulqiParams()); |
||||
|
||||
$content = $template->fetch('buycourses/view/subscription_process_confirm.tpl'); |
||||
|
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
|
||||
break; |
||||
case BuyCoursesPlugin::PAYMENT_TYPE_TPV_REDSYS: |
||||
$tpvRedsysParams = $plugin->getTpvRedsysParams(); |
||||
|
||||
require_once '../resources/apiRedsys.php'; |
||||
$tpv = new RedsysAPI(); |
||||
|
||||
$merchantcode = $tpvRedsysParams['merchantcode']; |
||||
$terminal = $tpvRedsysParams['terminal']; |
||||
$currency = $tpvRedsysParams['currency']; |
||||
$transactionType = "0"; |
||||
$urlMerchant = api_get_path(WEB_PLUGIN_PATH).'buycourses/src/tpv_response.php'; |
||||
$urlSuccess = api_get_path(WEB_PLUGIN_PATH).'buycourses/src/tpv_success.php'; |
||||
$urlFailed = api_get_path(WEB_PLUGIN_PATH).'buycourses/src/tpv_error.php'; |
||||
$order = str_pad(strval($saleId), 4, "0", STR_PAD_LEFT); |
||||
$amount = $sale['price'] * 100; |
||||
$description = $plugin->get_lang('OrderReference').": ".$sale['reference']; |
||||
$tpv->setParameter("DS_MERCHANT_AMOUNT", $amount); |
||||
$tpv->setParameter("DS_MERCHANT_ORDER", $order); |
||||
$tpv->setParameter("DS_MERCHANT_MERCHANTCODE", $merchantcode); |
||||
$tpv->setParameter("DS_MERCHANT_CURRENCY", $currency); |
||||
$tpv->setParameter("DS_MERCHANT_TRANSACTIONTYPE", $transactionType); |
||||
$tpv->setParameter("DS_MERCHANT_TERMINAL", $terminal); |
||||
$tpv->setParameter("DS_MERCHANT_MERCHANTURL", $urlMerchant); |
||||
$tpv->setParameter("DS_MERCHANT_URLOK", $urlSuccess); |
||||
$tpv->setParameter("DS_MERCHANT_URLKO", $urlFailed); |
||||
$tpv->setParameter("DS_MERCHANT_PRODUCTDESCRIPTION", $description); |
||||
|
||||
$version = "HMAC_SHA256_V1"; |
||||
$kc = $tpvRedsysParams['kc']; |
||||
|
||||
$urlTpv = $tpvRedsysParams['url_redsys']; |
||||
$sandboxFlag = $tpvRedsysParams['sandbox'] == 1; |
||||
if ($sandboxFlag === true) { |
||||
$urlTpv = $tpvRedsysParams['url_redsys_sandbox']; |
||||
} |
||||
|
||||
$params = $tpv->createMerchantParameters(); |
||||
$signature = $tpv->createMerchantSignature($kc); |
||||
|
||||
echo '<form name="tpv_chamilo" action="'.$urlTpv.'" method="POST">'; |
||||
echo '<input type="hidden" name="Ds_SignatureVersion" value="'.$version.'" />'; |
||||
echo '<input type="hidden" name="Ds_MerchantParameters" value="'.$params.'" />'; |
||||
echo '<input type="hidden" name="Ds_Signature" value="'.$signature.'" />'; |
||||
echo '</form>'; |
||||
|
||||
echo '<SCRIPT language=javascript>'; |
||||
echo 'document.tpv_chamilo.submit();'; |
||||
echo '</script>'; |
||||
|
||||
break; |
||||
} |
@ -0,0 +1,32 @@ |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
{{ items_form }} |
||||
</div> |
||||
</div> |
||||
<div class="table-responsive"> |
||||
<table class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr class="sale-columns"> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th>{{ 'SubscriptionPeriodDuration'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th width="10%">{{ 'Options'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for frequency in frequencies_list %} |
||||
<tr class="sale-row"> |
||||
<td class="text-center">{{ frequency.name }}</td> |
||||
<td class="text-center">{{ frequency.duration }}</td> |
||||
<td class="text-center"> |
||||
<div class="btn-group btn-group-xs" role="group" aria-label="..."> |
||||
<a title="{{ 'DeleteFrequency'|get_plugin_lang('BuyCoursesPlugin') }}" href="{{ _p.web_plugin ~ 'buycourses/src/configure_frequency.php?' ~ {'action': 'delete_frequency', 'd': frequency.duration, 'n': frequency.name}|url_encode() }}" |
||||
class="btn btn-danger btn-default"> |
||||
<em class="fa fa-remove"></em> |
||||
</a> |
||||
</div> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
@ -0,0 +1,45 @@ |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
{{ items_form }} |
||||
</div> |
||||
</div> |
||||
<div class="panel panel-default"> |
||||
<div class="panel-heading"> |
||||
<h3 class="panel-title">{{ 'FrequencyConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
</div> |
||||
<div class="panel-body"> |
||||
<div class="row"> |
||||
<div class="col-md-5"> |
||||
{{ frequency_form }} |
||||
</div> |
||||
<div class="col-md-7"> |
||||
<div class="table-responsive"> |
||||
<table class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr> |
||||
<th>{{ 'Duration'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'Actions'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for subscription in subscriptions %} |
||||
<tr> |
||||
<td>{{ subscription.durationName }}</td> |
||||
<td>{{ subscription.price }} {{ currencyIso }}</td> |
||||
<td> |
||||
<a href="{{ _p.web_self ~ '?' ~ {'action':'delete_frequency', 'd': subscription.duration, 'id': subscription.product_id, 'type': subscription.product_type}|url_encode() }}" |
||||
class="btn btn-danger btn-sm"> |
||||
<em class="fa fa-remove"></em> |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
@ -0,0 +1,37 @@ |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
{{ items_form }} |
||||
</div> |
||||
</div> |
||||
<script> |
||||
$(function () { |
||||
$("a[name='add']").click(function () { |
||||
var selectedFrequency = $("#duration").val(); |
||||
var selectedFrequencyText = $("#duration option:selected").text(); |
||||
var selectedFrequencyPrice = $("#price").val(); |
||||
|
||||
if (selectedFrequencyPrice === "0") { |
||||
return; |
||||
} |
||||
|
||||
var inputs = $("tbody tr td .frequency-days"); |
||||
|
||||
for (var i = 0; i < inputs.length; i++){ |
||||
if (inputs[i].value === selectedFrequency) { |
||||
return; |
||||
} |
||||
} |
||||
|
||||
var count = $("tbody tr").length; |
||||
var frequencyRow = '<tr><td><input class=\"frequency-days\" type="hidden" name=\"frequencies['+ (count + 1) + '][duration]\" value="'+selectedFrequency+'" />' + selectedFrequencyText + '</input></td><td><input type="hidden" name=\"frequencies['+ (count + 1) + '][price]\" value="' + selectedFrequencyPrice + '" />' + selectedFrequencyPrice + ' {{ currencyIso }} </td><td><a name=\"delete\" class=\"btn btn-danger btn-sm\"><em class=\"fa fa-remove\"></em></a></td></tr>'; |
||||
|
||||
$("tbody").append(frequencyRow); |
||||
}); |
||||
|
||||
$("tbody").on("click", "tr td a", function(){ |
||||
var elementToDelete = $(this).closest("tr"); |
||||
elementToDelete.remove(); |
||||
}); |
||||
}); |
||||
</script> |
||||
|
@ -0,0 +1,122 @@ |
||||
<div id="buy-courses-tabs"> |
||||
{% if sessions_are_included %} |
||||
<ul class="nav nav-tabs buy-courses-tabs" role="tablist"> |
||||
{% if coursesExist %} |
||||
<li id="buy-courses-tab" class="{{ showing_courses ? 'active' : '' }}" role="presentation"> |
||||
<a href="subscription_course_catalog.php" aria-controls="buy-courses" role="tab">{{ 'Courses'|get_lang }}</a> |
||||
</li> |
||||
{% endif %} |
||||
{% if sessionExist %} |
||||
<li id="buy-sessions-tab" class="{{ showing_sessions ? 'active' : '' }}" role="presentation"> |
||||
<a href="subscription_session_catalog.php" aria-controls="buy-sessions" role="tab">{{ 'Sessions'|get_lang }}</a> |
||||
</li> |
||||
{% endif %} |
||||
</ul> |
||||
{% endif %} |
||||
|
||||
<div class="tab-content"> |
||||
<div class="tab-pane active" aria-labelledby="buy-sessions-tab" role="tabpanel"> |
||||
<div class="row"> |
||||
<div class="col-md-3"> |
||||
{{ search_filter_form }} |
||||
</div> |
||||
<div class="col-md-9"> |
||||
<div class="row grid-courses"> |
||||
{% if showing_courses %} |
||||
{% for course in courses %} |
||||
<div class="col-md-4 col-sm-6"> |
||||
<article class="items-course"> |
||||
<div class="items-course-image"> |
||||
<figure class="img-responsive"> |
||||
<img alt="{{ course.title }}" |
||||
class="img-responsive" |
||||
src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}"> |
||||
</figure> |
||||
</div> |
||||
<div class="items-course-info"> |
||||
{% set course_description_url = _p.web_ajax ~ 'course_home.ajax.php?' ~ {'code': course.code, 'a': 'show_course_information'}|url_encode() %} |
||||
<h4 class="title"> |
||||
<a class="ajax" href="{{ course_description_url }}" |
||||
data-title="{{ course.title }}">{{ course.title }}</a> |
||||
</h4> |
||||
<ul class="list-unstyled"> |
||||
{% for teacher in course.teachers %} |
||||
<li><em class="fa fa-user"></em> {{ teacher }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% if course.enrolled == "YES" %} |
||||
<div class="alert alert-success"> |
||||
<em class="fa fa-check-square-o fa-fw"></em> {{ 'TheUserIsAlreadyRegisteredInTheCourse'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
{% elseif course.enrolled == "NO" %} |
||||
<div class="toolbar"> |
||||
<a class="ajax btn btn-info btn-block btn-sm" title="" |
||||
href="{{ course_description_url }}" |
||||
data-title="{{ course.title }}"> |
||||
<em class="fa fa-file-text"></em> {{ 'SeeDescription'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
<a class="btn btn-success btn-block btn-sm" title="" |
||||
href="{{ _p.web_plugin ~ 'buycourses/src/subscription_process.php?' ~ {'i': course.id, 't': 1}|url_encode() }}"> |
||||
<em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
</div> |
||||
{% elseif course.enrolled == "TMP" %} |
||||
<div class="alert alert-info">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</div> |
||||
{% endif %} |
||||
</div> |
||||
</article> |
||||
</div> |
||||
{% endfor %} |
||||
{% endif %} |
||||
|
||||
{% if showing_sessions %} |
||||
{% for session in sessions %} |
||||
<div class="col-md-4 col-sm-6"> |
||||
<article class="items-course"> |
||||
<div class="items-course-image"> |
||||
<figure class="img-responsive"> |
||||
<img alt="{{ session.name }}" class="img-responsive" |
||||
src="{{ session.image ? session.image : 'session_default.png'|icon() }}"> |
||||
</figure> |
||||
</div> |
||||
<div class="items-course-info"> |
||||
<h4 class="title"> |
||||
<a href="{{ _p.web ~ 'session/' ~ session.id ~ '/about/' }}">{{ session.name }}</a> |
||||
</h4> |
||||
{% if 'show_session_coach'|api_get_setting == 'true' %} |
||||
<p><em class="fa fa-user fa-fw"></em> {{ session.coach }}</p> |
||||
{% endif %} |
||||
<p> |
||||
<em class="fa fa-calendar fa-fw"></em> |
||||
{% if session.duration %} |
||||
{{ 'SessionDurationXDaysTotal'|get_lang|format(session.duration) }} |
||||
{% else %} |
||||
{{ session.dates.display }} |
||||
{% endif %} |
||||
</p> |
||||
{% if session.enrolled == "YES" %} |
||||
<div class="alert alert-success"> |
||||
<em class="fa fa-check-square-o fa-fw"></em> {{ 'TheUserIsAlreadyRegisteredInTheSession'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
{% elseif session.enrolled == "NO" %} |
||||
<div class="toolbar"> |
||||
<a class="btn btn-success btn-block btn-sm" |
||||
href="{{ _p.web_plugin ~ 'buycourses/src/subscription_process.php?' ~ {'i': session.id, 't': 2}|url_encode() }}"> |
||||
<em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</a> |
||||
</div> |
||||
{% elseif session.enrolled == "TMP" %} |
||||
<div class="alert alert-info">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</div> |
||||
{% endif %} |
||||
</div> |
||||
</article> |
||||
</div> |
||||
{% endfor %} |
||||
{% endif %} |
||||
</div> |
||||
{{ pagination }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,187 @@ |
||||
<div class="actions"> |
||||
{% if item_type == 1 %} |
||||
{% set back_url = _p.web_plugin ~ 'buycourses/src/subscription_course_catalog.php' %} |
||||
{% elseif item_type == 2 %} |
||||
{% set back_url = _p.web_plugin ~ 'buycourses/src/subscription_session_catalog.php' %} |
||||
{% endif %} |
||||
|
||||
<a href="{{ back_url }}" title="{{ "Back"|get_lang }}"> |
||||
<img src="{{ "back.png"|icon(32) }}" width="32" height="32" alt="{{ "Back"|get_lang }}" |
||||
title="{{ "Back"|get_lang }}"/> |
||||
</a> |
||||
</div> |
||||
<div class="page-header"> |
||||
<h3>{{ 'PurchaseData'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-md-12"> |
||||
<div class="panel panel-default panel-box-buy"> |
||||
<div class="panel-body"> |
||||
<div class="buy-info"> |
||||
{% if buying_course %} |
||||
<div class="row"> |
||||
<div class="col-md-5"> |
||||
<a class="ajax" data-title="{{ course.title }}" |
||||
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}"> |
||||
<img alt="{{ course.title }}" class="img-rounded img-responsive" |
||||
src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}"> |
||||
</a> |
||||
{% if course.tax_enable %} |
||||
<div class="price-details-tax"> |
||||
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }} : |
||||
{{ subscription.price_formatted }} |
||||
<br> |
||||
{{ course.tax_name }} ({{ subscription.item.tax_perc_show }}%): |
||||
{{ subscription.tax_amount_formatted }} |
||||
</div> |
||||
{% endif %} |
||||
<div class="price"> |
||||
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin') }} : |
||||
{{ subscription.total_price_formatted }} |
||||
</div> |
||||
{% if course.has_coupon %} |
||||
<div class="price-details-tax"> |
||||
{{ 'DiscountAmount'|get_plugin_lang('BuyCoursesPlugin') }}: |
||||
{{ course.discount_amount_formatted }} |
||||
</div> |
||||
{% endif %} |
||||
<div class="coupon-question"> |
||||
{{ 'SelecSubscription'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
<div class="subscription"> |
||||
{{ form_subscription }} |
||||
</div> |
||||
<div class="coupon-question"> |
||||
{{ 'DoYouHaveACoupon'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
<div class="coupon"> |
||||
{{ form_coupon }} |
||||
</div> |
||||
</div> |
||||
<div class="col-md-7"> |
||||
<div class="buy-item"> |
||||
<h3 class="title"> |
||||
<a class="ajax" data-title="{{ course.title }}" |
||||
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}"> |
||||
{{ course.title }} |
||||
</a> |
||||
</h3> |
||||
{% if course.description %} |
||||
<div class="description"> |
||||
{{ course.description }} |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if course.teachers %} |
||||
<div class="coaches"> |
||||
<p> |
||||
{{ 'Teachers'|get_plugin_lang('BuyCoursesPlugin') }} : |
||||
{% for teacher in course.teachers %} |
||||
<em class="fa fa-user" aria-hidden="true"></em> |
||||
<a href="{{ _p.web }}main/social/profile.php?u={{ teacher.id }}" |
||||
class="teacher-item"> {{ teacher.name }}</a>, |
||||
{% endfor %} |
||||
</p> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% elseif buying_session %} |
||||
<div class="row"> |
||||
<div class="col-md-5"> |
||||
<img alt="{{ session.name }}" class="img-rounded img-responsive" |
||||
src="{{ session.image ? session.image : 'session_default.png'|icon() }}"> |
||||
{% if session.tax_enable %} |
||||
<div class="price-details-tax"> |
||||
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }} : |
||||
{{ subscription.price_formatted }} |
||||
<br> |
||||
{{ session.tax_name }} ({{ subscription.item.tax_perc_show }}%): |
||||
{{ subscription.tax_amount_formatted }} |
||||
</div> |
||||
{% endif %} |
||||
<div class="price"> |
||||
{{ 'Total'|get_plugin_lang('BuyCoursesPlugin') }} : |
||||
{{ subscription.total_price_formatted }} |
||||
</div> |
||||
{% if session.has_coupon %} |
||||
<div class="price-details-tax"> |
||||
{{ 'DiscountAmount'|get_plugin_lang('BuyCoursesPlugin') }}: |
||||
{{ session.discount_amount_formatted }} |
||||
</div> |
||||
{% endif %} |
||||
<div class="coupon-question"> |
||||
{{ 'SelecSubscription'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
<div class="subscription"> |
||||
{{ form_subscription }} |
||||
</div> |
||||
<div class="coupon-question"> |
||||
{{ 'DoYouHaveACoupon'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</div> |
||||
<div class="coupon"> |
||||
{{ form_coupon }} |
||||
</div> |
||||
</div> |
||||
<div class="col-md-7"> |
||||
<div class="buy-item"> |
||||
<h3 class="title">{{ session.name }}</h3> |
||||
{% if session.description %} |
||||
<div class="description"> |
||||
{{ session.description }} |
||||
</div> |
||||
{% endif %} |
||||
<div class="date"> |
||||
<em class="fa fa-calendar" aria-hidden="true"></em> {{ session.dates.display }} |
||||
</div> |
||||
<hr> |
||||
<div class="coaches"> |
||||
{% for course in session.courses %} |
||||
<p class="course"> |
||||
<em class="fa fa-book" aria-hidden="true"></em> {{ course.title }} |
||||
</p> |
||||
{% if course.coaches|length %} |
||||
<p> |
||||
{{ 'Teachers'|get_plugin_lang('BuyCoursesPlugin') }} : |
||||
|
||||
{% for coach in course.coaches %} |
||||
<em class="fa fa-user" aria-hidden="true"></em> |
||||
<a href="{{ _p.web }}main/social/profile.php?u={{ coach.id }}" |
||||
class="teacher-item">{{ coach.name }}</a>, |
||||
{% endfor %} |
||||
</p> |
||||
{% endif %} |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<div class="buy-summary"> |
||||
<h3>{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
{% if message_payment %} |
||||
{{ message_payment }} |
||||
{% else %} |
||||
{{ form }} |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<script> |
||||
$(function () { |
||||
$("label").removeClass('control-label'); |
||||
$('.form_required').remove(); |
||||
$("small").remove(); |
||||
$("label[for=submit]").remove(); |
||||
$('input[name=duration]').click(function(){ |
||||
var selected = $('input[name=duration]:checked').val(); |
||||
if (selected != null) { |
||||
$('form[name=confirm_subscription]').submit(); |
||||
} |
||||
}) |
||||
}); |
||||
</script> |
@ -0,0 +1,283 @@ |
||||
<div class="row"> |
||||
<div id="message-alert"></div> |
||||
<div class="col-md-5"> |
||||
<div class="panel panel-default buycourse-panel-default"> |
||||
<div class="panel-heading"> |
||||
<h3 class="panel-title">{{ 'PurchaseData'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
</div> |
||||
<div class="panel-body"> |
||||
{% if buying_course %} |
||||
<div class="row"> |
||||
<div class="col-sm-12 col-md-12 col-xs-12"> |
||||
<a class="ajax" data-title="{{ course.title }}" |
||||
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}"> |
||||
<img alt="{{ course.title }}" class="img-responsive" style="width: 100%;" |
||||
src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}"> |
||||
</a> |
||||
</div> |
||||
<div class="col-sm-12 col-md-12 col-xs-12"> |
||||
<h3> |
||||
<a class="ajax" data-title="{{ course.title }}" |
||||
href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">{{ course.title }}</a> |
||||
</h3> |
||||
<ul class="list-unstyled"> |
||||
{% for teacher in course.teachers %} |
||||
<li><em class="fa fa-user"></em> {{ teacher.name }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<p id="n-price" class="lead text-right" style="color: white;"> |
||||
<span class="label label-primary"> |
||||
{{ course.item.total_price_formatted }} |
||||
</span> |
||||
</p> |
||||
<p id="s-price" class="lead text-right"></p> |
||||
</div> |
||||
</div> |
||||
{% elseif buying_session %} |
||||
<div class="row"> |
||||
<div class="col-sm-12 col-md-12 col-xs-12"> |
||||
<p> |
||||
<img alt="{{ session.name }}" class="img-responsive" style="width: 100%;" |
||||
src="{{ session.image ? session.image : 'session_default.png'|icon() }}"> |
||||
</p> |
||||
</div> |
||||
<div class="col-sm-12 col-md-12 col-xs-12"> |
||||
<h3>{{ session.name }}</h3> |
||||
<p><em class="fa fa-calendar fa-fw"></em> {{ session.dates.display }}</p> |
||||
<ul class="list-unstyled"> |
||||
{% for course in session.courses %} |
||||
<li> |
||||
<em class="fa fa-book fa-fw"></em> {{ course.title }} |
||||
{% if course.coaches|length %} |
||||
<ul> |
||||
{% for coach in course.coaches %} |
||||
<li><em class="fa fa-user fa-fw"></em>{{ coach }}</li> |
||||
{% endfor %} |
||||
</ul> |
||||
{% endif %} |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
<p id="n-price" class="lead text-right" style="color: white;"> |
||||
<span class="label label-primary"> |
||||
{{ session.item.total_price_formatted }} |
||||
</span> |
||||
</p> |
||||
<p id="s-price" class="lead text-right"></p> |
||||
</div> |
||||
</div> |
||||
{% elseif buying_service %} |
||||
<div class="row"> |
||||
<div class="col-sm-12 col-md-12 col-xs-12"> |
||||
<a href='{{ _p.web }}service/{{ service.id }}'> |
||||
<img alt="{{ service.name }}" class="img-responsive" |
||||
src="{{ service.image ? _p.web ~ 'plugin/buycourses/uploads/services/images/' ~ service.image : 'session_default.png'|icon() }}"> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-sm-12 col-md-12 col-xs-12"> |
||||
<h3> |
||||
<a href='{{ _p.web }}service/{{ service.id }}'>{{ service.name }}</a> |
||||
</h3> |
||||
<ul class="list-unstyled"> |
||||
{% if service.applies_to == 0 %} |
||||
<li> |
||||
<em class="fa fa-hand-o-right"></em> {{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }} {{ 'None'|get_lang }} |
||||
</li> |
||||
{% elseif service.applies_to == 1 %} |
||||
<li> |
||||
<em class="fa fa-hand-o-right"></em> {{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }} {{ 'User'|get_lang }} |
||||
</li> |
||||
{% elseif service.applies_to == 2 %} |
||||
<li> |
||||
<em class="fa fa-hand-o-right"></em> {{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }} {{ 'Course'|get_lang }} |
||||
</li> |
||||
{% elseif service.applies_to == 3 %} |
||||
<li> |
||||
<em class="fa fa-hand-o-right"></em> {{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }} {{ 'Session'|get_lang }} |
||||
</li> |
||||
{% elseif service.applies_to == 4 %} |
||||
<li> |
||||
<em class="fa fa-hand-o-right"></em> {{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }} {{ 'TemplateTitleCertificate'|get_lang }} |
||||
</li> |
||||
{% endif %} |
||||
<li> |
||||
<em class="fa fa-money"></em> |
||||
{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
: {{ service_item.total_price_formatted }} |
||||
/ {{ service.duration_days == 0 ? 'NoLimit'|get_lang : service.duration_days ~ ' ' ~ 'Days'|get_lang }} |
||||
</li> |
||||
<li><em class="fa fa-user"></em> {{ service.owner.name }}</li> |
||||
{% if service.description %} |
||||
<li><em class="fa fa-align-justify"></em> {{ service.description }}</li> |
||||
{% endif %} |
||||
</ul> |
||||
<p id="n-price" class="lead text-right" style="color: white;"> |
||||
<span class="label label-primary"> |
||||
{{ service_item.total_price_formatted }} |
||||
</span> |
||||
</p> |
||||
<p id="s-price" class="lead text-right"></p> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% if terms %} |
||||
<div class="col-md-7"> |
||||
<div class="panel panel-default buycourse-panel-default"> |
||||
<div class="panel-heading"> |
||||
<h3 class="panel-title">{{ 'TermsAndConditions'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
</div> |
||||
<div class="panel-body"> |
||||
<form action="#"> |
||||
<div class="form-group"> |
||||
<textarea class="form-control" style="height: 345px;" readonly>{{ terms }}</textarea> |
||||
</div> |
||||
<div class="checkbox"> |
||||
<label for="confirmTermsAndConditons"> |
||||
<input class="" type="checkbox" id="confirmTermsAndConditons" name="confirmTermsAndConditons"> |
||||
{{ 'IConfirmIReadAndAcceptTermsAndCondition'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
</label> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
|
||||
{% if is_bank_transfer %} |
||||
<div class="row"> |
||||
<div class="col-xs-12"> |
||||
<h3 class="page-header">{{ 'BankAccountInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3> |
||||
<div class="table-responsive"> |
||||
<table class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th class="text-center">{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th class="text-center">{{ 'SWIFT'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for account in transfer_accounts %} |
||||
<tr> |
||||
<td>{{ account.name }}</td> |
||||
<td class="text-center">{{ account.account }}</td> |
||||
<td class="text-center">{{ account.swift }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
<p>{{ 'OnceItIsConfirmedYouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</p> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<div class="row"> |
||||
<div class="col-xs-12"> |
||||
{{ form }} |
||||
</div> |
||||
</div> |
||||
<script> |
||||
$(function () { |
||||
{% if terms %} |
||||
$("#confirm").prop("disabled", true); |
||||
|
||||
$("#confirmTermsAndConditons").click(function () { |
||||
if ($("#confirmTermsAndConditons").is(':checked')) { |
||||
$("#confirm").prop("disabled", false); |
||||
} else { |
||||
$("#confirm").prop("disabled", true); |
||||
} |
||||
}); |
||||
{% endif %} |
||||
|
||||
{% if is_culqi_payment %} |
||||
var price = {{ price }} * 100; |
||||
|
||||
Culqi.codigoComercio = '{{ culqi_params.commerce_code }}'; |
||||
Culqi.configurar({ |
||||
nombre: '{{ _s.institution }}', |
||||
orden: '{{ sale.reference ? sale.reference : buying_service.reference }}', |
||||
moneda: '{{ currency.iso_code }}', |
||||
descripcion: '{{ title }}', |
||||
monto: price |
||||
}); |
||||
|
||||
$("#confirm").click(function (e) { |
||||
Culqi.abrir(); |
||||
e.preventDefault(); |
||||
$(".culqi_checkout").watch('style', function () { |
||||
|
||||
if (Culqi.error) { |
||||
$("#message-alert").html('<div class="col-md-12 alert alert-danger">{{ 'ErrorOccurred'|get_plugin_lang('BuyCoursesPlugin')|format(Culqi.error.codigo, Culqi.error.mensaje) }}</div>') |
||||
} else if (Culqi.token) { |
||||
|
||||
{% if buying_service %} |
||||
|
||||
var url = '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a=culqi_cargo_service&token_id=' + Culqi.token.id + '&service_sale_id=' + {{ buying_service.id }}; |
||||
|
||||
{% else %} |
||||
|
||||
var url = '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a=culqi_cargo&token_id=' + Culqi.token.id + '&sale_id=' + {{ sale.id }}; |
||||
|
||||
{% endif %} |
||||
|
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: url, |
||||
beforeSend: function () { |
||||
$("#confirm").html('<em class="fa fa-spinner fa-pulse fa-fw" ></em> {{ 'Loading'|get_lang }}'); |
||||
$("#confirm").prop("disabled", true); |
||||
$("#cancel").prop("disabled", true); |
||||
}, |
||||
success: function () { |
||||
window.location = "{{ _p.web_plugin }}buycourses/index.php"; |
||||
} |
||||
}) |
||||
} |
||||
|
||||
$(".culqi_checkout").unwatch('style'); |
||||
}); |
||||
|
||||
return false; |
||||
}); |
||||
|
||||
$.fn.watch = function (property, callback) { |
||||
return $(this).each(function () { |
||||
|
||||
var old_property_val = this[property]; |
||||
var timer; |
||||
|
||||
function watch() { |
||||
var self = $(".culqi_checkout"); |
||||
self = self[0]; |
||||
|
||||
if ($(self).data(property + '-watch-abort') == true) { |
||||
timer = clearInterval(timer); |
||||
$(self).data(property + '-watch-abort', null); |
||||
return; |
||||
} |
||||
if (self[property] != old_property_val) { |
||||
old_property_val = self[property]; |
||||
callback.call(self); |
||||
} |
||||
} |
||||
|
||||
timer = setInterval(watch, 700); |
||||
}); |
||||
}; |
||||
|
||||
$.fn.unwatch = function (property) { |
||||
return $(this).each(function () { |
||||
$(this).data(property + '-watch-abort', true); |
||||
}); |
||||
}; |
||||
{% endif %} |
||||
}) |
||||
</script> |
@ -0,0 +1,122 @@ |
||||
<ul class="nav nav-tabs buy-courses-sessions-tabs" role="tablist"> |
||||
<li id="buy-courses-sessions-tab" role="presentation"> |
||||
<a href="sales_report.php" aria-controls="buy-courses_sessions" |
||||
role="tab">{{ 'CourseSessionBlock'|get_lang }}</a> |
||||
</li> |
||||
{% if services_are_included %} |
||||
<li id="buy-services-tab" class="{{ showing_services ? 'active' : '' }}" role="presentation"> |
||||
<a href="service_sales_report.php" aria-controls="buy-services" |
||||
role="tab">{{ 'Services'|get_plugin_lang('BuyCoursesPlugin') }}</a> |
||||
</li> |
||||
{% endif %} |
||||
<li id="buy-subscriptions-tab" class="active" role="presentation"> |
||||
<a href="subscription_sales_report.php" aria-controls="buy-subscriptions" |
||||
role="tab">{{ 'Subscriptions'|get_plugin_lang('BuyCoursesPlugin') }}</a> |
||||
</li> |
||||
</ul> |
||||
<br /> |
||||
<br /> |
||||
{{ form }} |
||||
|
||||
<div class="table-responsive"> |
||||
<table class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr class="sale-columns"> |
||||
<th>{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'OrderStatus'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'PaymentMethod'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'CouponDiscount'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'Coupon'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'ProductType'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
<th>{{ 'Name'|get_lang }}</th> |
||||
<th>{{ 'UserName'|get_lang }}</th> |
||||
<th>{{ 'Email'|get_lang }}</th> |
||||
{% if invoicing_enable %} |
||||
<th>{{ 'Invoice'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
{% endif %} |
||||
<th width="10%">{{ 'Options'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for sale in sale_list %} |
||||
<tr class="sale-row {{ sale.id == selected_sale ? 'warning' : '' }}"> |
||||
<td class="text-center">{{ sale.reference }}</td> |
||||
<td class="text-center"> |
||||
{% if sale.status == sale_status_canceled %} |
||||
{{ 'SaleStatusCanceled'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
{% elseif sale.status == sale_status_pending %} |
||||
{{ 'SaleStatusPending'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
{% elseif sale.status == sale_status_completed %} |
||||
{{ 'SaleStatusCompleted'|get_plugin_lang('BuyCoursesPlugin') }} |
||||
{% endif %} |
||||
</td> |
||||
<td class="text-center">{{ sale.date | api_get_local_time }}</td> |
||||
<td class="text-center">{{ sale.payment_type }}</td> |
||||
<td class="text-right">{{ sale.total_price }}</td> |
||||
<td class="text-right">{{ sale.total_discount }}</td> |
||||
<td class="text-right">{{ sale.coupon_code }}</td> |
||||
<td class="text-center">{{ sale.product_type }}</td> |
||||
<td>{{ sale.product_name }}</td> |
||||
<td>{{ sale.complete_user_name }}</td> |
||||
<td>{{ sale.email }}</td> |
||||
{% if invoicing_enable %} |
||||
<td class="text-center"> |
||||
{% if sale.invoice == 1 %} |
||||
<a href="{{ _p.web_plugin ~ 'buycourses/src/invoice.php?' ~ {'invoice': sale.id, 'is_service': 0}|url_encode() }}" title="{{ 'InvoiceView'|get_plugin_lang('BuyCoursesPlugin') }}" > |
||||
<img src="{{ _p.web_img }}/icons/32/default.png" alt="{{ 'InvoiceView'|get_plugin_lang('BuyCoursesPlugin') }}" /> |
||||
<br/>{{ sale.num_invoice }} |
||||
</a> |
||||
{% endif %} |
||||
</td> |
||||
{% endif %} |
||||
<td class="text-center"> |
||||
{% if sale.status == sale_status_pending %} |
||||
<div class="btn-group btn-group-xs" role="group" aria-label="..."> |
||||
<a title="{{ 'SubscribeUser'|get_plugin_lang('BuyCoursesPlugin') }}" href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'confirm'}|url_encode() }}" |
||||
class="btn btn-default"> |
||||
<img src="{{ 'user_subscribe_session.png' | icon(22) }}" width="22" height="22 alt="{{ 'SubscribeUser'|get_plugin_lang('BuyCoursesPlugin') }}"> |
||||
</a> |
||||
<a title="{{ 'DeleteOrder'|get_plugin_lang('BuyCoursesPlugin') }}" href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'cancel'}|url_encode() }}" |
||||
class="btn btn-default"> |
||||
<img src="{{ 'delete.png' | icon(22) }}" width="22" height="22 alt="{{ 'DeleteOrder'|get_plugin_lang('BuyCoursesPlugin') }}"> |
||||
</a> |
||||
</div> |
||||
{% endif %} |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
<script> |
||||
$(function () { |
||||
$('[name="filter_type"]').on('change', function () { |
||||
var self = $(this); |
||||
|
||||
if (self.val() === '0') { |
||||
$('#report-by-user').hide(); |
||||
$('#report-by-status').show(); |
||||
$('#report-by-date').hide(); |
||||
$('#report-by-email').hide(); |
||||
} else if (self.val() === '1') { |
||||
$('#report-by-status').hide(); |
||||
$('#report-by-user').show(); |
||||
$('#report-by-date').hide(); |
||||
$('#report-by-email').hide(); |
||||
} else if (self.val() === '2') { |
||||
$('#report-by-status').hide(); |
||||
$('#report-by-user').hide(); |
||||
$('#report-by-date').show(); |
||||
$('#report-by-email').hide(); |
||||
} else if (self.val() === '3') { |
||||
$('#report-by-status').hide(); |
||||
$('#report-by-user').hide(); |
||||
$('#report-by-date').hide(); |
||||
$('#report-by-email').show(); |
||||
} |
||||
}); |
||||
}); |
||||
</script> |
@ -0,0 +1,152 @@ |
||||
{% if sessions_are_included %} |
||||
<ul class="nav nav-tabs buy-courses-tabs" role="tablist"> |
||||
<li role="presentation" class="{{ courses ? 'active' : '' }}"> |
||||
<a href="{{ _p.web_plugin ~ 'buycourses/src/subscriptions_courses.php' }}" > |
||||
{{ 'Courses'|get_lang }} |
||||
</a> |
||||
</li> |
||||
<li role="presentation" class="{{ sessions ? 'active' : '' }}"> |
||||
<a href="{{ _p.web_plugin ~ 'buycourses/src/subscriptions_sessions.php' }}" > |
||||
{{ 'Sessions'|get_lang }}</a> |
||||
</li> |
||||
</ul> |
||||
{% endif %} |
||||
|
||||
<div class="tab-content"> |
||||
<div role="tabpanel" class="tab-pane {{ courses ? 'fade in active' : '' }} " id="courses"> |
||||
<div class="table-responsive"> |
||||
<table id="courses_table" class="table table-striped table-hover"> |
||||
<thead> |
||||
<tr> |
||||
<th>{{ 'Title'|get_lang }}</th> |
||||
<th class="text-center">{{ 'OfficialCode'|get_lang }}</th> |
||||
<th class="text-center">{{ 'HasSubscriptions'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
{% if tax_enable and (tax_applies_to == 1 or tax_applies_to == 2) %} |
||||
<th class="text-center" width="100">{{ tax_name }}</th> |
||||
{% endif %} |
||||
<th class="text-right">{{ 'Options'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for item in courses %} |
||||
<tr data-item="{{ item.id }}" data-type="course"> |
||||
<td> |
||||
{% if item.visibility == 0 %} |
||||
<img src="{{ 'bullet_red.png'|icon() }}" alt="{{ 'CourseVisibilityClosed'|get_lang }}" |
||||
title="{{ 'CourseVisibilityClosed'|get_lang }}"> |
||||
{% elseif item.visibility == 1 %} |
||||
<img src="{{ 'bullet_orange.png'|icon() }}" alt="{{ 'Private'|get_lang }}" |
||||
title="{{ 'Private'|get_lang }}"> |
||||
{% elseif item.visibility == 2 %} |
||||
<img src="{{ 'bullet_green.png'|icon() }}" alt="{{ 'OpenToThePlatform'|get_lang }}" |
||||
title="{{ 'OpenToThePlatform'|get_lang }}"> |
||||
{% elseif item.visibility == 3 %} |
||||
<img src="{{ 'bullet_blue.png'|icon() }}" alt="{{ 'OpenToTheWorld'|get_lang }}" |
||||
title="{{ 'OpenToTheWorld'|get_lang }}"> |
||||
{% elseif item.visibility == 4 %} |
||||
<img src="{{ 'bullet_grey.png'|icon() }}" alt="{{ 'CourseVisibilityHidden'|get_lang }}" |
||||
title="{{ 'CourseVisibilityHidden'|get_lang }}"> |
||||
{% endif %} |
||||
<a href="{{ _p.web_course ~ item.path ~ item.code~ '/index.php' }}"> |
||||
{{ item.title }} |
||||
</a> |
||||
<span class="label label-info">{{ item.code }}</span> |
||||
</td> |
||||
<td class="text-center"> |
||||
{{ item.code }} |
||||
</td> |
||||
<td class="text-center"> |
||||
{% if item.buyCourseData %} |
||||
<em class="fa fa-fw fa-check-square-o"></em> |
||||
{% else %} |
||||
<em class="fa fa-fw fa-square-o"></em> |
||||
{% endif %} |
||||
</td> |
||||
{% if tax_enable and (tax_applies_to == 1 or tax_applies_to == 2) %} |
||||
<td class="text-center"> |
||||
{{ item.buyCourseData.tax_perc_show }} % |
||||
</td> |
||||
{% endif %} |
||||
<td class="text-right"> |
||||
{% if item.buyCourseData %} |
||||
<a href="{{ _p.web_plugin ~ 'buycourses/src/configure_subscription.php?' ~ {'id': item.id, 'type':product_type_course}|url_encode() }}" |
||||
class="btn btn-info btn-sm"> |
||||
<em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }} |
||||
</a> |
||||
{% else %} |
||||
<a href="{{ _p.web_plugin ~ 'buycourses/src/subscription_add.php?' ~ {'id': item.id, 'type':product_type_course}|url_encode() }}" |
||||
class="btn btn-info btn-sm"> |
||||
<em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }} |
||||
</a> |
||||
{% endif %} |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
{{ course_pagination }} |
||||
</div> |
||||
|
||||
{% if sessions_are_included %} |
||||
<div role="tabpanel" class="tab-pane {{ sessions ? 'fade in active' : '' }} " id="sessions"> |
||||
<div class="table-responsive"> |
||||
<table id="session_table" class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th>{{ 'Title'|get_lang }}</th> |
||||
<th class="text-center">{{ 'StartDate'|get_lang }}</th> |
||||
<th class="text-center">{{ 'EndDate'|get_lang }}</th> |
||||
<th class="text-center">{{ 'HasSubscriptions'|get_plugin_lang('BuyCoursesPlugin') }}</th> |
||||
{% if tax_enable and (tax_applies_to == 1 or tax_applies_to == 3) %} |
||||
<th class="text-center" width="100">{{ tax_name }}</th> |
||||
{% endif %} |
||||
<th class="text-right">{{ 'Options'|get_lang }}</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for item in sessions %} |
||||
<tr data-item="{{ item.id }}" data-type="session"> |
||||
<td> |
||||
<a href="{{ _p.web_main ~ 'session/index.php?' ~ {'session_id': item.id}|url_encode() }}">{{ item.name }}</a> |
||||
</td> |
||||
<td class="text-center"> |
||||
{{ item.displayStartDate | api_convert_and_format_date(6)}} |
||||
</td> |
||||
<td class="text-center"> |
||||
{{ item.displayEndDate |api_convert_and_format_date(6)}} |
||||
</td> |
||||
<td class="text-center"> |
||||
{% if item.buyCourseData %} |
||||
<em class="fa fa-fw fa-check-square-o"></em> |
||||
{% else %} |
||||
<em class="fa fa-fw fa-square-o"></em> |
||||
{% endif %} |
||||
</td> |
||||
{% if tax_enable and (tax_applies_to == 1 or tax_applies_to == 3) %} |
||||
<td class="text-center"> |
||||
{{ item.buyCourseData.tax_perc_show }} % |
||||
</td> |
||||
{% endif %} |
||||
<td class="text-right"> |
||||
{% if item.buyCourseData %} |
||||
<a href="{{ _p.web_plugin ~ 'buycourses/src/configure_subscription.php?' ~ {'id': item.id, 'type':product_type_session}|url_encode() }}" |
||||
class="btn btn-info btn-sm"> |
||||
<em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }} |
||||
</a> |
||||
{% else %} |
||||
<a href="{{ _p.web_plugin ~ 'buycourses/src/subscription_add.php?' ~ {'id': item.id, 'type':product_type_session}|url_encode() }}" |
||||
class="btn btn-info btn-sm"> |
||||
<em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }} |
||||
</a> |
||||
{% endif %} |
||||
</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
{{ session_pagination }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |