Browse Source

Merge pull request #582 from ilosada/7370

C#7370 - Afinar plugin venta de cursos
Yannick Warnier 10 years ago
parent
commit
50db5cca4c

+ 1 - 0
plugin/buycourses/lang/english.php

@@ -11,6 +11,7 @@ $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['CourseVisibilityHidden'] = "Hidden - Completely hidden to all users except the administrators";
 $strings['Description'] = "Description";
 $strings['Buy'] = "Buy";
 $strings['Mostrar_disponibles'] = "Show available courses";

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

@@ -11,6 +11,7 @@ $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['CourseVisibilityHidden'] = "Invisible - Complètement invisible et inaccessible pour tous les utilisateurs excepté les administrateurs";
 $strings['Description'] = "Description";
 $strings['Buy'] = "Acheter";
 $strings['Mostrar_disponibles'] = "Montrer les cours disponibles";

+ 1 - 0
plugin/buycourses/lang/spanish.php

@@ -11,6 +11,7 @@ $strings['Private'] = "Privado - acceso autorizado sólo para los miembros
 $strings['CourseVisibilityClosed'] = "Cerrado - no hay acceso a este curso";
 $strings['OpenToThePlatform'] = "Abierto - acceso autorizado sólo para los usuarios registrados en la plataforma";
 $strings['OpenToTheWorld'] = "Público - acceso autorizado a cualquier persona";
+$strings['CourseVisibilityHidden'] = "Invisible - Totalmente invisible para todos los usuarios a parte de los administradores";
 $strings['Description'] = "Descripción";
 $strings['Buy'] = "Comprar";
 $strings['Mostrar_disponibles'] = "Mostrar cursos disponibles";

+ 7 - 7
plugin/buycourses/src/buy_course.lib.php

@@ -126,7 +126,7 @@ function listCourses()
     $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
     $sql = "SELECT a.course_id, a.visible, a.price, b.*
         FROM $tableBuyCourse a, $tableCourse b
