| @@ 2334-2345 (lines=12) @@ | ||
| 2331 | } |
|
| 2332 | ||
| 2333 | // If the end date was set. |
|
| 2334 | if (!empty($row['access_end_date'])) { |
|
| 2335 | // Only if date_start said that it was ok |
|
| 2336 | if ($visibility == SESSION_AVAILABLE) { |
|
| 2337 | if ($now < api_strtotime($row['access_end_date'], 'UTC')) { |
|
| 2338 | // Date still available |
|
| 2339 | $visibility = SESSION_AVAILABLE; |
|
| 2340 | } else { |
|
| 2341 | // Session ends |
|
| 2342 | $visibility = $row['visibility']; |
|
| 2343 | } |
|
| 2344 | } |
|
| 2345 | } |
|
| 2346 | } |
|
| 2347 | ||
| 2348 | /* If I'm a coach the visibility can change in my favor depending in |
|
| @@ 2354-2362 (lines=9) @@ | ||
| 2351 | ||
| 2352 | if ($is_coach) { |
|
| 2353 | // Test end date. |
|
| 2354 | if (!empty($row['coach_access_end_date'])) { |
|
| 2355 | $endDateCoach = api_strtotime($row['coach_access_end_date'], 'UTC'); |
|
| 2356 | ||
| 2357 | if ($endDateCoach >= $now) { |
|
| 2358 | $visibility = SESSION_AVAILABLE; |
|
| 2359 | } else { |
|
| 2360 | $visibility = SESSION_INVISIBLE; |
|
| 2361 | } |
|
| 2362 | } |
|
| 2363 | ||
| 2364 | // Test start date. |
|
| 2365 | if (!empty($row['coach_access_start_date'])) { |
|
| @@ 2365-2372 (lines=8) @@ | ||
| 2362 | } |
|
| 2363 | ||
| 2364 | // Test start date. |
|
| 2365 | if (!empty($row['coach_access_start_date'])) { |
|
| 2366 | $start = api_strtotime($row['coach_access_start_date'], 'UTC'); |
|
| 2367 | if ($start < $now) { |
|
| 2368 | $visibility = SESSION_AVAILABLE; |
|
| 2369 | } else { |
|
| 2370 | $visibility = SESSION_INVISIBLE; |
|
| 2371 | } |
|
| 2372 | } |
|
| 2373 | } |
|
| 2374 | } else { |
|
| 2375 | $visibility = SESSION_INVISIBLE; |
|