} catch (ATCExceptionDBError $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCExceptionDBConn $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCException $e) { header("HTTP/1.0 400 Bad Request"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (Exception $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } } if (!isset($_GET['id'])) { $lessons = $ATC->get_lesson(); ?> <table class="tablesorter"> <thead> <tr> <th> Category </th> <th> Code </th> <th> NZQA </th> <th> Group </th> <td> <a href="system_lesson.php?id=0" class="button new">New</a> </tr> </thead> <tbody> <?php foreach ($lessons as $lesson) {
header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCException $e) { header("HTTP/1.0 400 Bad Request"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (Exception $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } exit; } $ATC->gui_output_page_header('Training'); $_GET['year'] = isset($_GET['year']) && (int) $_GET['year'] ? (int) $_GET['year'] : date('Y'); $terms = $ATC->get_terms(date('Y-m-d', strtotime((int) $_GET['year'] . '-01-01')), date('Y-m-d', strtotime((int) $_GET['year'] . '-12-31'))); $timetable = $ATC->get_timetable(date('Y-m-d', strtotime((int) $_GET['year'] . '-01-01')), date('Y-m-d', strtotime((int) $_GET['year'] . '-12-31'))); $lessons = $ATC->get_lesson(); ?> <form> <fieldset> <legend>Choose a year</legend> <label for="year">Pick a year:</label> <select name="year" id="year"> <?php for ($i = 2016; $i <= date('Y') + 5; $i++) { echo '<option value="' . $i . '"' . ($i == $_GET['year'] ? ' selected="selected"' : '') . '>' . $i . '</option>'; } ?> </select> <button type="submit" class="update">Update</button> </fieldset> </form>