$condition_date_end = " AND (CURDATE() > (SELECT adddate(date_end,nb_days_access_after_end) FROM $tbl_session WHERE id = $session_id) AND date_end != '0000-00-00') ";
} else {
$condition_date_end = " AND (date_end <CURDATE()ANDdate_end!='0000-00-00')";
$condition_date_end = " ";
}
$sql = "SELECT visibility FROM $tbl_session
WHERE id = $session_id $condition_date_end "; // session is old and is not unlimited
$sql = "SELECT visibility, date_start, date_end FROM $tbl_session
WHERE id = $session_id $condition_date_end ";
$result = Database::query($sql);
if (Database::num_rows($result)>0) {
if (Database::num_rows($result)>0) {
$row = Database::fetch_array($result, 'ASSOC');
$visibility = $row['visibility'];
//I don't care the field visibility
if ($row['date_start'] == '0000-00-00' && $row['date_end'] == '0000-00-00') {
$visibility = SESSION_AVAILABLE;
} else {
$time = time();
//If datestart is set
if (!empty($row['date_start']) && $row['date_start'] != '0000-00-00') {
category_code user_course_cat, date_start, date_end, session.id as id_session, session.name as session_name, course.id as course_id
FROM $tbl_session_course_user as session_course_user
@ -1982,7 +1973,7 @@ class UserManager {
foreach ($sessions as $enreg) {
$id_session = $enreg['id'];
// this query is very similar to the above query, but it will check the session_rel_course_user table if there are courses registered to our user or not