diff --git a/plugin/buycourses/lang/english.php b/plugin/buycourses/lang/english.php index ae2408d163..fa715aca2a 100644 --- a/plugin/buycourses/lang/english.php +++ b/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"; diff --git a/plugin/buycourses/lang/french.php b/plugin/buycourses/lang/french.php index 97c20312dc..0d152e8daa 100644 --- a/plugin/buycourses/lang/french.php +++ b/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"; diff --git a/plugin/buycourses/lang/spanish.php b/plugin/buycourses/lang/spanish.php index 38ccef238f..5a3f4e8b1a 100644 --- a/plugin/buycourses/lang/spanish.php +++ b/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"; diff --git a/plugin/buycourses/src/buy_course.lib.php b/plugin/buycourses/src/buy_course.lib.php index e3eb0b6a13..b6b2aa2e60 100644 --- a/plugin/buycourses/src/buy_course.lib.php +++ b/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)); } } /** diff --git a/plugin/buycourses/src/configuration.php b/plugin/buycourses/src/configuration.php index 5f84896ca1..9010434d09 100644 --- a/plugin/buycourses/src/configuration.php +++ b/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'; diff --git a/plugin/buycourses/src/paymentsetup.php b/plugin/buycourses/src/paymentsetup.php index 6310008fda..fe6d2a1f98 100644 --- a/plugin/buycourses/src/paymentsetup.php +++ b/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 diff --git a/plugin/buycourses/src/pending_orders.php b/plugin/buycourses/src/pending_orders.php index 4d80fd55ef..d844ab9046 100644 --- a/plugin/buycourses/src/pending_orders.php +++ b/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']); diff --git a/plugin/buycourses/view/index.tpl b/plugin/buycourses/view/index.tpl index 8e671f214e..80aed3709c 100644 --- a/plugin/buycourses/view/index.tpl +++ b/plugin/buycourses/view/index.tpl @@ -26,7 +26,9 @@
- + + + @@ -35,7 +37,9 @@ {% if isAdmin == 'true' %}