remove(); $user = new User; $user->get($reservation->user_id); $apartmentHistory = new ApartmentHistory(); $storedData = $apartmentHistory->getData($reservation->id); $apartment = unserialize($storedData['apartment']); $block = unserialize($storedData['block']); $building = unserialize($storedData['building']); $roomType = unserialize($storedData['roomType']); $builder = unserialize($storedData['builder']); $f1 = file("https://joywork.ru/template_mail/reservation_status.html"); $text = implode("", $f1); $text = str_replace("<%apartment_number%>", $reservation->apartment_number, $text); $text = str_replace("<%user_name%>", $user->fio, $text); $text = str_replace("<%reservation_status%>", $reservation->getStateName(), $text); $text = str_replace("<%room_type%>", $roomType->name, $text); $text = str_replace("<%space_total%>", $apartment->space_total, $text); $text = str_replace("<%flat_floor%>", $apartment->flat_floor, $text); $text = str_replace("<%discount_price%>", number_format($reservation->full_price, 0, ',', ' '), $text); $text = str_replace("<%base_price%>", number_format($reservation->base_price, 0, ',', ' '), $text); $text = str_replace("<%block_name%>", $block->name, $text); $text = str_replace("<%building_line%>", $building->line, $text); $text = str_replace("<%building_corp%>", $building->corp, $text); $text = str_replace("<%building_deadline%>", Date::getFormatedEndingPeriod($building->deadline), $text); $text = str_replace("<%building_floors%>", $building->floors, $text); $text = str_replace("<%block_address%>", $block->address, $text); $text = str_replace("<%builder_name%>", $builder->name, $text); $text = str_replace("<%reservation_client_name%>", $reservation->getFullname(), $text); $text = str_replace("<%reservation_client_phone%>", $reservation->phone, $text); $style = ""; switch( $reservation->status ) { case 1: $style = "background: #d0d0d0; color: #757575;"; break; case 2: $style = "background: #ffc107; color: #ffffff;"; break; case 3: $style = "background: #d0d0d0; color: #757575;"; break; case 4: $style = "background: #4caf50;color: #ffffff;"; break; case 5: $style = "background: #d0d0d0; color: #757575;"; break; } $text = str_replace("<%reservation_status_style%>", $style, $text); mailClientFromJoywork($user->email, "Изменен статус брони", $text); } }