|
|
|
|
@ -1940,10 +1940,10 @@ class UserManager { |
|
|
|
|
|
|
|
|
|
$condition_date_end = ""; |
|
|
|
|
if ($is_time_over) { |
|
|
|
|
$condition_date_end = " AND (session.date_end < CURDATE() AND session.session_category.date_end != '0000-00-00') AND "; |
|
|
|
|
$condition_date_end = " AND (session.date_end < CURDATE() AND session.date_end != '0000-00-00') "; |
|
|
|
|
} else { |
|
|
|
|
$condition_date_end = " AND (session.date_end >= CURDATE() OR session.date_end = '0000-00-00') "; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//ORDER BY session_category_id, date_start, date_end |
|
|
|
|
$sql = "SELECT DISTINCT session.id, session.name, session.date_start, session.date_end, session_category_id, |
|
|
|
|
@ -1953,8 +1953,9 @@ class UserManager { |
|
|
|
|
|
|
|
|
|
FROM $tbl_session as session LEFT JOIN $tbl_session_category session_category ON (session_category_id = session_category.id) |
|
|
|
|
INNER JOIN $tbl_session_course_user as session_rel_course_user ON (session_rel_course_user.id_session = session.id) |
|
|
|
|
WHERE (session_rel_course_user.id_user = $user_id) OR |
|
|
|
|
(session.id_coach = $user_id) |
|
|
|
|
WHERE ( |
|
|
|
|
session_rel_course_user.id_user = $user_id OR session.id_coach = $user_id |
|
|
|
|
) $condition_date_end |
|
|
|
|
ORDER BY session_category_name, name"; |
|
|
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
@ -1963,15 +1964,15 @@ class UserManager { |
|
|
|
|
$categories[$row['session_category_id']]['session_category']['id'] = $row['session_category_id']; |
|
|
|
|
$categories[$row['session_category_id']]['session_category']['name'] = $row['session_category_name']; |
|
|
|
|
$categories[$row['session_category_id']]['session_category']['date_start'] = $row['session_category_date_start']; |
|
|
|
|
$categories[$row['session_category_id']]['session_category']['date_end'] = $row['session_category_date_end']; |
|
|
|
|
$categories[$row['session_category_id']]['session_category']['date_end'] = $row['session_category_date_end']; |
|
|
|
|
|
|
|
|
|
$categories[$row['session_category_id']]['sessions'][$row['id']]['session_name'] = $row['name']; |
|
|
|
|
$categories[$row['session_category_id']]['sessions'][$row['id']]['session_id'] = $row['id']; |
|
|
|
|
$categories[$row['session_category_id']]['sessions'][$row['id']]['date_start'] = $row['date_start']; |
|
|
|
|
$categories[$row['session_category_id']]['sessions'][$row['id']]['date_end'] = $row['date_end']; |
|
|
|
|
$categories[$row['session_category_id']]['sessions'][$row['id']]['nb_days_access_before_beginning'] = $row['nb_days_access_before_beginning']; |
|
|
|
|
$categories[$row['session_category_id']]['sessions'][$row['id']]['courses'] = UserManager::get_courses_list_by_session($user_id, $row['id']); |
|
|
|
|
|
|
|
|
|
$categories[$row['session_category_id']]['sessions'][$row['id']]['courses'] = UserManager::get_courses_list_by_session($user_id, $row['id']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $categories; |
|
|
|
|
|