Browse Source

Remove unnecessaty JS/Ajax code - refs #7768

Angel Fernando Quiroz Campos 9 years ago
parent
commit
890a3794f1
2 changed files with 0 additions and 147 deletions
  1. 0 64
      plugin/buycourses/js/buycourses.js
  2. 0 83
      plugin/buycourses/src/function.php

+ 0 - 64
plugin/buycourses/js/buycourses.js

@@ -4,24 +4,6 @@
  * @package chamilo.plugin.buycourses
  */
 $(document).ready(function () {
-    $("input[name='price']").change(function () {
-        $(this).parent().next().children().attr("style", "display:none");
-        $(this).parent().next().children().next().attr("style", "display:''");
-        $(this).parent().parent().addClass("fmod");
-        $(this).parent().parent().children().each(function () {
-            $(this).addClass("btop");
-        });
-    });
-
-    $("input[name='price']").keyup(function () {
-        $(this).parent().next().children().attr("style", "display:none");
-        $(this).parent().next().children().next().attr("style", "display:''");
-        $(this).parent().parent().addClass("fmod");
-        $(this).parent().parent().children().each(function () {
-            $(this).addClass("btop");
-        });
-    });
-
     $(".bc-button-save").click(function () {
         var currentRow = $(this).closest("tr");
         var courseOrSessionObject = {
@@ -52,20 +34,6 @@ $(document).ready(function () {
         );
     });
 
-    $('#sync').click(function (e) {
-        $.post("function.php", {tab: "sync"},
-            function (data) {
-                if (data.status == "false") {
-                    alert(data.contenido);
-                } else {
-                    alert(data.contenido);
-                    location.reload();
-                }
-            }, "json");
-        e.preventDefault();
-        e.stopPropagation();
-    });
-
     $(".filter").click(function (e) {
         var target = "#"+($(this).closest(".row").children().last()).attr("id");
         var filterFields = $(this).siblings("input");
@@ -88,38 +56,6 @@ $(document).ready(function () {
         e.preventDefault();
         e.stopPropagation();
     });
-
-    $("#cancel_order").click(function (e) {
-        $.post("function.php", {tab: "unset_variables"});
-        window.location.replace("list.php");
-    });
-
-    $(".clear_order").click(function (e) {
-        var vid = $(this).parent().attr("id");
-        $.post("function.php", {tab: "clear_order", id: vid},
-            function (data) {
-                location.reload();
-            }, "json");
-
-        e.preventDefault();
-        e.stopPropagation();
-    });
-
-    $(".confirm_order").click(function (e) {
-        var vid = $(this).parent().attr("id");
-        $.post("function.php", {tab: "confirm_order", id: vid},
-            function (data) {
-                location.reload();
-            }, "json");
-
-        e.preventDefault();
-        e.stopPropagation();
-    });
-
-    $(".slt_tpv").change(function () {
-        var vcod = $(this).val();
-        $.post("function.php", {tab: "activar_tpv", cod: vcod});
-    });
 });
 
 function acciones_ajax() {

+ 0 - 83
plugin/buycourses/src/function.php

@@ -15,10 +15,6 @@ $tableBuySessionTemporal = Database::get_main_table(TABLE_BUY_SESSION_TEMPORARY)
 $tableBuySessionRelCourse = Database::get_main_table(TABLE_BUY_SESSION_COURSE);
 $tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
 $tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
-$tableBuyCourseCountry = Database::get_main_table(TABLE_BUY_COURSE_COUNTRY);
-$tableBuyCoursePaypal = Database::get_main_table(TABLE_BUY_COURSE_PAYPAL);
-$tableBuyCourseTransfer = Database::get_main_table(TABLE_BUY_COURSE_TRANSFER);
-$tableBuyCourseTemporal = Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
 $tableSession = Database::get_main_table(TABLE_MAIN_SESSION);
 $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
 $tableSessionRelUser = Database::get_main_table(TABLE_MAIN_SESSION_USER);
@@ -31,23 +27,6 @@ $plugin = BuyCoursesPlugin::create();
 $buy_name = $plugin->get_lang('Buy');
 $currency = $plugin->getSelectedCurrency();
 
-if ($_REQUEST['tab'] == 'sync') {
-    $sql = "SELECT code, title FROM $tableCourse;";
-    $res = Database::query($sql);
-    while ($row = Database::fetch_assoc($res)) {
-        $aux_code .= $row['code'];
-        $aux_title .= $row['title'];
-    }
-    $sql = "SELECT name, access_start_date, access_end_date FROM $tableSession;";
-    $res = Database::query($sql);
-    while ($row = Database::fetch_assoc($res)) {
-        $aux_name .= $row['name'];
-        $aux_date_start .= $row['access_start_date'];
-        $aux_date_end .= $row['access_end_date'];
-    }
-    echo json_encode(array("status" => "true", "content" => $content));
-}
-
 if ($_REQUEST['tab'] == 'sessions_filter') {
     $session = isset($_REQUEST['name']) ? Database::escape_string($_REQUEST['name']) : '';
     $priceMin = isset($_REQUEST['pricemin']) ? floatval($_REQUEST['pricemin']) : 0;
@@ -429,65 +408,3 @@ if ($_REQUEST['tab'] == 'save_mod') {
     echo json_encode($jsonResult);
     exit;
 }
-
-if ($_REQUEST['tab'] == 'unset_variables') {
-    unset($_SESSION['bc_user_id']);
-    unset($_SESSION['bc_registered']);
-    unset($_SESSION['bc_code']);
-    unset($_SESSION['bc_title']);
-    unset($_SESSION["Payment_Amount"]);
-    unset($_SESSION["currencyCodeType"]);
-    unset($_SESSION["PaymentType"]);
-    unset($_SESSION["nvpReqArray"]);
-    unset($_SESSION['TOKEN']);
-    $_SESSION['bc_success'] = false;
-    $_SESSION['bc_message'] = 'CancelOrder';
-    unset($_SESSION['bc_url']);
-}
-
-if ($_REQUEST['tab'] == 'clear_order') {
-    $id = substr(intval($_REQUEST['id']), 6);
-    $sql = "DELETE FROM $tableBuyCourseTemporal WHERE cod='" . $id . "';";
-
-    $res = Database::query($sql);
-    if (!$res) {
-        $content = $plugin->get_lang('ProblemToDeleteTheAccount');
-        echo json_encode(array("status" => "false", "content" => $content));
-    } else {
-        $content = get_lang('Saved');
-        echo json_encode(array("status" => "true", "content" => $content));
-    }
-}
-
-if ($_REQUEST['tab'] == 'confirm_order') {
-    $id = substr(intval($_REQUEST['id']), 6);
-    $sql = "SELECT * FROM $tableBuyCourseTemporal WHERE cod='" . $id . "';";
-    $res = Database::query($sql);
-    $row = Database::fetch_assoc($res);
-
-    $isAllowed = false;
-    $user_id = $row['user_id'];
-    $course_code = $row['course_code'];
-    $all_course_information = CourseManager::get_course_information($course_code);
-
-    if (CourseManager::subscribe_user($user_id, $course_code)) {
-        $isAllowed = true;
-    } else {
-        $isAllowed = false;
-    }
-    //Activate user account
-    if ($isAllowed) {
-        // 1. set account inactive
-        $sql = "UPDATE $tableUser SET active = '1' WHERE user_id = " . intval($_SESSION['bc_user_id']) . "";
-        Database::query($sql);
-
-        $sql = "DELETE FROM $tableBuyCourseTemporal WHERE cod='" . $id . "';";
-        $res = Database::query($sql);
-
-        $content = $plugin->get_lang('TheSubscriptionAndActivationWereDoneSuccessfully');
-        echo json_encode(array("status" => "true", "content" => $content));
-    } else {
-        $content = $plugin->get_lang('ProblemToSubscribeTheUser');
-        echo json_encode(array("status" => "false", "content" => $content));
-    }
-}