コード例 #1
0
 public function enrichTriggeredAlerts($triggeredAlerts)
 {
     return parent::enrichTriggeredAlerts($triggeredAlerts);
 }
コード例 #2
0
 /**
  * @param array $alerts
  * @param Mail $mail
  * @param string[] $recipient Email addresses
  * @param $period
  * @param $idSite
  */
 protected function sendAlertsPerEmailToRecipient($alerts, Mail $mail, $recipient, $period, $idSite)
 {
     if (empty($recipient) || empty($alerts)) {
         return;
     }
     $prettyDate = $this->getPrettyDateForSite($period, $idSite);
     $websiteName = Site::getNameFor($idSite);
     $mail->setDefaultFromPiwik();
     $mail->addTo($recipient);
     $mail->setSubject(Piwik::translate('CustomAlerts_MailAlertSubject', array($websiteName, $prettyDate)));
     $controller = new Controller();
     $viewHtml = new View('@CustomAlerts/alertHtmlMail');
     $viewHtml->assign('triggeredAlerts', $controller->formatAlerts($alerts, 'html'));
     $mail->setBodyHtml($viewHtml->render());
     $viewText = new View('@CustomAlerts/alertTextMail');
     $viewText->assign('triggeredAlerts', $controller->formatAlerts($alerts, 'text'));
     $viewText->setContentType('text/plain');
     $mail->setBodyText($viewText->render());
     $mail->send();
 }