<?php

require_once "atc_training.class.php";
$ATC = new ATC_Training();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
        $_POST['nzqa_qualifies'] = isset($_POST['nzqa_qualifies']) ? 1 : 0;
        $ATC->set_lesson($_GET['id'], $_POST['lesson_category_id'], $_POST['code'], $_POST['description'], $_POST['dress_code'], $_POST['nzqa_qualifies'], $_POST['level'], 7);
    } catch (ATCExceptionInsufficientPermissions $e) {
        header("HTTP/1.0 401 Unauthorised");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    } 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>
<?php

require_once "atc_training.class.php";
$ATC = new ATC_Training();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
        $ATC->set_lesson_category($_GET['id'], $_POST['category'], $_POST['color'], $_POST['textcolor'], $_POST['code'], 7);
    } catch (ATCExceptionInsufficientPermissions $e) {
        header("HTTP/1.0 401 Unauthorised");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    } 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'])) {
    $categories = $ATC->get_lesson_category();
    ?>
	
		<table class="tablesorter">
			<thead>
				<tr>
Beispiel #3
0
<?php

require_once "atc_training.class.php";
$ATC = new ATC_Training();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
        if (isset($_GET['action']) && $_GET['action'] == 'delete') {
            $ATC->delete_lesson_from_timetable($_POST['lesson_id'], $_POST['year']);
        } else {
            $ATC->set_timetable($_POST['lesson_id'], $ATC->set_location($_POST['location_id'], $_POST['location'], null), $_POST['personnel_id'], $_POST['date'], date('Y-m-d H:i', strtotime('+45 minutes', strtotime($_POST['date']))), $_POST['group'], $_POST['dress_code']);
        }
    } catch (ATCExceptionInsufficientPermissions $e) {
        header("HTTP/1.0 401 Unauthorised");
        echo 'Caught exception: ', $e->getMessage(), "\n";
    } 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";
    }
    exit;
}
$ATC->gui_output_page_header('Training');
$_GET['year'] = isset($_GET['year']) && (int) $_GET['year'] ? (int) $_GET['year'] : date('Y');