function sendGuestList() { $reservationService = new ReservationService(); $startDate = date('Y-m-d', strtotime(date('Y-m-d') . ' + 1 day')); $endDate = date('Y-m-d', strtotime($startDate . ' + 1 day')); $confirmationTable = $this->getTable('Confirmations'); $reservations = $confirmationTable->getReservationList($startDate, $startDate); $guestDetailsList = "<tr style='text-align: left;'><th>" . JText::_("LNG_NAME") . "</th><th>" . JText::_("LNG_ARRIVAL") . "</th><th>" . JText::_("LNG_DEPARTURE") . "</th><th>" . JText::_("LNG_ADULTS") . " </th><th>" . JText::_("LNG_ROOMS") . " </th><th>" . JText::_("LNG_OFFERS") . "</th></tr>"; if (count($reservations) > 0) { $hotelId = $reservations[0]->hotel_id; $guestDetailsList .= "<tr>"; $guestDetailsList .= "<td>" . $reservations[0]->last_name . ' ' . $reservations[0]->first_name . " </td><td nowrap='nowrap'>" . JHotelUtil::convertToFormat($reservations[0]->start_date) . " </td><td nowrap='nowrap'>" . JHotelUtil::convertToFormat($reservations[0]->end_date) . " </td><td>" . $reservations[0]->adults . " </td><td>" . $reservations[0]->number_rooms . " </td><td>" . $reservations[0]->offer_names . " </td>"; $guestDetailsList .= "</tr>"; foreach ($reservations as $reservation) { if ($hotelId != $reservation->hotel_id || next($reservations) === false) { $guestDetailsList .= "<tr>"; $guestDetailsList .= "<td>" . $reservation->last_name . ' ' . $reservation->first_name . " </td><td nowrap='nowrap'>" . JHotelUtil::convertToFormat($reservation->start_date) . " </td><td nowrap='nowrap'>" . JHotelUtil::convertToFormat($reservation->end_date) . " </td><td>" . $reservation->adults . " </td><td>" . $reservation->number_rooms . " </td><td>" . $reservation->offer_names . " </td>"; $guestDetailsList .= "</tr>"; $guestDetailsList = "<table style=text-align:left'>" . $guestDetailsList . "</table>"; EmailService::sendGuestListEmail($reservation->hotel_id, $reservation->hotel_name, $reservation->hotel_email, $guestDetailsList, $startDate); $guestDetailsList = "<tr style='text-align: left;'><th>" . JText::_("LNG_NAME") . "</th><th>" . JText::_("LNG_ARRIVAL") . "</th><th>" . JText::_("LNG_DEPARTURE") . "</th><th>" . JText::_("LNG_ADULTS") . " </th><th>" . JText::_("LNG_ROOMS") . " </th><th>" . JText::_("LNG_OFFERS") . "</th></tr>"; $hotelId = $reservation->hotel_id; break; } $guestDetailsList .= "<tr>"; $guestDetailsList .= "<td>" . $reservation->last_name . ' ' . $reservation->first_name . " </td><td nowrap='nowrap'>" . JHotelUtil::convertToFormat($reservation->start_date) . " </td><td nowrap='nowrap'>" . JHotelUtil::convertToFormat($reservation->end_date) . " </td><td>" . $reservation->adults . " </td><td>" . $reservation->number_rooms . " </td><td>" . $reservation->offer_names . " </td>"; $guestDetailsList .= "</tr>"; } } }