netv-mam/schedule.php

26 lines
745 B
PHP
Raw Normal View History

2024-09-10 16:44:22 -04:00
<?php
$db = new SQLite3('netv-mam.sqlite');
if (isset($_GET['date']) && $_GET['date'] !== "") {
// get info about single day's schedule
2024-09-22 12:41:58 -04:00
$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'])));
2024-09-10 16:44:22 -04:00
$result = $query->execute();
if ($result) {
$row = $result->fetchArray(SQLITE3_ASSOC);
echo(json_encode($row));
}
2024-09-22 12:41:58 -04:00
} else if (isset($_POST['id']) && intval($_POST['id']) > 0) {
// update single schedule
} else if (isset($_POST['date']) && strtotime($_POST['date'])) {
// add new schedule
2024-09-10 16:44:22 -04:00
} else {
echo("{}");
}
?>