Example #1
0
            if (empty($id_rooms)) {
                $condition = '1';
            }
            if (!empty($id_rooms)) {
                $string_id_rooms = implode(",", $id_rooms);
                $select .= "AND rooms_id in ({$string_id_rooms}) ";
            }
        }
        $select .= "AND activa=1";
        //$result = $DB->get_records_select('reservarooms_reservas',$select);
        $result = $DB->get_records_select('bookingrooms_bookings', $select, $params);
        if (empty($result) || $condition == 1) {
            // $condition=1 significa que no hay rooms
            echo '<h5>' . get_string('noreservesarefound', 'local_bookingrooms') . '</h5>';
        } else {
            $table = tables::searchRooms($result);
            echo html_writer::tag('<form', '', array('name' => 'search', 'method' => 'POST'));
            echo html_writer::table($table);
            if (has_capability('local/bookingrooms:delete', $context)) {
                echo '<input type="submit" name="action" value="remove" onClick="return ComfirmDeleteOrder();">';
            }
            if (has_capability('local/bookingrooms:changewith', $context)) {
                echo '<input type="submit" name="action" value="swap">';
            }
            echo html_writer::end_tag('form');
        }
    }
} else {
    if ($action == "remove") {
        echo $OUTPUT->heading(get_string('reserveseliminated', 'local_bookingrooms') . '!');
        if (!has_capability('local/bookingrooms:delete', $context)) {