Browse Source

Final touch to BuyCourses plugin before 1.9.8 - refs #5464

Yannick Warnier 10 years ago
parent
commit
cc9f0ad702
35 changed files with 524 additions and 294 deletions
  1. 2 2
      plugin/buycourses/config.php
  2. 30 21
      plugin/buycourses/database.php
  3. 1 1
      plugin/buycourses/index.php
  4. 6 3
      plugin/buycourses/install.php
  5. 12 7
      plugin/buycourses/js/buycourses.js
  6. 65 52
      plugin/buycourses/lang/english.php
  7. 72 0
      plugin/buycourses/lang/french.php
  8. 14 11
      plugin/buycourses/lang/spanish.php
  9. 3 4
      plugin/buycourses/plugin.php
  10. 5 5
      plugin/buycourses/readme.txt
  11. 3 3
      plugin/buycourses/resources/plugin.css
  12. 9 2
      plugin/buycourses/src/ajax.php
  13. 86 27
      plugin/buycourses/src/buy_course.lib.php
  14. 10 8
      plugin/buycourses/src/buy_course_plugin.class.php
  15. 10 5
      plugin/buycourses/src/configuration.php
  16. 10 2
      plugin/buycourses/src/error.php
  17. 9 3
      plugin/buycourses/src/expresscheckout.php
  18. 27 24
      plugin/buycourses/src/function.php
  19. 9 5
      plugin/buycourses/src/index.buycourses.php
  20. 5 4
      plugin/buycourses/src/inscription.php
  21. 6 5
      plugin/buycourses/src/list.php
  22. 16 11
      plugin/buycourses/src/paymentsetup.php
  23. 9 4
      plugin/buycourses/src/pending_orders.php
  24. 12 7
      plugin/buycourses/src/process.php
  25. 14 7
      plugin/buycourses/src/process_confirm.php
  26. 11 4
      plugin/buycourses/src/success.php
  27. 3 3
      plugin/buycourses/uninstall.php
  28. 4 4
      plugin/buycourses/view/configuration.tpl
  29. 1 1
      plugin/buycourses/view/index.tpl
  30. 12 12
      plugin/buycourses/view/list.tpl
  31. 14 14
      plugin/buycourses/view/paymentsetup.tpl
  32. 5 5
      plugin/buycourses/view/pending_orders.tpl
  33. 9 9
      plugin/buycourses/view/process.tpl
  34. 11 11
      plugin/buycourses/view/process_confirm.tpl
  35. 9 8
      plugin/buycourses/view/success.tpl

+ 2 - 2
plugin/buycourses/config.php

@@ -4,10 +4,10 @@
 define('TABLE_BUY_COURSE', 'plugin_buy_course');
 define('TABLE_BUY_COURSE_COUNTRY', 'plugin_buy_course_country');
 define('TABLE_BUY_COURSE_PAYPAL', 'plugin_buy_course_paypal');
-define('TABLE_BUY_COURSE_TRANSFERENCE', 'plugin_buy_course_transference');
+define('TABLE_BUY_COURSE_TRANSFER', 'plugin_buy_course_transfer');
 define('TABLE_BUY_COURSE_TEMPORAL', 'plugin_buy_course_temporal');
 define('TABLE_BUY_COURSE_SALE', 'plugin_buy_course_sale');
 
 require_once __DIR__ . '/../../main/inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
-require_once  api_get_path(PLUGIN_PATH) . 'buy_courses/src/buy_course_plugin.class.php';
+require_once  api_get_path(PLUGIN_PATH) . 'buycourses/src/buy_course_plugin.class.php';

+ 30 - 21
plugin/buycourses/database.php

@@ -1,46 +1,55 @@
 <?php
+/* For license terms, see /license.txt */
 /**
- * Created by PhpStorm.
- * User: fgonzales
- * Date: 21/05/14
- * Time: 12:19 PM
+ * Plugin database installation script. Can only be executed if included
+ * inside another script loading global.inc.php
+ * @package chamilo.plugin.buycourses
  */
-$objPlugin = Buy_CoursesPlugin::create();
+/**
+ * Check if script can be called
+ */
+if (!function_exists('api_get_path')) {
+    die('This script must be loaded through the Chamilo plugin installer sequence');
+}
+/**
+ * Create the script context, then execute database queries to enable
+ */
+$objPlugin = BuyCoursesPlugin::create();
 
 $table = Database::get_main_table(TABLE_BUY_COURSE);
 $sql = "CREATE TABLE IF NOT EXISTS $table (
     id INT unsigned NOT NULL auto_increment PRIMARY KEY,
-    id_course INT unsigned NOT NULL DEFAULT '0',
+    course_id INT unsigned NOT NULL DEFAULT '0',
     code VARCHAR(40),
     title VARCHAR(250),
-    visible int(1),
+    visible int,
     price FLOAT(11,2) NOT NULL DEFAULT '0',
-    sync int(1))";
+    sync int)";
 Database::query($sql);
 $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
 $sql = "SELECT id, code, title FROM $tableCourse";
 $res = Database::query($sql);
 while ($row = Database::fetch_assoc($res)) {
-    $presql = "INSERT INTO $table (id_course, code, title, visible) VALUES ('" . $row['id'] . "','" . $row['code'] . "','" . $row['title'] . "','NO')";
+    $presql = "INSERT INTO $table (course_id, code, title, visible) VALUES ('" . $row['id'] . "','" . $row['code'] . "','" . $row['title'] . "','NO')";
     Database::query($presql);
 }
 
 $table = Database::get_main_table(TABLE_BUY_COURSE_COUNTRY);
 $sql = "CREATE TABLE IF NOT EXISTS $table (
-    `id_country` int(5) NOT NULL AUTO_INCREMENT,
-    `country_code` char(2) NOT NULL DEFAULT '',
-    `country_name` varchar(45) NOT NULL DEFAULT '',
-    `currency_code` char(3) DEFAULT NULL,
-    `iso_alpha3` char(3) DEFAULT NULL,
-    `status` int(1) DEFAULT '0',
-    PRIMARY KEY (`id_country`)
+    country_id int NOT NULL AUTO_INCREMENT,
+    country_code char(2) NOT NULL DEFAULT '',
+    country_name varchar(45) NOT NULL DEFAULT '',
+    currency_code char(3) DEFAULT NULL,
+    iso_alpha3 char(3) DEFAULT NULL,
+    status int DEFAULT '0',
+    PRIMARY KEY (country_id)
     ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;";
 Database::query($sql);
 
-$sql = "CREATE UNIQUE INDEX index_country ON $table (`country_code`)";
+$sql = "CREATE UNIQUE INDEX index_country ON $table (country_code)";
 Database::query($sql);
 
-$sql = "INSERT INTO $table (`country_code`, `country_name`, `currency_code`, `iso_alpha3`) VALUES
+$sql = "INSERT INTO $table (country_code, country_name, currency_code, iso_alpha3) VALUES
 	('AD', 'Andorra', 'EUR', 'AND'),
 	('AE', 'United Arab Emirates', 'AED', 'ARE'),
 	('AF', 'Afghanistan', 'AFN', 'AFG'),
@@ -304,7 +313,7 @@ Database::query($sql);
 $sql = "INSERT INTO $table (id,username,password,signature) VALUES ('1', 'API_UserName', 'API_Password', 'API_Signature')";
 Database::query($sql);
 
-$table = Database::get_main_table(TABLE_BUY_COURSE_TRANSFERENCE);
+$table = Database::get_main_table(TABLE_BUY_COURSE_TRANSFER);
 $sql = "CREATE TABLE IF NOT EXISTS $table (
     id INT unsigned NOT NULL auto_increment PRIMARY KEY,
     name VARCHAR(100) NOT NULL DEFAULT '',
@@ -336,8 +345,8 @@ $sql = "CREATE TABLE IF NOT EXISTS $table (
 Database::query($sql);
 
 //Menu main tabs
-$rsTab = $objPlugin->addTab('Buy Courses', 'plugin/buy_courses/index.php');
+$rsTab = $objPlugin->addTab('Buy Courses', 'plugin/buycourses/index.php');
 
 if ($rsTab) {
-    echo "<script>location.href = '" . $_SERVER['REQUEST_URI'] . "';</script>";
+    echo "<script>location.href = '" . Security::remove_XSS($_SERVER['REQUEST_URI']) . "';</script>";
 }

+ 1 - 1
plugin/buycourses/index.php

@@ -1,5 +1,5 @@
 <?php
-
+/* For license terms, see /license.txt */
 /**
  * Show form
  */

+ 6 - 3
plugin/buycourses/install.php

@@ -1,12 +1,15 @@
 <?php
+/* For license terms, see /license.txt */
 /**
  * This script is included by main/admin/settings.lib.php and generally
  * includes things to execute in the main database (settings_current table)
- * @package chamilo.plugin.bigbluebutton
+ * @package chamilo.plugin.buycourses
  */
 /**
  * Initialization
  */
-
 require_once dirname(__FILE__) . '/config.php';
-Buy_CoursesPlugin::create()->install();
+if (!api_is_platform_admin()) {
+    die ('You must have admin permissions to install plugins');
+}
+BuyCoursesPlugin::create()->install();

+ 12 - 7
plugin/buycourses/js/buycourses.js

