From 270e4ec03dfd6090c43aa112b68f31659d3a43d6 Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 25 Jun 2020 17:59:56 +0200 Subject: [PATCH] Add appointment calendar queries --- src/appointment.php | 10 ++++++++-- src/database.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/appointment.php b/src/appointment.php index ded066f..e1324de 100644 --- a/src/appointment.php +++ b/src/appointment.php @@ -19,8 +19,14 @@
diff --git a/src/database.php b/src/database.php index 9081e51..95e9b7a 100644 --- a/src/database.php +++ b/src/database.php @@ -308,3 +308,33 @@ function configureCalendar($pdo, $data) } return "Calendario configurado con éxito"; } + + +function fetchCalendarEvents($pdo) +{ + $query = "SELECT * from cita"; + $result = $pdo->prepare($query); + $result->execute(); + $data = $result->fetchAll(); + return $data; +} + + +function fetchCalendarSettings($pdo, $doctor) +{ + $query = "SELECT * from calendario WHERE medico=?"; + $result = $pdo->prepare($query); + $result->execute([$doctor]); + $data = $result->fetch(); + return $data; +} + + +function fetchDoctorHolidays($pdo, $doctor) +{ + $query = "SELECT * FROM festivo WHERE medico IS NULL OR medico=?"; + $result = $pdo->prepare($query); + $result->execute($doctor); + $data = $result->fetchAll(); + return $data; +}