Browse Source

Minor - format code

jmontoyaa 7 years ago
parent
commit
6db64bd77f

+ 9 - 4
plugin/buycourses/src/service_catalog.php

@@ -3,9 +3,7 @@
  * List of services
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
+
 
 $cidReset = true;
 
@@ -20,7 +18,14 @@ $minFilter = 0;
 $maxFilter = 0;
 $appliesToFilter = '';
 
-$form = new FormValidator('search_filter_form', 'get', null, null, [], FormValidator::LAYOUT_INLINE);
+$form = new FormValidator(
+    'search_filter_form',
+    'get',
+    null,
+    null,
+    [],
+    FormValidator::LAYOUT_INLINE
+);
 
 if ($form->validate()) {
     $formValues = $form->getSubmitValues();

+ 5 - 6
plugin/buycourses/src/service_error.php

@@ -4,14 +4,9 @@
  * Errors management for the Buy Courses plugin - Redirects to service_catalog.php with a error msg
  * @package chamilo.plugin.buycourses
  */
-/**
- * Config
- */
-
 require_once '../config.php';
 
 if (isset($_SESSION['bc_service_sale_id'])) {
-
     $plugin = BuyCoursesPlugin::create();
     $serviceSaleId = $_SESSION['bc_service_sale_id'];
     unset($_SESSION['bc_service_sale_id']);
@@ -19,7 +14,11 @@ if (isset($_SESSION['bc_service_sale_id'])) {
 
     $plugin->cancelServiceSale(intval($serviceSaleId));
     Display::addFlash(
-        Display::return_message($plugin->get_lang('OrderCancelled'), 'error', false)
+        Display::return_message(
+            $plugin->get_lang('OrderCancelled'),
+            'error',
+            false
+        )
     );
 
     header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');

+ 2 - 6
plugin/buycourses/src/service_panel.php

@@ -3,9 +3,6 @@
  * User Panel
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
 
 $cidReset = true;
 
@@ -33,7 +30,6 @@ $serviceSales = $plugin->getServiceSale(null, $userInfo['user_id']);
 $saleList = [];
 
 foreach ($serviceSales as $sale) {
-
     $saleList[] = [
         'id' => $sale['id'],
         'name' => $sale['service']['name'],
@@ -44,7 +40,7 @@ foreach ($serviceSales as $sale) {
         'date_end' => api_format_date(api_get_local_time($sale['date_end']), DATE_TIME_FORMAT_LONG_24H),
         'currency' => $sale['currency'],
         'price' => $sale['price'],
-        'status' => $sale['status']  
+        'status' => $sale['status']
     ];
 }
 
@@ -75,4 +71,4 @@ $tpl->assign(
 );
 $tpl->assign('header', $templateName);
 $tpl->assign('content', $content);
-$tpl->display_one_col_template();
+$tpl->display_one_col_template();

+ 18 - 15
plugin/buycourses/src/service_process.php

@@ -4,9 +4,6 @@
  * Process payments for the Buy Courses plugin
  * @package chamilo.plugin.buycourses
  */
-/**
- * Initialization
- */
 
 $cidReset = true;
 
@@ -48,7 +45,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)
@@ -64,8 +61,13 @@ if ($form->validate()) {
         header('Location:'.api_get_self().'?'.$queryString);
         exit;
     }
-    
-    $serviceSaleId = $plugin->registerServiceSale($serviceId, $formValues['payment_type'], $formValues['info_select'], $formValues['enable_trial']);
+
+    $serviceSaleId = $plugin->registerServiceSale(
+        $serviceId,
+        $formValues['payment_type'],
+        $formValues['info_select'],
+        $formValues['enable_trial']
+    );
 
     if ($serviceSaleId !== false) {
         $_SESSION['bc_service_sale_id'] = $serviceSaleId;
@@ -94,7 +96,12 @@ $form->addHeader('');
 $form->addRadio('payment_type', null, $paymentTypesOptions);
 $form->addHtml('<h3 class="panel-heading">'.$plugin->get_lang('AdditionalInfo').'</h3>');
 $form->addHeader('');
-$form->addHtml(Display::return_message($plugin->get_lang('PleaseSelectTheCorrectInfoToApplyTheService'), 'info'));
+$form->addHtml(
+    Display::return_message(
+        $plugin->get_lang('PleaseSelectTheCorrectInfoToApplyTheService'),
+        'info'
+    )
+);
 $selectOptions = [
     0 => get_lang('None')
 ];
@@ -145,7 +152,6 @@ if ($typeUser) {
         // Now get all the courses lp's
         $thisLpList = $em->getRepository('ChamiloCourseBundle:CLp')->findBy(['cId' => $course->getCourse()->getId()]);
         foreach ($thisLpList as $lp) {
-
             $courseLpList[$lp->getCId()] = $lp->getName().' ('.$course->getCourse()->getTitle().')'; ;
         }
     }
@@ -190,10 +196,8 @@ if ($typeUser) {
         $form->addHtml(Display::return_message($plugin->get_lang('YourCoursesNeedAtLeastOneLearningPath'), 'error'));
     }
     $form->addSelect('info_select', get_lang('LearningPath'), $selectOptions);
-
 }
 
-
 $form->addHidden('t', intval($_GET['t']));
 $form->addHidden('i', intval($_GET['i']));
 
@@ -201,17 +205,16 @@ $form->addButton('submit', $plugin->get_lang('ConfirmOrder'), 'check', 'success'
 
 // View
 $templateName = $plugin->get_lang('PaymentMethods');
-$interbreadcrumb[] = array("url" => "service_catalog.php", "name" => $plugin->get_lang('ListOfServicesOnSale'));
+$interbreadcrumb[] = array(
+    "url" => "service_catalog.php",
+    "name" => $plugin->get_lang('ListOfServicesOnSale'),
+);
 
 $tpl = new Template($templateName);
-
 $tpl->assign('buying_service', true);
 $tpl->assign('service', $serviceInfo);
 $tpl->assign('user', api_get_user_info());
 $tpl->assign('form', $form->returnForm());
-
-
 $content = $tpl->fetch('buycourses/view/process.tpl');
-
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();

+ 26 - 8
plugin/buycourses/src/service_process_confirm.php

@@ -171,12 +171,17 @@ switch ($serviceSale['payment_type']) {
         // directly from the main url "https://integ-pago.culqi.com" because a local copy of this JS is not supported
         $htmlHeadXtra[] = '<script src="//integ-pago.culqi.com/js/v1"></script>';
 
-        $form = new FormValidator('success', 'POST', api_get_self(), null, null, FormValidator::LAYOUT_INLINE);
+        $form = new FormValidator(
+            'success',
+            'POST',
+            api_get_self(),
+            null,
+            null,
+            FormValidator::LAYOUT_INLINE
+        );
 
         if ($form->validate()) {
-
             $formValues = $form->getSubmitValues();
-
             if (isset($formValues['cancel'])) {
                 $plugin->cancelServiceSale($serviceSale['id']);
 
@@ -194,11 +199,26 @@ switch ($serviceSale['payment_type']) {
                 exit;
             }
         }
-        $form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success', 'default', null, ['id' => 'confirm']);
-        $form->addButton('cancel', $plugin->get_lang('CancelOrder'), 'times', 'danger', 'default', null, ['id' => 'cancel']);
+        $form->addButton(
+            'confirm',
+            $plugin->get_lang('ConfirmOrder'),
+            'check',
+            'success',
+            'default',
+            null,
+            ['id' => 'confirm']
+        );
+        $form->addButton(
+            'cancel',
+            $plugin->get_lang('CancelOrder'),
+            'times',
+            'danger',
+            'default',
+            null,
+            ['id' => 'cancel']
+        );
 
         $template = new Template();
-
         $template->assign('terms', $terms['terms_and_conditions']);
         $template->assign('title', $serviceSale['service']['name']);
         $template->assign('price', floatval($serviceSale['price']));
@@ -209,9 +229,7 @@ switch ($serviceSale['payment_type']) {
         $template->assign('form', $form->returnForm());
         $template->assign('is_culqi_payment', true);
         $template->assign('culqi_params', $culqiParams = $plugin->getCulqiParams());
-
         $content = $template->fetch('buycourses/view/process_confirm.tpl');
-
         $template->assign('content', $content);
         $template->display_one_col_template();
         break;

+ 0 - 3
plugin/buycourses/src/service_sales_report.php

@@ -87,9 +87,6 @@ $template->assign('sale_list', $serviceSaleList);
 $template->assign('sale_status_cancelled', BuyCoursesPlugin::SERVICE_STATUS_CANCELLED);
 $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');
-
-
 $template->assign('content', $content);
 $template->display_one_col_template();

+ 0 - 4
plugin/buycourses/src/success.php

@@ -36,7 +36,6 @@ switch ($sale['product_type']) {
 }
 
 $paypalParams = $plugin->getPaypalParams();
-
 $pruebas = $paypalParams['sandbox'] == 1;
 $paypalUsername = $paypalParams['username'];
 $paypalPassword = $paypalParams['password'];
@@ -57,12 +56,9 @@ $form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
 
 if ($form->validate()) {
     $formValues = $form->getSubmitValues();
-
     if (isset($formValues['cancel'])) {
         $plugin->cancelSale($sale['id']);
-
         unset($_SESSION['bc_sale_id']);
-
         header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/index.php');
         exit;
     }