Merge pull request #1131 from jloguercio/1.11.x

Add minor code validations and corrections in new course grid template
remotes/angel/1.11.x
José Loguercio 9 years ago
commit e66d58baad
  1. 13
      main/inc/lib/course.lib.php
  2. 12
      main/inc/lib/userportal.lib.php

@ -3358,7 +3358,7 @@ class CourseManager
$with_special_courses = ' course.code IN ("' . implode('","', $special_course_list) . '")';
}
$courseList = array();
$courseList = [];
if (!empty($with_special_courses)) {
$sql = "SELECT
course.id,
@ -3385,7 +3385,7 @@ class CourseManager
continue;
}
$params = array();
$params = [];
// Get notifications.
$course_info['id_session'] = null;
$course_info['status'] = $course['status'];
@ -3402,13 +3402,13 @@ class CourseManager
if ($load_dirs) {
$params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">'
. Display::returnFontAwesomeIcon('folder-open') . '</a>';
$params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
$params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']);
}
}else{
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED && $load_dirs) {
$params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">'
. Display::returnFontAwesomeIcon('folder-open') . '</a>';
$params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container'));
$params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']);
}
}
@ -3426,9 +3426,8 @@ class CourseManager
if (api_get_setting('display_teacher_in_courselist') === 'true') {
$params['teachers'] = CourseManager::getTeachersFromCourseByCode($course['code']);
}
$iconName = basename($course_info['course_image']);
if ($showCustomIcon === 'true' && $iconName != 'course.png') {
if ($showCustomIcon === 'true') {
$params['thumbnails'] = $course_info['course_image'];
$params['image'] = $course_info['course_image_large'];
}

@ -1050,7 +1050,7 @@ class IndexManager
$user_id,
$this->load_directories_preview
);
// Display courses.
$courses = CourseManager::returnCourses(
$user_id,
@ -1058,14 +1058,16 @@ class IndexManager
);
$this->tpl->assign('special_courses', $specialCourses);
$this->tpl->assign('courses', $courses);
if ($_configuration['view_grid_courses']==true) {
if (isset($_configuration['view_grid_courses']) && $_configuration['view_grid_courses']) {
$listCourse = $this->tpl->fetch(
$this->tpl->get_template('/user_portal/grid_courses.tpl'));
} else {
$listCourse = $this->tpl->fetch(
$this->tpl->get_template('/user_portal/classic_courses.tpl'));
}
$courseCount = $specialCourses['course_count'] + $courses['course_count'];
}
if (!empty($specialCourses['course_count']) && !empty($courses['course_count'])) {
$courseCount = intval($specialCourses['course_count']) + intval($courses['course_count']);
}
}
$sessions_with_category = '';
@ -1365,7 +1367,7 @@ class IndexManager
}
return [
'html' => $sessions_with_category.$sessions_with_no_category.$listCourse.$special_courses,
'html' => $sessions_with_category.$sessions_with_no_category.$listCourse,
'session_count' => $sessionCount,
'course_count' => $courseCount
];

Loading…
Cancel
Save