125 lines
3.6 KiB
PHP
125 lines
3.6 KiB
PHP
|
<?php
|
||
|
require_once('utils/config.php');
|
||
|
require_once('utils/db.php');
|
||
|
require_once('utils/strings.php');
|
||
|
require_once('utils/tools.php');
|
||
|
require_once('course.php');
|
||
|
require_once('main.php');
|
||
|
require_once('appointment.php');
|
||
|
|
||
|
$connection = connect();
|
||
|
|
||
|
$result = "";
|
||
|
$title = "";
|
||
|
$height = 100;
|
||
|
$width = 100;
|
||
|
$func = "";
|
||
|
|
||
|
$action = intval($_POST["action"]);
|
||
|
$ccid = intval($_POST["ccid"]);
|
||
|
$cid = intval($_POST["cid"]);
|
||
|
$sid = intval($_POST["sid"]);
|
||
|
$did = intval($_POST["did"]);
|
||
|
// Do not change this to 'day', this causes errors with ajax
|
||
|
$day=intval($_POST["days"]);
|
||
|
$begin = intval($_POST["begin"]);
|
||
|
$end = intval($_POST["end"]);
|
||
|
$intervall = intval($_POST["intervall"]);
|
||
|
$gender = intval($_POST["gender"]);
|
||
|
$house = intval($_POST["house"]);
|
||
|
|
||
|
$cname = mysqli_real_escape_string($connection, $_POST["cname"]);
|
||
|
$cdescr = mysqli_real_escape_string($connection, $_POST["cdescr"]);
|
||
|
$cdiffname = mysqli_real_escape_string($connection, $_POST["cdiffname"]);
|
||
|
$clevel = mysqli_real_escape_string($connection, $_POST["clevel"]);
|
||
|
$clink = mysqli_real_escape_string($connection, $_POST["clink"]);
|
||
|
$ccolor = substr(mysqli_real_escape_string($connection, $_POST["ccolor"]),0 , 6);
|
||
|
$cbegin = mysqli_real_escape_string($connection, $_POST["cbegin"]);
|
||
|
|
||
|
$add = intval($_POST["add"]);
|
||
|
|
||
|
$token = $_POST["token"];
|
||
|
|
||
|
// APPOINTMENT
|
||
|
if( $action == 1 ) {
|
||
|
$result = AppointmentEdit($connection, 0, $day, $begin, 0);
|
||
|
$title = "Kurs zum Plan hinzufugen";
|
||
|
$width = 420;
|
||
|
$height = 280;
|
||
|
$func = "AppointmentCommit";
|
||
|
} elseif( $action == 2 ) {
|
||
|
$result = AppointmentEdit($connection, $cid, $day, $begin, $end);
|
||
|
$title = "Kursbelegung bearbeiten";
|
||
|
$width = 420;
|
||
|
$height = 280;
|
||
|
$func = "AppointmentUpdate";
|
||
|
} elseif ( $action == 3 ) {
|
||
|
$result = AppointmentDelete($connection, $cid, $day, $begin, $end);
|
||
|
$title = $GLOBALS["operation_result"];
|
||
|
$width = 200;
|
||
|
$height = 200;
|
||
|
$func = "Plan";
|
||
|
} elseif ( $action == 5 ) {
|
||
|
$result = AppointmentCommit($connection, $cid, $day, $begin, $end);
|
||
|
$title = $GLOBALS["operation_result"];
|
||
|
$width = 200;
|
||
|
$height = 200;
|
||
|
$func = "Plan";
|
||
|
} elseif ( $action == 6 ) {
|
||
|
$result = AppointmentUpdate($connection, $ccid, $cid, $day, $begin, $end);
|
||
|
$title = $GLOBALS["operation_result"];
|
||
|
$width = 200;
|
||
|
$height = 200;
|
||
|
$func = "Plan";
|
||
|
|
||
|
// COURSE
|
||
|
} elseif ( $action == 7 ) {
|
||
|
$result = CourseDelete($connection, $cid);
|
||
|
$title = $GLOBALS["operation_result"];
|
||
|
$width = 200;
|
||
|
$height = 200;
|
||
|
$func = "Kurse";
|
||
|
} elseif ( $action == 8 ) {
|
||
|
$result = CourseEdit($connection, 0);
|
||
|
$title = "Neuer Kurs";
|
||
|
$width = 420;
|
||
|
$height = 420;
|
||
|
$func = "CourseCommit";
|
||
|
} elseif ( $action == 9 ) {
|
||
|
$result = CourseEdit($connection, $cid);
|
||
|
$title = "Kurs bearbeiten";
|
||
|
$width = 420;
|
||
|
$height = 420;
|
||
|
$func = "CourseUpdate";
|
||
|
} elseif ( $action == 10 ) {
|
||
|
$result = CourseCommit($connection, $cname, $cdescr, $cdiffname, $clevel, $clink, $ccolor);
|
||
|
$title = $GLOBALS["operation_result"];
|
||
|
$width = 200;
|
||
|
$height = 200;
|
||
|
$func = "Kurse";
|
||
|
} elseif ( $action == 11 ) {
|
||
|
$result = CourseUpdate($connection, $cid, $cname, $cdescr, $cdiffname, $clevel, $clink, $ccolor);
|
||
|
$title = $GLOBALS["operation_result"];
|
||
|
$width = 200;
|
||
|
$height = 200;
|
||
|
$func = "Kurse";
|
||
|
|
||
|
// MAIN
|
||
|
} elseif ( $action == 101 ) {
|
||
|
$result = Plan($connection, $begin, $end, $intervall, $day);
|
||
|
} elseif ( $action == 102 ) {
|
||
|
$result = Kurse($connection);
|
||
|
} else {
|
||
|
$result = Plan($connection, 1500, 2200, 30, 7);
|
||
|
}
|
||
|
|
||
|
disconnect();
|
||
|
|
||
|
echo json_encode( array( "title" => $title,
|
||
|
"html" => utf8_encode($result),
|
||
|
"width" => $width,
|
||
|
"height" => $height,
|
||
|
"func" => $func) );
|
||
|
|
||
|
?>
|