response; // Skip if no email is associated with the booking if (!$this->email) { return false; } $lang = $this->language; if (!$lang) { $lang = $this->restaurant->language; } // Get the mail manager if ($this->mailManager == null) { $this->mailManager = new MailManager($this->restaurant_id); } // Create a subject and content for the email $subject = $this->getReviewResponseSubject($lang); $content = $this->getReviewResponseContent($review, $lang); // Parse the email tags $subject = $this->parseEmailTags($subject); $content = $this->parseEmailTags($content); // Store the notification first $notification = $this->storeEmailSent( $this->email, $subject, $content, 'pending', 'email_review_response' ); // Add tracking pixel $pixel_code = alexr_get_pixel_code($this->uuid, $notification ? $notification->id : 0); // Send the email $result = $this->mailManager->send_email($this->email, $subject, $content, $pixel_code); // Update the notification status if ($notification) { $this->updateEmailSent($notification->id, $result); } return $result; } /** * Get the subject for the review response email * * @param string $lang Language code * @return string Email subject */ protected function getReviewResponseSubject($lang) { $restaurant_name = $this->restaurant->name; $subject = evavel_translate(__eva('has responded to your review'), $lang); $subject = $restaurant_name.' '.$subject; return $subject; } /** * Get the content for the review response email * * @param string $response The restaurant's response * @param string $lang Language code * @return string Email content in HTML format */ protected function getReviewResponseContent($review, $lang) { $restaurant_name = $this->restaurant->name; $responseTitle = evavel_translate( __eva('Response from'), $lang).' '.$restaurant_name; $feedbackTitle = evavel_translate( __eva('Your feedback'), $lang); // Get original review feedback (decode if it's base64 encoded) $feedback = $review->feedback; //if ($this->isBase64($feedback)) { // $feedback = base64_decode($feedback); //} return <<

{$responseTitle}

{$review->response}

{$feedbackTitle}

{$feedback}

HTML; } }