diff --git a/plugin/buycourses/js/buycourses.js b/plugin/buycourses/js/buycourses.js deleted file mode 100644 index 25c1927ade..0000000000 --- a/plugin/buycourses/js/buycourses.js +++ /dev/null @@ -1,36 +0,0 @@ -/* For licensing terms, see /license.txt */ -/** - * JS library for the Chamilo buy-courses plugin - * @package chamilo.plugin.buycourses - */ -$(document).ready(function () { - $(".bc-button-save").click(function () { - var currentRow = $(this).closest("tr"); - var courseOrSessionObject = { - tab: "save_mod", - visible: currentRow.find("[name='visible']").is(':checked') ? 1 : 0, - price: currentRow.find("[name='price']").val() - }; - - var itemField = currentRow.data('type') + '_id'; - - courseOrSessionObject[itemField] = currentRow.data('item') || 0; - - $.post( - "function.php", - courseOrSessionObject, - function (data) { - if (!data.status) { - return; - } - - currentRow.addClass('success'); - - window.setTimeout(function () { - currentRow.removeClass('success'); - }, 3000); - }, - "json" - ); - }); -}); diff --git a/plugin/buycourses/src/function.php b/plugin/buycourses/src/function.php deleted file mode 100644 index 79a4a5b336..0000000000 --- a/plugin/buycourses/src/function.php +++ /dev/null @@ -1,62 +0,0 @@ -getSelectedCurrency(); - -if ($_REQUEST['tab'] == 'save_mod') { - if (isset($_REQUEST['course_id'])) { - $productId = $_REQUEST['course_id']; - $productType = BuyCoursesPlugin::PRODUCT_TYPE_COURSE; - } else { - $productId = $_REQUEST['session_id']; - $productType = BuyCoursesPlugin::PRODUCT_TYPE_SESSION; - } - - $affectedRows = false; - $item = $plugin->getItemByProduct($productId, $productType); - - if ($_POST['visible'] == 1) { - if (!empty($item)) { - $affectedRows = $plugin->updateItem( - ['price' => floatval($_POST['price'])], - $productId, - $productType - ); - } else { - $affectedRows = $plugin->registerItem([ - 'currency_id' => $currency['id'], - 'product_type' => $productType, - 'product_id' => intval($productId), - 'price' => floatval($_POST['price']) - ]); - } - } else { - $affectedRows = $plugin->deleteItem($item['id']); - } - - if ($affectedRows > 0) { - $jsonResult = [ - "status" => true, - "itemId" => $productId - ]; - } else { - $jsonResult = [ - "status" => false, - "content" => $plugin->get_lang('ItemNotSaved') - ]; - } - - echo json_encode($jsonResult); - exit; -} diff --git a/plugin/buycourses/view/configuration.tpl b/plugin/buycourses/view/configuration.tpl index 24bbb84302..3d1c4f7d62 100644 --- a/plugin/buycourses/view/configuration.tpl +++ b/plugin/buycourses/view/configuration.tpl @@ -21,9 +21,9 @@