Exemplo n.º 1
0
 public static function bookings($app)
 {
     $database = Database::getFactory()->getConnection();
     $sql = "SELECT * FROM `bookings`";
     $query = $database->prepare($sql);
     $query->execute();
     echo json_encode(array("category" => "statistics", "type" => "bookings", "total" => $query->rowCount()));
 }
Exemplo n.º 2
0
 public static function create($app, $details)
 {
     $Database = Database::getFactory()->getConnection();
     $sql = "INSERT INTO `bookings` (\n                            `booking_id`,\n                            `booking_title`,\n                            `booking_room`,\n                            `booking_creator`,\n                            `booking_start`,\n                            `booking_end`,\n                            `booking_notes`,\n                            `booking_attendees`,\n                            `booking_guests`)\n                VALUES      ( NULL,\n                             ':title',\n                             ':room',\n                             ':creator',\n                             ':from',\n                             ':to',\n                             ':notes',\n                             ':attendees',\n                             ':guests' );";
     $query = $Database->prepare($sql);
     $title = $details['title'];
     $room = $details['room'];
     $creator = $details['creator'];
     $from = $details['from'];
     $to = $details['to'];
     $notes = $details['notes'];
     $attendees = $details['attendees'];
     $guests = $details['guests'];
     $query->execute(array(':title' => $title, ':room' => $room, ':creator' => $creator, ':from' => $from, ':to' => $to, ':notes' => $notes, ':attendees' => $attendees, ':guests' => $guests));
     // TODO: If success then true, else false...
     echo json_encode(array("category" => "bookings", "type" => "booking_create", "success" => true));
 }