@@ -1,3 +1,8 @@
+/* For licensing terms, see /license.txt */
+/**
+ * JS library for the Chamilo buy-courses plugin
+ * @package chamilo.plugin.buycourses
+ */
 $(document).ready(function () {
     $("input[name='price']").change(function () {
         $(this).parent().next().children().attr("style", "display:none");
@@ -29,16 +34,16 @@ $(document).ready(function () {
     $(".save").click(function () {
         var visible = $(this).parent().parent().prev().prev().children().attr("checked");
         var price = $(this).parent().parent().prev().children().attr("value");
-        var id_course = $(this).attr('id');
-        $.post("function.php", {tab: "save_mod", id_course: id_course, visible: visible, price: price},
+        var course_id = $(this).attr('id');
+        $.post("function.php", {tab: "save_mod", course_id: course_id, visible: visible, price: price},
             function (data) {
                 if (data.status == "false") {
                     alert("Database Error");
                 } else {
-                    $("#course" + data.id_course).children().attr("style", "display:''");
-                    $("#course" + data.id_course).children().next().attr("style", "display:none");
-                    $("#course" + data.id_course).parent().removeClass("fmod")
-                    $("#course" + data.id_course).parent().children().each(function () {
+                    $("#course" + data.course_id).children().attr("style", "display:''");
+                    $("#course" + data.course_id).children().next().attr("style", "display:none");
+                    $("#course" + data.course_id).parent().removeClass("fmod")
+                    $("#course" + data.course_id).parent().children().each(function () {
                         $(this).removeClass("btop");
                     });
                 }
@@ -216,4 +221,4 @@ function acciones_ajax() {
 
 
 }
-		
+		

+ 65 - 52
plugin/buycourses/lang/english.php

@@ -1,52 +1,65 @@
-<?php
-//Needed in order to show the plugin title
-$strings['plugin_title'] = "Comprar cursos";
-$strings['plugin_comment'] = "Configurar precios, tipos de pago, visibilidad de cursos.";
-
-$strings['Visible'] = "Mostrar en el listado";
-$strings['Options'] = "Opciones";
-$strings['Price'] = "Precio";
-$strings['SyncCourseDatabase'] = "Sincronizar cursos de la base de datos";
-
-$strings['Private'] = "Privado - acceso autorizado s&oacute;lo para los miembros del curso";
-$strings['CourseVisibilityClosed'] = "Cerrado - no hay acceso a este curso";
-$strings['OpenToThePlatform'] = "Abierto - acceso autorizado s&oacute;lo para los usuarios registrados en la plataforma";
-$strings['OpenToTheWorld'] = "P&uacute;blico - acceso autorizado a cualquier persona";
-
-$strings['bc_setting_courses_available'] = "Configuraci&oacute;n de cursos disponibles";
-$strings['bc_setting_pay'] = "Configuraci&oacute;n pagos";
-
-$strings['Description'] = "Descripci&oacute;n";
-$strings['Buy'] = "Comprar";
-$strings['Filtro_buscar'] = "Filtro de busqueda";
-$strings['Curso'] = "Curso";
-$strings['Price_Maximum'] = "Precio mayor de";
-$strings['Price_Minimum'] = "Precio menor de";
-$strings['Mostrar_disponibles'] = "Mostrar cursos disponibles";
-$strings['Categorias'] = "Categorias";
-
-$strings['paypal_enable'] = "Habilitar PayPal";
-$strings['tarjet_credit_enable'] = "Habilitar TPV";
-$strings['transference_enable'] = "Habilitar transferencia";
-$strings['unregistered_users_enable'] = "Permitir usuarios sin registro en la plataforma";
-
-$strings['EnrollToCourseXSuccessful'] = "Su inscripci�n en el curso %s se ha completado.";
-$strings['ErrorContactPlatformAdmin'] = "Se ha producido un error desconocido. Por favor, p�ngase en contacto con el administrador de la plataforma.";
-$strings['Cancelacionpedido'] = "El pedido se ha cancelado.";
-$strings['AlreadyBuy'] = "Ya est� matriculado en el curso";
-$strings['Message_conf_transf'] = "Una vez confirmado, recibira un e-mail con los datos bancarios y una referencia del pedido.";
-$strings['bc_subject'] = "Confirmaci�n pedido de cursos";
-$strings['bc_message'] = "Estimado {{name}}. <br />En cuanto recibamos confirmaci&oacute;n de pago procederemos a dar de alta su usuario en el curso <strong>{{curso}}</strong>.<br><br><strong>No olvide indicar en el concepto de la transferencia el n&uacute;mero de referencia del pedido: <div style='display:inline;text-align:center; font-weight:bold; font-size:20px; color:#333'>{{reference}}</div></strong>";
-$strings['bc_registrado'] = 'Ya se encuentra registrado en el curso';
-$strings['bc_tmp_registrado'] = 'Se encuentra a la espera de recibir el pago';
-
-$strings['bc_confi_index'] = 'Configuraci�n cursos y precio';
-$strings['bc_pagos_index'] = 'Configuraci�n pagos';
-$strings['bc_pending'] = 'Pedidos pendientes de pago';
-
-$strings['Ref_pedido'] = 'Referencia del pedido';
-$strings['transferencia_bancaria'] = 'Transferencia Bancaria';
-$strings['paypal'] = 'PayPal';
-$strings['confirmar_compra'] = 'Confirmar compra de curso';
-
-$strings['The_User_Is_Already_Registered'] = 'El usuario ya está registrado';
+<?php
+$strings['plugin_title'] = "Sell courses";
+$strings['plugin_comment'] = "Sell courses directly through your Chamilo portal, using a PayPal account to receive funds. This plugin is in beta version. Neither the Chamilo association nor the developers involved could be considered responsible of any issue you might suffer using this plugin.";
+$strings['Visible'] = "Show list";
+$strings['Options'] = "Options";
+$strings['Price'] = "Price";
+$strings['SyncCourseDatabase'] = "Synchronize courses from database";
+$strings['Private'] = "Private - access authorized only for course members";
+$strings['CourseVisibilityClosed'] = "Closed - no access to this course";
+$strings['OpenToThePlatform'] = "Open - access authorized only for users registered on the platform";
+$strings['OpenToTheWorld'] = "Public - access open to anybody";
+$strings['Description'] = "Description";
+$strings['Buy'] = "Buy";
+$strings['Mostrar_disponibles'] = "Show available courses";
+$strings['paypal_enable'] = "Enable PayPal";
+$strings['transfer_enable'] = "Enable bank transfer";
+$strings['unregistered_users_enable'] = "Allow anonymous users";
+$strings['Cancelacionpedido'] = "The payment has been cancelled.";
+$strings['AlreadyBuy'] = "You are already subscribed to this course.";
+$strings['bc_subject'] = "Confirmation of course order";
+$strings['paypal'] = 'PayPal';
+$strings['confirmar_compra'] = 'Course purchase confirmation';
+$strings['TheUserIsAlreadyRegistered'] = 'The user is already registered';
+$strings['ProblemToSaveTheCurrencyType'] = 'Problem loading the currency type';
+$strings['ProblemToSaveThePaypalParameters'] = 'Problem saving PayPal parameters';
+$strings['ProblemToInsertANewAccount'] = 'Problem inserting the new account';
+$strings['ProblemToDeleteTheAccount'] = 'Problem removing account';
+$strings['ProblemToSaveTheMessage'] = 'Problem saving message';
+$strings['ProblemToSubscribeTheUser'] = 'Problem subscribing the user';
+$strings['TheSubscriptionAndActivationWereDoneSuccessfully'] = 'The subscription and activation were successful';
+$strings['TheUserIsAlreadyRegisteredInTheCourse'] = 'The user is already registered in the course.';
+$strings['CourseListOnSale'] = 'List of courses on sale';
+$strings['BuyCourses'] = 'Buy courses';
+$strings['ConfigurationOfCoursesAndPrices'] = 'Courses and prices configuration';
+$strings['ConfigurationOfPayments'] = 'Payments configuration';
+$strings['OrdersPendingOfPayment'] = 'Orders awaiting payment';
+$strings['AvailableCoursesConfiguration'] = 'Available courses configuration';
+$strings['PaymentsConfiguration'] = 'Payments configuration';
+$strings['bc_message'] = "Dear {{name}}. <br />We are currently waiting for the payment confirmation. Once received, we will enable your user in course <strong>{{curso}}</strong>.<br><br><strong>Please do not forget to mention your order reference number in your transfer: <div style='display:inline;text-align:center; font-weight:bold; font-size:20px; color:#333'>{{reference}}</div></strong>";
+$strings['Categories'] = "Categories";
+$strings['BankTransfer'] = 'Bank transfer';
+$strings['EnrollToCourseXSuccessful'] = "Your subscription to the course is complete";
+$strings['SearchFilter'] = "Search filter";
+$strings['MinimumPrice'] = "Minimum price";
+$strings['MaximumPrice'] = "Maximum price";
+$strings['AvailableCourses'] = "Courses available";
+$strings['PaymentConfiguration'] = "Payment configuration";
+$strings['WaitingToReceiveThePayment'] = "Currently pending payment";
+$strings['CurrencyType'] = "Currency type";
+$strings['SelectACurrency'] = "Choose a currency";
+$strings['Sandbox'] = "Test environment";
+$strings['BankAccount'] = "Bank account";
+$strings['SubscribeUser'] = "Subscribe user";
+$strings['DeleteTheOrder'] = "Delete order";
+$strings['ReferenceOrder'] = 'Order reference';
+$strings['UserInformation'] = "Buyer's details";
+$strings['OnceItIsConfirmed,YouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Once confirmed, you will receive an e-mail with the bank details and an order reference.";
+$strings['BankAccountInformation'] = 'Bank account details';
+$strings['ConfirmOrder'] = 'Confirm order';
+$strings['PaymentMethods'] = 'Payment methods';
+$strings['CancelOrder'] = 'Cancel order';
+$strings['ErrorContactPlatformAdmin'] = "Unknown error. Please contact the platform administrator.";
+$strings['PayPalConfig'] = "PayPal configuration:";
+$strings['TransfersConfig'] = "Bank transfers configuration:";
+$strings['PayPalPaymentOKPleaseConfirm'] = "PayPal reports the transaction is ready to be executed. To acknowledge that you are OK to proceed, please click the confirmation button below. Once clicked, you will be registered to the course and the funds will be transferred from your PayPal account to our shop. You can always access your courses through the 'My courses' tab. Thank you for your custom!";

+ 72 - 0
plugin/buycourses/lang/french.php

@@ -0,0 +1,72 @@
+<?php
+//Needed in order to show the plugin title
+$strings['plugin_title'] = "Vente de cours";
+$strings['plugin_comment'] = "Vendez vos cours directement depuis votre portail Chamilo, au travers d'un compte PayPal. Plugin en version beta, à utiliser avec précaution. Ni l'association Chamilo ni les développeurs impliqués dans le développement de ce plugin ne sauraient être tenus responsables d'un quelconque inconvénient causé par celui-ci.";
+
+$strings['Visible'] = "Montrer dans la liste";
+$strings['Options'] = "Options";
+$strings['Price'] = "Prix";
+$strings['SyncCourseDatabase'] = "Synchroniser les cours depuis la base de données";
+
+$strings['Private'] = "Privé - Accès autorisé seulement aux inscrits au cours";
+$strings['CourseVisibilityClosed'] = "Fermé - Pas d'accès au cours";
+$strings['OpenToThePlatform'] = "Ouvert - Accès autorisé seulement pour les utilisateurs inscrits à la plateforme";
+$strings['OpenToTheWorld'] = "Public - Accès autorisé à tous";
+
+$strings['Description'] = "Description";
+$strings['Buy'] = "Acheter";
+$strings['Mostrar_disponibles'] = "Montrer les cours disponibles";
+
+$strings['paypal_enable'] = "Activer PayPal";
+$strings['transfer_enable'] = "Activer les transferts bancaires";
+$strings['unregistered_users_enable'] = "Permettre l'accès aux utilisateurs non enregistrés sur la plateforme";
+$strings['Cancelacionpedido'] = "La commande a été annulée.";
+$strings['AlreadyBuy'] = "Vous êtes déjà inscrit au cours";
+$strings['bc_subject'] = "Confirmation de commande de cours";
+
+$strings['paypal'] = "PayPal";
+$strings['confirmar_compra'] = "Confirmer achat de cours";
+
+$strings['TheUserIsAlreadyRegistered'] = "L'utilisateur est déjà inscrit";
+$strings['ProblemToSaveTheCurrencyType'] = "Problème de sauvegarde du type de devise";
+$strings['ProblemToSaveThePaypalParameters'] = "Problème de sauvegarde des paramètres de Paypal";
+$strings['ProblemToInsertANewAccount'] = "Problème à l'insertion du nouveau compte";
+$strings['ProblemToDeleteTheAccount'] = "Problème de suppression du compte";
+$strings['ProblemToSaveTheMessage'] = "Problème d'enregistrement du message";
+$strings['ProblemToSubscribeTheUser'] = "Problème d'inscription de l'utilisateur";
+$strings['TheSubscriptionAndActivationWereDoneSuccessfully'] = "L'inscription et l'activation se sont déroulés sans problème.";
+$strings['TheUserIsAlreadyRegisteredInTheCourse'] = "L'utilisateur est déjà inscrit au cours";
+$strings['CourseListOnSale'] = "Liste de cours en vente";
+$strings['BuyCourses'] = "Acheter des cours";
+$strings['ConfigurationOfCoursesAndPrices'] = "Configuration des cours et prix";
+$strings['ConfigurationOfPayments'] = "Configuration des paiements";
+$strings['OrdersPendingOfPayment'] = "Commandes en attente de paiement";
+$strings['AvailableCoursesConfiguration'] = "Configuration des cours disponibles";
+$strings['PaymentsConfiguration'] = "Configuration des paiements";
+$strings['bc_message'] = "Cher/Chère {{name}}. <br />À la réception de la confirmation de paiement, nous terminerons le processus d'inscrtipion au cours <strong>{{curso}}</strong>.<br><br><strong>N'oubliez pas d'indiquer le numéro de référence de la commande lors de votre transfert: <div style='display:inline;text-align:center; font-weight:bold; font-size:20px; color:#333'>{{reference}}</div></strong>";
+$strings['Categories'] = "Catégories";
+$strings['BankTransfer'] = 'Transfert bancaire';
+$strings['EnrollToCourseXSuccessful'] = "Votre inscription au cours au cours %s est terminée.";
+$strings['SearchFilter'] = "Filtre de recherche";
+$strings['MinimumPrice'] = "Prix minimum";
+$strings['MaximumPrice'] = "Prix maximum";
+$strings['AvailableCourses'] = "Cours disponibles";
+$strings['PaymentConfiguration'] = "Configuration des paiements";
+$strings['WaitingToReceiveThePayment'] = "En attente de réception du paiement";
+$strings['CurrencyType'] = "Tipe de device";
+$strings['SelectACurrency'] = "Sélectionnez une devise";
+$strings['Sandbox'] = "Environnement de test";
+$strings['BankAccount'] = "Compte bancaire";
+$strings['SubscribeUser'] = "Inscrire utilisateur";
+$strings['DeleteTheOrder'] = "Éliminer la commande";
+$strings['ReferenceOrder'] = "Référence de la commande";
+$strings['UserInformation'] = "Fiche acheteur";
+$strings['OnceItIsConfirmed,YouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Une fois confirmée, vous recevrez un e-mail avec les données bancaires et la référence de la commande";
+$strings['BankAccountInformation'] = "Détails du compte bancaire";
+$strings['ConfirmOrder'] = "Confirmer commande";
+$strings['PaymentMethods'] = "Méthodes de paiement";
+$strings['CancelOrder'] = "Annuler la commande";
+$strings['ErrorContactPlatformAdmin'] = "Une erreur inconnue s'est produite. Veuillez contacter l'administrateur de la plateforme.";
+$strings['PayPalConfig'] = "Configuration PayPal:";
+$strings['TransfersConfig'] = "Configuration des transfers bancaires:";
+$strings['PayPalPaymentOKPleaseConfirm'] = "PayPal nous indique que la transaction est prête à être exécutée. Par mesure de sécurité, nous vous demandons de bien vouloir confirmer une dernière fois la transaction en cliquant sur le bouton de confirmation ci-dessous. Une fois cliqué, vous serez immédiatement enregistré au cours, et les fonds correspondants seront soustraits de votre compte PayPal. Vous pouvez accéder à vos cours à tout moment à partir de l'onglet 'Mes cours'. Merci de votre fidélité!";

+ 14 - 11
plugin/buycourses/lang/spanish.php

@@ -1,7 +1,7 @@
 <?php
 //Needed in order to show the plugin title
-$strings['plugin_title'] = "Comprar cursos";
-$strings['plugin_comment'] = "Configurar precios, tipos de pago, visibilidad de cursos.";
+$strings['plugin_title'] = "Venta de cursos";
+$strings['plugin_comment'] = "Vender cursos a través de PayPal directamente desde su portal Chamilo. Plugin en versión Beta, a usar con mucha precaución. La asociación Chamilo y los desarrolladores involucrados no pueden ser considerados responsables de cualquier inconveniente que se presente.";
 
 $strings['Visible'] = "Mostrar en el listado";
 $strings['Options'] = "Opciones";
@@ -18,11 +18,11 @@ $strings['Buy'] = "Comprar";
 $strings['Mostrar_disponibles'] = "Mostrar cursos disponibles";
 
 $strings['paypal_enable'] = "Habilitar PayPal";
-$strings['transference_enable'] = "Habilitar transferencia";
+$strings['transfer_enable'] = "Habilitar transferencia";
 $strings['unregistered_users_enable'] = "Permitir usuarios sin registro en la plataforma";
 $strings['Cancelacionpedido'] = "El pedido se ha cancelado.";
-$strings['AlreadyBuy'] = "Ya est matriculado en el curso";
-$strings['bc_subject'] = "Confirmacin pedido de cursos";
+$strings['AlreadyBuy'] = "Ya está matriculado en el curso";
+$strings['bc_subject'] = "Confirmación pedido de cursos";
 
 $strings['paypal'] = 'PayPal';
 $strings['confirmar_compra'] = 'Confirmar compra de curso';
@@ -38,18 +38,18 @@ $strings['TheSubscriptionAndActivationWereDoneSuccessfully'] = 'La suscripción
 $strings['TheUserIsAlreadyRegisteredInTheCourse'] = 'El usuario ya está registrado en el curso.';
 $strings['CourseListOnSale'] = 'Lista de cursos a la venta';
 $strings['BuyCourses'] = 'Comprar cursos';
-$strings['ConfigurationOfCoursesAndPrices'] = 'Configuración de los cursos y precios';
+$strings['ConfigurationOfCoursesAndPrices'] = 'Configuración de cursos y precios';
 $strings['ConfigurationOfPayments'] = 'Configuración de pagos';
 $strings['OrdersPendingOfPayment'] = 'Pedidos pendientes de pago';
 $strings['AvailableCoursesConfiguration'] = 'Configuración de cursos disponibles';
 $strings['PaymentsConfiguration'] = 'Configuración de Pagos';
 $strings['bc_message'] = "Estimado {{name}}. <br />En cuanto recibamos confirmaci&oacute;n de pago procederemos a dar de alta su usuario en el curso <strong>{{curso}}</strong>.<br><br><strong>No olvide indicar en el concepto de la transferencia el n&uacute;mero de referencia del pedido: <div style='display:inline;text-align:center; font-weight:bold; font-size:20px; color:#333'>{{reference}}</div></strong>";
 $strings['Categories'] = "Categorias";
-$strings['BankTransference'] = 'Transferencia Bancaria';
+$strings['BankTransfer'] = 'Transferencia Bancaria';
 $strings['EnrollToCourseXSuccessful'] = "Su inscripción en el curso %s se ha completado.";
 $strings['SearchFilter'] = "Filtro de búsqueda";
-$strings['MinimumPrice'] = "Precio menor de";
-$strings['MaximumPrice'] = "Precio mayor de";
+$strings['MinimumPrice'] = "Precio mínimo";
+$strings['MaximumPrice'] = "Precio máximo";
 $strings['AvailableCourses'] = "Cursos disponibles";
 $strings['PaymentConfiguration'] = "Configuración de Pagos";
 $strings['WaitingToReceiveThePayment'] = "Se encuentra a la espera de recibir el pago";
@@ -60,10 +60,13 @@ $strings['BankAccount'] = "Cuenta Bancaria";
 $strings['SubscribeUser'] = "Suscribir Usuario";
 $strings['DeleteTheOrder'] = "Eliminar el Pedido";
 $strings['ReferenceOrder'] = 'Referencia del pedido';
-$strings['UserInformation'] = 'Información del Usuario';
+$strings['UserInformation'] = 'Ficha del comprador';
 $strings['OnceItIsConfirmed,YouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'] = "Una vez confirmado, recibira un e-mail con los datos bancarios y una referencia del pedido.";
 $strings['BankAccountInformation'] = 'Información de la Cuenta Bancaria';
 $strings['ConfirmOrder'] = 'Confirmar Orden';
 $strings['PaymentMethods'] = 'Métodos de pago';
 $strings['CancelOrder'] = 'Cancelar Orden';
-$strings['ErrorContactPlatformAdmin'] = "Se ha producido un error desconocido. Por favor, póngase en contacto con el administrador de la plataforma.";
+$strings['ErrorContactPlatformAdmin'] = "Se ha producido un error desconocido. Por favor, póngase en contacto con el administrador de la plataforma.";
+$strings['PayPalConfig'] = "Configuraci&oacute;n PayPal:";
+$strings['TransfersConfig'] = "Configuraci&oacute;n de transferencias:";
+$strings['PayPalPaymentOKPleaseConfirm'] = "PayPal nos indicó que todo estaba listo para ejecutar el pago. Por seguridad, le pedimos confirme una última vez su pedido dando clic en el botón de confirmación a bajo. Una vez le haya dado clic, será registrado al curso y el monto correspondiente será retirado de su cuenta PayPal. Siempre puede acceder a sus cursos a partir de la pestaña 'Mis cursos'. Gracias por su compra!";

+ 3 - 4
plugin/buycourses/plugin.php

@@ -1,13 +1,12 @@
 <?php
+/* For license terms, see /license.txt */
 /**
  * This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different).
  * These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)
- * @package chamilo.plugin
- * @author Yannick Warnier <ywarnier@beeznest.org>
+ * @package chamilo.plugin.buycourses
  */
 /**
  * Plugin details (must be present)
  */
-
 require_once dirname(__FILE__) . '/config.php';
-$plugin_info = Buy_CoursesPlugin::create()->get_info();
+$plugin_info = BuyCoursesPlugin::create()->get_info();

+ 5 - 5
plugin/buycourses/readme.txt

@@ -1,5 +1,5 @@
-Buy Courses<br/><br/>
-Users can access to the catalog to buy the visible courses.<br/>
-If the user is unregistered this user will be requested to register.<br/>
-Once the course is chosen Chamilo is going to show different enabled payment types. <br/>
-Finally the user will receive through email the user and password to access to the chosen course. <br/>
+Courses purchase plugin<br/><br/>
+Users can access the courses purchase catalog to buy available courses.<br/>
+If the user is unregistered he/she will be requested to register.<br/>
+Once the course is chosen, Chamilo shows the different payment types available (currently only PayPal works). <br/>
+Finally, the user receives user and password by e-mail, to access the chosen course. <br/>

+ 3 - 3
plugin/buycourses/resources/plugin.css

@@ -11,11 +11,11 @@ table td.ta-center, table th.ta-center {
     text-align: center;
 }
 
-#courses_table td, #transference_table td, #order_table td {
+#courses_table td, #transfer_table td, #order_table td {
     vertical-align: middle;
 }
 
-#courses_table td input.price, #transference_table td input, #currency_type {
+#courses_table td input.price, #transfer_table td input, #currency_type {
     margin: 0;
 }
 
@@ -76,4 +76,4 @@ select#lsessions, select#lcourses, select#lexercises, select#status {
 
 .margin-left-fifty{
     margin-left: 50px !important;
-}
+}

+ 9 - 2
plugin/buycourses/src/ajax.php

@@ -1,5 +1,12 @@
 <?php
-
+/* For license terms, see /license.txt */
+/**
+ * AJAX script to get courses descriptions
+ * @package chamilo.plugin.buycourses
+ */
+/**
+ * Init
+ */
 require_once '../config.php';
 require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php';
 
@@ -26,4 +33,4 @@ if (Database::num_rows($result) > 0) {
     echo CourseManager::get_details_course_description_html($descriptions, api_get_system_encoding(), false);
 } else {
     echo get_lang('NoDescription');
-}		
+}		

+ 86 - 27
plugin/buycourses/src/buy_course.lib.php

@@ -1,12 +1,19 @@
 <?php
+/* For license terms, see /license.txt */
 /**
  * Functions
- * @package chamilo.plugin.notify
+ * @package chamilo.plugin.buycourses
+ */
+/**
+ * Init
  */
 require_once '../../../main/inc/global.inc.php';
 require_once '../config.php';
 require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
 
+/**
+ *
+ */
 function sync()
 {
     $tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
@@ -18,13 +25,13 @@ function sync()
     $sql = "SELECT id FROM $tableCourse";
     $res = Database::query($sql);
     while ($row = Database::fetch_assoc($res)) {
-        $sql = "SELECT 1 FROM $tableBuyCourse WHERE id_course='" . $row['id'] . "';";
+        $sql = "SELECT 1 FROM $tableBuyCourse WHERE course_id='" . $row['id'] . "';";
         Database::query($sql);
         if (Database::affected_rows() > 0) {
-            $sql = "UPDATE $tableBuyCourse SET sync = 1 WHERE id_course='" . $row['id'] . "';";
+            $sql = "UPDATE $tableBuyCourse SET sync = 1 WHERE course_id='" . $row['id'] . "';";
             Database::query($sql);
         } else {
-            $sql = "INSERT INTO $tableBuyCourse (id_course, visible, sync) VALUES ('" . $row['id'] . "', 0, 1);";
+            $sql = "INSERT INTO $tableBuyCourse (course_id, visible, sync) VALUES ('" . $row['id'] . "', 0, 1);";
             Database::query($sql);
         }
     }
@@ -32,13 +39,17 @@ function sync()
     Database::query($sql);
 }
 
+/**
+ * List courses detils from the buy-course table and the course table
+ * @return array Results (list of courses details)
+ */
 function listCourses()
 {
     $tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
     $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
-    $sql = "SELECT a.id_course, a.visible, a.price, b.*
+    $sql = "SELECT a.course_id, a.visible, a.price, b.*
         FROM $tableBuyCourse a, $tableCourse b
-        WHERE a.id_course = b.id;";
+        WHERE a.course_id = b.id;";
 
     $res = Database::query($sql);
     $aux = array();
@@ -49,6 +60,9 @@ function listCourses()
     return $aux;
 }
 
+/**
+ *
+ */
 function userCourseList()
 {
     $tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
@@ -56,9 +70,9 @@ function userCourseList()
     $tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $tableBuyCourseTemporal = Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
 
-    $sql = "SELECT a.id_course, a.visible, a.price, b.*
+    $sql = "SELECT a.course_id, a.visible, a.price, b.*
         FROM $tableBuyCourse a, $tableCourse b
-        WHERE a.id_course = b.id AND a.visible = 1;";
+        WHERE a.course_id = b.id AND a.visible = 1;";
     $res = Database::query($sql);
     $aux = array();
     while ($row = Database::fetch_assoc($res)) {
@@ -115,6 +129,9 @@ function userCourseList()
     return $aux;
 }
 
+/**
+ *
+ */
 function checkUserCourse($course, $user)
 {
     $tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
@@ -129,7 +146,10 @@ function checkUserCourse($course, $user)
     }
 }
 
-function checkUserCourseTransference($course, $user)
+/**
+ * 
+ */
+function checkUserCourseTransfer($course, $user)
 {
     $tableBuyCourseTemporal = Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
     $sql = "SELECT 1 FROM $tableBuyCourseTemporal
@@ -143,6 +163,9 @@ function checkUserCourseTransference($course, $user)
     }
 }
 
+/**
+ *
+ */
 function listCategories()
 {
     $tblCourseCategory = Database::get_main_table(TABLE_MAIN_CATEGORY);
@@ -158,6 +181,8 @@ function listCategories()
 
 /**
  * Return an icon representing the visibility of the course
+ * @param int $option The course visibility
+ * @return string HTML string of the visibility icon
  */
 function getCourseVisibilityIcon($option)
 {
@@ -179,7 +204,10 @@ function getCourseVisibilityIcon($option)
             return '';
     }
 }
-
+/**
+ * List the available currencies
+ * @result array The list of currencies
+ */
 function listCurrency()
 {
     $tableBuyCourseCountry = Database::get_main_table(TABLE_BUY_COURSE_COUNTRY);
@@ -193,11 +221,14 @@ function listCurrency()
 
     return $aux;
 }
-
+/**
+ * Gets the list of accounts from the buy_course_transfer table
+ * @return array The list of accounts
+ */
 function listAccounts()
 {
-    $tableBuyCourseTransference = Database::get_main_table(TABLE_BUY_COURSE_TRANSFERENCE);
-    $sql = "SELECT * FROM $tableBuyCourseTransference";
+    $tableBuyCourseTransfer = Database::get_main_table(TABLE_BUY_COURSE_TRANSFER);
+    $sql = "SELECT * FROM $tableBuyCourseTransfer";
     $res = Database::query($sql);
     $aux = array();
     while ($row = Database::fetch_assoc($res)) {
@@ -206,7 +237,10 @@ function listAccounts()
 
     return $aux;
 }
-
+/**
+ * Gets the stored PayPal params
+ * @return array The stored PayPal params
+ */
 function paypalParameters()
 {
     $tableBuyCoursePaypal = Database::get_main_table(TABLE_BUY_COURSE_PAYPAL);
@@ -216,11 +250,14 @@ function paypalParameters()
 
     return $row;
 }
-
-function transferenceParameters()
+/**
+ * Gets the parameters for the bank transfers payment method
+ * @result array Bank transfer payment parameters stored
+ */
+function transferParameters()
 {
-    $tableBuyCourseTransference = Database::get_main_table(TABLE_BUY_COURSE_TRANSFERENCE);
-    $sql = "SELECT * FROM $tableBuyCourseTransference";
+    $tableBuyCourseTransfer = Database::get_main_table(TABLE_BUY_COURSE_TRANSFER);
+    $sql = "SELECT * FROM $tableBuyCourseTransfer";
     $res = Database::query($sql);
     $aux = array();
     while ($row = Database::fetch_assoc($res)) {
@@ -229,7 +266,10 @@ function transferenceParameters()
 
     return $aux;
 }
-
+/**
+ * Find the first enabled currency (there should be only one)
+ * @result string The code of the active currency
+ */
 function findCurrency()
 {
     $tableBuyCourseCountry = Database::get_main_table(TABLE_BUY_COURSE_COUNTRY);
@@ -239,16 +279,21 @@ function findCurrency()
 
     return $row['currency_code'];
 }
-
+/**
+ * Extended information about the course (from the course table as well as
+ * the buy_course table)
+ * @param string $code The course code
+ * @return array Info about the course
+ */
 function courseInfo($code)
 {
     $tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
     $tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $tableUser = Database::get_main_table(TABLE_MAIN_USER);
-
-    $sql = "SELECT a.id_course, a.visible, a.price, b.*
+    $code = Database::escape_string($code);
+    $sql = "SELECT a.course_id, a.visible, a.price, b.*
         FROM $tableBuyCourse a, course b
-        WHERE a.id_course=b.id
+        WHERE a.course_id=b.id
         AND a.visible = 1
         AND b.id = '" . $code . "';";
     $res = Database::query($sql);
@@ -286,7 +331,14 @@ function courseInfo($code)
 
     return $row;
 }
-
+/**
+ * Generates a random text (used for order references)
+ * @param int $long
+ * @param bool $minWords
+ * @param bool $maxWords
+ * @param bool $number
+ * @return string A random text
+ */
 function randomText($long = 6, $minWords = true, $maxWords = true, $number = true)
 {
     $salt = $minWords ? 'abchefghknpqrstuvwxyz' : '';
@@ -310,7 +362,10 @@ function randomText($long = 6, $minWords = true, $maxWords = true, $number = tru
 
     return $str;
 }
-
+/**
+ * Generates an order reference
+ * @result string A reference number
+ */
 function calculateReference()
 {
     $tableBuyCourseTemporal = Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
@@ -327,7 +382,11 @@ function calculateReference()
 
     return $reference;
 }
-
+/**
+ * Gets a list of pending orders
+ * @result array List of orders
+ * @todo Enable pagination
+ */
 function pendingList()
 {
     $tableBuyCourseTemporal = Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
@@ -339,4 +398,4 @@ function pendingList()
     }
 
     return $aux;
-}
+}

+ 10 - 8
plugin/buycourses/src/buy_course_plugin.class.php

@@ -1,12 +1,14 @@
 <?php
-
+/* For license terms, see /license.txt */
 /**
  * Description of buy_courses_plugin
- *
- * @copyright (c) 2013 Nosolored
+ * @package chamilo.plugin.buycourses
  * @author Jose Angel Ruiz    <jaruiz@nosolored.com>
  */
-class Buy_CoursesPlugin extends Plugin
+/**
+ * Plugin class for the BuyCourses plugin
+ */
+class BuyCoursesPlugin extends Plugin
 {
     /**
      *
@@ -20,7 +22,7 @@ class Buy_CoursesPlugin extends Plugin
 
     protected function __construct()
     {
-        parent::__construct('1.0', 'Jose Angel Ruiz, Francis Gonzales', array('paypal_enable' => 'boolean', 'transference_enable' => 'boolean', 'unregistered_users_enable' => 'boolean'));
+        parent::__construct('1.0', 'Jose Angel Ruiz, Francis Gonzales', array('paypal_enable' => 'boolean', 'transfer_enable' => 'boolean', 'unregistered_users_enable' => 'boolean'));
     }
 
     /**
@@ -28,7 +30,7 @@ class Buy_CoursesPlugin extends Plugin
      */
     function install()
     {
-        require_once api_get_path(SYS_PLUGIN_PATH) . 'buy_courses/database.php';
+        require_once api_get_path(SYS_PLUGIN_PATH) . 'buycourses/database.php';
     }
 
     /**
@@ -48,7 +50,7 @@ class Buy_CoursesPlugin extends Plugin
         $sql = "DROP TABLE IF EXISTS $table";
         Database::query($sql);
 
-        $table = Database::get_main_table(TABLE_BUY_COURSE_TRANSFERENCE);
+        $table = Database::get_main_table(TABLE_BUY_COURSE_TRANSFER);
         $sql = "DROP TABLE IF EXISTS $table";
         Database::query($sql);
 
@@ -60,4 +62,4 @@ class Buy_CoursesPlugin extends Plugin
         $sql = "DROP TABLE IF EXISTS $table";
         Database::query($sql);
     }
-}
+}

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

@@ -1,4 +1,9 @@
 <?php
+/* For license terms, see /license.txt */
+/**
+ * Configuration script for the Buy Courses plugin
+ * @package chamilo.plugin.buycourses
+ */
 /**
  * Initialization
  */
@@ -6,7 +11,7 @@ require_once dirname(__FILE__) . '/buy_course.lib.php';
 require_once '../../../main/inc/global.inc.php';
 require_once 'buy_course_plugin.class.php';
 
-$plugin = Buy_CoursesPlugin::create();
+$plugin = BuyCoursesPlugin::create();
 
 $_cid = 0;
 $templateName = $plugin->get_lang('AvailableCourses');
@@ -28,8 +33,8 @@ if ($teacher) {
     $visibility[] = getCourseVisibilityIcon('3');
 
     $coursesList = listCourses();
-    $confirmationImgPath = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/message_confirmation.png';
-    $saveImgPath = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/save.png';
+    $confirmationImgPath = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/message_confirmation.png';
+    $saveImgPath = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/save.png';
     $currencyType = findCurrency();
 
     $tpl->assign('server', $_configuration['root_web']);
@@ -39,8 +44,8 @@ if ($teacher) {
     $tpl->assign('save_img', $saveImgPath);
     $tpl->assign('currency', $currencyType);
 
-    $listing_tpl = 'buy_courses/view/configuration.tpl';
+    $listing_tpl = 'buycourses/view/configuration.tpl';
     $content = $tpl->fetch($listing_tpl);
     $tpl->assign('content', $content);
     $tpl->display_one_col_template();
-}
+}

+ 10 - 2
plugin/buycourses/src/error.php

@@ -1,5 +1,13 @@
 <?php
-$course_plugin = 'buy_courses';
+/* For license terms, see /license.txt */
+/**
+ * Errors management for the Buy Courses plugin - Redirects to list.php
+ * @package chamilo.plugin.buycourses
+ */
+/**
+ * Config
+ */
+$course_plugin = 'buycourses';
 require_once 'buy_course.lib.php';
 require_once 'buy_course_plugin.class.php';
 
@@ -15,4 +23,4 @@ unset($_SESSION['TOKEN']);
 $_SESSION['bc_success'] = false;
 $_SESSION['bc_message'] = 'CancelOrder';
 
-header('Location:list.php');
+header('Location:list.php');

+ 9 - 3
plugin/buycourses/src/expresscheckout.php

@@ -1,8 +1,14 @@
 <?php
-
-require_once 'paypalfunctions.php';
+/* For license terms, see /license.txt */
 /**
  * PayPal Express Checkout Module
+ * @package chamilo.plugin.buycourses
+ */
+/**
+ * Init
+ */
+require_once 'paypalfunctions.php';
+/**
  *
  * The paymentAmount is the total value of
  * the shopping cart, that was set
@@ -38,4 +44,4 @@ if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
     echo "Short Error Message: " . $ErrorShortMsg;
     echo "Error Code: " . $ErrorCode;
     echo "Error Severity Code: " . $ErrorSeverityCode;
-}
+}

+ 27 - 24
plugin/buycourses/src/function.php

@@ -1,5 +1,12 @@
 <?php
-
+/* For license terms, see /license.txt */
+/**
+ * Functions for the Buy Courses plugin
+ * @package chamilo.plugin.buycourses
+ */
+/**
+ * Init
+ */
 require_once '../config.php';
 require_once 'buy_course.lib.php';
 require_once api_get_path(LIBRARY_PATH) . 'mail.lib.inc.php';
@@ -8,13 +15,13 @@ require_once api_get_path(LIBRARY_PATH) . 'course.lib.php';
 $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);
-$tableBuyCourseTransference = Database::get_main_table(TABLE_BUY_COURSE_TRANSFERENCE);
+$tableBuyCourseTransfer = Database::get_main_table(TABLE_BUY_COURSE_TRANSFER);
 $tableBuyCourseTemporal = Database::get_main_table(TABLE_BUY_COURSE_TEMPORAL);
 $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
 $tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 $tableUser = Database::get_main_table(TABLE_MAIN_USER);
 
-$plugin = Buy_CoursesPlugin::create();
+$plugin = BuyCoursesPlugin::create();
 $buy_name = $plugin->get_lang('Buy');
 
 if ($_REQUEST['tab'] == 'sync') {
@@ -33,7 +40,7 @@ if ($_REQUEST['tab'] == 'courses_filter') {
     $priceMax = Database::escape_string($_REQUEST['pricemax']);
     $show = Database::escape_string($_REQUEST['show']);
     $category = Database::escape_string($_REQUEST['category']);
-    $server = Database::escape_string($_configuration['root_web']);
+    $server = api_get_path(WEB_PATH);
 
     $filter = '';
     if ($course != '') {
@@ -64,14 +71,14 @@ if ($_REQUEST['tab'] == 'courses_filter') {
     }
 
     if ($filter == '') {
-        $sql = "SELECT a.id_course, a.visible, a.price, b.*
+        $sql = "SELECT a.course_id, a.visible, a.price, b.*
             FROM $tableBuyCourse a, $tableCourse b
-            WHERE a.id_course = b.id
+            WHERE a.course_id = b.id
             AND a.visible = 1;";
     } else {
-        $sql = "SELECT a.id_course, a.visible, a.price, b.*
+        $sql = "SELECT a.course_id, a.visible, a.price, b.*
             FROM $tableBuyCourse a, $tableCourse b
-            WHERE a.id_course = b.id
+            WHERE a.course_id = b.id
             AND a.visible = 1 AND " . $filter . ";";
     }
 
@@ -144,7 +151,7 @@ if ($_REQUEST['tab'] == 'courses_filter') {
         $content .= '<div class="btn-toolbar right">';
         $content .= '<a class="ajax btn btn-primary" title="" href="' . $server . 'main/inc/ajax/course_home.ajax.php?a=show_course_information&code=' . $course['code'] . '">' . get_lang('Description') . '</a>&nbsp;';
         if ($course['enrolled'] != "YES") {
-            $content .= '<a class="btn btn-success" title="" href="' . $server . 'plugin/buy_courses/src/process.php?code=' . $course['id'] . '">' . $buy_name . '</a>';
+            $content .= '<a class="btn btn-success" title="" href="' . $server . 'plugin/buycourses/src/process.php?code=' . $course['id'] . '">' . $buy_name . '</a>';
         }
         $content .= '</div>';
         $content .= '</div>';
@@ -156,10 +163,10 @@ if ($_REQUEST['tab'] == 'courses_filter') {
 }
 
 if ($_REQUEST['tab'] == 'save_currency') {
-    $id = $_REQUEST['currency'];
+    $id = Database::escape_string($_REQUEST['currency']);
     $sql = "UPDATE $tableBuyCourseCountry SET status='0';";
     $res = Database::query($sql);
-    $sql = "UPDATE $tableBuyCourseCountry SET status='1' WHERE id_country='" . $id . "';";
+    $sql = "UPDATE $tableBuyCourseCountry SET status='1' WHERE country_id='" . $id . "';";
     $res = Database::query($sql);
     if (!res) {
         $content = $plugin->get_lang('ProblemToSaveTheCurrencyType') . Database::error();
@@ -196,7 +203,7 @@ if ($_REQUEST['tab'] == 'add_account') {
     $name = Database::escape_string($_REQUEST['name']);
     $account = Database::escape_string($_REQUEST['account']);
     $swift = Database::escape_string($_REQUEST['swift']);
-    $sql = "INSERT INTO $tableBuyCourseTransference (name, account, swift)
+    $sql = "INSERT INTO $tableBuyCourseTransfer (name, account, swift)
         VALUES ('" . $name . "','" . $account . "', '" . $swift . "');";
 
     $res = Database::query($sql);
@@ -210,10 +217,9 @@ if ($_REQUEST['tab'] == 'add_account') {
 }
 
 if ($_REQUEST['tab'] == 'delete_account') {
-    $_REQUEST['id'] = intval($_REQUEST['id']);
-    $id = $_REQUEST['id'];
+    $id = intval($_REQUEST['id']);
 
-    $sql = "DELETE FROM $tableBuyCourseTransference WHERE id='" . $id . "';";
+    $sql = "DELETE FROM $tableBuyCourseTransfer WHERE id='" . $id . "';";
     $res = Database::query($sql);
     if (!res) {
         $content = $plugin->get_lang('ProblemToDeleteTheAccount') . Database::error();
@@ -226,22 +232,21 @@ if ($_REQUEST['tab'] == 'delete_account') {
 
 if ($_REQUEST['tab'] == 'save_mod') {
     $_REQUEST['id'] = Database::escape_string($_REQUEST['id']);
-    $idCourse = intval($_REQUEST['id_course']);
+    $idCourse = intval($_REQUEST['course_id']);
     $visible = ($_REQUEST['visible'] == "checked") ? 1 : 0;
     $price = Database::escape_string($_REQUEST['price']);
-    $obj = $_REQUEST['obj'];
 
     $sql = "UPDATE $tableBuyCourse
         SET visible = " . $visible . ",
         price = '" . $price . "'
-        WHERE id_course = '" . $idCourse . "';";
+        WHERE course_id = '" . $idCourse . "';";
 
     $res = Database::query($sql);
     if (!res) {
         $content = $plugin->get_lang('ProblemToSaveTheMessage') . Database::error();
         echo json_encode(array("status" => "false", "content" => $content));
     } else {
-        echo json_encode(array("status" => "true", "id_course" => $idCourse));
+        echo json_encode(array("status" => "true", "course_id" => $idCourse));
     }
 }
 
@@ -261,8 +266,7 @@ if ($_REQUEST['tab'] == 'unset_variables') {
 }
 
 if ($_REQUEST['tab'] == 'clear_order') {
-    $_REQUEST['id'] = intval($_REQUEST['id']);
-    $id = substr($_REQUEST['id'], 6);
+    $id = substr(intval($_REQUEST['id']), 6);
     $sql = "DELETE FROM $tableBuyCourseTemporal WHERE cod='" . $id . "';";
 
     $res = Database::query($sql);
@@ -276,8 +280,7 @@ if ($_REQUEST['tab'] == 'clear_order') {
 }
 
 if ($_REQUEST['tab'] == 'confirm_order') {
-    $_REQUEST['id'] = intval($_REQUEST['id']);
-    $id = substr($_REQUEST['id'], 6);
+    $id = substr(intval($_REQUEST['id']), 6);
     $sql = "SELECT * FROM $tableBuyCourseTemporal WHERE cod='" . $id . "';";
     $res = Database::query($sql);
     $row = Database::fetch_assoc($res);
@@ -307,4 +310,4 @@ if ($_REQUEST['tab'] == 'confirm_order') {
         $content = $plugin->get_lang('ProblemToSubscribeTheUser');
         echo json_encode(array("status" => "false", "content" => $content));
     }
-}
+}

+ 9 - 5
plugin/buycourses/src/index.buycourses.php

@@ -1,9 +1,13 @@
 <?php
+/* For license terms, see /license.txt */
 /**
- * @package chamilo.plugin.themeselect
+ * Index of the Buy Courses plugin courses list
+ * @package chamilo.plugin.buycourses
  */
-
-$plugin = Buy_CoursesPlugin::create();
+/**
+ *
+ */
+$plugin = BuyCoursesPlugin::create();
 $guess_enable = $plugin->get('unregistered_users_enable');
 
 if ($guess_enable == "true" || isset($_SESSION['_user'])) {
@@ -17,9 +21,9 @@ if ($guess_enable == "true" || isset($_SESSION['_user'])) {
     $tpl->assign('ConfigurationOfCoursesAndPrices', $plugin->get_lang('ConfigurationOfCoursesAndPrices'));
     $tpl->assign('ConfigurationOfPayments', $plugin->get_lang('ConfigurationOfPayments'));
     $tpl->assign('OrdersPendingOfPayment', $plugin->get_lang('OrdersPendingOfPayment'));
-    $listing_tpl = 'buy_courses/view/index.tpl';
+    $listing_tpl = 'buycourses/view/index.tpl';
     $content = $tpl->fetch($listing_tpl);
     $tpl->assign('content', $content);
     $tpl->display_one_col_template();
 }
- 
+ 

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

@@ -1,11 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
-
 /**
- * This script displays a form for registering new users.
- * @package  chamilo.auth
+ * This script displays a form for registering new users to a course directly
+ * @package  chamilo.plugin.buycourses
+ */
+/**
+ * Init
  */
-
 use ChamiloSession as Session;
 
 $language_file = array('registration', 'admin');

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

@@ -1,6 +1,7 @@
 <?php
 /**
- * @package chamilo.plugin.buy_courses
+ * List of courses
+ * @package chamilo.plugin.buycourses
  */
 /**
  * Initialization
@@ -11,8 +12,8 @@ require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
 require_once 'buy_course_plugin.class.php';
 require_once 'buy_course.lib.php';
 
-$course_plugin = 'buy_courses';
-$plugin = Buy_CoursesPlugin::create();
+$course_plugin = 'buycourses';
+$plugin = BuyCoursesPlugin::create();
 $_cid = 0;
 
 if (api_is_platform_admin()) {
@@ -49,7 +50,7 @@ $tpl->assign('courses', $courseList);
 $tpl->assign('category', $categoryList);
 $tpl->assign('currency', $currencyType);
 
-$listing_tpl = 'buy_courses/view/list.tpl';
+$listing_tpl = 'buycourses/view/list.tpl';
 $content = $tpl->fetch($listing_tpl);
 $tpl->assign('content', $content);
-$tpl->display_one_col_template();
+$tpl->display_one_col_template();

+ 16 - 11
plugin/buycourses/src/paymentsetup.php

@@ -1,11 +1,16 @@
 <?php
+/* For license terms, see /license.txt */
+/**
+ * Configuration page for payment methods for the Buy Courses plugin
+ * @package chamilo.plugin.buycourses
+ */
 /**
  * Initialization
  */
 require_once dirname(__FILE__) . '/buy_course.lib.php';
 require_once '../../../main/inc/global.inc.php';
 require_once 'buy_course_plugin.class.php';
-$plugin = Buy_CoursesPlugin::create();
+$plugin = BuyCoursesPlugin::create();
 $_cid = 0;
 $templateName = $plugin->get_lang('PaymentConfiguration');
 $interbreadcrumb[] = array("url" => "list.php", "name" => $plugin->get_lang('CourseListOnSale'));
@@ -19,30 +24,30 @@ if ($teacher) {
     // Sync course table with the plugin
     $listCurrency = listCurrency();
     $paypalParams = paypalParameters();
-    $transferenceParams = transferenceParameters();
+    $transferParams = transferParameters();
 
-    $confirmationImg = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/message_confirmation.png';
-    $saveImg = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/save.png';
-    $moreImg = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/more.png';
-    $deleteImg = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/delete.png';
-    $showImg = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/acces_tool.gif';
+    $confirmationImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/message_confirmation.png';
+    $saveImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/save.png';
+    $moreImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/more.png';
+    $deleteImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/delete.png';
+    $showImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/acces_tool.gif';
 
     $paypalEnable = $plugin->get('paypal_enable');
-    $transferenceEnable = $plugin->get('transference_enable');
+    $transferEnable = $plugin->get('transfer_enable');
 
     $tpl->assign('server', $_configuration['root_web']);
     $tpl->assign('currencies', $listCurrency);
     $tpl->assign('paypal', $paypalParams);
-    $tpl->assign('transference', $transferenceParams);
+    $tpl->assign('transfer', $transferParams);
     $tpl->assign('confirmation_img', $confirmationImg);
     $tpl->assign('save_img', $saveImg);
     $tpl->assign('more_img', $moreImg);
     $tpl->assign('delete_img', $deleteImg);
     $tpl->assign('show_img', $showImg);
     $tpl->assign('paypal_enable', $paypalEnable);
-    $tpl->assign('transference_enable', $transferenceEnable);
+    $tpl->assign('transfer_enable', $transferEnable);
 
-    $listing_tpl = 'buy_courses/view/paymentsetup.tpl';
+    $listing_tpl = 'buycourses/view/paymentsetup.tpl';
     $content = $tpl->fetch($listing_tpl);
     $tpl->assign('content', $content);
     $tpl->display_one_col_template();

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

@@ -1,11 +1,16 @@
 <?php
+/* For license terms, see /license.txt */
+/**
+ * List of pending payments of the Buy Courses plugin
+ * @package chamilo.plugin.buycourses
+ */
 /**
  * Initialization
  */
 require_once '../config.php';
 require_once dirname(__FILE__) . '/buy_course.lib.php';
 
-$plugin = Buy_CoursesPlugin::create();
+$plugin = BuyCoursesPlugin::create();
 $_cid = 0;
 $tableName = $plugin->get_lang('AvailableCoursesConfiguration');
 $interbreadcrumb[] = array("url" => "list.php", "name" => $plugin->get_lang('CourseListOnSale'));
@@ -18,8 +23,8 @@ api_protect_course_script(true);
 
 if ($teacher) {
     $pendingList = pendingList();
-    $confirmationImg = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/message_confirmation.png';
-    $deleteImg = api_get_path(WEB_PLUGIN_PATH) . 'buy_courses/resources/delete.png';
+    $confirmationImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/message_confirmation.png';
+    $deleteImg = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/delete.png';
     $currencyType = findCurrency();
 
     $tpl->assign('server', $_configuration['root_web']);
@@ -28,7 +33,7 @@ if ($teacher) {
     $tpl->assign('delete_img', $deleteImg);
     $tpl->assign('currency', $currencyType);
 
-    $listing_tpl = 'buy_courses/view/pending_orders.tpl';
+    $listing_tpl = 'buycourses/view/pending_orders.tpl';
     $content = $tpl->fetch($listing_tpl);
     $tpl->assign('content', $content);
     $tpl->display_one_col_template();

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

@@ -1,11 +1,16 @@
 <?php
+/* For license terms, see /license.txt */
+/**
+ * Process payments for the Buy Courses plugin
+ * @package chamilo.plugin.buycourses
+ */
 /**
  * Initialization
  */
 require_once '../config.php';
 require_once dirname(__FILE__) . '/buy_course.lib.php';
 
-$plugin = Buy_CoursesPlugin::create();
+$plugin = BuyCoursesPlugin::create();
 $_cid = 0;
 $templateName = $plugin->get_lang('PaymentMethods');
 $interbreadcrumb[] = array("url" => "list.php", "name" => $plugin->get_lang('CourseListOnSale'));
@@ -23,8 +28,8 @@ $tableBuyCourse = Database::get_main_table(TABLE_BUY_COURSE);
 
 $sql = "SELECT a.price, a.title, b.code
     FROM $tableBuyCourse a, $tableCourse b
-    WHERE a.id_course = " . $code . "
-    AND a.id_course = b.id;";
+    WHERE a.course_id = " . $code . "
+    AND a.course_id = b.id;";
 $res = Database::query($sql);
 $row = Database::fetch_assoc($res);
 
@@ -58,7 +63,7 @@ if (checkUserCourse($_SESSION['bc_course_codetext'], $_SESSION['bc_user_id'])) {
     header('Location: list.php');
 }
 
-if (checkUserCourseTransference($_SESSION['bc_course_codetext'], $_SESSION['bc_user_id'])) {
+if (checkUserCourseTransfer($_SESSION['bc_course_codetext'], $_SESSION['bc_user_id'])) {
     $_SESSION['bc_success'] = false;
     $_SESSION['bc_message'] = 'bc_tmp_registered';
     header('Location: list.php');
@@ -67,19 +72,19 @@ if (checkUserCourseTransference($_SESSION['bc_course_codetext'], $_SESSION['bc_u
 $currencyType = findCurrency();
 
 $paypalEnable = $plugin->get('paypal_enable');
-$transferenceEnable = $plugin->get('transference_enable');
+$transferEnable = $plugin->get('transfer_enable');
 
 $courseInfo = courseInfo($code);
 
 $tpl->assign('course', $courseInfo);
 $tpl->assign('server', $_configuration['root_web']);
 $tpl->assign('paypal_enable', $paypalEnable);
-$tpl->assign('transference_enable', $transferenceEnable);
+$tpl->assign('transfer_enable', $transferEnable);
 $tpl->assign('title', $_SESSION['bc_course_title']);
 $tpl->assign('price', $_SESSION['Payment_Amount']);
 $tpl->assign('currency', $currencyType);
 
-$listing_tpl = 'buy_courses/view/process.tpl';
+$listing_tpl = 'buycourses/view/process.tpl';
 $content = $tpl->fetch($listing_tpl);
 $tpl->assign('content', $content);
 $tpl->display_one_col_template();

+ 14 - 7
plugin/buycourses/src/process_confirm.php

@@ -1,5 +1,12 @@
 <?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';
 require_once '../../../main/inc/lib/mail.lib.inc.php';
 require_once dirname(__FILE__) . '/buy_course.lib.php';
@@ -43,7 +50,7 @@ if (isset($_POST['Confirm'])) {
     }
     $text .= '</table></div>';
 
-    $plugin = Buy_CoursesPlugin::create();
+    $plugin = BuyCoursesPlugin::create();
     $asunto = utf8_encode($plugin->get_lang('bc_subject'));
 
 
@@ -87,8 +94,8 @@ if ($_POST['payment_type'] == "PayPal") {
     $paymentAmount = $_SESSION["Payment_Amount"];
     $currencyCodeType = $currencyType;
     $paymentType = "Sale";
-    $returnURL = $server . "plugin/buy_courses/src/success.php";
-    $cancelURL = $server . "plugin/buy_courses/src/error.php";
+    $returnURL = $server . "plugin/buycourses/src/success.php";
+    $cancelURL = $server . "plugin/buycourses/src/error.php";
 
     $courseInfo = courseInfo($_SESSION['bc_course_code']);
     $courseTitle = $courseInfo['title'];
@@ -116,7 +123,7 @@ if ($_POST['payment_type'] == "PayPal") {
     }
 }
 
-if ($_POST['payment_type'] == "Transference") {
+if ($_POST['payment_type'] == "Transfer") {
     $_cid = 0;
     $templateName = $plugin->get_lang('PaymentMethods');
     $interbreadcrumb[] = array("url" => "list.php", "name" => $plugin->get_lang('CourseListOnSale'));
@@ -145,8 +152,8 @@ if ($_POST['payment_type'] == "Transference") {
     $accountsList = listAccounts();
     $tpl->assign('accounts', $accountsList);
 
-    $listing_tpl = 'buy_courses/view/process_confirm.tpl';
+    $listing_tpl = 'buycourses/view/process_confirm.tpl';
     $content = $tpl->fetch($listing_tpl);
     $tpl->assign('content', $content);
     $tpl->display_one_col_template();
-}
+}

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

@@ -1,5 +1,12 @@
 <?php
-
+/* For license terms, see /license.txt */
+/**
+ * Success page for the purchase of a course in the Buy Courses plugin
+ * @package chamilo.plugin.buycourses
+ */
+/**
+ * Init
+ */
 use ChamiloSession as Session;
 
 require_once '../config.php';
@@ -9,7 +16,7 @@ require_once api_get_path(LIBRARY_PATH) . 'course.lib.php';
 
 $tableBuyCoursePaypal = Database::get_main_table(TABLE_BUY_COURSE_PAYPAL);
 
-$plugin = Buy_CoursesPlugin::create();
+$plugin = BuyCoursesPlugin::create();
 
 /**
  * Paypal data
@@ -118,7 +125,7 @@ if (!isset($_POST['paymentOption'])) {
     }
 
 
-    $listing_tpl = 'buy_courses/view/success.tpl';
+    $listing_tpl = 'buycourses/view/success.tpl';
     $content = $tpl->fetch($listing_tpl);
     $tpl->assign('content', $content);
     $tpl->display_one_col_template();
@@ -310,4 +317,4 @@ if (!isset($_POST['paymentOption'])) {
             header('Location:list.php');
         }
     }
-}
+}

+ 3 - 3
plugin/buycourses/uninstall.php

@@ -1,13 +1,13 @@
 <?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
  * the global database and the courses tables
- * @package chamilo.plugin.bigbluebutton
+ * @package chamilo.plugin.buycourses
  */
 /**
  * Queries
  */
 require_once dirname(__FILE__) . '/config.php';
-Buy_CoursesPlugin::create()->uninstall();
+BuyCoursesPlugin::create()->uninstall();

+ 4 - 4
plugin/buycourses/view/configuration.tpl

@@ -1,4 +1,4 @@
-<script type='text/javascript' src="../js/funciones.js"></script>
+<script type='text/javascript' src="../js/buycourses.js"></script>
 
 <link rel="stylesheet" type="text/css" href="../resources/plugin.css"/>
 
@@ -9,7 +9,7 @@
                 <th>{{ 'Title'|get_lang }}</th>
                 <th>{{ 'OfficialCode'|get_lang }}</th>
                 <th class="ta-center">{{ 'Visible'|get_lang }}</th>
-                <th class="span2">{{ 'Price'|get_plugin_lang('Buy_CoursesPlugin') }}</th>
+                <th class="span2">{{ 'Price'|get_plugin_lang('BuyCoursesPlugin') }}</th>
                 <th class="span1 ta-center">{{ 'Option'|get_lang }}</th>
             </tr>
             {% set i = 0 %}
@@ -35,11 +35,11 @@
                     <td><input type="text" name="price" value="{{course.price}}" class="span1 price" /> {{ currency }}</td>
                     <td class=" ta-center" id="course{{ course.id }}">
                         <div class="confirmed"><img src="{{ confirmation_img }}" alt="ok"/></div>
-                        <div class="modified" style="display:none"><img id="{{course.id_course}}" src="{{ save_img }}" alt="save" class="cursor save"/></div>
+                        <div class="modified" style="display:none"><img id="{{course.course_id}}" src="{{ save_img }}" alt="save" class="cursor save"/></div>
                     </td>
                 </tr>
             {% endfor %}
         </table>
     </div>
 <div class="cleared"></div>
-</div>
+</div>

+ 1 - 1
plugin/buycourses/view/index.tpl

@@ -16,4 +16,4 @@
         </li>
         {% endif %}
     </ul>
-</div>
+</div>

+ 12 - 12
plugin/buycourses/view/list.tpl

@@ -1,17 +1,17 @@
-<script type='text/javascript' src="../js/funciones.js"></script>
+<script type='text/javascript' src="../js/buycourses.js"></script>
 <link rel="stylesheet" type="text/css" href="../resources/plugin.css"/>
 
 <div class="row">
     <div class="span3">
         <div id="course_category_well" class="well">
             <ul class="nav nav-list">
-                <li class="nav-header"><h4>{{ 'SearchFilter'|get_plugin_lang('Buy_CoursesPlugin') }}:</h4></li>
-                <li class="nav-header">{{ 'Course'|get_lang }}:</li>
+                <li class="nav-header"><h4>{{ 'SearchFilter'|get_plugin_lang('BuyCoursesPlugin') }}:</h4></li>
+                <li class="nav-header">{{ 'CourseName'|get_lang }}:</li>
                 <li><input type="text" id="course_name" style="width:95%"/></li>
-                <li class="nav-header">{{ 'MinimumPrice'|get_plugin_lang('Buy_CoursesPlugin') }}:
+                <li class="nav-header">{{ 'MinimumPrice'|get_plugin_lang('BuyCoursesPlugin') }}:
                     <input type="text" id="price_min" class="span1"/>
                 </li>
-                <li class="nav-header">{{ 'MaximumPrice'|get_plugin_lang('Buy_CoursesPlugin') }}:
+                <li class="nav-header">{{ 'MaximumPrice'|get_plugin_lang('BuyCoursesPlugin') }}:
                     <input type="text" id="price_max" class="span1"/>
                 </li>
                 <li class="nav-header">{{ 'Categories'|get_lang }}:</li>
@@ -41,7 +41,7 @@
                 <div class="row">
                     <div class="span">
                         <div class="thumbnail">
-                            <a class="ajax" rel="gb_page_center[778]" title="" href="{{ server }}plugin/buy_courses/src/ajax.php?code={{ course.code }}">
+                            <a class="ajax" rel="gb_page_center[778]" title="" href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">
                                 <img alt="" src="{{ server }}{{ course.course_img }}">
                             </a>
                         </div>
@@ -52,10 +52,10 @@
                             <h5>{{ 'Teacher'|get_lang }}: {{ course.teacher }}</h5>
                         </div>
                         {% if course.enrolled == "YES" %}
-                            <span class="label label-info">{{ 'TheUserIsAlreadyRegisteredInTheCourse'|get_plugin_lang('Buy_CoursesPlugin') }}</span>
+                            <span class="label label-info">{{ 'TheUserIsAlreadyRegisteredInTheCourse'|get_plugin_lang('BuyCoursesPlugin') }}</span>
                         {% endif %}
                         {% if course.enrolled == "TMP" %}
-                            <span class="label label-warning">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('Buy_CoursesPlugin') }}</span>
+                            <span class="label label-warning">{{ 'WaitingToReceiveThePayment'|get_plugin_lang('BuyCoursesPlugin') }}</span>
                         {% endif %}
                     </div>
                     <div class="span right">
@@ -64,12 +64,12 @@
                         </div>
                         <div class="cleared"></div>
                         <div class="btn-toolbar right">
-                            <a class="ajax btn btn-primary" title="" href="{{ server }}plugin/buy_courses/src/ajax.php?code={{ course.code }}">
+                            <a class="ajax btn btn-primary" title="" href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">
                                 {{ 'Description'|get_lang }}
                             </a>
                             {% if course.enrolled == "NO" %}
-                                <a class="btn btn-success" title="" href="{{ server }}plugin/buy_courses/src/process.php?code={{ course.id }}">
-                                    {{ 'Buy'|get_plugin_lang('Buy_CoursesPlugin') }}
+                                <a class="btn btn-success" title="" href="{{ server }}plugin/buycourses/src/process.php?code={{ course.id }}">
+                                    {{ 'Buy'|get_plugin_lang('BuyCoursesPlugin') }}
                                 </a>
                             {% endif %}
                         </div>
@@ -78,4 +78,4 @@
             </div>
         {% endfor %}
     </div>
-</div>
+</div>

+ 14 - 14
plugin/buycourses/view/paymentsetup.tpl

@@ -1,18 +1,18 @@
-<script type='text/javascript' src="../js/funciones.js"></script>
+<script type='text/javascript' src="../js/buycourses.js"></script>
 
 <link rel="stylesheet" type="text/css" href="../resources/plugin.css"/>
 
 <div class="row">
     <div class="span12">
-        <h3>{{ 'CurrencyType'|get_plugin_lang('Buy_CoursesPlugin') }}:</h3>
+        <h3>{{ 'CurrencyType'|get_plugin_lang('BuyCoursesPlugin') }}:</h3>
         <select id="currency_type">
-            <option value="" selected="selected">{{ 'SelectACurrency'|get_plugin_lang('Buy_CoursesPlugin') }}</option>
+            <option value="" selected="selected">{{ 'SelectACurrency'|get_plugin_lang('BuyCoursesPlugin') }}</option>
             {% for currency in currencies %}
                 {% if currency.status == 1 %}
-                    <option value="{{ currency.id_country }}" selected="selected">{{ currency.country_name }} => {{ currency.currency_code }}
+                    <option value="{{ currency.country_id }}" selected="selected">{{ currency.country_name }} => {{ currency.currency_code }}
                     </option>
                 {% else %}
-                    <option value="{{ currency.id_country }}">{{ currency.country_name }} => {{ currency.currency_code }}</option>
+                    <option value="{{ currency.country_id }}">{{ currency.country_name }} => {{ currency.currency_code }}</option>
                 {% endif %}
             {% endfor %}
         </select>
@@ -20,11 +20,11 @@
 
         {% if paypal_enable == "true" %}
             <hr />
-            <h3>Configuraci&oacute;n PayPal:</h3>
+            <h3>{{ 'PayPalConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
                 {% if paypal.sandbox == "YES" %}
-                    {{ 'Sandbox'|get_plugin_lang('Buy_CoursesPlugin') }}: <input type="checkbox" id="sandbox" value="YES" checked="checked"/>
+                    {{ 'Sandbox'|get_plugin_lang('BuyCoursesPlugin') }}: <input type="checkbox" id="sandbox" value="YES" checked="checked"/>
                 {% else %}
-                    {{ 'Sandbox'|get_plugin_lang('Buy_CoursesPlugin') }}: <input type="checkbox" id="sandbox" value="YES" />
+                    {{ 'Sandbox'|get_plugin_lang('BuyCoursesPlugin') }}: <input type="checkbox" id="sandbox" value="YES" />
                 {% endif %}
             <br />
             API_UserName: <input type="text" id="username" value="{{ paypal.username | e}}" /><br/>
@@ -33,19 +33,19 @@
             <input type="button" id="save_paypal" class="btn btn-primary" value="{{ 'Save'|get_lang }}"/>
         {% endif %}
 
-        {% if transference_enable == "true" %}
+        {% if transfer_enable == "true" %}
             <hr />
-            <h3>Configuraci&oacute;n Transferencia: </h3>
-            <table id="transference_table" class="data_table">
+            <h3>{{ 'TransfersConfig'|get_plugin_lang('BuyCoursesPlugin') }}</h3>
+            <table id="transfer_table" class="data_table">
                 <tr class="row_odd">
                 <th>{{ 'Name'|get_lang }}</th>
-                <th>{{ 'BankAccount'|get_plugin_lang('Buy_CoursesPlugin') }}</th>
+                <th>{{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}</th>
                 <th>{{ 'SWIFT'|get_lang }}</th>
                 <th class="span1 ta-center">{{ 'Option'|get_lang }}</th>
                 </tr>
                 {% set i = 0 %}
 
-                {% for transf in transference %}
+                {% for transf in transfer %}
                 {{ i%2==0 ? '
                 <tr class="row_even">' : '
                 <tr class="row_odd">' }}
@@ -73,4 +73,4 @@
         {% endif %}
 </div>
 <div class="cleared"></div>
-</div>
+</div>

+ 5 - 5
plugin/buycourses/view/pending_orders.tpl

@@ -1,4 +1,4 @@
-<script type='text/javascript' src="../js/funciones.js"></script>
+<script type='text/javascript' src="../js/buycourses.js"></script>
 
 <link rel="stylesheet" type="text/css" href="../resources/plugin.css"/>
 
@@ -6,7 +6,7 @@
     <div class="span12">
         <table id="orders_table" class="data_table">
             <tr class="row_odd">
-                <th class="ta-center">{{ 'ReferenceOrder'|get_plugin_lang('Buy_CoursesPlugin') }}</th>
+                <th class="ta-center">{{ 'ReferenceOrder'|get_plugin_lang('BuyCoursesPlugin') }}</th>
                 <th>{{ 'Name'|get_lang }}</th>
                 <th>{{ 'Title'|get_lang }}</th>
                 <th class="span2">{{ 'Price'|get_lang }}</th>
@@ -25,10 +25,10 @@
                 <td class="ta-center">{{ order.date }}</td>
                 <td class="ta-center" id="order{{ order.cod }}">
                     <img src="{{ confirmation_img }}" alt="ok" class="cursor confirm_order"
-                         title="{{ 'SubscribeUser'|get_plugin_lang('Buy_CoursesPlugin') }}"/>
+                         title="{{ 'SubscribeUser'|get_plugin_lang('BuyCoursesPlugin') }}"/>
                     &nbsp;&nbsp;
                     <img src="{{ delete_img }}" alt="delete" class="cursor clear_order"
-                         title="{{ 'DeleteTheOrder'|get_plugin_lang('Buy_CoursesPlugin') }}"/>
+                         title="{{ 'DeleteTheOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/>
                 </td>
             </tr>
 {% endfor %}
@@ -36,4 +36,4 @@
 </table>
 </div>
 <div class="cleared"></div>
-</div>
+</div>

+ 9 - 9
plugin/buycourses/view/process.tpl

@@ -1,4 +1,4 @@
-<script type='text/javascript' src="../js/funciones.js"></script>
+<script type='text/javascript' src="../js/buycourses.js"></script>
 
 <link rel="stylesheet" type="text/css" href="../resources/plugin.css"/>
 
@@ -6,7 +6,7 @@
     <div class="span12">
         <div id="course_category_well" class="well span3">
             <ul class="nav nav-list">
-                <li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('Buy_CoursesPlugin') }}:</h4></li>
+                <li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}:</h4></li>
                 <li class="nav-header">{{ 'Name'|get_lang }}:</li>
                 <li><h5>{{ name }}</h5></li>
                 <li class="nav-header">{{ 'User'|get_lang }}:</li>
@@ -24,7 +24,7 @@
                 <div class="span">
                     <div class="thumbnail">
                         <a class="ajax" rel="gb_page_center[778]" title=""
-                           href="{{ server }}plugin/buy_courses/src/ajax.php?code={{ course.code }}">
+                           href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">
                             <img alt="" src="{{ server }}{{ course.course_img }}">
                         </a>
                     </div>
@@ -40,7 +40,7 @@
                     <div class="cleared"></div>
                     <div class="btn-toolbar right">
                         <a class="ajax btn btn-primary" title=""
-                           href="{{ server }}plugin/buy_courses/src/ajax.php?code={{ course.code }}">{{'Description'|get_lang }}
+                           href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">{{'Description'|get_lang }}
                         </a>
                     </div>
                 </div>
@@ -50,7 +50,7 @@
     <div class="cleared"></div>
     <form class="form-horizontal span3 offset4" action="../src/process_confirm.php" method="post">
         <fieldset>
-            <legend align="center">{{ 'PaymentMethods'|get_plugin_lang('Buy_CoursesPlugin') }}</legend>
+            <legend align="center">{{ 'PaymentMethods'|get_plugin_lang('BuyCoursesPlugin') }}</legend>
             <div align="center" class="control-group">
                 <div class="controls margin-left-fifty">
                     {% if paypal_enable == "true" %}
@@ -58,18 +58,18 @@
                             <input type="radio" id="payment_type-p" name="payment_type" value="PayPal" > Paypal
                         </label>
                     {% endif %}
-                    {% if transference_enable == "true" %}
+                    {% if transfer_enable == "true" %}
                         <label class="radio">
-                            <input type="radio" id="payment_type-tra" name="payment_type" value="Transference" > {{ 'BankTransference'|get_plugin_lang('Buy_CoursesPlugin') }}
+                            <input type="radio" id="payment_type-tra" name="payment_type" value="Transfer" > {{ 'BankTransfer'|get_plugin_lang('BuyCoursesPlugin') }}
                         </label>
                     {% endif %}
                 </div>
                 </br>
                 <input type="hidden" name="currency_type" value="{{ currency }}" />
                 <input type="hidden" name="server" value="{{ server }}"/>
-                <input align="center" type="submit" class="btn btn-success" value="{{ 'ConfirmOrder'|get_plugin_lang('Buy_CoursesPlugin') }}"/>
+                <input align="center" type="submit" class="btn btn-success" value="{{ 'ConfirmOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/>
             </div>
         </fieldset>
     </form>
     <div class="cleared"></div>
-</div>
+</div>

+ 11 - 11
plugin/buycourses/view/process_confirm.tpl

@@ -1,4 +1,4 @@
-<script type='text/javascript' src="../js/funciones.js"></script>
+<script type='text/javascript' src="../js/buycourses.js"></script>
 
 <link rel="stylesheet" type="text/css" href="../resources/plugin.css"/>
 
@@ -6,7 +6,7 @@
     <div class="span12">
         <div id="course_category_well" class="well span3">
             <ul class="nav nav-list">
-                <li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('Buy_CoursesPlugin') }}:</h4></li>
+                <li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}:</h4></li>
                 <li class="nav-header">{{ 'Name'|get_lang }}:</li>
                 <li><h5>{{ name | e }}</h5></li>
                 <li class="nav-header">{{ 'User'|get_lang }}:</li>
@@ -24,7 +24,7 @@
                 <div class="span">
                     <div class="thumbnail">
                         <a class="ajax" rel="gb_page_center[778]" title=""
-                           href="{{ server }}plugin/buy_courses/src/ajax.php?code={{ course.code }}">
+                           href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">
                             <img src="{{ server }}{{ course.course_img }}">
                         </a>
                     </div>
@@ -40,7 +40,7 @@
                     <div class="cleared"></div>
                     <div class="btn-toolbar right">
                         <a class="ajax btn btn-primary" title=""
-                           href="{{ server }}plugin/buy_courses/src/ajax.php?code={{ course.code }}">{{'Description'|get_lang }}
+                           href="{{ server }}plugin/buycourses/src/ajax.php?code={{ course.code }}">{{'Description'|get_lang }}
                         </a>
                     </div>
                 </div>
@@ -52,7 +52,7 @@
     <div align="center">
         <table class="data_table" style="width:70%">
             <tr>
-                <th class="ta-center">{{ 'BankAccountInformation'|get_plugin_lang('Buy_CoursesPlugin') }}</th>
+                <th class="ta-center">{{ 'BankAccountInformation'|get_plugin_lang('BuyCoursesPlugin') }}</th>
             </tr>
             {% set i = 0 %}
             {% for account in accounts %}
@@ -63,26 +63,26 @@
                 {% if account.swift != '' %}
                 SWIFT: <strong>{{ account.swift | e }}</strong><br/>
                 {% endif %}
-                {{ 'BankAccount'|get_plugin_lang('Buy_CoursesPlugin') }}: <strong>{{ account.account | e }}</strong><br/>
+                {{ 'BankAccount'|get_plugin_lang('BuyCoursesPlugin') }}: <strong>{{ account.account | e }}</strong><br/>
                 </td></tr>
             {% endfor %}
             </table>
             <br />
-            <div class="normal-message">{{ 'OnceItIsConfirmed,YouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'|get_plugin_lang('Buy_CoursesPlugin') | e}}
+            <div class="normal-message">{{ 'OnceItIsConfirmed,YouWillReceiveAnEmailWithTheBankInformationAndAnOrderReference'|get_plugin_lang('BuyCoursesPlugin') | e}}
     </div>
     <br/>
 
     <form method="post" name="frmConfirm" action="../src/process_confirm.php">
-        <input type="hidden" name="payment_type" value="Transference"/>
+        <input type="hidden" name="payment_type" value="Transfer"/>
         <input type="hidden" name="name" value="{{ name | e }}"/>
         <input type="hidden" name="price" value="{{ course.price }}"/>
         <input type="hidden" name="title" value="{{ course.title | e }}"/>
 
         <div class="btn_next">
-            <input class="btn btn-success" type="submit" name="Confirm" value="{{ 'ConfirmOrder'|get_plugin_lang('Buy_CoursesPlugin') }}"/>
-            <input class="btn btn-danger" type="button" name="Cancel" value="{{ 'CancelOrder'|get_plugin_lang('Buy_CoursesPlugin') }}" id="CancelOrder"/>
+            <input class="btn btn-success" type="submit" name="Confirm" value="{{ 'ConfirmOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/>
+            <input class="btn btn-danger" type="button" name="Cancel" value="{{ 'CancelOrder'|get_plugin_lang('BuyCoursesPlugin') }}" id="CancelOrder"/>
         </div>
     </form>
 </div>
 <div class="cleared"></div>
-</div>
+</div>

+ 9 - 8
plugin/buycourses/view/success.tpl

@@ -1,4 +1,4 @@
-<script type='text/javascript' src="../js/funciones.js"></script>
+<script type='text/javascript' src="../js/buycourses.js"></script>
 
 <link rel="stylesheet" type="text/css" href="../resources/plugin.css"/>
 
@@ -6,7 +6,7 @@
     <div class="span12">
         <div id="course_category_well" class="well span3">
             <ul class="nav nav-list">
-                <li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('Buy_CoursesPlugin') }}:</h4></li>
+                <li class="nav-header"><h4>{{ 'UserInformation'|get_plugin_lang('BuyCoursesPlugin') }}:</h4></li>
                 <li class="nav-header">{{ 'Name'|get_lang }}:</li>
                 <li><h5>{{ name }}</h5></li>
                 <li class="nav-header">{{ 'User'|get_lang }}:</li>
@@ -24,7 +24,7 @@
                 <div class="span">
                     <div class="thumbnail">
                         <a class="ajax" rel="gb_page_center[778]" title=""
-                           href="{{ server }}plugin/buy_courses/function/ajax.php?code={{ course.code }}">
+                           href="{{ server }}plugin/buycourses/function/ajax.php?code={{ course.code }}">
                             <img alt="" src="{{ server }}{{ course.course_img }}">
                         </a>
                     </div>
@@ -40,7 +40,7 @@
                     <div class="cleared"></div>
                     <div class="btn-toolbar right">
                         <a class="ajax btn btn-primary" title=""
-                           href="{{ server }}plugin/buy_courses/function/ajax.php?code={{ course.code }}">{{'Description'|get_lang }}</a>
+                           href="{{ server }}plugin/buycourses/function/ajax.php?code={{ course.code }}">{{'Description'|get_lang }}</a>
 
                     </div>
                 </div>
@@ -50,14 +50,15 @@
     <div class="cleared"></div>
     <hr/>
     <div align="center">
+        <div class="confirmation-message">{{ 'PayPalPaymentOKPleaseConfirm'|get_plugin_lang('BuyCoursesPlugin') }}</div>
+        <br />
         <form method="post" name="frmConfirm" action="../src/success.php">
             <input type="hidden" name="paymentOption" value="PayPal"/>
-
             <div class="btn_next">
-                <input class="btn btn-success" type="submit" name="Confirm" value="{{ 'ConfirmOrder'|get_plugin_lang('Buy_CoursesPlugin') }}"/>
-                <input class="btn btn-danger" type="button" name="Cancel" value="{{ 'CancelOrder'|get_plugin_lang('Buy_CoursesPlugin') }}" id="cancel_order"/>
+                <input class="btn btn-success" type="submit" name="Confirm" value="{{ 'ConfirmOrder'|get_plugin_lang('BuyCoursesPlugin') }}"/>
+                <input class="btn btn-danger" type="button" name="Cancel" value="{{ 'CancelOrder'|get_plugin_lang('BuyCoursesPlugin') }}" id="cancel_order"/>
             </div>
         </form>
     </div>
     <div class="cleared"></div>
-</div>
+</div>