Ejemplo n.º 1
0
 /**
  * Sends an email to reviewer when a Performance Review is added.
  *
  * @param PerformanceReviewService $review
  * @return null
  */
 public function informReviewer(PerformanceReview $review)
 {
     try {
         $reviewerEmail = $review->getReviewer()->getEmpWorkEmail();
         if ($reviewerEmail != '') {
             $content = file_get_contents(sfConfig::get('sf_root_dir') . "/apps/orangehrm/modules/performance/templates/email/" . self::EMAIL_TEMPLATE_ADD_REVIEW);
             $varibles = array('#reviewerName' => $review->getReviewer()->getFirstName(), '#empName' => $review->getEmployee()->getFullName(), '#period' => set_datepicker_date_format($review->getPeriodFrom()) . ' ' . set_datepicker_date_format($review->getPeriodTo()), '#dueDate' => set_datepicker_date_format($review->getDueDate()));
             $mailBody = strtr($content, $varibles);
             $mailService = new EmailService();
             $mailService->setMessageTo(array($reviewerEmail));
             $mailService->setMessageFrom(array("admin@orangehrm"));
             $mailService->setMessageSubject("You Have Been Assigned a New Performance Review");
             $mailService->setMessageBody($mailBody);
             @$mailService->sendEmail();
         }
         return true;
     } catch (Exception $e) {
         throw new PerformanceServiceException($e->getMessage());
     }
 }