Browse Source

Fix plugins to work into a chamilov2

jmontoyaa 8 years ago
parent
commit
88ad270512
64 changed files with 1543 additions and 1566 deletions
  1. 1 1
      plugin/azure_active_directory/view/block.tpl
  2. 2 3
      plugin/before_login/index.php
  3. 12 13
      plugin/before_login/plugin.php
  4. 1 3
      plugin/before_login/readme.md
  5. 3 5
      plugin/before_login/template.tpl
  6. 4 1
      plugin/buycourses/database.php
  7. 0 0
      plugin/buycourses/public/css/style.css
  8. 0 0
      plugin/buycourses/public/img/128/backlogs.png
  9. 0 0
      plugin/buycourses/public/img/128/buycourses.png
  10. 0 0
      plugin/buycourses/public/img/128/paymentsettings.png
  11. 0 0
      plugin/buycourses/public/img/128/settings.png
  12. 0 0
      plugin/buycourses/public/img/32/backlogs.png
  13. 0 0
      plugin/buycourses/public/img/32/buycourses.png
  14. 0 0
      plugin/buycourses/public/img/32/paymentsettings.png
  15. 0 0
      plugin/buycourses/public/img/32/settings.png
  16. 0 0
      plugin/buycourses/public/img/42/backlogs.png
  17. 0 0
      plugin/buycourses/public/img/42/buycourses.png
  18. 0 0
      plugin/buycourses/public/img/42/paymentsettings.png
  19. 0 0
      plugin/buycourses/public/img/42/settings.png
  20. 0 0
      plugin/buycourses/public/img/64/backlogs.png
  21. 0 0
      plugin/buycourses/public/img/64/buycourses.png
  22. 0 0
      plugin/buycourses/public/img/64/paymentsettings.png
  23. 0 0
      plugin/buycourses/public/img/64/settings.png
  24. 0 0
      plugin/buycourses/public/js/commissions.js
  25. 3 5
      plugin/buycourses/src/configuration.php
  26. 12 14
      plugin/buycourses/src/configure_course.php
  27. 6 4
      plugin/buycourses/src/course_catalog.php
  28. 3 4
      plugin/buycourses/src/course_panel.php
  29. 6 8
      plugin/buycourses/src/index.buycourses.php
  30. 4 4
      plugin/buycourses/src/paymentsetup.php
  31. 2 4
      plugin/buycourses/src/payout_panel.php
  32. 3 3
      plugin/buycourses/src/payout_report.php
  33. 3 8
      plugin/buycourses/src/paypal_payout.php
  34. 4 4
      plugin/buycourses/src/process.php
  35. 4 5
      plugin/buycourses/src/process_confirm.php
  36. 6 8
      plugin/buycourses/src/sales_report.php
  37. 3 6
      plugin/buycourses/src/service_catalog.php
  38. 4 2
      plugin/buycourses/src/service_information.php
  39. 3 3
      plugin/buycourses/src/service_process.php
  40. 2 2
      plugin/buycourses/src/service_process_confirm.php
  41. 7 12
      plugin/buycourses/src/service_sales_report.php
  42. 1 1
      plugin/buycourses/src/service_success.php
  43. 3 1
      plugin/buycourses/src/session_catalog.php
  44. 2 4
      plugin/buycourses/src/session_panel.php
  45. 1 1
      plugin/buycourses/src/success.php
  46. 164 164
      plugin/buycourses/view/catalog.html.twig
  47. 198 198
      plugin/buycourses/view/configuration.html.twig
  48. 40 43
      plugin/buycourses/view/course_panel.html.twig
  49. 76 75
      plugin/buycourses/view/index.html.twig
  50. 2 0
      plugin/buycourses/view/message_transfer.html.twig
  51. 93 94
      plugin/buycourses/view/paymentsetup.html.twig
  52. 46 48
      plugin/buycourses/view/payout_panel.html.twig
  53. 95 94
      plugin/buycourses/view/payout_report.html.twig
  54. 121 121
      plugin/buycourses/view/paypal_payout.html.twig
  55. 93 91
      plugin/buycourses/view/process.html.twig
  56. 113 111
      plugin/buycourses/view/process_confirm.html.twig
  57. 81 80
      plugin/buycourses/view/sales_report.html.twig
  58. 79 80
      plugin/buycourses/view/service_information.html.twig
  59. 97 98
      plugin/buycourses/view/service_sales_report.html.twig
  60. 40 43
      plugin/buycourses/view/session_panel.html.twig
  61. 66 64
      plugin/buycourses/view/success.html.twig
  62. 0 11
      plugin/customfooter/install.php
  63. 23 11
      plugin/customfooter/lib/customfooter_plugin.class.php
  64. 11 11
      plugin/show_user_info/template.tpl

+ 1 - 1
plugin/azure_active_directory/view/block.tpl

@@ -1,5 +1,5 @@
 <div id="azure-active-directory-login">
