$PAGE->set_url($url); $PAGE->set_pagelayout('standard'); if (!has_capability('local/bookingrooms:bockinginfo', $context)) { // TODO: Log unsuccessful attempts for security print_error(get_string('INVALID_ACCESS', 'booking_room')); } $action = optional_param('action', 'see', PARAM_TEXT); //action commentary implementation // allows the administrator to add a comment on a reservation if ($action == "comment") { $bookingid = required_param('booking', PARAM_INT); $commentform = new AdminComment(null, array('bookingid' => $reservaid)); if ($commentform->is_cancelled()) { $action = "see"; } else { if ($fromform = $commentform->get_data()) { $booking = $DB->get_record('bookingrooms_bookings', array('id' => bookingid)); $booking->comment_admin = $fromform->comment; $DB->update_record('bookingrooms_bookings', $bookings); $action = "see"; } } } // 'See' action implementation // Shows a table per page of all the room reservations that are active in decreasing order by date // with a link that allows you to add a comment or see, if exist, a comment if ($action == "see") { $max = 15; $page = optional_param('page', 0, PARAM_INT); //$bokkings = $DB->get_records('bookingrooms_bookings'); $bookings = $DB->get_records_sql('select * from {bookingrooms_bookings} where active = 1 order by date_bookings desc');