MAKETIME(" . $begin_hour . "," . $begin_minute . ",0) ORDER BY li_plan.begin LIMIT 1";
$course_query = "SELECT * FROM li_courses";
$currentInput = '';
$return .= '
Kurs
' . $currentInput . '
';
$return .= 'Tag
' . $week[$day] . '
';
$return .= 'Beginn
' . timeI2S($begin_hour, $begin_minute, ':') . '
';
if( $cid > 0 ) {
$return .= 'Ende
' . timeI2S($end_hour, $end_minute, ":") . '
';
} else {
$begin_hour_max=23;
$begin_minute_max=30;
$result = mysqli_query($connection, $plan_end_query);
while ($row = mysqli_fetch_object($result)) {
$begin_hour_max=intval(substr($row->begin, 0, 2));
$begin_minute_max=intval(substr($row->begin, 3, 2));
}
mysqli_free_result($result);
$currentInput = '';
$return .= 'Ende
' . $currentInput . '
';
}
return $return;
}
function AppointmentCommit($connection, $cid, $day, $begin, $end) {
$begin_hour=intval($begin/100);
$begin_minute=$begin - ($begin_hour*100);
$end_hour=intval($end/100);
$end_minute=$end - ($end_hour*100);
$querystr = "INSERT INTO li_plan VALUES(" . $cid . "," . $day . ",MAKETIME(" . $begin_hour . "," . $begin_minute . "," . "0),MAKETIME(" . $end_hour . "," . $end_minute . ",0) )";
mysqli_query($connection, $querystr);
return $GLOBALS["operation_success"];
}
function AppointmentUpdate($connection, $ccid, $cid, $day, $begin, $end) {
$begin_hour=intval($begin/100);
$begin_minute=$begin - ($begin_hour*100);
$end_hour=intval($end/100);
$end_minute=$end - ($end_hour*100);
$querystr = "UPDATE li_plan SET cid=" . $cid . " WHERE cid=" . $ccid . " AND day=" . $day . " AND begin=MAKETIME(" . $begin_hour . "," . $begin_minute . "," . "0) AND end=MAKETIME(" . $end_hour . "," . $end_minute . ",0)";
mysqli_query($connection, $querystr);
return $GLOBALS["operation_success"];
}
function AppointmentDelete($connection, $cid, $day, $begin, $end) {
$begin_hour=intval($begin/100);
$begin_minute=$begin - ($begin_hour*100);
$end_hour=intval($end/100);
$end_minute=$end - ($end_hour*100);
$querystr = "DELETE FROM li_plan WHERE cid=" . $cid . " AND day=" . $day . " AND begin=MAKETIME(" . $begin_hour . "," . $begin_minute . "," . "0) AND end=MAKETIME(" . $end_hour . "," . $end_minute . ",0)";
mysqli_query($connection, $querystr);
return $GLOBALS["operation_success"];
}
?>