Skip to content

Commit 50db5cc

Browse files
committed
Merge pull request #582 from ilosada/7370
C#7370 - Afinar plugin venta de cursos
2 parents 96ab630 + 68ce8d7 commit 50db5cc

File tree

8 files changed

+26
-14
lines changed

8 files changed

+26
-14
lines changed

plugin/buycourses/lang/english.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
$strings['CourseVisibilityClosed'] = "Closed - no access to this course";
1212
$strings['OpenToThePlatform'] = "Open - access authorized only for users registered on the platform";
1313
$strings['OpenToTheWorld'] = "Public - access open to anybody";
14+
$strings['CourseVisibilityHidden'] = "Hidden - Completely hidden to all users except the administrators";
1415
$strings['Description'] = "Description";
1516
$strings['Buy'] = "Buy";
1617
$strings['Mostrar_disponibles'] = "Show available courses";

plugin/buycourses/lang/french.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
$strings['CourseVisibilityClosed'] = "Fermé - Pas d'accès au cours";
1212
$strings['OpenToThePlatform'] = "Ouvert - Accès autorisé seulement pour les utilisateurs inscrits à la plateforme";
1313
$strings['OpenToTheWorld'] = "Public - Accès autorisé à tous";
14+
$strings['CourseVisibilityHidden'] = "Invisible - Complètement invisible et inaccessible pour tous les utilisateurs excepté les administrateurs";
1415
$strings['Description'] = "Description";
1516
$strings['Buy'] = "Acheter";
1617
$strings['Mostrar_disponibles'] = "Montrer les cours disponibles";

plugin/buycourses/lang/spanish.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
$strings['CourseVisibilityClosed'] = "Cerrado - no hay acceso a este curso";
1212
$strings['OpenToThePlatform'] = "Abierto - acceso autorizado sólo para los usuarios registrados en la plataforma";
1313
$strings['OpenToTheWorld'] = "Público - acceso autorizado a cualquier persona";
14+
$strings['CourseVisibilityHidden'] = "Invisible - Totalmente invisible para todos los usuarios a parte de los administradores";
1415
$strings['Description'] = "Descripción";
1516
$strings['Buy'] = "Comprar";
1617
$strings['Mostrar_disponibles'] = "Mostrar cursos disponibles";

