Add param history fixes BT#13396

pull/2487/head
jmontoyaa 8 years ago
parent 23cbb53e7f
commit c6c5f8ab9e
  1. 7
      main/inc/lib/userportal.lib.php
  2. 19
      user_portal.php

@ -1142,25 +1142,26 @@ class IndexManager
* @param bool $showSessions
* @param string $categoryCodeFilter
* @param bool $useUserLanguageFilterIfAvailable
* @param bool $loadHistory
* @return array
*/
public function returnCoursesAndSessions(
$user_id,
$showSessions = true,
$categoryCodeFilter = '',
$useUserLanguageFilterIfAvailable = true
$useUserLanguageFilterIfAvailable = true,
$loadHistory = false
) {
$gameModeIsActive = api_get_setting('gamification_mode');
$listCourse = '';
$specialCourseList = '';
$load_history = isset($_GET['history']) && intval($_GET['history']) == 1 ? true : false;
$viewGridCourses = api_get_configuration_value('view_grid_courses') === 'true';
$showSimpleSessionInfo = api_get_configuration_value('show_simple_session_info');
$coursesWithoutCategoryTemplate = '/user_portal/classic_courses_without_category.tpl';
$coursesWithCategoryTemplate = '/user_portal/classic_courses_with_category.tpl';
if ($load_history) {
if ($loadHistory) {
// Load sessions in category in *history*
$session_categories = UserManager::get_sessions_by_category($user_id, true);
} else {

@ -39,6 +39,7 @@ $userId = api_get_user_id();
$load_dirs = api_get_setting('show_documents_preview');
$displayMyCourseViewBySessionLink = api_get_setting('my_courses_view_by_session') === 'true';
$nameTools = get_lang('MyCourses');
$loadHistory = isset($_GET['history']) && intval($_GET['history']) == 1 ? true : false;
// Load course notification by ajax
$loadNotificationsByAjax = api_get_configuration_value('user_portal_load_notification_by_ajax');
@ -139,7 +140,7 @@ if (!$myCourseListAsCategory) {
$courseAndSessions = $controller->returnCoursesAndSessionsViewBySession($userId);
IndexManager::setDefaultMyCourseView(IndexManager::VIEW_BY_SESSION, $userId);
} else {
$courseAndSessions = $controller->returnCoursesAndSessions($userId);
$courseAndSessions = $controller->returnCoursesAndSessions($userId, true, null, true, $loadHistory);
IndexManager::setDefaultMyCourseView(IndexManager::VIEW_BY_DEFAULT, $userId);
}
@ -179,7 +180,9 @@ if (!$myCourseListAsCategory) {
$courseAndSessions = $controller->returnCoursesAndSessions(
$userId,
false,
$categoryCode
$categoryCode,
true,
$loadHistory
);
$getCategory = CourseCategory::getCategory($categoryCode);
$controller->tpl->assign('category', $getCategory);
@ -301,6 +304,7 @@ if ($allow) {
$userId,
false,
'',
false,
false
);
@ -387,11 +391,6 @@ if ($allow) {
}
}
/*$userFinished =
$countDependenciesPassed == count($dependencies) &&
$countCoursesPassedNoDependency >= $minToValidate
;*/
$userFinished =
$countDependenciesPassed >= $gradeBooksToValidateInDependence &&
$countCoursesPassedNoDependency >= $minToValidate
@ -421,12 +420,6 @@ if ($allow) {
$finalResult
);
$controller->tpl->assign('grade_book_badge_list', $badgeList);
/*if ($finalScore > 0) {
$finalScore = (int) $finalScore / count($total);
if ($finalScore == 100) {
$completed = true;
}
}*/
}
$controller->tpl->display_two_col_template();

Loading…
Cancel
Save