26 lines
745 B
PHP
Executable File
26 lines
745 B
PHP
Executable File
<?php
|
|
|
|
$db = new SQLite3('netv-mam.sqlite');
|
|
|
|
if (isset($_GET['date']) && $_GET['date'] !== "") {
|
|
// get info about single day's schedule
|
|
$query = $db->prepare("SELECT * FROM schedules s
|
|
LEFT JOIN schedules_blocks sb ON s.id = sb.schedule_id
|
|
LEFT JOIN blocks b ON sb.block_id = b.id
|
|
WHERE s.date = :date");
|
|
$query->bindValue(":date", intval(strtotime($_GET['date'])));
|
|
$result = $query->execute();
|
|
if ($result) {
|
|
$row = $result->fetchArray(SQLITE3_ASSOC);
|
|
echo(json_encode($row));
|
|
}
|
|
} else if (isset($_POST['id']) && intval($_POST['id']) > 0) {
|
|
// update single schedule
|
|
} else if (isset($_POST['date']) && strtotime($_POST['date'])) {
|
|
// add new schedule
|
|
} else {
|
|
echo("{}");
|
|
}
|
|
|
|
?>
|