| @@ 2261-2272 (lines=12) @@ | ||
| 2258 | } |
|
| 2259 | ||
| 2260 | // If the end date was set. |
|
| 2261 | if (!empty($row['access_end_date'])) { |
|
| 2262 | // Only if date_start said that it was ok |
|
| 2263 | if ($visibility === SESSION_AVAILABLE) { |
|
| 2264 | if ($now < api_strtotime($row['access_end_date'], 'UTC')) { |
|
| 2265 | // Date still available |
|
| 2266 | $visibility = SESSION_AVAILABLE; |
|
| 2267 | } else { |
|
| 2268 | // Session ends |
|
| 2269 | $visibility = $row['visibility']; |
|
| 2270 | } |
|
| 2271 | } |
|
| 2272 | } |
|
| 2273 | } |
|
| 2274 | ||
| 2275 | /* If I'm a coach the visibility can change in my favor depending in |
|
| @@ 2281-2289 (lines=9) @@ | ||
| 2278 | ||
| 2279 | if ($isCoach) { |
|
| 2280 | // Test end date. |
|
| 2281 | if (!empty($row['coach_access_end_date'])) { |
|
| 2282 | $endDateCoach = api_strtotime($row['coach_access_end_date'], 'UTC'); |
|
| 2283 | ||
| 2284 | if ($endDateCoach >= $now) { |
|
| 2285 | $visibility = SESSION_AVAILABLE; |
|
| 2286 | } else { |
|
| 2287 | $visibility = SESSION_INVISIBLE; |
|
| 2288 | } |
|
| 2289 | } |
|
| 2290 | ||
| 2291 | // Test start date. |
|
| 2292 | if (!empty($row['coach_access_start_date'])) { |
|
| @@ 2292-2299 (lines=8) @@ | ||
| 2289 | } |
|
| 2290 | ||
| 2291 | // Test start date. |
|
| 2292 | if (!empty($row['coach_access_start_date'])) { |
|
| 2293 | $start = api_strtotime($row['coach_access_start_date'], 'UTC'); |
|
| 2294 | if ($start < $now) { |
|
| 2295 | $visibility = SESSION_AVAILABLE; |
|
| 2296 | } else { |
|
| 2297 | $visibility = SESSION_INVISIBLE; |
|
| 2298 | } |
|
| 2299 | } |
|
| 2300 | } |
|
| 2301 | } else { |
|
| 2302 | $visibility = SESSION_INVISIBLE; |
|