-    {% if _u.logged %}
+    {% if is_granted('IS_AUTHENTICATED_FULLY') %}
         {# <a href="{{ azure_active_directory.signout_url }}" class="btn btn-primary">{{ 'Logout'|get_lang }}</a> #}
     {% else %}
         {% if not azure_active_directory.block_title is empty %}

+ 2 - 3
plugin/before_login/index.php

@@ -22,13 +22,12 @@ if (api_is_anonymous()) {
     // Only available for the selected language.
     $languageToActivate = api_get_plugin_setting('before_login', 'language');
 
-    if (api_get_interface_language() != $languageToActivate) {
+    if (api_get_language_isocode() != $languageToActivate) {
         return null;
     }
 
     $option1 = api_get_plugin_setting('before_login', 'option1');
     $urlOption1 = api_get_plugin_setting('before_login', 'option1_url');
-
     $option2 = api_get_plugin_setting('before_login', 'option2');
     $urlOption2 = api_get_plugin_setting('before_login', 'option2_url');
 
@@ -62,7 +61,7 @@ if (api_is_anonymous()) {
         $form2->addElement('html', $option2);
         $form2->addElement('checkbox', 'right', null, get_lang('Yes'));
         $form2->addElement('button', 'submit', get_lang('Send'));
-        $formHtml2 = $form2->return_form();
+        $formHtml2 = $form2->returnForm();
 
         if ($form2->validate()) {
             $result = $form2->getSubmitValues();

+ 12 - 13
plugin/before_login/plugin.php

@@ -10,17 +10,17 @@
 /* Plugin config */
 
 // The plugin title.
-$plugin_info['title']       = 'Show HTML before login';
+$plugin_info['title'] = 'Show HTML before login';
 // The comments that go with the plugin.
-$plugin_info['comment']     = "Show a content before loading the login page.";
+$plugin_info['comment'] = "Show a content before loading the login page.";
 // The plugin version.
-$plugin_info['version']     = '1.0';
+$plugin_info['version'] = '1.0';
 // The plugin author.
-$plugin_info['author']      = 'Julio Montoya';
+$plugin_info['author'] = 'Julio Montoya';
 
 // The plugin configuration.
 $form = new FormValidator('form');
-$form->addElement('select', 'language', get_lang('Language'), api_get_languages_to_array());
+$form->addSelectLanguage('language', get_lang('Language'));
 
 $form->addElement('header', 'Option 1');
 $form->addElement('textarea', 'option1', get_lang('Description'), array('rows' => 10, 'class' => 'span6'));
@@ -34,16 +34,15 @@ $form->addElement('button', 'submit_button', get_lang('Save'));
 // Get default value for form
 
 $defaults = array();
-$defaults['language'] = api_get_plugin_setting('before_login', 'language');
-$defaults['option1'] = api_get_plugin_setting('before_login', 'option1');
-$defaults['option2'] = api_get_plugin_setting('before_login', 'option2');
+$defaults['language'] = api_get_plugin_setting('before_login', 'before_login_language');
+$defaults['option1'] = api_get_plugin_setting('before_login', 'before_login_option1');
+$defaults['option2'] = api_get_plugin_setting('before_login', 'before_login_option2');
+$defaults['option1_url'] = api_get_plugin_setting('before_login', 'before_login_option1_url');
+$defaults['option2_url'] = api_get_plugin_setting('before_login', 'before_login_option2_url');
 
-$defaults['option1_url'] = api_get_plugin_setting('before_login', 'option1_url');
-$defaults['option2_url'] = api_get_plugin_setting('before_login', 'option2_url');
-
-$plugin_info['templates']   = array('template.tpl');
+$plugin_info['templates'] = array('template.tpl');
 if (file_exists(__DIR__.'/custom.template.tpl')) {
-    $plugin_info['templates']   = array( 'custom.template.tpl');
+    $plugin_info['templates'] = array( 'custom.template.tpl');
 }
 $form->setDefaults($defaults);
 

+ 1 - 3
plugin/before_login/readme.txt → plugin/before_login/readme.md

@@ -1,8 +1,6 @@
-README
-<br/><br/>
 This plugins shows page before showing the login page.
 This is useful if you want a question before a user has the opportunity to login.
-<br/>
+
 Example:
 You're old enough to enter this site? If you accept the "option 1" then
 you can enter to the campus (the login will appeared).

+ 3 - 5
plugin/before_login/template.tpl

@@ -1,14 +1,12 @@
-{% if before_login.form_option1 %}
+{% if before_login.plugin_info.settings.before_login_option1 %}
     <div class="span12">
         <div class="row">
             <div class="span6">
-                {{ before_login.form_option1 }}
+                {{ before_login.plugin_info.settings.before_login_option1 }}
             </div>
             <div class="span6">
-                {{ before_login.form_option2 }}
+                {{ before_login.plugin_info.settings.before_login_option2 }}
             </div>
         </div>
     </div>
-{% else %}
-
 {% endif %}

+ 4 - 1
plugin/buycourses/database.php

@@ -1,10 +1,12 @@
 <?php
 /* For license terms, see /license.txt */
+
 /**
  * Plugin database installation script. Can only be executed if included
  * inside another script loading global.inc.php
  * @package chamilo.plugin.buycourses
  */
+
 /**
  * Check if script can be called
  */
@@ -588,7 +590,8 @@ foreach ($currencies as $currency) {
         [
             'country_code' => $currency[0],
             'country_name' => $currency[1],
-            'iso_code' => $currency[2]
+            'iso_code' => $currency[2],
+            'status' => 0
         ]
     );
 }

+ 0 - 0
plugin/buycourses/resources/css/style.css → plugin/buycourses/public/css/style.css


+ 0 - 0
plugin/buycourses/resources/img/128/backlogs.png → plugin/buycourses/public/img/128/backlogs.png


+ 0 - 0
plugin/buycourses/resources/img/128/buycourses.png → plugin/buycourses/public/img/128/buycourses.png


+ 0 - 0
plugin/buycourses/resources/img/128/paymentsettings.png → plugin/buycourses/public/img/128/paymentsettings.png


+ 0 - 0
plugin/buycourses/resources/img/128/settings.png → plugin/buycourses/public/img/128/settings.png


+ 0 - 0
plugin/buycourses/resources/img/32/backlogs.png → plugin/buycourses/public/img/32/backlogs.png


+ 0 - 0
plugin/buycourses/resources/img/32/buycourses.png → plugin/buycourses/public/img/32/buycourses.png


+ 0 - 0
plugin/buycourses/resources/img/32/paymentsettings.png → plugin/buycourses/public/img/32/paymentsettings.png


+ 0 - 0
plugin/buycourses/resources/img/32/settings.png → plugin/buycourses/public/img/32/settings.png


+ 0 - 0
plugin/buycourses/resources/img/42/backlogs.png → plugin/buycourses/public/img/42/backlogs.png


+ 0 - 0
plugin/buycourses/resources/img/42/buycourses.png → plugin/buycourses/public/img/42/buycourses.png


+ 0 - 0
plugin/buycourses/resources/img/42/paymentsettings.png → plugin/buycourses/public/img/42/paymentsettings.png


+ 0 - 0
plugin/buycourses/resources/img/42/settings.png → plugin/buycourses/public/img/42/settings.png


+ 0 - 0
plugin/buycourses/resources/img/64/backlogs.png → plugin/buycourses/public/img/64/backlogs.png


+ 0 - 0
plugin/buycourses/resources/img/64/buycourses.png → plugin/buycourses/public/img/64/buycourses.png


+ 0 - 0
plugin/buycourses/resources/img/64/paymentsettings.png → plugin/buycourses/public/img/64/paymentsettings.png


+ 0 - 0
plugin/buycourses/resources/img/64/settings.png → plugin/buycourses/public/img/64/settings.png


+ 0 - 0
plugin/buycourses/resources/js/commissions.js → plugin/buycourses/public/js/commissions.js


+ 3 - 5
plugin/buycourses/src/configuration.php

@@ -4,9 +4,7 @@
  * Configuration script for the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
+
 $cidReset = true;
 
 require_once __DIR__.'/../../../main/inc/global.inc.php';
@@ -28,7 +26,7 @@ $interbreadcrumb[] = [
 ];
 
 $templateName = $plugin->get_lang('AvailableCourses');
-
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
 $tpl = new Template($templateName);
 
 $tpl->assign('product_type_course', BuyCoursesPlugin::PRODUCT_TYPE_COURSE);
@@ -49,7 +47,7 @@ if ($includeServices) {
     $tpl->assign('services', $services);
 }
 
-$content = $tpl->fetch('buycourses/view/configuration.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/configuration.tpl');
 
 $tpl->assign('header', $templateName);
 $tpl->assign('content', $content);

+ 12 - 14
plugin/buycourses/src/configure_course.php

@@ -21,12 +21,10 @@ $plugin = BuyCoursesPlugin::create();
 
 $commissionsEnable = $plugin->get('commissions_enable');
 
-if ($commissionsEnable == "true") {
-    
-    $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/js/commissions.js"></script>';
+if ($commissionsEnable == 'true') {
+    $htmlHeadXtra[] = api_get_js('plugins/buycourses/js/commissions.js');
     $defaultCommissions = [];
-    $commissions = "";
-    
+    $commissions = '';
 }
 
 $includeSession = $plugin->get('include_sessions') === 'true';
@@ -71,10 +69,10 @@ if ($editingCourse) {
 
     if (!empty($currentBeneficiaries)) {
         $defaultBeneficiaries = array_column($currentBeneficiaries, 'user_id');
-        
+
         if ($commissionsEnable === 'true') {
             $defaultCommissions = array_column($currentBeneficiaries, 'commissions');
-        
+
             foreach ($defaultCommissions as $defaultCommission) {
                 $commissions .= $defaultCommission.',';
             }
@@ -137,10 +135,10 @@ if ($editingCourse) {
 
     if (!empty($currentBeneficiaries)) {
         $defaultBeneficiaries = array_column($currentBeneficiaries, 'user_id');
-        
+
         if ($commissionsEnable == "true") {
             $defaultCommissions = array_column($currentBeneficiaries, 'commissions');
-        
+
             foreach ($defaultCommissions as $defaultCommission) {
                 $commissions .= $defaultCommission.',';
             }
@@ -223,9 +221,9 @@ if ($editingCourse) {
 }
 
 if ($commissionsEnable === 'true') {
-    
+
     $platformCommission = $plugin->getPlatformCommission();
-    
+
     $form->addHtml( ''
             . '<div class="form-group">'
                 . '<label for="sliders" class="col-sm-2 control-label">'
@@ -241,9 +239,9 @@ if ($commissionsEnable === 'true') {
                 . '</div>'
             . '</div>'
     );
-    
+
     $form->addHidden('commissions', '');
-    
+
 }
 
 $form->addHidden('t', null);
@@ -285,7 +283,7 @@ if ($form->validate()) {
                 $commissions = array_fill(0, count($usersId), 0);
                 $beneficiaries = array_combine($usersId, $commissions);
             }
-            
+
             $plugin->registerItemBeneficiaries($productItem['id'], $beneficiaries);
         }
     } else {

+ 6 - 4
plugin/buycourses/src/course_catalog.php

@@ -3,9 +3,7 @@
  * List of courses
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
+
 $cidReset = true;
 
 require_once __DIR__.'/../../../main/inc/global.inc.php';
@@ -63,6 +61,8 @@ if (api_is_platform_admin()) {
     ];
 }
 
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
+
 $templateName = $plugin->get_lang('CourseListOnSale');
 $tpl = new Template($templateName);
 $tpl->assign('search_filter_form', $form->returnForm());
@@ -70,8 +70,10 @@ $tpl->assign('showing_courses', true);
 $tpl->assign('courses', $courseList);
 $tpl->assign('sessions_are_included', $includeSessions);
 $tpl->assign('services_are_included', $includeServices);
+$tpl->assign('showing_sessions', false);
+$tpl->assign('showing_services', false);
 
-$content = $tpl->fetch('buycourses/view/catalog.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/catalog.tpl');
 
 $tpl->assign('header', $templateName);
 $tpl->assign('content', $content);

+ 3 - 4
plugin/buycourses/src/course_panel.php

@@ -3,9 +3,6 @@
  * User Panel
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
 
 $cidReset = true;
 
@@ -47,13 +44,15 @@ $toolbar = Display::toolbarButton(
     ['title' => $plugin->get_lang('CourseListOnSale')]
 );
 
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
+
 $templateName = get_lang('TabsDashboard');
 $tpl = new Template($templateName);
 $tpl->assign('showing_courses', true);
 $tpl->assign('sessions_are_included', $includeSessions);
 $tpl->assign('sale_list', $saleList);
 
-$content = $tpl->fetch('buycourses/view/course_panel.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/course_panel.tpl');
 
 $tpl->assign('actions', $toolbar);
 $tpl->assign('header', $templateName);

+ 6 - 8
plugin/buycourses/src/index.buycourses.php

@@ -1,27 +1,25 @@
 <?php
 /* For license terms, see /license.txt */
+
 /**
  * Index of the Buy Courses plugin courses list
  * @package chamilo.plugin.buycourses
  */
-/**
- *
- */
+
 $plugin = BuyCoursesPlugin::create();
 $guess_enable = $plugin->get('unregistered_users_enable');
+$userInfo = api_get_user_info();
 
-if ($guess_enable == "true" || isset($_SESSION['_user'])) {
+if ($guess_enable == 'true' || isset($userInfo)) {
     // If the user is NOT an administrator, redirect it to course/session buy list
     if (!api_is_platform_admin()) {
         header('Location: src/course_panel.php');
         exit;
     }
 
+    $htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
     $tpl = new Template();
-
-    $content = $tpl->fetch('buycourses/view/index.tpl');
-
+    $content = $tpl->fetch('@plugin/buycourses/view/index.html.twig');
     $tpl->assign('content', $content);
-
     $tpl->display_one_col_template();
 }

+ 4 - 4
plugin/buycourses/src/paymentsetup.php

@@ -4,9 +4,7 @@
  * Configuration page for payment methods for the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
+
 $cidReset = true;
 
 require_once __DIR__.'/../../../main/inc/global.inc.php';
@@ -190,6 +188,8 @@ $interbreadcrumb[] = [
 ];
 
 $templateName = $plugin->get_lang('PaymentsConfiguration');
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
+$htmlHeadXtra[] = api_get_js('plugins/buycourses/css/style.css');
 $tpl = new Template($templateName);
 $tpl->assign('header', $templateName);
 $tpl->assign('curency_form', $currencyForm->returnForm());
@@ -201,7 +201,7 @@ $tpl->assign('paypal_enable', $paypalEnable);
 $tpl->assign('commissions_enable', $commissionsEnable);
 $tpl->assign('transfer_enable', $transferEnable);
 
-$content = $tpl->fetch('buycourses/view/paymentsetup.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/paymentsetup.tpl');
 
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();

+ 2 - 4
plugin/buycourses/src/payout_panel.php

@@ -3,9 +3,6 @@
  * User Panel
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
 
 $cidReset = true;
 
@@ -44,12 +41,13 @@ $toolbar = Display::toolbarButton(
 );
 
 $templateName = get_lang('TabsDashboard');
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
 $tpl = new Template($templateName);
 $tpl->assign('showing_courses', true);
 $tpl->assign('sessions_are_included', $includeSessions);
 $tpl->assign('payout_list', $payoutList);
 
-$content = $tpl->fetch('buycourses/view/payout_panel.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/payout_panel.tpl');
 
 $tpl->assign('actions', $toolbar);
 $tpl->assign('header', $templateName);

+ 3 - 3
plugin/buycourses/src/payout_report.php

@@ -5,12 +5,12 @@
  * List of pending payments of the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-//Initialization
+
 $cidReset = true;
 
 require_once __DIR__.'/../../../main/inc/global.inc.php';
 
-$htmlHeadXtra[] = '<link rel="stylesheet" href="../resources/css/style.css" type="text/css">';
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
 $htmlHeadXtra[] = '<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>';
 
 api_protect_admin_script(true);
@@ -84,7 +84,7 @@ $template->assign('form', $form->returnForm());
 $template->assign('payout_list', $payoutList);
 $template->assign('selected_status', $selectedStatus);
 
-$content = $template->fetch('buycourses/view/payout_report.tpl');
+$content = $template->fetch('@plugin/buycourses/view/payout_report.tpl');
 
 $template->assign('header', $templateName);
 $template->assign('content', $content);

+ 3 - 8
plugin/buycourses/src/paypal_payout.php

@@ -5,15 +5,10 @@
  * List page for Paypal Payout for the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
-
 $cidReset = true;
-
 require_once __DIR__.'/../../../main/inc/global.inc.php';
 
-$htmlHeadXtra[] = '<link rel="stylesheet" href="../resources/css/style.css" type="text/css">';
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
 
 api_protect_admin_script(true);
 
@@ -22,7 +17,7 @@ $plugin = BuyCoursesPlugin::create();
 $paypalEnable = $plugin->get('paypal_enable');
 $commissionsEnable = $plugin->get('commissions_enable');
 
-if ($paypalEnable !== "true" && $commissionsEnable !== "true") {
+if ($paypalEnable !== 'true' && $commissionsEnable !== 'true') {
     api_not_allowed(true);
 }
 
@@ -48,7 +43,7 @@ $template = new Template($templateName);
 
 $template->assign('payout_list', $payoutList);
 
-$content = $template->fetch('buycourses/view/paypal_payout.tpl');
+$content = $template->fetch('@plugin/buycourses/view/paypal_payout.tpl');
 
 $template->assign('header', $templateName);
 $template->assign('content', $content);

+ 4 - 4
plugin/buycourses/src/process.php

@@ -47,7 +47,7 @@ $form = new FormValidator('confirm_sale');
 
 if ($form->validate()) {
     $formValues = $form->getSubmitValues();
-    
+
     if (!$formValues['payment_type']) {
         Display::addFlash(
             Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
@@ -55,12 +55,12 @@ if ($form->validate()) {
         header('Location:' . api_get_self() . '?' . $queryString);
         exit;
     }
-    
+
     $saleId = $plugin->registerSale($item['id'], $formValues['payment_type']);
 
     if ($saleId !== false) {
         $_SESSION['bc_sale_id'] = $saleId;
-        header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/process_confirm.php');  
+        header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/process_confirm.php');
     }
 
     exit;
@@ -109,7 +109,7 @@ if ($buyingCourse) {
     $tpl->assign('session', $sessionInfo);
 }
 
-$content = $tpl->fetch('buycourses/view/process.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/process.tpl');
 
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();

+ 4 - 5
plugin/buycourses/src/process_confirm.php

@@ -4,11 +4,10 @@
  * Process purchase confirmation script for the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-/**
- * Init
- */
 require_once '../config.php';
 
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
+
 $plugin = BuyCoursesPlugin::create();
 
 $saleId = $_SESSION['bc_sale_id'];
@@ -114,7 +113,7 @@ switch ($sale['payment_type']) {
                 $userInfo['complete_name'],
                 $userInfo['email'],
                 $plugin->get_lang('bc_subject'),
-                $messageTemplate->fetch('buycourses/view/message_transfer.tpl')
+                $messageTemplate->fetch('@plugin/buycourses/view/message_transfer.tpl')
             );
 
             Display::addFlash(
@@ -154,7 +153,7 @@ switch ($sale['payment_type']) {
         $template->assign('transfer_accounts', $transferAccounts);
         $template->assign('form', $form->returnForm());
 
-        $content = $template->fetch('buycourses/view/process_confirm.tpl');
+        $content = $template->fetch('@plugin/buycourses/view/process_confirm.tpl');
 
         $template->assign('content', $content);
         $template->display_one_col_template();

+ 6 - 8
plugin/buycourses/src/sales_report.php

@@ -5,7 +5,7 @@
  * List of pending payments of the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-//Initialization
+
 $cidReset = true;
 
 require_once '../config.php';
@@ -136,7 +136,7 @@ foreach ($sales as $sale) {
 $interbreadcrumb[] = ['url' => '../index.php', 'name' => $plugin->get_lang('plugin_title')];
 
 $templateName = $plugin->get_lang('SalesReport');
-
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
 $template = new Template($templateName);
 
 $toolbar = '';
@@ -150,13 +150,11 @@ if ($paypalEnable == "true" && $commissionsEnable == "true") {
         'primary',
         ['title' => $plugin->get_lang('PaypalPayoutCommissions')]
     );
-    
+
     $template->assign('actions', $toolbar);
-    
 }
 
 if ($commissionsEnable == "true") {
-
     $toolbar .= Display::toolbarButton(
         $plugin->get_lang('PayoutReport'),
         api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/payout_report.php',
@@ -164,9 +162,9 @@ if ($commissionsEnable == "true") {
         'info',
         ['title' => $plugin->get_lang('PayoutReport')]
     );
-    
+
     $template->assign('actions', $toolbar);
-    
+
 }
 $template->assign('form', $form->returnForm());
 $template->assign('selected_sale', $selectedSale);
@@ -177,7 +175,7 @@ $template->assign('sale_status_canceled', BuyCoursesPlugin::SALE_STATUS_CANCELED
 $template->assign('sale_status_pending', BuyCoursesPlugin::SALE_STATUS_PENDING);
 $template->assign('sale_status_completed', BuyCoursesPlugin::SALE_STATUS_COMPLETED);
 
-$content = $template->fetch('buycourses/view/sales_report.tpl');
+$content = $template->fetch('@plugin/buycourses/view/sales_report.tpl');
 
 $template->assign('header', $templateName);
 $template->assign('content', $content);

+ 3 - 6
plugin/buycourses/src/service_catalog.php

@@ -3,14 +3,9 @@
  * List of services
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
 
 $cidReset = true;
 
-require_once '../../../main/inc/global.inc.php';
-
 $plugin = BuyCoursesPlugin::create();
 $includeSessions = $plugin->get('include_sessions') === 'true';
 $includeServices = $plugin->get('include_services') === 'true';
@@ -81,8 +76,10 @@ $tpl->assign('showing_services', true);
 $tpl->assign('services', $serviceList);
 $tpl->assign('sessions_are_included', $includeSessions);
 $tpl->assign('services_are_included', $includeServices);
+$tpl->assign('showing_sessions', false);
+$tpl->assign('showing_courses', false);
 
-$content = $tpl->fetch('buycourses/view/catalog.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/catalog.tpl');
 
 $tpl->assign('header', $templateName);
 $tpl->assign('content', $content);

+ 4 - 2
plugin/buycourses/src/service_information.php

@@ -1,6 +1,6 @@
 <?php
-
 /* For licensing terms, see /license.txt */
+
 /**
  * Service information page
  * Show information about a service (for custom purposes)
@@ -28,12 +28,14 @@ if (!$service['id']) {
     api_not_allowed(true);
 }
 
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
+
 $template = new Template(false);
 $template->assign('pageUrl', api_get_path(WEB_PATH) . "service/{$serviceId}/information/");
 $template->assign('service', $service);
 $template->assign('essence', Essence\Essence::instance());
 
-$content = $template->fetch('buycourses/view/service_information.tpl');
+$content = $template->fetch('@plugin/buycourses/view/service_information.tpl');
 
 $template->assign('content', $content);
 $template->display_one_col_template();

+ 3 - 3
plugin/buycourses/src/service_process.php

@@ -46,7 +46,7 @@ $form = new FormValidator('confirm_sale');
 
 if ($form->validate()) {
     $formValues = $form->getSubmitValues();
-    
+
     if (!$formValues['payment_type']) {
         Display::addFlash(
             Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
@@ -62,7 +62,7 @@ if ($form->validate()) {
         header('Location:' . api_get_self() . '?' . $queryString);
         exit;
     }
-    
+
     $serviceSaleId = $plugin->registerServiceSale($serviceId, $formValues['payment_type'], $formValues['info_select'], $formValues['enable_trial']);
 
     if ($serviceSaleId !== false) {
@@ -132,7 +132,7 @@ $tpl->assign('user', api_get_user_info());
 $tpl->assign('form', $form->returnForm());
 
 
-$content = $tpl->fetch('buycourses/view/process.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/process.tpl');
 
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();

+ 2 - 2
plugin/buycourses/src/service_process_confirm.php

@@ -134,7 +134,7 @@ switch ($serviceSale['payment_type']) {
                 $buyer['complete_name'],
                 $buyer['email'],
                 $plugin->get_lang('bc_subject'),
-                $messageTemplate->fetch('buycourses/view/message_transfer.tpl')
+                $messageTemplate->fetch('@plugin/buycourses/view/message_transfer.tpl')
             );
 
             Display::addFlash(
@@ -167,7 +167,7 @@ switch ($serviceSale['payment_type']) {
         $template->assign('transfer_accounts', $transferAccounts);
         $template->assign('form', $form->returnForm());
 
-        $content = $template->fetch('buycourses/view/process_confirm.tpl');
+        $content = $template->fetch('@plugin/buycourses/view/process_confirm.tpl');
 
         $template->assign('content', $content);
         $template->display_one_col_template();

+ 7 - 12
plugin/buycourses/src/service_sales_report.php

@@ -1,11 +1,10 @@
 <?php
-
 /* For license terms, see /license.txt */
+
 /**
  * List of pending payments of the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-//Initialization
 $cidReset = true;
 
 require_once '../config.php';
@@ -48,13 +47,11 @@ foreach ($servicesSales as $sale) {
 $interbreadcrumb[] = ['url' => '../index.php', 'name' => $plugin->get_lang('plugin_title')];
 
 $templateName = $plugin->get_lang('SalesReport');
-
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
+$htmlHeadXtra[] = api_get_js('plugins/buycourses/js/modeal.js');
 $template = new Template($templateName);
-
 $toolbar = '';
-
 if ($paypalEnable == 'true' && $commissionsEnable == 'true') {
-
     $toolbar .= Display::toolbarButton(
         $plugin->get_lang('PaypalPayoutCommissions'),
         api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/paypal_payout.php',
@@ -62,13 +59,11 @@ if ($paypalEnable == 'true' && $commissionsEnable == 'true') {
         'primary',
         ['title' => $plugin->get_lang('PaypalPayoutCommissions')]
     );
-    
+
     $template->assign('actions', $toolbar);
-    
 }
 
 if ($commissionsEnable == 'true') {
-
     $toolbar .= Display::toolbarButton(
         $plugin->get_lang('PayoutReport'),
         api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/payout_report.php',
@@ -76,9 +71,9 @@ if ($commissionsEnable == 'true') {
         'info',
         ['title' => $plugin->get_lang('PayoutReport')]
     );
-    
+
     $template->assign('actions', $toolbar);
-    
+
 }
 $template->assign('form', $form->returnForm());
 $template->assign('showing_services', true);
@@ -88,7 +83,7 @@ $template->assign('sale_status_cancelled', BuyCoursesPlugin::SERVICE_STATUS_CANC
 $template->assign('sale_status_pending', BuyCoursesPlugin::SERVICE_STATUS_PENDING);
 $template->assign('sale_status_completed', BuyCoursesPlugin::SERVICE_STATUS_COMPLETED);
 
-$content = $template->fetch('buycourses/view/service_sales_report.tpl');
+$content = $template->fetch('@plugin/buycourses/view/service_sales_report.tpl');
 
 
 $template->assign('content', $content);

+ 1 - 1
plugin/buycourses/src/service_success.php

@@ -174,6 +174,6 @@ $tpl->assign('buying_service', true);
 $tpl->assign('user', api_get_user_info($serviceSale['buyer']['id']));
 $tpl->assign('form', $form->returnForm());
 
-$content = $tpl->fetch('buycourses/view/success.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/success.tpl');
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();

+ 3 - 1
plugin/buycourses/src/session_catalog.php

@@ -70,8 +70,10 @@ $template->assign('sessions_are_included', $includeSessions);
 $template->assign('services_are_included', $includeServices);
 $template->assign('showing_sessions', true);
 $template->assign('sessions', $sessionList);
+$template->assign('showing_courses', false);
+$template->assign('showing_services', false);
 
-$content = $template->fetch('buycourses/view/catalog.tpl');
+$content = $template->fetch('@plugin/buycourses/view/catalog.tpl');
 
 $template->assign('header', $templateName);
 $template->assign('content', $content);

+ 2 - 4
plugin/buycourses/src/session_panel.php

@@ -3,9 +3,6 @@
  * User Panel
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
 
 $cidReset = true;
 
@@ -48,12 +45,13 @@ $toolbar = Display::toolbarButton(
 );
 
 $templateName = get_lang('TabsDashboard');
+$htmlHeadXtra[] = api_get_css('plugins/buycourses/css/style.css');
 $tpl = new Template($templateName);
 $tpl->assign('showing_courses', true);
 $tpl->assign('sessions_are_included', $includeSessions);
 $tpl->assign('sale_list', $saleList);
 
-$content = $tpl->fetch('buycourses/view/session_panel.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/session_panel.tpl');
 
 $tpl->assign('actions', $toolbar);
 $tpl->assign('header', $templateName);

+ 1 - 1
plugin/buycourses/src/success.php

@@ -209,6 +209,6 @@ $tpl->assign('currency', $sale['currency_id']);
 $tpl->assign('user', api_get_user_info($sale['user_id']));
 $tpl->assign('form', $form->returnForm());
 
-$content = $tpl->fetch('buycourses/view/success.tpl');
+$content = $tpl->fetch('@plugin/buycourses/view/success.tpl');
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();

+ 164 - 164
plugin/buycourses/view/catalog.tpl → plugin/buycourses/view/catalog.html.twig

@@ -1,164 +1,164 @@
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-
-<div id="buy-courses-tabs">
-    {% if sessions_are_included %}
-        <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
-            <li id="buy-courses-tab" class="{{ showing_courses ? 'active' : '' }}" role="presentation">
-                <a href="course_catalog.php" aria-controls="buy-courses" role="tab">{{ 'Courses'|get_lang }}</a>
-            </li>
-            <li id="buy-sessions-tab" class="{{ showing_sessions ? 'active' : '' }}" role="presentation">
-                <a href="session_catalog.php" aria-controls="buy-sessions" role="tab">{{ 'Sessions'|get_lang }}</a>
-            </li>
-            {% if services_are_included %}
-                <li id="buy-services-tab" class="{{ showing_services ? 'active' : '' }}" role="presentation">
-                    <a href="service_catalog.php" aria-controls="buy-services" role="tab">{{ 'Services'|get_plugin_lang('BuyCoursesPlugin') }}</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">
-                        {% if showing_courses %}
-                            {% for course in courses %}
-                                <div class="col-md-4 col-sm-6">
-                                    <article class="thumbnail">
-                                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
-                                        <div class="caption">
-                                            {% set course_description_url = _p.web_ajax ~ 'course_home.ajax.php?' ~ {'code': course.code, 'a': 'show_course_information'}|url_encode() %}
-                                            <h3>
-                                                <a class="ajax" href="{{ course_description_url }}" data-title="{{ course.title }}">{{ course.title }}</a>
-                                            </h3>
-                                            <ul class="list-unstyled">
-                                                {% for teacher in course.teachers %}
-                                                    <li><em class="fa fa-user"></em> {{ teacher }}</li>
-                                                    {% endfor %}
-                                            </ul>
-                                            <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
-                                            {% 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="text-center">
-                                                    <a class="ajax btn btn-primary" 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" title="" href="{{ _p.web_plugin ~ 'buycourses/src/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="thumbnail">
-                                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
-                                        <div class="caption">
-                                            <h3>
-                                                <a href="{{ _p.web ~ 'session/' ~ session.id ~ '/about/' }}">{{ session.name }}</a>
-                                            </h3>
-                                            {% if 'show_session_coach'|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> {{ session.dates.display }}</p>
-                                            <p class="lead text-right">{{ session.currency }} {{ session.price }}</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>{{ coach }}</li>
-                                                                    {% endfor %}
-                                                            </ul>
-                                                        {% endif %}
-                                                    </li>
-                                                {% endfor %}
-                                            </ul>
-                                            {% 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="text-center">
-                                                    <a class="btn btn-success" href="{{ _p.web_plugin ~ 'buycourses/src/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 %}
-
-                        {% if showing_services %}
-                            {% for service in services %}
-                                <div class="col-md-4 col-sm-6">
-                                    <div class="items-course">
-                                        <div class="items-course-image">
-                                            <a href="{{ _p.web }}service/{{ service.id }}"><img alt="{{ service.name }}" class="img-responsive" src="{{ service.image }}"></a>
-                                        </div>
-                                        <div class="items-course-info">
-                                            <h4 class="title">
-                                                <a title="{{ service.name }}" href="{{ _p.web }}service/{{ service.id }}" >
-                                                    {{ service.name }}
-                                                </a>
-                                            </h4>
-                                            <ul class="list-unstyled">
-                                                <li><em class="fa fa-clock-o"></em> {{ 'Duration'|get_plugin_lang('BuyCoursesPlugin') }} : {{ service.duration_days == 0 ? 'NoLimit' | get_lang  : service.duration_days ~ ' ' ~ 'Days' | get_lang }}</li>
-                                                {% 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') }} {{ 'SubscriptionPackage' | get_plugin_lang('BuyCoursesPlugin') }}</li>
-                                                {% endif %}
-                                                <li><em class="fa fa-user"></em> {{ service.owner_name }}</li>
-                                            </ul>
-                                            <p class="text-right">
-                                                <span class="label label-primary">
-                                                    {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
-                                                </span>
-                                            </p>
-                                            <div class="toolbar">
-                                                <a class="btn btn-info btn-block btn-sm" title="" href="{{ _p.web }}service/{{ service.id }}">
-                                                    <em class="fa fa-info-circle"></em> {{ 'ServiceInformation'|get_plugin_lang('BuyCoursesPlugin') }}
-                                                </a>
-                                                <a class="btn btn-success btn-block btn-sm" title="" href="{{ _p.web_plugin ~ 'buycourses/src/service_process.php?' ~ {'i': service.id, 't': service.applies_to}|url_encode() }}">
-                                                    <em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
-                                                </a>
-                                            </div>
-                                        </div>
-                                    </div>
-                                </div>
-                            {% endfor %}
-                        {% endif %}
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
+{% autoescape false %}
+<div id="buy-courses-tabs">
+    {% if sessions_are_included %}
+        <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
+            <li id="buy-courses-tab" class="{{ showing_courses ? 'active' : '' }}" role="presentation">
+                <a href="course_catalog.php" aria-controls="buy-courses" role="tab">{{ 'Courses'|get_lang }}</a>
+            </li>
+            <li id="buy-sessions-tab" class="{{ showing_sessions ? 'active' : '' }}" role="presentation">
+                <a href="session_catalog.php" aria-controls="buy-sessions" role="tab">{{ 'Sessions'|get_lang }}</a>
+            </li>
+            {% if services_are_included %}
+                <li id="buy-services-tab" class="{{ showing_services ? 'active' : '' }}" role="presentation">
+                    <a href="service_catalog.php" aria-controls="buy-services" role="tab">{{ 'Services'|get_plugin_lang('BuyCoursesPlugin') }}</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">
+                        {% if showing_courses %}
+                            {% for course in courses %}
+                                <div class="col-md-4 col-sm-6">
+                                    <article class="thumbnail">
+                                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
+                                        <div class="caption">
+                                            {% set course_description_url = _p.web_ajax ~ 'course_home.ajax.php?' ~ {'code': course.code, 'a': 'show_course_information'}|url_encode() %}
+                                            <h3>
+                                                <a class="ajax" href="{{ course_description_url }}" data-title="{{ course.title }}">{{ course.title }}</a>
+                                            </h3>
+                                            <ul class="list-unstyled">
+                                                {% for teacher in course.teachers %}
+                                                    <li><em class="fa fa-user"></em> {{ teacher }}</li>
+                                                    {% endfor %}
+                                            </ul>
+                                            <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
+                                            {% 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="text-center">
+                                                    <a class="ajax btn btn-primary" 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" title="" href="{{ _p.web_plugin ~ 'buycourses/src/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="thumbnail">
+                                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
+                                        <div class="caption">
+                                            <h3>
+                                                <a href="{{ _p.web ~ 'session/' ~ session.id ~ '/about/' }}">{{ session.name }}</a>
+                                            </h3>
+                                            {% if 'show_session_coach'|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> {{ session.dates.display }}</p>
+                                            <p class="lead text-right">{{ session.currency }} {{ session.price }}</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>{{ coach }}</li>
+                                                                    {% endfor %}
+                                                            </ul>
+                                                        {% endif %}
+                                                    </li>
+                                                {% endfor %}
+                                            </ul>
+                                            {% 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="text-center">
+                                                    <a class="btn btn-success" href="{{ _p.web_plugin ~ 'buycourses/src/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 %}
+
+                        {% if showing_services %}
+                            {% for service in services %}
+                                <div class="col-md-4 col-sm-6">
+                                    <div class="items-course">
+                                        <div class="items-course-image">
+                                            <a href="{{ _p.web }}service/{{ service.id }}"><img alt="{{ service.name }}" class="img-responsive" src="{{ service.image }}"></a>
+                                        </div>
+                                        <div class="items-course-info">
+                                            <h4 class="title">
+                                                <a title="{{ service.name }}" href="{{ _p.web }}service/{{ service.id }}" >
+                                                    {{ service.name }}
+                                                </a>
+                                            </h4>
+                                            <ul class="list-unstyled">
+                                                <li><em class="fa fa-clock-o"></em> {{ 'Duration'|get_plugin_lang('BuyCoursesPlugin') }} : {{ service.duration_days == 0 ? 'NoLimit' | get_lang  : service.duration_days ~ ' ' ~ 'Days' | get_lang }}</li>
+                                                {% 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') }} {{ 'SubscriptionPackage' | get_plugin_lang('BuyCoursesPlugin') }}</li>
+                                                {% endif %}
+                                                <li><em class="fa fa-user"></em> {{ service.owner_name }}</li>
+                                            </ul>
+                                            <p class="text-right">
+                                                <span class="label label-primary">
+                                                    {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}
+                                                </span>
+                                            </p>
+                                            <div class="toolbar">
+                                                <a class="btn btn-info btn-block btn-sm" title="" href="{{ _p.web }}service/{{ service.id }}">
+                                                    <em class="fa fa-info-circle"></em> {{ 'ServiceInformation'|get_plugin_lang('BuyCoursesPlugin') }}
+                                                </a>
+                                                <a class="btn btn-success btn-block btn-sm" title="" href="{{ _p.web_plugin ~ 'buycourses/src/service_process.php?' ~ {'i': service.id, 't': service.applies_to}|url_encode() }}">
+                                                    <em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
+                                                </a>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            {% endfor %}
+                        {% endif %}
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+{% endautoescape %}

+ 198 - 198
plugin/buycourses/view/configuration.tpl → plugin/buycourses/view/configuration.html.twig

@@ -1,198 +1,198 @@
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-
-{% if sessions_are_included %}
-    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
-        <li role="presentation" class="active">
-            <a href="#courses" aria-controls="courses" role="tab" data-toggle="tab">{{ 'Courses'|get_lang }}</a>
-        </li>
-        <li role="presentation">
-            <a href="#sessions" aria-controls="sessions" role="tab" data-toggle="tab">{{ 'Sessions'|get_lang }}</a>
-        </li>
-        {% if services_are_included %}
-            <li role="presentation">
-                <a href="#services" aria-controls="services" role="tab" data-toggle="tab">{{ 'Services'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-            </li>
-        {% endif %}
-    </ul>
-{% endif %}
-
-<div class="tab-content">
-    <div role="tabpanel" class="tab-pane 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">{{ 'VisibleInCatalog'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                        <th class="text-right" width="200">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                        <th class="text-right">{{ 'Options'|get_lang }}</th>
-                    </tr>
-                </thead>
-
-                <tbody>
-                    {% for item in courses %}
-                        <tr data-item="{{ item.course_id }}" data-type="course">
-                            <td>
-                                {% if item.course_visibility == 0 %}
-                                    <img src="{{ 'bullet_red.png'|icon() }}" alt="{{ 'CourseVisibilityClosed'|get_lang }}" title="{{ 'CourseVisibilityClosed'|get_lang }}">
-                                {% elseif item.course_visibility == 1 %}
-                                    <img src="{{ 'bullet_orange.png'|icon() }}" alt="{{ 'Private'|get_lang }}" title="{{ 'Private'|get_lang }}">
-                                {% elseif item.course_visibility == 2 %}
-                                    <img src="{{ 'bullet_green.png'|icon() }}" alt="{{ 'OpenToThePlatform'|get_lang }}" title="{{ 'OpenToThePlatform'|get_lang }}">
-                                {% elseif item.course_visibility == 3 %}
-                                    <img src="{{ 'bullet_blue.png'|icon() }}" alt="{{ 'OpenToTheWorld'|get_lang }}" title="{{ 'OpenToTheWorld'|get_lang }}">
-                                {% elseif item.course_visibility == 4 %}
-                                    <img src="{{ 'bullet_gray.png'|icon() }}" alt="{{ 'CourseVisibilityHidden'|get_lang }}" title="{{ 'CourseVisibilityHidden'|get_lang }}">
-                                {% endif %}
-
-                                <a href="{{ _p.web_course ~ item.course_code ~ '/index.php' }}">{{ item.course_title }}</a>
-                                <span class="label label-info">{{ item.course_visual_code }}</span>
-                            </td>
-                            <td class="text-center">
-                                {{ item.course_code }}
-                            </td>
-                            <td class="text-center">
-                                {% if item.visible %}
-                                    <em class="fa fa-fw fa-check-square-o"></em>
-                                {% else %}
-                                    <em class="fa fa-fw fa-square-o"></em>
-                                {% endif %}
-                            </td>
-                            <td width="200" class="text-right">
-                                {{ "#{item.price} #{tem.currency ?: item.currency}" }}
-                            </td>
-                            <td class="text-right">
-                                <a href="{{ _p.web_plugin ~ 'buycourses/src/configure_course.php?' ~ {'i': item.course_id, 't':product_type_course}|url_encode() }}" class="btn btn-info btn-sm">
-                                    <em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }}
-                                </a>
-                            </td>
-                        </tr>
-                    {% endfor %}
-                </tbody>
-            </table>
-        </div>
-    </div>
-
-    {% if sessions_are_included %}
-        <div role="tabpanel" class="tab-pane" id="sessions">
-            <div class="table-responsive">
-                <table id="courses_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">{{ 'VisibleInCatalog'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                            <th class="text-right">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                            <th class="text-right">{{ 'Options'|get_lang }}</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        {% for item in sessions %}
-                            <tr data-item="{{ item.session_id }}" data-type="session">
-                                <td>
-                                    {% if item.session_visibility == 0 %}
-                                        <img src="{{ 'bullet_red.png'|icon() }}" alt="{{ 'CourseVisibilityClosed'|get_lang }}" title="{{ 'CourseVisibilityClosed'|get_lang }}">
-                                    {% elseif item.session_visibility == 1 %}
-                                        <img src="{{ 'bullet_orange.png'|icon() }}" alt="{{ 'Private'|get_lang }}" title="{{ 'Private'|get_lang }}">
-                                    {% elseif item.session_visibility == 2 %}
-                                        <img src="{{ 'bullet_green.png'|icon() }}" alt="{{ 'OpenToThePlatform'|get_lang }}" title="{{ 'OpenToThePlatform'|get_lang }}">
-                                    {% elseif item.session_visibility == 3 %}
-                                        <img src="{{ 'bullet_blue.png'|icon() }}" alt="{{ 'OpenToTheWorld'|get_lang }}" title="{{ 'OpenToTheWorld'|get_lang }}">
-                                    {% elseif item.session_visibility == 4 %}
-                                        <img src="{{ 'bullet_gray.png'|icon() }}" alt="{{ 'CourseVisibilityHidden'|get_lang }}" title="{{ 'CourseVisibilityHidden'|get_lang }}">
-                                    {% endif %}
-
-                                    <a href="{{ _p.web_main ~ 'session/index.php?' ~ {'session_id': item.session_id}|url_encode() }}">{{ item.session_name }}</a>
-                                </td>
-                                <td class="text-center">
-                                    {{ item.session_display_start_date }}
-                                </td>
-                                <td class="text-center">
-                                    {{ item.session_display_end_date }}
-                                </td>
-                                <td class="text-center">
-                                    {% if item.visible %}
-                                        <em class="fa fa-fw fa-check-square-o"></em>
-                                    {% else %}
-                                        <em class="fa fa-fw fa-square-o"></em>
-                                    {% endif %}
-                                </td>
-                                <td class="text-right" width="200">
-                                    {{ "#{item.price} #{tem.currency ?: item.currency}" }}
-                                </td>
-                                <td class="text-right">
-                                    <a href="{{ _p.web_plugin ~ 'buycourses/src/configure_course.php?' ~ {'i': item.session_id, 't': product_type_session}|url_encode() }}" class="btn btn-info btn-sm">
-                                        <em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }}
-                                    </a>
-                                </td>
-                            </tr>
-                        {% endfor %}
-                    </tbody>
-                </table>
-            </div>
-        </div>
-    {% endif %}
-    {% if services_are_included %}
-        <div role="tabpanel" class="tab-pane" id="services">
-            <div class="table-responsive">
-                <a href="{{ _p.web_plugin ~ 'buycourses/src/services_add.php' }}" class="btn btn-primary">
-                    <em class="fa fa-cart-plus fa-fw"></em> {{ 'NewService'| get_plugin_lang('BuyCoursesPlugin') }}
-                </a>
-                </br>
-                </br>
-                <table id="services_table" class="table">
-                    <thead>
-                    <tr>
-                        <th>{{ 'Service'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                        <th>{{ 'Description'|get_lang }}</th>
-                        <th class="text-center">{{ 'Duration'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                        <th class="text-center">{{ 'VisibleInCatalog'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                        <th class="text-center">{{ 'Owner'|get_lang }}</th>
-                        <th class="text-right">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                        <th class="text-right">{{ 'Options'|get_lang }}</th>
-                    </tr>
-                    </thead>
-                    <tbody>
-                    {% for item in services %}
-                        <tr data-item="{{ item.id }}" data-type="service">
-                            <td>
-                                {{ item.name }}
-                            </td>
-                            <td>
-                                {{ item.description }}
-                            </td>
-                            <td class="text-center">
-                                {% if item.duration_days == 0 %}
-                                    {{ 'NoLimit'|get_lang }}
-                                {% else %}
-                                    {{ item.duration_days }} {{ 'Days'|get_lang }}
-                                {% endif %}
-                            </td>
-                            <td class="text-center">
-                                {% if item.visibility == 1 %}
-                                    <em class="fa fa-fw fa-check-square-o"></em>
-                                {% else %}
-                                    <em class="fa fa-fw fa-square-o"></em>
-                                {% endif %}
-                            </td>
-                            <td class="text-center">
-                                {{ item.owner_name }}
-                            </td>
-                            <td class="text-right" width="200">
-                                {{ "#{item.price} #{tem.currency ?: item.currency}" }}
-                            </td>
-                            <td class="text-right">
-                                <a href="{{ _p.web_plugin ~ 'buycourses/src/services_edit.php?' ~ {'id': item.id}|url_encode() }}" class="btn btn-info btn-sm">
-                                    <em class="fa fa-wrench fa-fw"></em> {{ 'Edit'|get_lang }}
-                                </a>
-                            </td>
-                        </tr>
-                    {% endfor %}
-                    </tbody>
-                </table>
-            </div>
-        </div>
-    {% endif %}
-</div>
+{% autoescape false %}
+{% if sessions_are_included %}
+    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
+        <li role="presentation" class="active">
+            <a href="#courses" aria-controls="courses" role="tab" data-toggle="tab">{{ 'Courses'|get_lang }}</a>
+        </li>
+        <li role="presentation">
+            <a href="#sessions" aria-controls="sessions" role="tab" data-toggle="tab">{{ 'Sessions'|get_lang }}</a>
+        </li>
+        {% if services_are_included %}
+            <li role="presentation">
+                <a href="#services" aria-controls="services" role="tab" data-toggle="tab">{{ 'Services'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+            </li>
+        {% endif %}
+    </ul>
+{% endif %}
+
+<div class="tab-content">
+    <div role="tabpanel" class="tab-pane 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">{{ 'VisibleInCatalog'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                        <th class="text-right" width="200">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                        <th class="text-right">{{ 'Options'|get_lang }}</th>
+                    </tr>
+                </thead>
+
+                <tbody>
+                    {% for item in courses %}
+                        <tr data-item="{{ item.course_id }}" data-type="course">
+                            <td>
+                                {% if item.course_visibility == 0 %}
+                                    <img src="{{ 'bullet_red.png'|icon() }}" alt="{{ 'CourseVisibilityClosed'|get_lang }}" title="{{ 'CourseVisibilityClosed'|get_lang }}">
+                                {% elseif item.course_visibility == 1 %}
+                                    <img src="{{ 'bullet_orange.png'|icon() }}" alt="{{ 'Private'|get_lang }}" title="{{ 'Private'|get_lang }}">
+                                {% elseif item.course_visibility == 2 %}
+                                    <img src="{{ 'bullet_green.png'|icon() }}" alt="{{ 'OpenToThePlatform'|get_lang }}" title="{{ 'OpenToThePlatform'|get_lang }}">
+                                {% elseif item.course_visibility == 3 %}
+                                    <img src="{{ 'bullet_blue.png'|icon() }}" alt="{{ 'OpenToTheWorld'|get_lang }}" title="{{ 'OpenToTheWorld'|get_lang }}">
+                                {% elseif item.course_visibility == 4 %}
+                                    <img src="{{ 'bullet_gray.png'|icon() }}" alt="{{ 'CourseVisibilityHidden'|get_lang }}" title="{{ 'CourseVisibilityHidden'|get_lang }}">
+                                {% endif %}
+
+                                <a href="{{ _p.web_course ~ item.course_code ~ '/index.php' }}">{{ item.course_title }}</a>
+                                <span class="label label-info">{{ item.course_visual_code }}</span>
+                            </td>
+                            <td class="text-center">
+                                {{ item.course_code }}
+                            </td>
+                            <td class="text-center">
+                                {% if item.visible %}
+                                    <em class="fa fa-fw fa-check-square-o"></em>
+                                {% else %}
+                                    <em class="fa fa-fw fa-square-o"></em>
+                                {% endif %}
+                            </td>
+                            <td width="200" class="text-right">
+                                {{ "#{item.price} #{tem.currency ?: item.currency}" }}
+                            </td>
+                            <td class="text-right">
+                                <a href="{{ _p.web_plugin ~ 'buycourses/src/configure_course.php?' ~ {'i': item.course_id, 't':product_type_course}|url_encode() }}" class="btn btn-info btn-sm">
+                                    <em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }}
+                                </a>
+                            </td>
+                        </tr>
+                    {% endfor %}
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+    {% if sessions_are_included %}
+        <div role="tabpanel" class="tab-pane" id="sessions">
+            <div class="table-responsive">
+                <table id="courses_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">{{ 'VisibleInCatalog'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                            <th class="text-right">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                            <th class="text-right">{{ 'Options'|get_lang }}</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        {% for item in sessions %}
+                            <tr data-item="{{ item.session_id }}" data-type="session">
+                                <td>
+                                    {% if item.session_visibility == 0 %}
+                                        <img src="{{ 'bullet_red.png'|icon() }}" alt="{{ 'CourseVisibilityClosed'|get_lang }}" title="{{ 'CourseVisibilityClosed'|get_lang }}">
+                                    {% elseif item.session_visibility == 1 %}
+                                        <img src="{{ 'bullet_orange.png'|icon() }}" alt="{{ 'Private'|get_lang }}" title="{{ 'Private'|get_lang }}">
+                                    {% elseif item.session_visibility == 2 %}
+                                        <img src="{{ 'bullet_green.png'|icon() }}" alt="{{ 'OpenToThePlatform'|get_lang }}" title="{{ 'OpenToThePlatform'|get_lang }}">
+                                    {% elseif item.session_visibility == 3 %}
+                                        <img src="{{ 'bullet_blue.png'|icon() }}" alt="{{ 'OpenToTheWorld'|get_lang }}" title="{{ 'OpenToTheWorld'|get_lang }}">
+                                    {% elseif item.session_visibility == 4 %}
+                                        <img src="{{ 'bullet_gray.png'|icon() }}" alt="{{ 'CourseVisibilityHidden'|get_lang }}" title="{{ 'CourseVisibilityHidden'|get_lang }}">
+                                    {% endif %}
+
+                                    <a href="{{ _p.web_main ~ 'session/index.php?' ~ {'session_id': item.session_id}|url_encode() }}">{{ item.session_name }}</a>
+                                </td>
+                                <td class="text-center">
+                                    {{ item.session_display_start_date }}
+                                </td>
+                                <td class="text-center">
+                                    {{ item.session_display_end_date }}
+                                </td>
+                                <td class="text-center">
+                                    {% if item.visible %}
+                                        <em class="fa fa-fw fa-check-square-o"></em>
+                                    {% else %}
+                                        <em class="fa fa-fw fa-square-o"></em>
+                                    {% endif %}
+                                </td>
+                                <td class="text-right" width="200">
+                                    {{ "#{item.price} #{tem.currency ?: item.currency}" }}
+                                </td>
+                                <td class="text-right">
+                                    <a href="{{ _p.web_plugin ~ 'buycourses/src/configure_course.php?' ~ {'i': item.session_id, 't': product_type_session}|url_encode() }}" class="btn btn-info btn-sm">
+                                        <em class="fa fa-wrench fa-fw"></em> {{ 'Configure'|get_lang }}
+                                    </a>
+                                </td>
+                            </tr>
+                        {% endfor %}
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    {% endif %}
+    {% if services_are_included %}
+        <div role="tabpanel" class="tab-pane" id="services">
+            <div class="table-responsive">
+                <a href="{{ _p.web_plugin ~ 'buycourses/src/services_add.php' }}" class="btn btn-primary">
+                    <em class="fa fa-cart-plus fa-fw"></em> {{ 'NewService'| get_plugin_lang('BuyCoursesPlugin') }}
+                </a>
+                </br>
+                </br>
+                <table id="services_table" class="table">
+                    <thead>
+                    <tr>
+                        <th>{{ 'Service'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                        <th>{{ 'Description'|get_lang }}</th>
+                        <th class="text-center">{{ 'Duration'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                        <th class="text-center">{{ 'VisibleInCatalog'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                        <th class="text-center">{{ 'Owner'|get_lang }}</th>
+                        <th class="text-right">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                        <th class="text-right">{{ 'Options'|get_lang }}</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    {% for item in services %}
+                        <tr data-item="{{ item.id }}" data-type="service">
+                            <td>
+                                {{ item.name }}
+                            </td>
+                            <td>
+                                {{ item.description }}
+                            </td>
+                            <td class="text-center">
+                                {% if item.duration_days == 0 %}
+                                    {{ 'NoLimit'|get_lang }}
+                                {% else %}
+                                    {{ item.duration_days }} {{ 'Days'|get_lang }}
+                                {% endif %}
+                            </td>
+                            <td class="text-center">
+                                {% if item.visibility == 1 %}
+                                    <em class="fa fa-fw fa-check-square-o"></em>
+                                {% else %}
+                                    <em class="fa fa-fw fa-square-o"></em>
+                                {% endif %}
+                            </td>
+                            <td class="text-center">
+                                {{ item.owner_name }}
+                            </td>
+                            <td class="text-right" width="200">
+                                {{ "#{item.price} #{tem.currency ?: item.currency}" }}
+                            </td>
+                            <td class="text-right">
+                                <a href="{{ _p.web_plugin ~ 'buycourses/src/services_edit.php?' ~ {'id': item.id}|url_encode() }}" class="btn btn-info btn-sm">
+                                    <em class="fa fa-wrench fa-fw"></em> {{ 'Edit'|get_lang }}
+                                </a>
+                            </td>
+                        </tr>
+                    {% endfor %}
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    {% endif %}
+</div>
+{% endautoescape %}

+ 40 - 43
plugin/buycourses/view/course_panel.tpl → plugin/buycourses/view/course_panel.html.twig

@@ -1,43 +1,40 @@
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-
-<div id="buy-courses-tabs">
-    
-    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
-        <li id="buy-courses-tab" class="active" role="presentation">
-            <a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
-        </li>
-        {% if sessions_are_included %}
-            <li id="buy-sessions-tab" class="" role="presentation">
-                <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
-            </li>
-        {% endif %}
-        <li id="buy-courses-tab" class="" role="presentation">
-            <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
-        </li>
-    </ul>
-        
-    <table class="table table-striped table-hover">
-        <thead>
-            <tr>
-                <th>{{ 'Course'|get_lang }}</th>
-                <th class="text-center">{{ 'PaymentMethod'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-            </tr>
-        </thead>
-        <tbody>
-            {% for sale in sale_list %}
-                <tr>
-                    <td>{{ sale.product_name }}</td>
-                    <td class="text-center">{{ sale.payment_type }}</td>
-                    <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
-                    <td class="text-center">{{ sale.date }}</td>
-                    <td class="text-center">{{ sale.reference }}</td>
-                </tr>
-            {% endfor %}
-        </tbody>
-    </table>
-
-  
-</div>
+{% autoescape false %}
+<div id="buy-courses-tabs">
+    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
+        <li id="buy-courses-tab" class="active" role="presentation">
+            <a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
+        </li>
+        {% if sessions_are_included %}
+            <li id="buy-sessions-tab" class="" role="presentation">
+                <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
+            </li>
+        {% endif %}
+        <li id="buy-courses-tab" class="" role="presentation">
+            <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
+        </li>
+    </ul>
+
+    <table class="table table-striped table-hover">
+        <thead>
+            <tr>
+                <th>{{ 'Course'|get_lang }}</th>
+                <th class="text-center">{{ 'PaymentMethod'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for sale in sale_list %}
+                <tr>
+                    <td>{{ sale.product_name }}</td>
+                    <td class="text-center">{{ sale.payment_type }}</td>
+                    <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
+                    <td class="text-center">{{ sale.date }}</td>
+                    <td class="text-center">{{ sale.reference }}</td>
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+</div>
+{% endautoescape %}

+ 76 - 75
plugin/buycourses/view/index.tpl → plugin/buycourses/view/index.html.twig

@@ -1,75 +1,76 @@
-<link rel="stylesheet" type="text/css" href="resources/css/style.css"/>
-{% if _u.is_admin %}
-    <div class="row">
-        <div class="col-md-12">
-            <article class="jumbotron">
-                <h3>{{ 'TitlePlugin'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
-                <p>{{ 'PluginPresentation'|get_plugin_lang('BuyCoursesPlugin') }}</p>
-                <ul class="list-unstyled">
-                    <li>
-                        {{ 'Instructions'|get_plugin_lang('BuyCoursesPlugin') }}
-                        <ul>
-                            <li>{{ 'InstructionsStepOne'|get_plugin_lang('BuyCoursesPlugin') }}</li>
-                            <li>{{ 'InstructionsStepTwo'|get_plugin_lang('BuyCoursesPlugin') }}</li>
-                            <li>{{ 'InstructionsStepThree'|get_plugin_lang('BuyCoursesPlugin') }}</li>
-                        </ul>
-                    </li>
-                </ul>
-            </article>
-        </div>
-    </div>
-{% endif %}
-
-<div class="row">
-    <div class="col-md-3">
-        <div class="thumbnail">
-            <a href="src/course_catalog.php">
-                <img src="resources/img/128/buycourses.png">
-            </a>
-            <div class="caption">
-                <p class="text-center">
-                    <a class="btn btn-default btn-sm" href="src/course_catalog.php">{{ 'BuyCourses'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-                </p>
-            </div>
-        </div>
-    </div>
-
-    {% if _u.is_admin %}
-        <div class="col-md-3">
-            <div class="thumbnail">
-                <a href="src/configuration.php">
-                    <img src="resources/img/128/settings.png">
-                </a>
-                <div class="caption">
-                    <p class="text-center">
-                        <a class="btn btn-default btn-sm" href="src/configuration.php">{{ 'ConfigurationOfCoursesAndPrices'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-                    </p>
-                </div>
-            </div>
-        </div>
-        <div class="col-md-3">
-            <div class="thumbnail">
-                <a href="src/paymentsetup.php">
-                    <img src="resources/img/128/paymentsettings.png">
-                </a>
-                <div class="caption">
-                    <p class="text-center">
-                        <a class="btn btn-default btn-sm" href="src/paymentsetup.php">{{ 'PaymentsConfiguration'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-                    </p>
-                </div>
-            </div>
-        </div>
-        <div class="col-md-3">
-            <div class="thumbnail">
-                <a href="src/sales_report.php">
-                    <img src="resources/img/128/backlogs.png">
-                </a>
-                <div class="caption">
-                    <p class="text-center">
-                        <a class="btn btn-default btn-sm" href="src/sales_report.php"> {{ 'SalesReport'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-                    </p>
-                </div>
-            </div>
-        </div>
-    {% endif %}
-</div>
+{% autoescape false %}
+{% if is_granted('ROLE_ADMIN') %}
+    <div class="row">
+        <div class="col-md-12">
+            <article class="jumbotron">
+                <h3>{{ 'TitlePlugin'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+                <p>{{ 'PluginPresentation'|get_plugin_lang('BuyCoursesPlugin') }}</p>
+                <ul class="list-unstyled">
+                    <li>
+                        {{ 'Instructions'|get_plugin_lang('BuyCoursesPlugin') }}
+                        <ul>
+                            <li>{{ 'InstructionsStepOne'|get_plugin_lang('BuyCoursesPlugin') }}</li>
+                            <li>{{ 'InstructionsStepTwo'|get_plugin_lang('BuyCoursesPlugin') }}</li>
+                            <li>{{ 'InstructionsStepThree'|get_plugin_lang('BuyCoursesPlugin') }}</li>
+                        </ul>
+                    </li>
+                </ul>
+            </article>
+        </div>
+    </div>
+{% endif %}
+
+<div class="row">
+    <div class="col-md-3">
+        <div class="thumbnail">
+            <a href="src/course_catalog.php">
+                <img src="{{ asset('plugins/buycourses/img/128/buycourses.png') }}">
+            </a>
+            <div class="caption">
+                <p class="text-center">
+                    <a class="btn btn-default btn-sm" href="src/course_catalog.php">{{ 'BuyCourses'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+                </p>
+            </div>
+        </div>
+    </div>
+
+    {% if is_granted('ROLE_ADMIN') %}
+        <div class="col-md-3">
+            <div class="thumbnail">
+                <a href="src/configuration.php">
+                    <img src="{{ asset('plugins/buycourses/img/128/settings.png') }}">
+                </a>
+                <div class="caption">
+                    <p class="text-center">
+                        <a class="btn btn-default btn-sm" href="src/configuration.php">{{ 'ConfigurationOfCoursesAndPrices'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+                    </p>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-3">
+            <div class="thumbnail">
+                <a href="src/paymentsetup.php">
+                    <img src="{{ asset('plugins/buycourses/img/128/paymentsettings.png') }}">
+                </a>
+                <div class="caption">
+                    <p class="text-center">
+                        <a class="btn btn-default btn-sm" href="src/paymentsetup.php">{{ 'PaymentsConfiguration'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+                    </p>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-3">
+            <div class="thumbnail">
+                <a href="src/sales_report.php">
+                    <img src="{{ asset('plugins/buycourses/img/128/backlogs.png') }}">
+                </a>
+                <div class="caption">
+                    <p class="text-center">
+                        <a class="btn btn-default btn-sm" href="src/sales_report.php"> {{ 'SalesReport'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+                    </p>
+                </div>
+            </div>
+        </div>
+    {% endif %}
+</div>
+{% endautoescape %}

+ 2 - 0
plugin/buycourses/view/message_transfer.tpl → plugin/buycourses/view/message_transfer.html.twig

@@ -1,3 +1,4 @@
+{% autoescape false %}
 <div>
     <p>{{ 'DearUser'|get_lang }}</p>
     <p>{{ 'PurchaseDetailsIntro'|get_plugin_lang('BuyCoursesPlugin') }}</p>
@@ -34,3 +35,4 @@
     </table>
     <p>{{ 'PurchaseDetailsEnd'|get_plugin_lang('BuyCoursesPlugin') }}</p>
 </div>
+{% endautoescape %}

+ 93 - 94
plugin/buycourses/view/paymentsetup.tpl → plugin/buycourses/view/paymentsetup.html.twig

@@ -1,94 +1,93 @@
-<script type='text/javascript' src="../js/buycourses.js"></script>
-
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-
-{{ curency_form }}
-
-<p class="alert alert-info">
-    {{ 'PluginInstruction'|get_plugin_lang('BuyCoursesPlugin') }}
-    <a href="{{ _p.web_main }}admin/configure_plugin.php?name=buycourses">{{ 'ClickHere'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-</p>
-
-{% if paypal_enable == "true" %}
-    <div class="panel panel-default">
-        <div class="panel-heading">
-            <h3 class="panel-title">{{ 'PayPalConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
-        </div>
-        <div class="panel-body">
-            <div class="row">
-                <div class="col-md-5">
-                    <p>{{ 'InfoApiCredentials'|get_plugin_lang('BuyCoursesPlugin') }}</p>
-                    <ul>
-                        <li>{{ 'InfoApiStepOne'|get_plugin_lang('BuyCoursesPlugin') }}</li>
-                        <li>{{ 'InfoApiStepTwo'|get_plugin_lang('BuyCoursesPlugin') }}</li>
-                        <li>{{ 'InfoApiStepThree'|get_plugin_lang('BuyCoursesPlugin') }}</li>
-                    </ul>
-                </div>
-                <div class="col-md-7">
-                    {{ paypal_form }}
-                </div>
-            </div>
-        </div>
-    </div>
-{% endif %}
-
-{% if commissions_enable == "true" %}
-    <div class="panel panel-default">
-        <div class="panel-heading">
-            <h3 class="panel-title">{{ 'CommissionsConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
-        </div>
-        <div class="panel-body">
-            <div class="row">
-                <div class="col-md-5">
-                    <p>{{ 'InfoCommissions'|get_plugin_lang('BuyCoursesPlugin') }}</p>
-                </div>
-                <div class="col-md-7">
-                    {{ commission_form }}
-                </div>
-            </div>
-        </div>
-    </div>
-{% endif %}
-
-{% if transfer_enable == "true" %}
-    <div class="panel panel-default">
-        <div class="panel-heading">
-            <h3 class="panel-title">{{ 'TransfersConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
-        </div>
-        <div class="panel-body">
-            <div class="row">
-                <div class="col-md-5">
-                    {{ transfer_form }}
-                </div>
-                <div class="col-md-7">
-                    <div class="table-responsive">
-                        <table class="table table-striped table-hover">
-                            <thead>
-                                <tr>
-                                    <th>{{ 'Name'|get_lang }}</th>
-                                    <th>{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                                    <th>{{ 'SWIFT'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                                    <th>{{ 'Actions'|get_lang }}</th>
-                                </tr>
-                            </thead>
-                            <tbody>
-                                {% for account in transfer_accounts %}
-                                    <tr>
-                                        <td>{{ account.name }}</td>
-                                        <td>{{ account.account }}</td>
-                                        <td>{{ account.swift }}</td>
-                                        <td>
-                                            <a href="{{ _p.web_self ~ '?' ~ {'action':'delete_taccount', 'id': account.id}|url_encode() }}" class="btn btn-danger btn-sm">
-                                                <em class="fa fa-remove"></em> {{ 'Delete'|get_lang }}
-                                            </a>
-                                        </td>
-                                    </tr>
-                                {% endfor %}
-                            </tbody>
-                        </table>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-{% endif %}
+{% autoescape false %}
+<script type='text/javascript' src="../js/buycourses.js"></script>
+{{ curency_form }}
+
+<p class="alert alert-info">
+    {{ 'PluginInstruction'|get_plugin_lang('BuyCoursesPlugin') }}
+    <a href="{{ _p.web_main }}admin/configure_plugin.php?name=buycourses">{{ 'ClickHere'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+</p>
+
+{% if paypal_enable == "true" %}
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">{{ 'PayPalConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+        </div>
+        <div class="panel-body">
+            <div class="row">
+                <div class="col-md-5">
+                    <p>{{ 'InfoApiCredentials'|get_plugin_lang('BuyCoursesPlugin') }}</p>
+                    <ul>
+                        <li>{{ 'InfoApiStepOne'|get_plugin_lang('BuyCoursesPlugin') }}</li>
+                        <li>{{ 'InfoApiStepTwo'|get_plugin_lang('BuyCoursesPlugin') }}</li>
+                        <li>{{ 'InfoApiStepThree'|get_plugin_lang('BuyCoursesPlugin') }}</li>
+                    </ul>
+                </div>
+                <div class="col-md-7">
+                    {{ paypal_form }}
+                </div>
+            </div>
+        </div>
+    </div>
+{% endif %}
+
+{% if commissions_enable == "true" %}
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">{{ 'CommissionsConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+        </div>
+        <div class="panel-body">
+            <div class="row">
+                <div class="col-md-5">
+                    <p>{{ 'InfoCommissions'|get_plugin_lang('BuyCoursesPlugin') }}</p>
+                </div>
+                <div class="col-md-7">
+                    {{ commission_form }}
+                </div>
+            </div>
+        </div>
+    </div>
+{% endif %}
+
+{% if transfer_enable == "true" %}
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">{{ 'TransfersConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+        </div>
+        <div class="panel-body">
+            <div class="row">
+                <div class="col-md-5">
+                    {{ transfer_form }}
+                </div>
+                <div class="col-md-7">
+                    <div class="table-responsive">
+                        <table class="table table-striped table-hover">
+                            <thead>
+                                <tr>
+                                    <th>{{ 'Name'|get_lang }}</th>
+                                    <th>{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                                    <th>{{ 'SWIFT'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                                    <th>{{ 'Actions'|get_lang }}</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                {% for account in transfer_accounts %}
+                                    <tr>
+                                        <td>{{ account.name }}</td>
+                                        <td>{{ account.account }}</td>
+                                        <td>{{ account.swift }}</td>
+                                        <td>
+                                            <a href="{{ _p.web_self ~ '?' ~ {'action':'delete_taccount', 'id': account.id}|url_encode() }}" class="btn btn-danger btn-sm">
+                                                <em class="fa fa-remove"></em> {{ 'Delete'|get_lang }}
+                                            </a>
+                                        </td>
+                                    </tr>
+                                {% endfor %}
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+{% endif %}
+{% endautoescape %}

+ 46 - 48
plugin/buycourses/view/payout_panel.tpl → plugin/buycourses/view/payout_panel.html.twig

@@ -1,48 +1,46 @@
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-
-<div id="buy-courses-tabs">
-    
-    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
-        <li id="buy-courses-tab" class="" role="presentation">
-            <a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
-        </li>
-        {% if sessions_are_included %}
-            <li id="buy-sessions-tab" class="" role="presentation">
-                <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
-            </li>
-        {% endif %}
-        <li id="buy-courses-tab" class="active" role="presentation">
-            <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
-        </li>
-    </ul>
-    {% if not payout_list %}
-        <p class="alert alert-info">
-            {{ 'WantToSellCourses'|get_plugin_lang('BuyCoursesPlugin') }}
-            <a href="#">{{ 'ClickHere'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-        </p>
-    {% endif %}
-    
-    {% if payout_list %}
-        <table class="table table-striped table-hover">
-            <thead>
-                <tr>
-                    <th class="text-center">{{ 'OrderReference'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-center">{{ 'PayoutDate'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-right">{{ 'Commission'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-right">{{ 'PayPalAccount'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                </tr>
-            </thead>
-            <tbody>
-                {% for payout in payout_list %}
-                    <tr>
-                        <td class="text-center" style="vertical-align:middle"><a id="{{ payout.sale_id }}" class="saleInfo" data-toggle="modal" data-target="#saleInfo" href="#">{{ payout.reference }}</a></td>
-                        <td class="text-center" style="vertical-align:middle">{{ payout.payout_date }}</td>
-                        <td class="text-right" style="vertical-align:middle">{{  payout.currency ~ ' ' ~ payout.commission }}</td>
-                        <td class="text-right" style="vertical-align:middle">{{ payout.paypal_account }}</td>
-                    </tr>
-                {% endfor %}
-            </tbody>
-        </table>
-    {% endif %}
-  
-</div>
+{% autoescape false %}
+<div id="buy-courses-tabs">
+    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
+        <li id="buy-courses-tab" class="" role="presentation">
+            <a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
+        </li>
+        {% if sessions_are_included %}
+            <li id="buy-sessions-tab" class="" role="presentation">
+                <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
+            </li>
+        {% endif %}
+        <li id="buy-courses-tab" class="active" role="presentation">
+            <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
+        </li>
+    </ul>
+    {% if not payout_list %}
+        <p class="alert alert-info">
+            {{ 'WantToSellCourses'|get_plugin_lang('BuyCoursesPlugin') }}
+            <a href="#">{{ 'ClickHere'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+        </p>
+    {% endif %}
+
+    {% if payout_list %}
+        <table class="table table-striped table-hover">
+            <thead>
+                <tr>
+                    <th class="text-center">{{ 'OrderReference'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-center">{{ 'PayoutDate'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-right">{{ 'Commission'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-right">{{ 'PayPalAccount'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                </tr>
+            </thead>
+            <tbody>
+                {% for payout in payout_list %}
+                    <tr>
+                        <td class="text-center" style="vertical-align:middle"><a id="{{ payout.sale_id }}" class="saleInfo" data-toggle="modal" data-target="#saleInfo" href="#">{{ payout.reference }}</a></td>
+                        <td class="text-center" style="vertical-align:middle">{{ payout.payout_date }}</td>
+                        <td class="text-right" style="vertical-align:middle">{{  payout.currency ~ ' ' ~ payout.commission }}</td>
+                        <td class="text-right" style="vertical-align:middle">{{ payout.paypal_account }}</td>
+                    </tr>
+                {% endfor %}
+            </tbody>
+        </table>
+    {% endif %}
+</div>
+{% endautoescape %}

+ 95 - 94
plugin/buycourses/view/payout_report.tpl → plugin/buycourses/view/payout_report.html.twig

@@ -1,94 +1,95 @@
-{{ form }}
-<div class="table-responsive">
-    <table class="table table-striped table-hover">
-        <thead>
-            <tr>
-                <th class="text-center">{{ 'OrderReference'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'PayoutDate'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-right">{{ 'Commission'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-right">{{ 'Names'| get_lang }}</th>
-                <th class="text-right">{{ 'PayPalAccount'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-            </tr>
-        </thead>
-        <tbody>
-            {% for payout in payout_list %}
-                <tr>
-                    <td class="text-center" style="vertical-align:middle"><a id="{{ payout.sale_id }}" class="saleInfo" data-toggle="modal" data-target="#saleInfo" href="#">{{ payout.reference }}</a></td>
-                    <td class="text-center" style="vertical-align:middle">{{ payout.payout_date }}</td>
-                    <td class="text-right" style="vertical-align:middle">{{  payout.currency ~ ' ' ~ payout.commission }}</td>
-                    <td class="text-right" style="vertical-align:middle">{{ payout.beneficiary }}</td>
-                    {% if payout.paypal_account %}
-                        <td class="text-right" style="vertical-align:middle">{{ payout.paypal_account }}</td>
-                    {% else %}
-                        <td class="text-right" style="vertical-align:middle">{{ 'NoPayPalAccountDetected'| get_plugin_lang('BuyCoursesPlugin') }}</td>
-                    {% endif %}
-                </tr>
-            {% endfor %}
-        </tbody>
-    </table>
-    <div id="saleInfo" class="modal fade" role="dialog">
-        <div class="modal-dialog modal-lg">
-            <div class="modal-content">
-                <div class="modal-header">
-                    <h4 class="modal-title">{{ 'SaleInfo'| get_plugin_lang('BuyCoursesPlugin') }}</h4>
-                </div>
-                <div class="modal-body" id="contentSale">
-                    
-                </div>
-                <div class="modal-footer">
-                    <button type="button" class="btn btn-default" data-dismiss="modal">{{ 'Close' | get_lang }}</button>
-                </div>
-            </div>
-        </div>
-    </div>
-    
-    <div id="reportStats" class="modal fade" role="dialog">
-        <div class="modal-dialog">
-            <div class="modal-content">
-                <div class="modal-header">
-                    <h4 class="modal-title">{{ 'Stats'| get_plugin_lang('BuyCoursesPlugin') }}</h4>
-                </div>
-                <div class="modal-body" id="contentStats">
-                    
-                </div>
-                <div class="modal-footer">
-                    <button type="button" class="btn btn-default" data-dismiss="modal">{{ 'Close' | get_lang }}</button>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
-
-<div>
-    <button id="stats" type="button" class="btn btn-primary fa fa-line-chart" data-toggle="modal" data-target="#reportStats"> {{ 'Stats'|get_plugin_lang('BuyCoursesPlugin') }}</button>
-</div>
-
-<script>
-    $(document).ready(function() {
-        
-        $(".saleInfo").click(function() {
-            var id = this.id;
-            $.ajax({
-                data: 'id='+id,
-                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'saleInfo' } | url_encode() }}',
-                type: 'POST',
-                success: function(response) {
-                    $("#contentSale").html(response);
-                }
-            });
-        });
-        
-        $("#stats").click(function() {
-            var id = this.id;
-            $.ajax({
-                data: 'id='+id,
-                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'stats' } | url_encode() }}',
-                type: 'POST',
-                success: function(response) {
-                    $("#contentStats").html(response);
-                }
-            });
-        });
-        
-    });
-</script>
+{% autoescape false %}
+{{ form }}
+<div class="table-responsive">
+    <table class="table table-striped table-hover">
+        <thead>
+            <tr>
+                <th class="text-center">{{ 'OrderReference'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'PayoutDate'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-right">{{ 'Commission'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-right">{{ 'Names'| get_lang }}</th>
+                <th class="text-right">{{ 'PayPalAccount'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for payout in payout_list %}
+                <tr>
+                    <td class="text-center" style="vertical-align:middle"><a id="{{ payout.sale_id }}" class="saleInfo" data-toggle="modal" data-target="#saleInfo" href="#">{{ payout.reference }}</a></td>
+                    <td class="text-center" style="vertical-align:middle">{{ payout.payout_date }}</td>
+                    <td class="text-right" style="vertical-align:middle">{{  payout.currency ~ ' ' ~ payout.commission }}</td>
+                    <td class="text-right" style="vertical-align:middle">{{ payout.beneficiary }}</td>
+                    {% if payout.paypal_account %}
+                        <td class="text-right" style="vertical-align:middle">{{ payout.paypal_account }}</td>
+                    {% else %}
+                        <td class="text-right" style="vertical-align:middle">{{ 'NoPayPalAccountDetected'| get_plugin_lang('BuyCoursesPlugin') }}</td>
+                    {% endif %}
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+    <div id="saleInfo" class="modal fade" role="dialog">
+        <div class="modal-dialog modal-lg">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h4 class="modal-title">{{ 'SaleInfo'| get_plugin_lang('BuyCoursesPlugin') }}</h4>
+                </div>
+                <div class="modal-body" id="contentSale">
+
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">{{ 'Close' | get_lang }}</button>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div id="reportStats" class="modal fade" role="dialog">
+        <div class="modal-dialog">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h4 class="modal-title">{{ 'Stats'| get_plugin_lang('BuyCoursesPlugin') }}</h4>
+                </div>
+                <div class="modal-body" id="contentStats">
+
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">{{ 'Close' | get_lang }}</button>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<div>
+    <button id="stats" type="button" class="btn btn-primary fa fa-line-chart" data-toggle="modal" data-target="#reportStats">
+        {{ 'Stats'|get_plugin_lang('BuyCoursesPlugin') }}
+    </button>
+</div>
+<script>
+    $(document).ready(function() {
+        $(".saleInfo").click(function() {
+            var id = this.id;
+            $.ajax({
+                data: 'id='+id,
+                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'saleInfo' } | url_encode() }}',
+                type: 'POST',
+                success: function(response) {
+                    $("#contentSale").html(response);
+                }
+            });
+        });
+
+        $("#stats").click(function() {
+            var id = this.id;
+            $.ajax({
+                data: 'id='+id,
+                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'stats' } | url_encode() }}',
+                type: 'POST',
+                success: function(response) {
+                    $("#contentStats").html(response);
+                }
+            });
+        });
+    });
+</script>
+{% endautoescape %}

+ 121 - 121
plugin/buycourses/view/paypal_payout.tpl → plugin/buycourses/view/paypal_payout.html.twig

@@ -1,121 +1,121 @@
-<div class="table-responsive">
-    <table class="table table-striped table-hover">
-        <thead>
-            <tr>
-                <th class="text-center"><input type="checkbox" id="checkAll"></th>
-                <th class="text-center">{{ 'OrderReference'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'OrderDate'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-right">{{ 'Commission'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-right">{{ 'PayPalAccount'| get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-right">{{ 'Options'| get_lang }}</th>
-            </tr>
-        </thead>
-        <tbody>
-            {% for payout in payout_list %}
-                <tr style="{{ payout.paypal_account ? '' : 'color: red;' }}">
-                    <td class="text-center" style="vertical-align:middle">{% if payout.paypal_account %} <input id="{{ payout.id }}" type="checkbox" name="data[]" value="{{ payout.commission }}"> {% endif %}</td>
-                    <td class="text-center" style="vertical-align:middle">{{ payout.reference }}</td>
-                    <td class="text-center" style="vertical-align:middle">{{ payout.date }}</td>
-                    <td class="text-right" style="vertical-align:middle">{{  payout.currency ~ ' ' ~ payout.commission }}</td>
-                    {% if payout.paypal_account %}
-                        <td class="text-right" style="vertical-align:middle">{{ payout.paypal_account }}</td>
-                    {% else %}
-                        <td class="text-right" style="vertical-align:middle">{{ 'NoPayPalAccountDetected'| get_plugin_lang('BuyCoursesPlugin') }}</td>
-                    {% endif %}
-                    <td class="text-right" style="vertical-align:middle"><button id="{{ payout.id }}" type="button" class="btn btn-danger fa fa-ban cancelPayout"> {{ 'CancelPayout'| get_plugin_lang('BuyCoursesPlugin') }}</button></td>
-                </tr>
-            {% endfor %}
-        </tbody>
-    </table>
-
-    <div id="startPayout" class="modal fade" role="dialog">
-        <div class="modal-dialog modal-lg">
-            <div class="modal-content">
-                <div class="modal-header">
-                    <h4 class="modal-title">{{ 'PaypalPayoutCommissions'|get_plugin_lang('BuyCoursesPlugin') }}</h4>
-                </div>
-                <div class="modal-body" id="content">
-
-                </div>
-                <div class="modal-footer">
-                    <button id="proceedPayout" type="button" class="btn btn-success fa fa-paypal"> {{ 'ProceedPayout' | get_plugin_lang('BuyCoursesPlugin') }}</button>
-                    <button id="cancelPayout" type="button" class="btn btn-danger" data-dismiss="modal">{{ 'Cancel' | get_lang }}</button>
-                    <button id="responseButton" type="button" class="btn btn-primary">{{ 'Confirm' | get_lang }}</button>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
-<div>
-    <button id="continuePayout" type="button" class="btn btn-primary fa fa-caret-square-o-right" data-toggle="modal" data-target="#startPayout" data-backdrop="static" data-keyboard="false"> {{ 'ContinuePayout'|get_plugin_lang('BuyCoursesPlugin') }}</button>
-</div>
-
-<script>
-    $(document).ready(function() {
-
-        $("#responseButton").hide();
-
-        $("#checkAll").click(function() {
-            $(':checkbox').prop('checked', this.checked);
-        });
-
-        $('#continuePayout').click(function() {
-
-            var val = [];
-
-            $(':checkbox:checked').not('#checkAll').each(function(i) {
-                val[i] = $(this).attr("id");
-            });
-
-            $.ajax({
-                data: { payouts : val },
-                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'processPayout' } | url_encode() }}',
-                type: 'POST',
-                success: function(response) {
-                    $("#content").html(response);
-                    (jQuery.isEmptyObject(val)) ? $('#proceedPayout').prop( "disabled", true ) : $('#proceedPayout').prop( "disabled", false );
-                }
-            });
-        });
-
-        $('#proceedPayout').click(function() {
-
-            var val = [];
-
-            $(':checkbox:checked').not('#checkAll').each(function(i) {
-                val[i] = $(this).attr("id");
-            });
-
-            $.ajax({
-                data: { payouts : val },
-                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'proceedPayout' } | url_encode() }}',
-                type: 'POST',
-                beforeSend: function() {
-                    $("#proceedPayout").hide();
-                    $("#cancelPayout").hide();
-                    $("#spinner").html('<br /><br /><div class="wobblebar-loader"></div><p> {{ 'ProcessingPayoutsDontCloseThisWindow' | get_plugin_lang('BuyCoursesPlugin') }} </p>');
-                },
-                success: function(response) {
-                    $("#content").html(response);
-                    $("#responseButton").show();
-                }
-            });
-        });
-
-        $(".cancelPayout").click(function() {
-            var id = this.id;
-            $.ajax({
-                data: 'id='+id,
-                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'cancelPayout' } | url_encode() }}',
-                type: 'POST',
-                success: function() {
-                    window.location.reload();
-                }
-            });
-        });
-
-        $('#responseButton').click(function() {
-            window.location.reload();
-        });
-    });
-</script>
+{% autoescape false %}
+<div class="table-responsive">
+    <table class="table table-striped table-hover">
+        <thead>
+            <tr>
+                <th class="text-center"><input type="checkbox" id="checkAll"></th>
+                <th class="text-center">{{ 'OrderReference'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderDate'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-right">{{ 'Commission'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-right">{{ 'PayPalAccount'| get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-right">{{ 'Options'| get_lang }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for payout in payout_list %}
+                <tr style="{{ payout.paypal_account ? '' : 'color: red;' }}">
+                    <td class="text-center" style="vertical-align:middle">{% if payout.paypal_account %} <input id="{{ payout.id }}" type="checkbox" name="data[]" value="{{ payout.commission }}"> {% endif %}</td>
+                    <td class="text-center" style="vertical-align:middle">{{ payout.reference }}</td>
+                    <td class="text-center" style="vertical-align:middle">{{ payout.date }}</td>
+                    <td class="text-right" style="vertical-align:middle">{{  payout.currency ~ ' ' ~ payout.commission }}</td>
+                    {% if payout.paypal_account %}
+                        <td class="text-right" style="vertical-align:middle">{{ payout.paypal_account }}</td>
+                    {% else %}
+                        <td class="text-right" style="vertical-align:middle">{{ 'NoPayPalAccountDetected'| get_plugin_lang('BuyCoursesPlugin') }}</td>
+                    {% endif %}
+                    <td class="text-right" style="vertical-align:middle"><button id="{{ payout.id }}" type="button" class="btn btn-danger fa fa-ban cancelPayout"> {{ 'CancelPayout'| get_plugin_lang('BuyCoursesPlugin') }}</button></td>
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+
+    <div id="startPayout" class="modal fade" role="dialog">
+        <div class="modal-dialog modal-lg">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <h4 class="modal-title">{{ 'PaypalPayoutCommissions'|get_plugin_lang('BuyCoursesPlugin') }}</h4>
+                </div>
+                <div class="modal-body" id="content">
+
+                </div>
+                <div class="modal-footer">
+                    <button id="proceedPayout" type="button" class="btn btn-success fa fa-paypal"> {{ 'ProceedPayout' | get_plugin_lang('BuyCoursesPlugin') }}</button>
+                    <button id="cancelPayout" type="button" class="btn btn-danger" data-dismiss="modal">{{ 'Cancel' | get_lang }}</button>
+                    <button id="responseButton" type="button" class="btn btn-primary">{{ 'Confirm' | get_lang }}</button>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div>
+    <button id="continuePayout" type="button" class="btn btn-primary fa fa-caret-square-o-right" data-toggle="modal" data-target="#startPayout" data-backdrop="static" data-keyboard="false"> {{ 'ContinuePayout'|get_plugin_lang('BuyCoursesPlugin') }}</button>
+</div>
+
+<script>
+    $(document).ready(function() {
+
+        $("#responseButton").hide();
+
+        $("#checkAll").click(function() {
+            $(':checkbox').prop('checked', this.checked);
+        });
+
+        $('#continuePayout').click(function() {
+
+            var val = [];
+
+            $(':checkbox:checked').not('#checkAll').each(function(i) {
+                val[i] = $(this).attr("id");
+            });
+
+            $.ajax({
+                data: { payouts : val },
+                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'processPayout' } | url_encode() }}',
+                type: 'POST',
+                success: function(response) {
+                    $("#content").html(response);
+                    (jQuery.isEmptyObject(val)) ? $('#proceedPayout').prop( "disabled", true ) : $('#proceedPayout').prop( "disabled", false );
+                }
+            });
+        });
+
+        $('#proceedPayout').click(function() {
+            var val = [];
+            $(':checkbox:checked').not('#checkAll').each(function(i) {
+                val[i] = $(this).attr("id");
+            });
+
+            $.ajax({
+                data: { payouts : val },
+                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'proceedPayout' } | url_encode() }}',
+                type: 'POST',
+                beforeSend: function() {
+                    $("#proceedPayout").hide();
+                    $("#cancelPayout").hide();
+                    $("#spinner").html('<br /><br /><div class="wobblebar-loader"></div><p> {{ 'ProcessingPayoutsDontCloseThisWindow' | get_plugin_lang('BuyCoursesPlugin') }} </p>');
+                },
+                success: function(response) {
+                    $("#content").html(response);
+                    $("#responseButton").show();
+                }
+            });
+        });
+
+        $(".cancelPayout").click(function() {
+            var id = this.id;
+            $.ajax({
+                data: 'id='+id,
+                url: '{{ _p.web_plugin ~ 'buycourses/src/buycourses.ajax.php?' ~  { 'a': 'cancelPayout' } | url_encode() }}',
+                type: 'POST',
+                success: function() {
+                    window.location.reload();
+                }
+            });
+        });
+
+        $('#responseButton').click(function() {
+            window.location.reload();
+        });
+    });
+</script>
+{% endautoescape %}

+ 93 - 91
plugin/buycourses/view/process.tpl → plugin/buycourses/view/process.html.twig

@@ -1,91 +1,93 @@
-<div class="row">
-    <div class="col-md-5 panel panel-default buycourse-panel-default">
-        <h3 class="panel-heading">{{ 'PurchaseData'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
-        <legend></legend>
-        <div class="row">
-            {% if buying_course %}
-                <div class="col-sm-6 col-md-5">
-                    <p>
-                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
-                    </p>
-                    <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
-                </div>
-                <div class="col-sm-6 col-md-7">
-                    <h3 class="page-header">{{ course.title }}</h3>
-                    <ul class="items-teacher list-unstyled">
-                        {% for teacher in course.teachers %}
-                            <li><em class="fa fa-user"></em> {{ teacher }}</li>
-                        {% endfor %}
-                    </ul>
-                    <p>
-                        <a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
-                            {{'Description'|get_lang }}
-                        </a>
-                    </p>
-                </div>
-            {% elseif buying_session %}
-                <div class="col-sm-6 col-md-5">
-                    <p>
-                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
-                    </p>
-                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
-                </div>
-                <div class="col-sm-6 col-md-7">
-                    <h3 class="page-header">{{ session.name }}</h3>
-                    <p>{{ session.dates.display }}</p>
-                    <dl>
-                        {% for course in session.courses %}
-                            <dt>{{ course.title }}</dt>
-                            {% for coach in course.coaches %}
-                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
-                            {% endfor %}
-                        {% endfor %}
-                    </dl>
-                </div>
-            {% elseif buying_service %}
-                <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="{{ _p.web }}plugin/buycourses/uploads/services/images/{{ service.image }}">
-                    </a>
-                </div>
-                <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>
-                        {% endif %}
-                        <li><em class="fa fa-money"></em> {{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }} : {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }} / {{ 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>
-                        <li><em class="fa fa-align-justify"></em> {{ service.description }}</li>
-                    </ul>
-                    <p id="n-price" class="lead text-right" style="color: white;"><span class="label label-primary">{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</span></p>
-                    <p id="s-price" class="lead text-right"></p>
-                </div>
-                <script>
-                    $(document).ready(function() {
-
-                        $("label").removeClass('control-label');
-                        $('.form_required').remove();
-                        $("small").remove();
-                        $("label[for=submit]").remove();
-
-                    });
-                </script>
-            {% endif %}
-        </div>
-    </div>
-    <div class="col-md-1">
-    </div>
-    <div class="col-md-6 panel panel-default buycourse-panel-default">
-        <h3 class="panel-heading">{{ 'PaymentMethods' | get_plugin_lang('BuyCoursesPlugin') }}</h3>
-        {{ form }}
-    </div>
-</div>
+{% autoescape false %}
+<div class="row">
+    <div class="col-md-5 panel panel-default buycourse-panel-default">
+        <h3 class="panel-heading">{{ 'PurchaseData'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+        <legend></legend>
+        <div class="row">
+            {% if buying_course %}
+                <div class="col-sm-6 col-md-5">
+                    <p>
+                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
+                    </p>
+                    <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
+                </div>
+                <div class="col-sm-6 col-md-7">
+                    <h3 class="page-header">{{ course.title }}</h3>
+                    <ul class="items-teacher list-unstyled">
+                        {% for teacher in course.teachers %}
+                            <li><em class="fa fa-user"></em> {{ teacher }}</li>
+                        {% endfor %}
+                    </ul>
+                    <p>
+                        <a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
+                            {{'Description'|get_lang }}
+                        </a>
+                    </p>
+                </div>
+            {% elseif buying_session %}
+                <div class="col-sm-6 col-md-5">
+                    <p>
+                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
+                    </p>
+                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
+                </div>
+                <div class="col-sm-6 col-md-7">
+                    <h3 class="page-header">{{ session.name }}</h3>
+                    <p>{{ session.dates.display }}</p>
+                    <dl>
+                        {% for course in session.courses %}
+                            <dt>{{ course.title }}</dt>
+                            {% for coach in course.coaches %}
+                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
+                            {% endfor %}
+                        {% endfor %}
+                    </dl>
+                </div>
+            {% elseif buying_service %}
+                <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="{{ _p.web }}plugin/buycourses/uploads/services/images/{{ service.image }}">
+                    </a>
+                </div>
+                <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>
+                        {% endif %}
+                        <li><em class="fa fa-money"></em> {{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }} : {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }} / {{ 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>
+                        <li><em class="fa fa-align-justify"></em> {{ service.description }}</li>
+                    </ul>
+                    <p id="n-price" class="lead text-right" style="color: white;"><span class="label label-primary">{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</span></p>
+                    <p id="s-price" class="lead text-right"></p>
+                </div>
+                <script>
+                    $(document).ready(function() {
+
+                        $("label").removeClass('control-label');
+                        $('.form_required').remove();
+                        $("small").remove();
+                        $("label[for=submit]").remove();
+
+                    });
+                </script>
+            {% endif %}
+        </div>
+    </div>
+    <div class="col-md-1">
+    </div>
+    <div class="col-md-6 panel panel-default buycourse-panel-default">
+        <h3 class="panel-heading">{{ 'PaymentMethods' | get_plugin_lang('BuyCoursesPlugin') }}</h3>
+        {{ form }}
+    </div>
+</div>
+{% endautoescape %}

+ 113 - 111
plugin/buycourses/view/process_confirm.tpl → plugin/buycourses/view/process_confirm.html.twig

@@ -1,111 +1,113 @@
-<div class="row">
-    <div class="col-sm-6 col-md-5">
-        <h3 class="page-header">{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
-        <dl class="dl-horizontal">
-            <dt>{{ 'Name'|get_lang }}<dt>
-            <dd>{{ user.complete_name }}</dd>
-            <dt>{{ 'Username'|get_lang }}<dt>
-            <dd>{{ user.username }}</dd>
-            <dt>{{ 'EmailAddress'|get_lang }}<dt>
-            <dd>{{ user.email }}</dd>
-        </dl>
-    </div>
-    <div class="col-sm-6 col-md-7">
-        {% if buying_course %}
-            <div class="row">
-                <div class="col-sm-6 col-md-5">
-                    <p>
-                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
-                    </p>
-                    <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
-                </div>
-                <div class="col-sm-6 col-md-7">
-                    <h3 class="page-header">{{ course.title }}</h3>
-                    <ul class="items-teacher list-unstyled">
-                        {% for teacher in course.teachers %}
-                            <li><em class="fa fa-user"></em> {{ teacher }}</li>
-                        {% endfor %}
-                    </ul>
-                    <p>
-                        <a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
-                            {{'Description'|get_lang }}
-                        </a>
-                    </p>
-                </div>
-            </div>
-        {% elseif buying_session %}
-            <h3 class="page-header">{{ session.name }}</h3>
-            <div class="row">
-                <div class="col-sm-12 col-md-5">
-                    <p>
-                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
-                    </p>
-                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
-                </div>
-                <div class="col-sm-12 col-md-7">
-                    <p>{{ session.dates.display }}</p>
-                    <dl>
-                        {% for course in session.courses %}
-                            <dt>{{ course.title }}</dt>
-                            {% for coach in course.coaches %}
-                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
-                            {% endfor %}
-                        {% endfor %}
-                    </dl>
-                </div>
-            </div>
-        {% elseif buying_service %}
-            <h3 class="page-header">{{ service.service.name }}</h3>
-            <div class="row">
-                <div class="col-sm-12 col-md-5">
-                    <p>
-                        {% if service.node_type == 0 %}
-                            <img alt="{{ service.service.name }}" class="img-responsive" src="{{ 'session_default.png'|icon() }}">
-                        {% elseif service.node_type == 1 %}
-                            <img alt="{{ service.service.name }}" class="img-responsive" style="margin: auto;" src="{{ _p.web }}plugin/buycourses/resources/img/bc-user.png">
-                        {% elseif service.node_type == 2 %}
-                            <img alt="{{ service.service.name }}" class="img-responsive" style="margin: auto;" src="{{ _p.web }}plugin/buycourses/resources/img/bc-course.png">
-                        {% elseif service.node_type == 3 %}
-                            <img alt="{{ service.service.name }}" class="img-responsive" style="margin: auto;" src="{{ _p.web }}plugin/buycourses/resources/img/bc-session.png">
-                        {% endif %}
-                    </p>
-                    <p class="lead text-right">{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</p>
-                </div>
-                <div class="col-sm-12 col-md-7">
-                    <p><b>{{ 'StartDate'|get_plugin_lang('BuyCoursesPlugin') }}</b></p>
-                    <li>{{ service.date_start | format_date() }}</li>
-                    <p><b>{{ 'EndDate'|get_plugin_lang('BuyCoursesPlugin') }}</b></p>
-                    <li>{{ service.date_end | format_date() }}</li>
-                </div>
-            </div>
-        {% endif %}
-    </div>
-</div>
-<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>
-
-{{ form }}
+{% autoescape false %}
+<div class="row">
+    <div class="col-sm-6 col-md-5">
+        <h3 class="page-header">{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+        <dl class="dl-horizontal">
+            <dt>{{ 'Name'|get_lang }}<dt>
+            <dd>{{ user.complete_name }}</dd>
+            <dt>{{ 'Username'|get_lang }}<dt>
+            <dd>{{ user.username }}</dd>
+            <dt>{{ 'EmailAddress'|get_lang }}<dt>
+            <dd>{{ user.email }}</dd>
+        </dl>
+    </div>
+    <div class="col-sm-6 col-md-7">
+        {% if buying_course %}
+            <div class="row">
+                <div class="col-sm-6 col-md-5">
+                    <p>
+                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
+                    </p>
+                    <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
+                </div>
+                <div class="col-sm-6 col-md-7">
+                    <h3 class="page-header">{{ course.title }}</h3>
+                    <ul class="items-teacher list-unstyled">
+                        {% for teacher in course.teachers %}
+                            <li><em class="fa fa-user"></em> {{ teacher }}</li>
+                        {% endfor %}
+                    </ul>
+                    <p>
+                        <a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
+                            {{'Description'|get_lang }}
+                        </a>
+                    </p>
+                </div>
+            </div>
+        {% elseif buying_session %}
+            <h3 class="page-header">{{ session.name }}</h3>
+            <div class="row">
+                <div class="col-sm-12 col-md-5">
+                    <p>
+                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
+                    </p>
+                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
+                </div>
+                <div class="col-sm-12 col-md-7">
+                    <p>{{ session.dates.display }}</p>
+                    <dl>
+                        {% for course in session.courses %}
+                            <dt>{{ course.title }}</dt>
+                            {% for coach in course.coaches %}
+                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
+                            {% endfor %}
+                        {% endfor %}
+                    </dl>
+                </div>
+            </div>
+        {% elseif buying_service %}
+            <h3 class="page-header">{{ service.service.name }}</h3>
+            <div class="row">
+                <div class="col-sm-12 col-md-5">
+                    <p>
+                        {% if service.node_type == 0 %}
+                            <img alt="{{ service.service.name }}" class="img-responsive" src="{{ 'session_default.png'|icon() }}">
+                        {% elseif service.node_type == 1 %}
+                            <img alt="{{ service.service.name }}" class="img-responsive" style="margin: auto;" src="{{ _p.web }}plugin/buycourses/resources/img/bc-user.png">
+                        {% elseif service.node_type == 2 %}
+                            <img alt="{{ service.service.name }}" class="img-responsive" style="margin: auto;" src="{{ _p.web }}plugin/buycourses/resources/img/bc-course.png">
+                        {% elseif service.node_type == 3 %}
+                            <img alt="{{ service.service.name }}" class="img-responsive" style="margin: auto;" src="{{ _p.web }}plugin/buycourses/resources/img/bc-session.png">
+                        {% endif %}
+                    </p>
+                    <p class="lead text-right">{{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</p>
+                </div>
+                <div class="col-sm-12 col-md-7">
+                    <p><b>{{ 'StartDate'|get_plugin_lang('BuyCoursesPlugin') }}</b></p>
+                    <li>{{ service.date_start | format_date() }}</li>
+                    <p><b>{{ 'EndDate'|get_plugin_lang('BuyCoursesPlugin') }}</b></p>
+                    <li>{{ service.date_end | format_date() }}</li>
+                </div>
+            </div>
+        {% endif %}
+    </div>
+</div>
+<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>
+
+{{ form }}
+{% endautoescape %}

+ 81 - 80
plugin/buycourses/view/sales_report.tpl → plugin/buycourses/view/sales_report.html.twig

@@ -1,80 +1,81 @@
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-<ul class="nav nav-tabs buy-courses-sessions-tabs" role="tablist">
-    <li id="buy-courses-sessions-tab" class="active" 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 %}
-</ul>
-</br>
-</br>
-{{ form }}
-
-<div class="table-responsive">
-    <table class="table table-striped table-hover">
-        <thead>
-            <tr>
-                <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'OrderStatus'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'PaymentMethod'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'ProductType'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th>{{ 'Name'|get_lang }}</th>
-                <th>{{ 'UserName'|get_lang }}</th>
-                <th class="text-center">{{ 'Options'|get_lang }}</th>
-            </tr>
-        </thead>
-        <tbody>
-            {% for sale in sale_list %}
-                <tr {{ sale.id == selected_sale ? 'class="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 }}</td>
-                    <td class="text-center">{{ sale.payment_type }}</td>
-                    <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
-                    <td class="text-center">{{ sale.product_type }}</td>
-                    <td>{{ sale.product_name }}</td>
-                    <td>{{ sale.complete_user_name }}</td>
-                    <td class="text-center">
-                        {% if sale.status == sale_status_pending %}
-                            <a href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'confirm'}|url_encode() }}" class="btn btn-success btn-sm">
-                                <em class="fa fa-user-plus fa-fw"></em> {{ 'SubscribeUser'|get_plugin_lang('BuyCoursesPlugin') }}
-                            </a>
-                            <a href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'cancel'}|url_encode() }}" class="btn btn-danger btn-sm">
-                                <em class="fa fa-times fa-fw"></em> {{ 'DeleteOrder'|get_plugin_lang('BuyCoursesPlugin') }}
-                            </a>
-                        {% endif %}
-                    </td>
-                </tr>
-            {% endfor %}
-        </tbody>
-    </table>
-</div>
-
-<script>
-    $(document).on('ready', function () {
-        $('[name="filter_type"]').on('change', function () {
-            var self = $(this);
-
-            if (self.val() === '0') {
-                $('#report-by-user').hide();
-                $('#report-by-status').show();
-            } else {
-                $('#report-by-status').hide();
-                $('#report-by-user').show();
-            }
-        });
-    });
-</script>
+{% autoescape false %}
+<ul class="nav nav-tabs buy-courses-sessions-tabs" role="tablist">
+    <li id="buy-courses-sessions-tab" class="active" 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 %}
+</ul>
+</br>
+</br>
+{{ form }}
+
+<div class="table-responsive">
+    <table class="table table-striped table-hover">
+        <thead>
+            <tr>
+                <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderStatus'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'PaymentMethod'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'ProductType'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th>{{ 'Name'|get_lang }}</th>
+                <th>{{ 'UserName'|get_lang }}</th>
+                <th class="text-center">{{ 'Options'|get_lang }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for sale in sale_list %}
+                <tr {{ sale.id == selected_sale ? 'class="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 }}</td>
+                    <td class="text-center">{{ sale.payment_type }}</td>
+                    <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
+                    <td class="text-center">{{ sale.product_type }}</td>
+                    <td>{{ sale.product_name }}</td>
+                    <td>{{ sale.complete_user_name }}</td>
+                    <td class="text-center">
+                        {% if sale.status == sale_status_pending %}
+                            <a href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'confirm'}|url_encode() }}" class="btn btn-success btn-sm">
+                                <em class="fa fa-user-plus fa-fw"></em> {{ 'SubscribeUser'|get_plugin_lang('BuyCoursesPlugin') }}
+                            </a>
+                            <a href="{{ _p.web_self ~ '?' ~ {'order': sale.id, 'action': 'cancel'}|url_encode() }}" class="btn btn-danger btn-sm">
+                                <em class="fa fa-times fa-fw"></em> {{ 'DeleteOrder'|get_plugin_lang('BuyCoursesPlugin') }}
+                            </a>
+                        {% endif %}
+                    </td>
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+</div>
+
+<script>
+    $(document).on('ready', function () {
+        $('[name="filter_type"]').on('change', function () {
+            var self = $(this);
+
+            if (self.val() === '0') {
+                $('#report-by-user').hide();
+                $('#report-by-status').show();
+            } else {
+                $('#report-by-status').hide();
+                $('#report-by-user').show();
+            }
+        });
+    });
+</script>
+{% endautoescape %}

+ 79 - 80
plugin/buycourses/view/service_information.tpl → plugin/buycourses/view/service_information.html.twig

@@ -1,80 +1,79 @@
-<link rel="stylesheet" type="text/css" href="{{ _p.web_plugin ~ 'buycourses/resources/css/style.css' }}"/>
-
-<div id="service-information">
-
-    <div class="row">
-        <div class="col-xs-12">
-            <h3 class="text-uppercase buy-courses-title-color">{{ service.name }}</h3>
-        </div>
-
-        {% if service.video_url %}
-            <div class="col-sm-6 col-md-7 col-xs-12">
-                <div class="embed-responsive embed-responsive-16by9">
-                    {{ essence.replace(service.video_url) }}
-                </div>
-            </div>
-        {% endif %}
-
-        <div class="{{ service.video_url ? 'col-sm-6 col-md-5 col-xs-12' : 'col-sm-12 col-xs-12' }}">
-            <div class="block">
-                <div class="panel panel-default">
-                    <div class="panel-heading">
-                        <h4>{{ "Description"|get_lang }}</h4>
-                    </div>
-                    <div class="panel-body">
-                        <p><em class="fa fa-flag-o"></em> <b>{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }}</b> :
-                            {% if service.applies_to == 1 %}
-                                {{ 'User' | get_lang }}
-                            {% elseif service.applies_to == 2 %}
-                                {{ 'Course' | get_lang }}
-                            {% elseif service.applies_to == 3 %}
-                                {{ 'Session' | get_lang }}
-                            {% endif %}
-                        </p>
-                        <p><em class="fa fa-money"></em> <b>{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</b> : {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</p>
-                        <p><em class="fa fa-align-justify"></em> <b>{{ 'Details' | get_lang }}</b> : {{ service.description }}</p>
-                        <div class="text-right" style="padding-bottom: 20px;">
-                            <a href="{{ _p.web_plugin ~ 'buycourses/src/service_process.php?t=4&i=' ~ service.id }}" class="btn btn-success btn-lg">
-                                <em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
-                            </a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-    </br>
-    </br>
-    <div class="row info-course">
-        <div class="col-xs-12 col-md-7">
-            <div class="panel panel-default">
-                <div class="panel-heading">
-                    <h4>{{ 'ServiceInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h4>
-                </div>
-                <div class="panel-body">
-                    {{ service.service_information }}
-                </div>
-            </div>
-        </div>
-        <div class="col-xs-12 col-md-5">
-            <div class="panel panel-default social-share">
-                <div class="panel-heading">
-                    <h4>{{ "ShareWithYourFriends"|get_lang }}</h4>
-                </div>
-                <div class="panel-body">
-                    <div class="icons-social text-center">
-                        <a href="https://www.facebook.com/sharer/sharer.php?{{ {'u': pageUrl}|url_encode }}" target="_blank" class="btn bnt-link btn-lg">
-                            <em class="fa fa-facebook fa-2x"></em>
-                        </a>
-                        <a href="https://twitter.com/home?{{ {'status': session.getName() ~ ' ' ~ pageUrl}|url_encode }}" target="_blank" class="btn bnt-link btn-lg">
-                            <em class="fa fa-twitter fa-2x"></em>
-                        </a>
-                        <a href="https://www.linkedin.com/shareArticle?{{ {'mini': 'true', 'url': pageUrl, 'title': session.getName() }|url_encode }}" target="_blank" class="btn bnt-link btn-lg">
-                            <em class="fa fa-linkedin fa-2x"></em>
-                        </a>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
+{% autoescape false %}
+<div id="service-information">
+    <div class="row">
+        <div class="col-xs-12">
+            <h3 class="text-uppercase buy-courses-title-color">{{ service.name }}</h3>
+        </div>
+
+        {% if service.video_url %}
+            <div class="col-sm-6 col-md-7 col-xs-12">
+                <div class="embed-responsive embed-responsive-16by9">
+                    {{ essence.replace(service.video_url) }}
+                </div>
+            </div>
+        {% endif %}
+
+        <div class="{{ service.video_url ? 'col-sm-6 col-md-5 col-xs-12' : 'col-sm-12 col-xs-12' }}">
+            <div class="block">
+                <div class="panel panel-default">
+                    <div class="panel-heading">
+                        <h4>{{ "Description"|get_lang }}</h4>
+                    </div>
+                    <div class="panel-body">
+                        <p><em class="fa fa-flag-o"></em> <b>{{ 'AppliesTo'|get_plugin_lang('BuyCoursesPlugin') }}</b> :
+                            {% if service.applies_to == 1 %}
+                                {{ 'User' | get_lang }}
+                            {% elseif service.applies_to == 2 %}
+                                {{ 'Course' | get_lang }}
+                            {% elseif service.applies_to == 3 %}
+                                {{ 'Session' | get_lang }}
+                            {% endif %}
+                        </p>
+                        <p><em class="fa fa-money"></em> <b>{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</b> : {{ service.currency == 'BRL' ? 'R$' : service.currency }} {{ service.price }}</p>
+                        <p><em class="fa fa-align-justify"></em> <b>{{ 'Details' | get_lang }}</b> : {{ service.description }}</p>
+                        <div class="text-right" style="padding-bottom: 20px;">
+                            <a href="{{ _p.web_plugin ~ 'buycourses/src/service_process.php?t=4&i=' ~ service.id }}" class="btn btn-success btn-lg">
+                                <em class="fa fa-shopping-cart"></em> {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
+                            </a>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    </br>
+    </br>
+    <div class="row info-course">
+        <div class="col-xs-12 col-md-7">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h4>{{ 'ServiceInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h4>
+                </div>
+                <div class="panel-body">
+                    {{ service.service_information }}
+                </div>
+            </div>
+        </div>
+        <div class="col-xs-12 col-md-5">
+            <div class="panel panel-default social-share">
+                <div class="panel-heading">
+                    <h4>{{ "ShareWithYourFriends"|get_lang }}</h4>
+                </div>
+                <div class="panel-body">
+                    <div class="icons-social text-center">
+                        <a href="https://www.facebook.com/sharer/sharer.php?{{ {'u': pageUrl}|url_encode }}" target="_blank" class="btn bnt-link btn-lg">
+                            <em class="fa fa-facebook fa-2x"></em>
+                        </a>
+                        <a href="https://twitter.com/home?{{ {'status': session.getName() ~ ' ' ~ pageUrl}|url_encode }}" target="_blank" class="btn bnt-link btn-lg">
+                            <em class="fa fa-twitter fa-2x"></em>
+                        </a>
+                        <a href="https://www.linkedin.com/shareArticle?{{ {'mini': 'true', 'url': pageUrl, 'title': session.getName() }|url_encode }}" target="_blank" class="btn bnt-link btn-lg">
+                            <em class="fa fa-linkedin fa-2x"></em>
+                        </a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+{% endautoescape %}

+ 97 - 98
plugin/buycourses/view/service_sales_report.tpl → plugin/buycourses/view/service_sales_report.html.twig

@@ -1,98 +1,97 @@
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-<script type="text/javascript" src="../resources/js/modals.js"></script>
-
-<ul class="nav nav-tabs buy-courses-sessions-tabs" role="tablist">
-    <li id="buy-courses-sessions-tab" class="" role="presentation">
-        <a href="sales_report.php" aria-controls="buy-courses_sessions" role="tab">{{ 'CourseSessionBlock'|get_lang }}</a>
-    </li>
-    <li id="buy-services-tab" class="active" role="presentation">
-        <a href="service_sales_report.php" aria-controls="buy-services" role="tab">{{ 'Services'|get_plugin_lang('BuyCoursesPlugin') }}</a>
-    </li>
-</ul>
-</br>
-</br>
-<div class="row">
-    <div class="col-md-3 col-sm-12 col-xs-12">
-        <h4><b>{{ 'Filter' | get_lang }}</b></h4>
-        {{ form }}
-    </div>
-    <div class="col-md-9 col-sm-12 col-xs-12">
-        <div class="table-responsive">
-            <table class="table table-striped table-hover">
-                <thead>
-                <tr>
-                    <th class="text-center">{{ 'ServiceName'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-center">{{ 'OrderStatus'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-right">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                    <th class="text-center">{{ 'ServiceSaleInfo'|get_plugin_lang('BuyCoursesPlugin')  }}</th>
-                </tr>
-                </thead>
-                <tbody>
-                {% for sale in sale_list %}
-                    <tr>
-                        <td class="text-center">{{ sale.service_name }}</td>
-                        <td class="text-center">{{ sale.reference }}</td>
-                        <td class="text-center">
-                            {% if sale.status == sale_status_cancelled %}
-                                {{ 'SaleStatusCancelled'|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 }}</td>
-                        <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
-                        <td class="text-center">
-                            <a id="service_sale_info" tag="{{ sale.id }}" name="s_{{ sale.id }}" class="btn btn-info btn-sm">{{ 'Info' | get_lang }}</a>
-                        </td>
-                    </tr>
-                {% endfor %}
-                </tbody>
-            </table>
-        </div>
-    </div>
-</div>
-
-<script>
-    $(document).on('ready', function () {
-        $("td a").click(function() {
-            var id = $(this).attr('tag');
-            var action = $(this).attr('id');
-            $.ajax({
-                data: 'id='+id,
-                url: '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a='+action,
-                type: 'POST',
-                beforeSend: function() {
-                    if (action == 'renewable_info') {
-                        $('a[name=r_'+id+']').html('<em class="fa fa-spinner fa-pulse"></em> {{ 'Loading' | get_lang }}');
-                    } else if (action == 'service_sale_info') {
-                        $('a[name=s_'+id+']').html('<em class="fa fa-spinner fa-pulse"></em> {{ 'Loading' | get_lang }}');
-                    }
-                },
-                success: function(response) {
-                    $('a[name=r_'+id+']').html('{{ 'Info' | get_lang }}');
-                    $('a[name=s_'+id+']').html('{{ 'Info' | get_lang }}');
-                    var title = "";
-                    if (action == "renewable_info") {
-                        title = "{{ 'RecurringPaymentProfilePaypalInformation' | get_plugin_lang('BuyCoursesPlugin') }}";
-                    } else if (action == 'service_sale_info') {
-                        title = "{{ 'ServiceSaleInfo' | get_plugin_lang('BuyCoursesPlugin') }}";
-                    }
-                    bootbox.dialog({
-                        message: response,
-                        title: title,
-                        buttons: {
-                            main: {
-                                label: "{{ 'Close' | get_lang }}",
-                                className: "btn-default"
-                            }
-                        }
-                    });
-                }
-            })
-        });
-    });
-</script>
+{% autoescape false %}
+<ul class="nav nav-tabs buy-courses-sessions-tabs" role="tablist">
+    <li id="buy-courses-sessions-tab" class="" role="presentation">
+        <a href="sales_report.php" aria-controls="buy-courses_sessions" role="tab">{{ 'CourseSessionBlock'|get_lang }}</a>
+    </li>
+    <li id="buy-services-tab" class="active" role="presentation">
+        <a href="service_sales_report.php" aria-controls="buy-services" role="tab">{{ 'Services'|get_plugin_lang('BuyCoursesPlugin') }}</a>
+    </li>
+</ul>
+</br>
+</br>
+<div class="row">
+    <div class="col-md-3 col-sm-12 col-xs-12">
+        <h4><b>{{ 'Filter' | get_lang }}</b></h4>
+        {{ form }}
+    </div>
+    <div class="col-md-9 col-sm-12 col-xs-12">
+        <div class="table-responsive">
+            <table class="table table-striped table-hover">
+                <thead>
+                <tr>
+                    <th class="text-center">{{ 'ServiceName'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-center">{{ 'OrderStatus'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-right">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                    <th class="text-center">{{ 'ServiceSaleInfo'|get_plugin_lang('BuyCoursesPlugin')  }}</th>
+                </tr>
+                </thead>
+                <tbody>
+                {% for sale in sale_list %}
+                    <tr>
+                        <td class="text-center">{{ sale.service_name }}</td>
+                        <td class="text-center">{{ sale.reference }}</td>
+                        <td class="text-center">
+                            {% if sale.status == sale_status_cancelled %}
+                                {{ 'SaleStatusCancelled'|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 }}</td>
+                        <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
+                        <td class="text-center">
+                            <a id="service_sale_info" tag="{{ sale.id }}" name="s_{{ sale.id }}" class="btn btn-info btn-sm">{{ 'Info' | get_lang }}</a>
+                        </td>
+                    </tr>
+                {% endfor %}
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>
+
+<script>
+    $(document).on('ready', function () {
+        $("td a").click(function() {
+            var id = $(this).attr('tag');
+            var action = $(this).attr('id');
+            $.ajax({
+                data: 'id='+id,
+                url: '{{ _p.web_plugin }}buycourses/src/buycourses.ajax.php?a='+action,
+                type: 'POST',
+                beforeSend: function() {
+                    if (action == 'renewable_info') {
+                        $('a[name=r_'+id+']').html('<em class="fa fa-spinner fa-pulse"></em> {{ 'Loading' | get_lang }}');
+                    } else if (action == 'service_sale_info') {
+                        $('a[name=s_'+id+']').html('<em class="fa fa-spinner fa-pulse"></em> {{ 'Loading' | get_lang }}');
+                    }
+                },
+                success: function(response) {
+                    $('a[name=r_'+id+']').html('{{ 'Info' | get_lang }}');
+                    $('a[name=s_'+id+']').html('{{ 'Info' | get_lang }}');
+                    var title = "";
+                    if (action == "renewable_info") {
+                        title = "{{ 'RecurringPaymentProfilePaypalInformation' | get_plugin_lang('BuyCoursesPlugin') }}";
+                    } else if (action == 'service_sale_info') {
+                        title = "{{ 'ServiceSaleInfo' | get_plugin_lang('BuyCoursesPlugin') }}";
+                    }
+                    bootbox.dialog({
+                        message: response,
+                        title: title,
+                        buttons: {
+                            main: {
+                                label: "{{ 'Close' | get_lang }}",
+                                className: "btn-default"
+                            }
+                        }
+                    });
+                }
+            })
+        });
+    });
+</script>
+{% endautoescape %}

+ 40 - 43
plugin/buycourses/view/session_panel.tpl → plugin/buycourses/view/session_panel.html.twig

@@ -1,43 +1,40 @@
-<link rel="stylesheet" type="text/css" href="../resources/css/style.css"/>
-
-<div id="buy-courses-tabs">
-    
-    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
-        <li id="buy-courses-tab" class="" role="presentation">
-            <a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
-        </li>
-        {% if sessions_are_included %}
-            <li id="buy-sessions-tab" class="active" role="presentation">
-                <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
-            </li>
-        {% endif %}
-        <li id="buy-courses-tab" class="" role="presentation">
-            <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
-        </li>
-    </ul>
-        
-    <table class="table table-striped table-hover">
-        <thead>
-            <tr>
-                <th>{{ 'Session'|get_lang }}</th>
-                <th class="text-center">{{ 'PaymentMethod'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-                <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
-            </tr>
-        </thead>
-        <tbody>
-            {% for sale in sale_list %}
-                <tr>
-                    <td>{{ sale.product_name }}</td>
-                    <td class="text-center">{{ sale.payment_type }}</td>
-                    <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
-                    <td class="text-center">{{ sale.date }}</td>
-                    <td class="text-center">{{ sale.reference }}</td>
-                </tr>
-            {% endfor %}
-        </tbody>
-    </table>
-
-  
-</div>
+{% autoescape false %}
+<div id="buy-courses-tabs">
+    <ul class="nav nav-tabs buy-courses-tabs" role="tablist">
+        <li id="buy-courses-tab" class="" role="presentation">
+            <a href="course_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyCourses'| get_lang }}</a>
+        </li>
+        {% if sessions_are_included %}
+            <li id="buy-sessions-tab" class="active" role="presentation">
+                <a href="session_panel.php" aria-controls="buy-sessions" role="tab">{{ 'MySessions'| get_lang }}</a>
+            </li>
+        {% endif %}
+        <li id="buy-courses-tab" class="" role="presentation">
+            <a href="payout_panel.php" aria-controls="buy-courses" role="tab">{{ 'MyPayouts'| get_plugin_lang('BuyCoursesPlugin') }}</a>
+        </li>
+    </ul>
+
+    <table class="table table-striped table-hover">
+        <thead>
+            <tr>
+                <th>{{ 'Session'|get_lang }}</th>
+                <th class="text-center">{{ 'PaymentMethod'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderDate'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+                <th class="text-center">{{ 'OrderReference'|get_plugin_lang('BuyCoursesPlugin') }}</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for sale in sale_list %}
+                <tr>
+                    <td>{{ sale.product_name }}</td>
+                    <td class="text-center">{{ sale.payment_type }}</td>
+                    <td class="text-right">{{ sale.currency ~ ' ' ~ sale.price }}</td>
+                    <td class="text-center">{{ sale.date }}</td>
+                    <td class="text-center">{{ sale.reference }}</td>
+                </tr>
+            {% endfor %}
+        </tbody>
+    </table>
+</div>
+{% endautoescape %}

+ 66 - 64
plugin/buycourses/view/success.tpl → plugin/buycourses/view/success.html.twig

@@ -1,64 +1,66 @@
-<div class="alert alert-info">
-    {{ 'PayPalPaymentOKPleaseConfirm'|get_plugin_lang('BuyCoursesPlugin') }}
-</div>
-<div class="row">
-    <div class="col-sm-6 col-md-5">
-        <h3 class="page-header">{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
-        <dl class="dl-horizontal">
-            <dt>{{ 'Name'|get_lang }}<dt>
-            <dd>{{ user.complete_name }}</dd>
-            <dt>{{ 'Username'|get_lang }}<dt>
-            <dd>{{ user.username }}</dd>
-            <dt>{{ 'EmailAddress'|get_lang }}<dt>
-            <dd>{{ user.email }}</dd>
-        </dl>
-    </div>
-    <div class="col-sm-6 col-md-7">
-        {% if buying_course %}
-            <div class="row">
-                <div class="col-sm-6 col-md-5">
-                    <p>
-                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
-                    </p>
-                    <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
-                </div>
-                <div class="col-sm-6 col-md-7">
-                    <h3 class="page-header">{{ course.title }}</h3>
-                    <ul class="items-teacher list-unstyled">
-                        {% for teacher in course.teachers %}
-                            <li><em class="fa fa-user"></em> {{ teacher }}</li>
-                        {% endfor %}
-                    </ul>
-                    <p>
-                        <a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
-                            {{'Description'|get_lang }}
-                        </a>
-                    </p>
-                </div>
-            </div>
-        {% elseif buying_session %}
-            <h3 class="page-header">{{ session.name }}</h3>
-            <div class="row">
-                <div class="col-sm-12 col-md-5">
-                    <p>
-                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
-                    </p>
-                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
-                </div>
-                <div class="col-sm-12 col-md-7">
-                    <p>{{ session.dates.display }}</p>
-                    <dl>
-                        {% for course in session.courses %}
-                            <dt>{{ course.title }}</dt>
-                            {% for coach in course.coaches %}
-                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
-                            {% endfor %}
-                        {% endfor %}
-                    </dl>
-                </div>
-            </div>
-        {% endif %}
-    </div>
-</div>
-    
-{{ form }}
+{% autoescape false %}
+<div class="alert alert-info">
+    {{ 'PayPalPaymentOKPleaseConfirm'|get_plugin_lang('BuyCoursesPlugin') }}
+</div>
+<div class="row">
+    <div class="col-sm-6 col-md-5">
+        <h3 class="page-header">{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+        <dl class="dl-horizontal">
+            <dt>{{ 'Name'|get_lang }}<dt>
+            <dd>{{ user.complete_name }}</dd>
+            <dt>{{ 'Username'|get_lang }}<dt>
+            <dd>{{ user.username }}</dd>
+            <dt>{{ 'EmailAddress'|get_lang }}<dt>
+            <dd>{{ user.email }}</dd>
+        </dl>
+    </div>
+    <div class="col-sm-6 col-md-7">
+        {% if buying_course %}
+            <div class="row">
+                <div class="col-sm-6 col-md-5">
+                    <p>
+                        <img alt="{{ course.title }}" class="img-responsive" src="{{ course.course_img ? course.course_img : 'session_default.png'|icon() }}">
+                    </p>
+                    <p class="lead text-right">{{ course.currency }} {{ course.price }}</p>
+                </div>
+                <div class="col-sm-6 col-md-7">
+                    <h3 class="page-header">{{ course.title }}</h3>
+                    <ul class="items-teacher list-unstyled">
+                        {% for teacher in course.teachers %}
+                            <li><em class="fa fa-user"></em> {{ teacher }}</li>
+                        {% endfor %}
+                    </ul>
+                    <p>
+                        <a class="ajax btn btn-primary btn-sm" data-title="{{ course.title }}" href="{{ _p.web_ajax ~ 'course_home.ajax.php?' ~ {'a': 'show_course_information', 'code': course.code}|url_encode() }}">
+                            {{'Description'|get_lang }}
+                        </a>
+                    </p>
+                </div>
+            </div>
+        {% elseif buying_session %}
+            <h3 class="page-header">{{ session.name }}</h3>
+            <div class="row">
+                <div class="col-sm-12 col-md-5">
+                    <p>
+                        <img alt="{{ session.name }}" class="img-responsive" src="{{ session.image ? session.image : 'session_default.png'|icon() }}">
+                    </p>
+                    <p class="lead text-right">{{ session.currency }} {{ session.price }}</p>
+                </div>
+                <div class="col-sm-12 col-md-7">
+                    <p>{{ session.dates.display }}</p>
+                    <dl>
+                        {% for course in session.courses %}
+                            <dt>{{ course.title }}</dt>
+                            {% for coach in course.coaches %}
+                                <dd><em class="fa fa-user fa-fw"></em> {{ coach }}</dd>
+                            {% endfor %}
+                        {% endfor %}
+                    </dl>
+                </div>
+            </div>
+        {% endif %}
+    </div>
+</div>
+
+{{ form }}
+{% endautoescape %}

+ 0 - 11
plugin/customfooter/install.php

@@ -1,16 +1,5 @@
 <?php
-/* PHP code to install the plugin
- * For example:
- *
-    // To query something to the database
 
-    $table = Database::get_main_table(TABLE_MAIN_USER); // TABLE_MAIN_USER is a constant check the main/inc/database.constants.inc.php
-    $sql = "SELECT firstname, lastname FROM $table_users ";
-    $users = Database::query($sql);
-
-    You can also use the Chamilo classes
-    $users = UserManager::get_user_list();
- */
 global $_configuration;
 
 api_add_setting(

+ 23 - 11
plugin/customfooter/lib/customfooter_plugin.class.php

@@ -7,37 +7,49 @@
  * @license GNU General Public License - http://www.gnu.org/copyleft/gpl.html
  * @author Valery Fremaux <valery.fremaux@gmail.com>
  */
-class CustomFooterPlugin extends Plugin {
-
+class CustomFooterPlugin extends Plugin
+{
     /**
      *
-     * @return CustomFooterPlugin 
+     * @return CustomFooterPlugin
      */
-    static function create() {
+    static function create()
+    {
         static $result = null;
+
         return $result ? $result : $result = new self();
     }
-    
-    function get_name() {
+
+    function get_name()
+    {
         return 'customfooter';
     }
 
-    protected function __construct() {
+    protected function __construct()
+    {
         parent::__construct('1.1', 'Valery Fremaux');
     }
 
-	function pix_url($pixname, $size = 16) {
+    function pix_url($pixname, $size = 16)
+    {
         global $_configuration;
 
-        if (file_exists($_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.png')){
+        if (file_exists(
+            $_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.png'
+        )) {
             return $_configuration['root_web'].'/plugin/customplugin/pix/'.$pixname.'.png';
         }
-        if (file_exists($_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.jpg')){
+        if (file_exists(
+            $_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.jpg'
+        )) {
             return $_configuration['root_web'].'/plugin/customplugin/pix/'.$pixname.'.jpg';
         }
-        if (file_exists($_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.gif')){
+        if (file_exists(
+            $_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.gif'
+        )) {
             return $_configuration['root_web'].'/plugin/customplugin/pix/'.$pixname.'.gif';
         }
+
         return $_configuration['root_web'].'/main/img/icons/'.$size.'/'.$pixname.'.png';
     }
 }

+ 11 - 11
plugin/show_user_info/template.tpl

@@ -1,21 +1,21 @@
 {#
     This is a Chamilo plugin using Twig you can use these handy shorcuts like:
-    
-    1. Shortcuts 
-    
+
+    1. Shortcuts
+
     _p = url chamilo paths
     _u = user information of the current user
-    
+
     2. i18n
-    
+
     You can use i18n variables just use this syntax:
-    
+
     {{ "HelloWorld"|get_lang }}
-    
+
     Now you can add your variables in the main/lang/english/ or main/lang/spanish/ for example in spanish:
     $HelloWorld = "Hola Mundo";
-    
-    3. Portal settings    
+
+    3. Portal settings
         You can access the portal settings using:
         {{ "siteName"|get_setting }}
         For more settings check the settings_current database table
@@ -23,8 +23,8 @@
         You can also see more examples in main/template/default/layout
 #}
 
-{% if show_user_info.show_message is not null and _u.logged == 1 %}
+{% if show_user_info.show_message is not null and is_granted('IS_AUTHENTICATED_FULLY') %}
     <div class="well">
-        {{ "WelcomeToChamiloUserX" | get_lang | format(show_user_info.user_info.complete_name) }}            
+        {{ "WelcomeToChamiloUserX" | get_lang | format(show_user_info.user_info.complete_name) }}
     </div>
 {% endif %}