-        WHERE a.course_id = b.id;";
+        WHERE a.course_id = b.id AND a.session_id = 0;";
     $res = Database::query($sql);
     $aux = array();
     while ($row = Database::fetch_assoc($res)) {
@@ -170,7 +170,7 @@ function userSessionList()
             // get course of current session
             $sql = "SELECT a.course_id, a.session_id, a.visible, a.price, b.*
             FROM $tableBuyCourse a, $tableCourse b
-            WHERE a.code = b.code AND a.code = '" . $rowSessionCourse['course_code'] . "' AND a.visible = 1;";
+            WHERE a.code = b.code AND a.code = '" . $rowSessionCourse['course_code'] . "'";
             $res = Database::query($sql);
             // loop inside a course of current session
             while ($row = Database::fetch_assoc($res)) {
@@ -369,19 +369,19 @@ function getCourseVisibilityIcon($option)
     $style = 'margin-bottom:-5px;margin-right:5px;';
     switch ($option) {
         case 0:
-            return Display::return_icon('bullet_red.gif', get_lang('CourseVisibilityClosed'), array('style' => $style));
+            return Display::return_icon('bullet_red.gif', get_plugin_lang('CourseVisibilityClosed', 'BuyCoursesPlugin'), array('style' => $style));
             break;
         case 1:
-            return Display::return_icon('bullet_orange.gif', get_lang('Private'), array('style' => $style));
+            return Display::return_icon('bullet_orange.gif', get_plugin_lang('Private', 'BuyCoursesPlugin'), array('style' => $style));
             break;
         case 2:
-            return Display::return_icon('bullet_green.gif', get_lang('OpenToThePlatform'), array('style' => $style));
+            return Display::return_icon('bullet_green.gif', get_plugin_lang('OpenToThePlatform', 'BuyCoursesPlugin'), array('style' => $style));
             break;
         case 3:
-            return Display::return_icon('bullet_blue.gif', get_lang('OpenToTheWorld'), array('style' => $style));
+            return Display::return_icon('bullet_blue.gif', get_plugin_lang('OpenToTheWorld', 'BuyCoursesPlugin'), array('style' => $style));
             break;
         default:
-            return '';
+            return Display::return_icon('bullet_grey.gif', get_plugin_lang('CourseVisibilityHidden', 'BuyCoursesPlugin'), array('style' => $style));;
     }
 }
 /**

+ 2 - 1
plugin/buycourses/src/configuration.php

@@ -21,7 +21,7 @@ $interbreadcrumb[] = array("url" => "paymentsetup.php", "name" => get_lang('Conf
 $tpl = new Template($templateName);
 
 $teacher = api_is_platform_admin();
-api_protect_course_script(true);
+api_protect_admin_script(true);
 
 if ($teacher) {
     // sync course table with the plugin
@@ -31,6 +31,7 @@ if ($teacher) {
     $visibility[] = getCourseVisibilityIcon('1');
     $visibility[] = getCourseVisibilityIcon('2');
     $visibility[] = getCourseVisibilityIcon('3');
+    $visibility[] = getCourseVisibilityIcon('4');
 
     $coursesList = listCourses();
     $confirmationImgPath = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/img/32/accept.png';

+ 1 - 1
plugin/buycourses/src/paymentsetup.php

@@ -18,7 +18,7 @@ $interbreadcrumb[] = array("url" => "configuration.php", "name" => $plugin->get_
 
 $tpl = new Template($templateName);
 $teacher = api_is_platform_admin();
-api_protect_course_script(true);
+api_protect_admin_script(true);
 
 if ($teacher) {
     // Sync course table with the plugin

+ 1 - 1
plugin/buycourses/src/pending_orders.php

@@ -19,7 +19,7 @@ $interbreadcrumb[] = array("url" => "paymentsetup.php", "name" => $plugin->get_l
 $tpl = new Template($tableName);
 
 $teacher = api_is_platform_admin();
-api_protect_course_script(true);
+api_protect_admin_script(true);
 
 if ($teacher) {
     $pendingList = pendingList($_SESSION['bc_codetext']);

+ 12 - 4
plugin/buycourses/view/index.tpl

@@ -26,7 +26,9 @@
 
             <div class="span3">
                 <div class="thumbnail">
-                    <img src="resources/img/128/buycourses.png">
+                    <a href="src/list.php">
+                        <img src="resources/img/128/buycourses.png">
+                    </a>
                     <div class="caption">
                         <a class="btn" href="src/list.php">{{ BuyCourses }}</a>
                     </div>
@@ -35,7 +37,9 @@
             {% if isAdmin == 'true' %}
             <div class="span3">
                 <div class="thumbnail">
-                    <img src="resources/img/128/settings.png">
+                    <a href="src/configuration.php">
+                        <img src="resources/img/128/settings.png">
+                    </a>
                     <div class="caption">
                         <a class="btn" href="src/configuration.php">{{ ConfigurationOfCoursesAndPrices }}</a>
                     </div>
@@ -43,7 +47,9 @@
             </div>
             <div class="span3">
                 <div class="thumbnail">
-                    <img src="resources/img/128/paymentsettings.png">
+                    <a href="src/paymentsetup.php">
+                        <img src="resources/img/128/paymentsettings.png">
+                    </a>
                     <div class="caption">
                         <a class="btn" href="src/paymentsetup.php">{{ ConfigurationOfPayments }} </a>
                     </div>
@@ -51,7 +57,9 @@
             </div>
             <div class="span3">
                 <div class="thumbnail">
-                    <img src="resources/img/128/backlogs.png">
+                    <a href="src/pending_orders.php">
+                        <img src="resources/img/128/backlogs.png">
+                    </a>
                     <div class="caption">
                         <a class="btn" href="src/pending_orders.php"> {{ OrdersPendingOfPayment }} </a>
                     </div>