plugin/buycourses/src/buy_course.lib.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function listCourses()
126126
$tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
127127
$sql = "SELECT a.course_id, a.visible, a.price, b.*
128128
FROM $tableBuyCourse a, $tableCourse b
129-
WHERE a.course_id = b.id;";
129+
WHERE a.course_id = b.id AND a.session_id = 0;";
130130
$res = Database::query($sql);
131131
$aux = array();
132132
while ($row = Database::fetch_assoc($res)) {
@@ -170,7 +170,7 @@ function userSessionList()
170170
// get course of current session
171171
$sql = "SELECT a.course_id, a.session_id, a.visible, a.price, b.*
172172
FROM $tableBuyCourse a, $tableCourse b
173-
WHERE a.code = b.code AND a.code = '" . $rowSessionCourse['course_code'] . "' AND a.visible = 1;";
173+
WHERE a.code = b.code AND a.code = '" . $rowSessionCourse['course_code'] . "'";
174174
$res = Database::query($sql);
175175
// loop inside a course of current session
176176
while ($row = Database::fetch_assoc($res)) {
@@ -369,19 +369,19 @@ function getCourseVisibilityIcon($option)
369369
$style = 'margin-bottom:-5px;margin-right:5px;';
370370
switch ($option) {
371371
case 0:
372-
return Display::return_icon('bullet_red.gif', get_lang('CourseVisibilityClosed'), array('style' => $style));
372+
return Display::return_icon('bullet_red.gif', get_plugin_lang('CourseVisibilityClosed', 'BuyCoursesPlugin'), array('style' => $style));
373373
break;
374374
case 1:
375-
return Display::return_icon('bullet_orange.gif', get_lang('Private'), array('style' => $style));
375+
return Display::return_icon('bullet_orange.gif', get_plugin_lang('Private', 'BuyCoursesPlugin'), array('style' => $style));
376376
break;
377377
case 2:
378-
return Display::return_icon('bullet_green.gif', get_lang('OpenToThePlatform'), array('style' => $style));
378+
return Display::return_icon('bullet_green.gif', get_plugin_lang('OpenToThePlatform', 'BuyCoursesPlugin'), array('style' => $style));
379379
break;
380380
case 3:
381-
return Display::return_icon('bullet_blue.gif', get_lang('OpenToTheWorld'), array('style' => $style));
381+
return Display::return_icon('bullet_blue.gif', get_plugin_lang('OpenToTheWorld', 'BuyCoursesPlugin'), array('style' => $style));
382382
break;
383383
default:
384-
return '';
384+
return Display::return_icon('bullet_grey.gif', get_plugin_lang('CourseVisibilityHidden', 'BuyCoursesPlugin'), array('style' => $style));;
385385
}
386386
}
387387
/**

plugin/buycourses/src/configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
$tpl = new Template($templateName);
2222

2323
$teacher = api_is_platform_admin();
24-
api_protect_course_script(true);
24+
api_protect_admin_script(true);
2525

2626
if ($teacher) {
2727
// sync course table with the plugin
@@ -31,6 +31,7 @@
3131
$visibility[] = getCourseVisibilityIcon('1');
3232
$visibility[] = getCourseVisibilityIcon('2');
3333
$visibility[] = getCourseVisibilityIcon('3');
34+
$visibility[] = getCourseVisibilityIcon('4');
3435

3536
$coursesList = listCourses();
3637
$confirmationImgPath = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/img/32/accept.png';

plugin/buycourses/src/paymentsetup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
$tpl = new Template($templateName);
2020
$teacher = api_is_platform_admin();
21-
api_protect_course_script(true);
21+
api_protect_admin_script(true);
2222

2323
if ($teacher) {
2424
// Sync course table with the plugin

plugin/buycourses/src/pending_orders.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
$tpl = new Template($tableName);
2020

2121
$teacher = api_is_platform_admin();
22-
api_protect_course_script(true);
22+
api_protect_admin_script(true);
2323

2424
if ($teacher) {
2525
$pendingList = pendingList($_SESSION['bc_codetext']);

plugin/buycourses/view/index.tpl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626

2727
<div class="span3">
2828
<div class="thumbnail">
29-
<img src="resources/img/128/buycourses.png">
29+
<a href="src/list.php">
30+
<img src="resources/img/128/buycourses.png">
31+
</a>
3032
<div class="caption">
3133
<a class="btn" href="src/list.php">{{ BuyCourses }}</a>
3234
</div>
@@ -35,23 +37,29 @@
3537
{% if isAdmin == 'true' %}
3638
<div class="span3">
3739
<div class="thumbnail">
38-
<img src="resources/img/128/settings.png">
40+
<a href="src/configuration.php">
41+
<img src="resources/img/128/settings.png">
42+
</a>
3943
<div class="caption">
4044
<a class="btn" href="src/configuration.php">{{ ConfigurationOfCoursesAndPrices }}</a>
4145
</div>
4246
</div>
4347
</div>
4448
<div class="span3">
4549
<div class="thumbnail">
46-
<img src="resources/img/128/paymentsettings.png">
50+
<a href="src/paymentsetup.php">
51+
<img src="resources/img/128/paymentsettings.png">
52+
</a>
4753
<div class="caption">
4854
<a class="btn" href="src/paymentsetup.php">{{ ConfigurationOfPayments }} </a>
4955
</div>
5056
</div>
5157
</div>
5258
<div class="span3">
5359
<div class="thumbnail">
54-
<img src="resources/img/128/backlogs.png">
60+
<a href="src/pending_orders.php">
61+
<img src="resources/img/128/backlogs.png">
62+
</a>
5563
<div class="caption">
5664
<a class="btn" href="src/pending_orders.php"> {{ OrdersPendingOfPayment }} </a>
5765
</div>

0 commit comments

Comments
 (0)