Fix the courses and sessions list - #7275

1.9.x
Angel Fernando Quiroz Campos 10 years ago
parent 86c53f0d10
commit ef518199d4
  1. 2
      main/auth/courses.php
  2. 8
      main/auth/courses_controller.php
  3. 30
      main/template/default/auth/courses_categories.php

@ -77,7 +77,7 @@ if (api_is_platform_admin() || api_is_course_admin() || api_is_allowed_to_create
// filter actions
$actions = array('sortmycourses', 'createcoursecategory', 'subscribe', 'deletecoursecategory', 'display_courses', 'display_random_courses', 'subscribe_user_with_password', 'display_sessions');
$action = 'display_random_courses';
$action = CoursesAndSessionsCatalog::is(CATALOG_SESSIONS) ? 'display_sessions' : 'display_random_courses';
$nameTools = get_lang('SortMyCourses');
if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {

@ -318,19 +318,11 @@ class CoursesController { // extends Controller {
$data = array();
$browse_course_categories = $this->model->browse_course_categories();
global $_configuration;
$data['browse_course_categories'] = $browse_course_categories;
$data['action'] = Security::remove_XSS($action);
$data['date'] = Security::remove_XSS($date);
$data['browseSessions'] = $this->model->browseSessions($date);
$data['catalogShowCoursesSessions'] = 0;
if (isset($_configuration['catalog_show_courses_sessions'])) {
$data['catalogShowCoursesSessions'] = $_configuration['catalog_show_courses_sessions'];
}
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('courses_categories');

@ -8,18 +8,10 @@
*/
$stok = Security::get_token();
$showCourses = false;
$showSessions = false;
$showCourses = CoursesAndSessionsCatalog::showCourses();
$showSessions = CoursesAndSessionsCatalog::showSessions();
$userInfo = api_get_user_info();
if ($catalogShowCoursesSessions == CATALOG_COURSES || $catalogShowCoursesSessions == CATALOG_COURSES_SESSIONS) {
$showCourses = true;
}
if ($catalogShowCoursesSessions == CATALOG_COURSES_SESSIONS || $catalogShowCoursesSessions == CATALOG_SESSIONS) {
$showSessions = true;
}
?>
<script>
$(document).ready( function() {
@ -219,9 +211,8 @@ if ($catalogShowCoursesSessions == CATALOG_COURSES_SESSIONS || $catalogShowCours
</div>
<div class="span9">
<?php
switch ($action) {
case 'display_sessions':
<?php if ($showSessions && $action == 'display_sessions') { ?>
<?php
if (!empty($browseSessions)) {
foreach ($browseSessions as $session) {
$sessionId = $session['id'];
@ -257,9 +248,10 @@ if ($catalogShowCoursesSessions == CATALOG_COURSES_SESSIONS || $catalogShowCours
} else {
Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
}
break;
default:
if (!empty($message)) { Display::display_confirmation_message($message, false); }
?>
<?php } ?>
<?php if ($showCourses && $action != 'display_sessions') { ?>
<?php if (!empty($message)) { Display::display_confirmation_message($message, false); }
if (!empty($error)) { Display::display_error_message($error, false); }
if (!empty($content)) { echo $content; }
@ -350,10 +342,8 @@ if ($catalogShowCoursesSessions == CATALOG_COURSES_SESSIONS || $catalogShowCours
if (!isset($_REQUEST['subscribe_user_with_password']) && !isset($_REQUEST['subscribe_course'])) {
Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
}
}
break;
}
?>
} ?>
<?php } ?>
</div>
</div>

Loading…
Cancel
Save