Minor - fix session order + refactor function name

pull/2539/head
jmontoyaa 7 years ago
parent 7234f18925
commit aa437864b6
  1. 3
      main/inc/lib/display.lib.php
  2. 6
      main/inc/lib/groupmanager.lib.php
  3. 5
      main/inc/lib/sessionmanager.lib.php
  4. 6
      main/inc/lib/usermanager.lib.php
  5. 32
      main/inc/lib/userportal.lib.php
  6. 2
      main/inc/lib/webservices/Rest.php

@ -1682,7 +1682,7 @@ class Display
* @return array Empty array or session array
* ['title'=>'...','category'=>'','dates'=>'...','coach'=>'...','active'=>true/false,'session_category_id'=>int]
*/
public static function get_session_title_box($session_id)
public static function getSessionTitleBox($session_id)
{
global $nosession;
@ -1690,7 +1690,6 @@ class Display
global $now, $date_start, $date_end;
}
$output = [];
$active = false;
if (!$nosession) {
$main_user_table = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);

@ -2295,6 +2295,10 @@ class GroupManager
$group_name = '<a class="'.$groupNameClass.'" href="group_space.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'">'.
Security::remove_XSS($this_group['name']).'</a> ';
$group_name2 = '<a href="suivi_group_space.php?cidReq='.api_get_course_id().'&gidReq='.$this_group['id'].'">
'.get_lang('suivi_de').''.stripslashes($this_group['name']).'</a>';
if (!empty($user_id) && !empty($this_group['id_tutor']) && $user_id == $this_group['id_tutor']) {
$group_name .= Display::label(get_lang('OneMyGroups'), 'success');
} elseif ($isMember) {
@ -2305,7 +2309,7 @@ class GroupManager
$group_name .= ' ('.$this_group['session_name'].')';
}
$group_name .= $session_img;
$row[] = $group_name.'<br />'.stripslashes(trim($this_group['description']));
$row[] = $group_name.$group_name2.'<br />'.stripslashes(trim($this_group['description']));
} else {
if ($hideGroup === 'true') {
continue;

@ -7583,8 +7583,7 @@ SQL;
/**
* Returns a human readable string.
*
* @params array $sessionInfo An array with all the session dates
*
* @param array $sessionInfo An array with all the session dates
* @param bool $showTime
*
* @return array
@ -9104,7 +9103,7 @@ SQL;
if (empty($result)) {
$result = get_lang('NoTimeLimits');
}
$result .= '->'.$endDateToLocal;
return $result;
}

@ -2952,10 +2952,10 @@ class UserManager
$order = $orderBySettings['order'];
switch ($field) {
case 'start_date':
$order = " ORDER BY s.accessEndDate $order";
$order = " ORDER BY s.accessStartDate $order";
break;
case 'end_date':
$order = " ORDER BY s.accessStartDate $order";
$order = " ORDER BY s.accessEndDate $order";
break;
}
}
@ -2968,6 +2968,8 @@ class UserManager
['user' => $user_id, 'url' => api_get_current_access_url_id()]
)
;
var_dump("s");
echo($dql->getSQL());
$sessionData = $dql->getResult();
$categories = [];

@ -1399,6 +1399,7 @@ class IndexManager
);
$courseCompleteList = array_merge($courseCompleteList, $specialCourses);
}
if ($courses['in_category'] || $courses['not_category']) {
foreach ($courses['in_category'] as $courseData) {
if (!empty($courseData['courses'])) {
@ -1527,7 +1528,6 @@ class IndexManager
if ($session_now >= $allowed_time && $allowedEndTime) {
// Read only and accessible.
$atLeastOneCourseIsVisible = true;
if (api_get_setting('hide_courses_in_sessions') == 'false') {
$courseUserHtml = CourseManager::get_logged_user_course_html(
$course,
@ -1605,10 +1605,9 @@ class IndexManager
$params = [
'id' => $session_id,
];
$session_box = Display::get_session_title_box($session_id);
$actions = api_get_path(
WEB_CODE_PATH
).'session/resume_session.php?id_session='.$session_id;
$session_box = Display::getSessionTitleBox($session_id);
$actions = api_get_path(WEB_CODE_PATH).
'session/resume_session.php?id_session='.$session_id;
$coachId = $session_box['id_coach'];
$extraFieldValue = new ExtraFieldValue('session');
$imageField = $extraFieldValue->get_values_by_handler_and_field_variable(
@ -1654,14 +1653,18 @@ class IndexManager
}
if ($gameModeIsActive) {
$params['stars'] =
GamificationUtils::getSessionStars($params['id'], $this->user_id);
$params['stars'] = GamificationUtils::getSessionStars(
$params['id'],
$this->user_id
);
$params['progress'] = GamificationUtils::getSessionProgress(
$params['id'],
$this->user_id
);
$params['points'] =
GamificationUtils::getSessionPoints($params['id'], $this->user_id);
$params['points'] = GamificationUtils::getSessionPoints(
$params['id'],
$this->user_id
);
}
$listSession[] = $params;
$sessionCount++;
@ -1754,7 +1757,7 @@ class IndexManager
$sessionParams = [];
// Category
if ($count > 0) {
$session_box = Display::get_session_title_box($session_id);
$session_box = Display::getSessionTitleBox($session_id);
$sessionParams[0]['id'] = $session_id;
$sessionParams[0]['date'] = $session_box['dates'];
$sessionParams[0]['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
@ -1980,6 +1983,7 @@ class IndexManager
usort($listCoursesInfo, 'self::compareByCourse');
}
$listCoursesInSession = [];
if (is_array($session_categories)) {
// all courses that are in a session
$listCoursesInSession = SessionManager::getNamedSessionCourseForCoach($user_id);
@ -2023,7 +2027,7 @@ class IndexManager
);
// list of session category
$htmlSessionCategory = '<div class="session-view-row" style="display:none;" id="courseblock-'.$coursesInfo['real_id'].'">';
foreach ($listCourse['sessionCatList'] as $j => $listCategorySession) {
foreach ($listCourse['sessionCatList'] as $listCategorySession) {
// add session category
$htmlSessionCategory .= self::getHtmlSessionCategory(
$listCategorySession['catSessionId'],
@ -2031,7 +2035,7 @@ class IndexManager
);
// list of session
$htmlSession = ''; // start
foreach ($listCategorySession['sessionList'] as $k => $listSession) {
foreach ($listCategorySession['sessionList'] as $listSession) {
// add session
$htmlSession .= '<div class="session-view-row">';
$htmlSession .= self::getHtmlForSession(
@ -2057,7 +2061,9 @@ class IndexManager
// if course not already added
$htmlCategory = '';
foreach ($listCoursesInfo as $i => $listCourse) {
if ($listCourse['userCatId'] == $userCategoryId && !isset($listCoursesAlreadyDisplayed[$listCourse['id']])) {
if ($listCourse['userCatId'] == $userCategoryId &&
!isset($listCoursesAlreadyDisplayed[$listCourse['id']])
) {
if ($userCategoryId != 0) {
$htmlCategory .= '<div class="panel panel-default">';
} else {

@ -916,7 +916,7 @@ class Rest extends WebService
];
}
$sessionBox = Display::get_session_title_box($sessions['session_id']);
$sessionBox = Display::getSessionTitleBox($sessions['session_id']);
$categorySessions[] = [
'name' => $sessionBox['title'],

Loading…
Cancel
Save