Minor - format code

pull/2487/head
jmontoyaa 9 years ago
parent ce37836102
commit ce3a391fc0
  1. 64
      plugin/buycourses/src/buycourses.ajax.php
  2. 7
      plugin/buycourses/src/configure_course.php
  3. 2
      plugin/buycourses/src/course_catalog.php
  4. 1
      plugin/buycourses/src/course_panel.php
  5. 1
      plugin/buycourses/src/error.php
  6. 10
      plugin/buycourses/src/process.php
  7. 4
      plugin/buycourses/src/process_confirm.php
  8. 5
      plugin/buycourses/src/service_process_confirm.php
  9. 2
      plugin/buycourses/src/service_sales_report.php
  10. 4
      plugin/buycourses/src/service_success.php
  11. 8
      plugin/buycourses/src/services_add.php
  12. 4
      plugin/buycourses/src/services_edit.php
  13. 15
      plugin/buycourses/src/session_catalog.php
  14. 5
      plugin/buycourses/src/session_panel.php
  15. 1
      plugin/buycourses/src/success.php
  16. 1
      plugin/buycourses/uninstall.php

@ -37,7 +37,6 @@ switch ($action) {
}
break;
case 'saleInfo':
if (api_is_anonymous()) {
break;
@ -75,9 +74,7 @@ switch ($action) {
$html .= '</div>';
echo $html;
break;
case 'stats':
if (api_is_anonymous()) {
break;
@ -114,7 +111,6 @@ switch ($action) {
$stats['canceled_total_amount'] = number_format($stats['canceled_total_amount'], 2);
}
$html = '<div class="row">'
. '<p>'
. '<ul>'
@ -125,9 +121,7 @@ switch ($action) {
. '</p>';
$html .= '</div>';
echo $html;
break;
case 'processPayout':
if (api_is_anonymous()) {
break;
@ -141,9 +135,11 @@ switch ($action) {
$payouts = isset($_POST['payouts']) ? $_POST['payouts'] : '';
if (!$payouts) {
echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false);
echo Display::return_message(
get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"),
'error',
false
);
break;
}
@ -157,9 +153,7 @@ switch ($action) {
}
$currentCurrency = $plugin->getSelectedCurrency();
$isoCode = $currentCurrency['iso_code'];
$html .= '<p>'. get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin") .'</p>';
$html .= ''
. '<p>'
@ -174,7 +168,6 @@ switch ($action) {
echo $html;
break;
case 'proceedPayout':
if (api_is_anonymous()) {
break;
@ -196,9 +189,7 @@ switch ($action) {
$payouts = isset($_POST['payouts']) ? $_POST['payouts'] : '';
if (!$payouts) {
echo Display::return_message(get_plugin_lang("SelectOptionToProceed", "BuyCoursesPlugin"), 'error', false);
break;
}
@ -207,23 +198,16 @@ switch ($action) {
}
$currentCurrency = $plugin->getSelectedCurrency();
$isoCode = $currentCurrency['iso_code'];
$result = MassPayment($allPayouts, $isoCode);
if ($result['ACK'] === 'Success') {
foreach ($allPayouts as $payout) {
$plugin->setStatusPayouts($payout['id'], BuyCoursesPlugin::PAYOUT_STATUS_COMPLETED);
}
echo Display::return_message(get_plugin_lang("PayoutSuccess", "BuyCoursesPlugin"), 'success', false);
} else {
echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'<br /><ul><li>'. $result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
}
break;
@ -241,7 +225,6 @@ switch ($action) {
break;
case 'culqi_cargo':
if (!$culqiEnable) {
break;
}
@ -270,7 +253,6 @@ switch ($action) {
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_API_KEY));
$environment = $culqiParams['integration'];
$environment = $environment ? BuyCoursesPlugin::CULQI_INTEGRATION_TYPE : BuyCoursesPlugin::CULQI_PRODUCTION_TYPE;
$culqi->setEnv($environment);
@ -296,7 +278,6 @@ switch ($action) {
));
if (is_object($cargo)) {
$saleIsCompleted = $plugin->completeSale($sale['id']);
if ($saleIsCompleted) {
@ -310,15 +291,10 @@ switch ($action) {
}
echo json_encode($cargo);
} catch(Exception $e) {
} catch (Exception $e) {
$cargo = json_decode($e->getMessage(), true);
$plugin->cancelSale($sale['id']);
unset($_SESSION['bc_sale_id']);
if (is_array($cargo)) {
Display::addFlash(
Display::return_message(
@ -337,11 +313,8 @@ switch ($action) {
);
}
}
break;
case 'culqi_cargo_service':
if (!$culqiEnable) {
break;
}
@ -370,11 +343,9 @@ switch ($action) {
$culqi = new Culqi\Culqi(array('api_key' => $SECRET_API_KEY));
$environment = $culqiParams['integration'];
$environment = $environment ? BuyCoursesPlugin::CULQI_INTEGRATION_TYPE : BuyCoursesPlugin::CULQI_PRODUCTION_TYPE;
$culqi->setEnv($environment);
$user = api_get_user_info();
try {
@ -395,9 +366,7 @@ switch ($action) {
));
if (is_object($cargo)) {
$saleIsCompleted = $plugin->completeServiceSale($serviceSale['id']);
if ($saleIsCompleted) {
Display::addFlash(
Display::return_message(
@ -409,11 +378,8 @@ switch ($action) {
}
echo json_encode($cargo);
} catch(Exception $e) {
} catch (Exception $e) {
$cargo = json_decode($e->getMessage(), true);
$plugin->cancelServiceSale($serviceSale['id']);
unset($_SESSION['bc_sale_id']);
@ -436,22 +402,16 @@ switch ($action) {
);
}
}
break;
case 'service_sale_info':
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$serviceSale = $plugin->getServiceSale($id);
$isAdmin = api_is_platform_admin();
if (!$serviceSale) {
break;
}
$ajaxCallFile = $plugin->getPath('SRC') . 'buycourses.ajax.php';
$serviceImg = $plugin->getPath('SERVICE_IMAGES') . $serviceSale['service']['image'];
$html = "<img class='img-responsive text-center' src='$serviceImg'>";
$html .= "<br />";
@ -539,12 +499,9 @@ switch ($action) {
$html .= "</script>";
echo $html;
break;
case 'service_sale_confirm':
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$serviceSale = $plugin->getServiceSale($id);
$response = $plugin->completeServiceSale($id);
$html = "";
@ -566,17 +523,14 @@ switch ($action) {
$html .= "location.reload();";
$html .= "});";
$html .= "</script>";
echo $html;
break;
case 'service_sale_cancel':
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
$serviceSale = $plugin->getServiceSale($id);
$response = $plugin->cancelServiceSale($id);
$html = "";
$html = '';
$html .= "<div class='text-center'>";
if ($response) {
@ -595,8 +549,6 @@ switch ($action) {
$html .= "location.reload();";
$html .= "});";
$html .= "</script>";
echo $html;
break;
}

@ -1,12 +1,11 @@
<?php
/* For license terms, see /license.txt */
/**
* Configuration script for the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
/**
* Initialization
*/
$cidReset = true;
require_once '../config.php';
@ -219,7 +218,7 @@ if ($editingCourse) {
if ($commissionsEnable === 'true') {
$platformCommission = $plugin->getPlatformCommission();
$form->addHtml( ''
$form->addHtml(''
. '<div class="form-group">'
. '<label for="sliders" class="col-sm-2 control-label">'
. get_plugin_lang('Commissions', 'BuyCoursesPlugin')

@ -1,4 +1,6 @@
<?php
/* For license terms, see /license.txt */
/**
* List of courses
* @package chamilo.plugin.buycourses

@ -1,4 +1,5 @@
<?php
/* For license terms, see /license.txt */
/**
* User Panel
* @package chamilo.plugin.buycourses

@ -10,3 +10,4 @@
unset($_SESSION['bc_sale_id']);
header('Location: course_catalog.php');
exit;

@ -1,12 +1,10 @@
<?php
/* For license terms, see /license.txt */
/**
* Process payments for the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
/**
* Initialization
*/
require_once '../config.php';
$currentUserId = api_get_user_id();
@ -48,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)
@ -56,12 +54,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;

@ -1,12 +1,10 @@
<?php
/* For license terms, see /license.txt */
/**
* Process purchase confirmation script for the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
/**
* Init
*/
require_once '../config.php';
$plugin = BuyCoursesPlugin::create();

@ -1,12 +1,11 @@
<?php
/* For license terms, see /license.txt */
/**
* Process purchase confirmation script for the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
/**
* Init
*/
require_once '../config.php';
$plugin = BuyCoursesPlugin::create();

@ -5,7 +5,7 @@
* List of pending payments of the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
//Initialization
$cidReset = true;
require_once '../config.php';

@ -1,12 +1,10 @@
<?php
/* For license terms, see /license.txt */
/**
* Success page for the purchase of a service in the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
/**
* Init
*/
require_once '../config.php';
$plugin = BuyCoursesPlugin::create();

@ -1,12 +1,10 @@
<?php
/* For license terms, see /license.txt */
/**
* Create new Services for the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
/**
* Init
*/
$cidReset = true;
@ -111,13 +109,13 @@ $form->setDefaults($formDefaultValues);
if ($form->validate()) {
$values = $form->getSubmitValues();
$plugin->storeService($values);
Display::addFlash(
Display::return_message($plugin->get_lang('ServiceAdded'), 'success')
);
header('Location: configuration.php');
exit;
}

@ -1,12 +1,10 @@
<?php
/* For license terms, see /license.txt */
/**
* Create new Services for the Buy Courses plugin
* @package chamilo.plugin.buycourses
*/
/**
* Init
*/
$cidReset = true;

@ -1,11 +1,11 @@
<?php
/* For license terms, see /license.txt */
/**
* List of courses
* @package chamilo.plugin.buycourses
*/
/**
* Initialization
*/
$cidReset = true;
require_once __DIR__.'/../../../main/inc/global.inc.php';
@ -22,7 +22,14 @@ $nameFilter = null;
$minFilter = 0;
$maxFilter = 0;
$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();

@ -1,11 +1,10 @@
<?php
/* For license terms, see /license.txt */
/**
* User Panel
* @package chamilo.plugin.buycourses
*/
/**
* Initialization
*/
$cidReset = true;

@ -1,5 +1,6 @@
<?php
/* For license terms, see /license.txt */
/**
* Success page for the purchase of a course in the Buy Courses plugin
* @package chamilo.plugin.buycourses

@ -1,5 +1,6 @@
<?php
/* For license terms, see /license.txt */
/**
* This script is included by main/admin/settings.lib.php when unselecting a plugin
* and is meant to remove things installed by the install.php script in both

Loading…
Cancel
Save