Fix my_courses_view_by_session view in user_portal

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
parent a12f80fd8f
commit 7d4f0ac11b
  1. 36
      main/inc/lib/userportal.lib.php

@ -1558,7 +1558,7 @@ class IndexManager
} }
} }
$specialCourses = ''; $html = '';
$loadDirs = $this->load_directories_preview; $loadDirs = $this->load_directories_preview;
// If we're not in the history view... // If we're not in the history view...
@ -1569,12 +1569,25 @@ class IndexManager
$user_id, $user_id,
$loadDirs $loadDirs
); );
$specialCourses = $specialCoursesResult['html']; $specialCourses = $specialCoursesResult;
if ($specialCourses) {
$specialCoursesTemplate = new Template(null, false, false, false, false, false, false);
$specialCoursesTemplate->assign('courses', $specialCourses);
$html = $specialCoursesTemplate->fetch(
$this->tpl->get_template('/user_portal/classic_courses_without_category.tpl')
);
}
// Display courses // Display courses
// [code=>xxx, real_id=>000] // [code=>xxx, real_id=>000]
$listCourses = CourseManager::get_courses_list_by_user_id($user_id, false); $listCourses = CourseManager::get_courses_list_by_user_id($user_id, false);
foreach ($listCourses as $i => $listCourseCodeId) { foreach ($listCourses as $i => $listCourseCodeId) {
if (isset($listCourseCodeId['special_course'])) {
continue;
}
list($userCategoryId, $userCatTitle) = CourseManager::getUserCourseCategoryForCourse( list($userCategoryId, $userCatTitle) = CourseManager::getUserCourseCategoryForCourse(
$user_id, $user_id,
$listCourseCodeId['real_id'] $listCourseCodeId['real_id']
@ -1605,7 +1618,7 @@ class IndexManager
uasort($listUserCategories, "self::compareListUserCategory"); uasort($listUserCategories, "self::compareListUserCategory");
$listUserCategories[0] = ''; $listUserCategories[0] = '';
$html = '<div class="session-view-block">'; $html .= '<div class="session-view-block">';
foreach ($listUserCategories as $userCategoryId => $userCatTitle) { foreach ($listUserCategories as $userCategoryId => $userCatTitle) {
// add user category // add user category
@ -1623,10 +1636,11 @@ class IndexManager
// add course // add course
$listCoursesAlreadyDisplayed[$listCourse['courseId']] = 1; $listCoursesAlreadyDisplayed[$listCourse['courseId']] = 1;
if ($userCategoryId == 0) { if ($userCategoryId == 0) {
$htmlCategory .= '<div class="session-view-well session-view-row well" >'; $htmlCategory .= '<div class="panel panel-default">';
} else { } else {
$htmlCategory .= '<div class="session-view-row" >'; $htmlCategory .= '<div class="panel panel-default">';
} }
$htmlCategory .= '<div class="panel-body">';
$coursesInfo = $listCourse['course']; $coursesInfo = $listCourse['course'];
$htmlCategory .= self::getHtmlForCourse( $htmlCategory .= self::getHtmlForCourse(
@ -1661,7 +1675,7 @@ class IndexManager
$htmlSessionCategory .= $htmlSession; $htmlSessionCategory .= $htmlSession;
} }
$htmlSessionCategory .= '</div>'; // end session cat block $htmlSessionCategory .= '</div>'; // end session cat block
$htmlCategory .= $htmlSessionCategory .'</div>' ; $htmlCategory .= $htmlSessionCategory .'</div></div>' ;
$htmlCategory .= ''; // end course block $htmlCategory .= ''; // end course block
} }
$userCategoryHtml .= $htmlCategory; $userCategoryHtml .= $htmlCategory;
@ -1673,17 +1687,19 @@ class IndexManager
foreach ($listCoursesInfo as $i => $listCourse) { foreach ($listCoursesInfo as $i => $listCourse) {
if ($listCourse['userCatId'] == $userCategoryId && !isset($listCoursesAlreadyDisplayed[$listCourse['id']])) { if ($listCourse['userCatId'] == $userCategoryId && !isset($listCoursesAlreadyDisplayed[$listCourse['id']])) {
if ($userCategoryId != 0) { if ($userCategoryId != 0) {
$htmlCategory .= '<div class="session-view-row" >'; $htmlCategory .= '<div class="panel panel-default">';
} else { } else {
$htmlCategory .= '<div class="session-view-well well">'; $htmlCategory .= '<div class="panel panel-default">';
} }
$htmlCategory .= '<div class="panel-body">';
$htmlCategory .= self::getHtmlForCourse( $htmlCategory .= self::getHtmlForCourse(
$listCourse['course'], $listCourse['course'],
$userCategoryId, $userCategoryId,
0, 0,
$loadDirs $loadDirs
); );
$htmlCategory .= '</div>'; $htmlCategory .= '</div></div>';
} }
} }
$htmlCategory .= ''; $htmlCategory .= '';
@ -1696,7 +1712,7 @@ class IndexManager
$html .= '</div>'; $html .= '</div>';
return [ return [
'html' => $html.$specialCourses, 'html' => $html,
'session_count' => $sessionCount, 'session_count' => $sessionCount,
'course_count' => $courseCount 'course_count' => $courseCount
]; ];

Loading…
Cancel
Save