/** * Send a notification * * @param Array $recipients the list of recipients * @param Array $headers the additional headers * @param String $subject the subject of the message * @param String $htmlBody the html content of the message * @param String $txtBody the text content of the message * * @return Void */ protected function sendReminder(Tracker_Artifact $artifact, $recipients, $headers, $subject, $htmlBody, $txtBody) { $mail = new Codendi_Mail(); $hp = Codendi_HTMLPurifier::instance(); $breadcrumbs = array(); $groupId = $this->getTracker()->getGroupId(); $project = $this->getTracker()->getProject(); $trackerId = $this->getTracker()->getID(); $artifactId = $artifact->getID(); $breadcrumbs[] = '<a href="' . get_server_url() . '/projects/' . $project->getUnixName(true) . '" />' . $project->getPublicName() . '</a>'; $breadcrumbs[] = '<a href="' . get_server_url() . '/plugins/tracker/?tracker=' . (int) $trackerId . '" />' . $hp->purify(SimpleSanitizer::unsanitize($this->getTracker()->getName())) . '</a>'; $breadcrumbs[] = '<a href="' . get_server_url() . '/plugins/tracker/?aid=' . (int) $artifactId . '" />' . $hp->purify($this->getTracker()->getName() . ' #' . $artifactId) . '</a>'; $mail->getLookAndFeelTemplate()->set('breadcrumbs', $breadcrumbs); $mail->getLookAndFeelTemplate()->set('title', $hp->purify($subject)); $mail->setFrom($GLOBALS['sys_noreply']); $mail->addAdditionalHeader("X-Codendi-Project", $this->getTracker()->getProject()->getUnixName()); $mail->addAdditionalHeader("X-Codendi-Tracker", $this->getTracker()->getItemName()); $mail->addAdditionalHeader("X-Codendi-Artifact-ID", $artifact->getId()); foreach ($headers as $header) { $mail->addAdditionalHeader($header['name'], $header['value']); } $mail->setTo(implode(', ', $recipients)); $mail->setSubject($subject); if ($htmlBody) { $mail->setBodyHTML($htmlBody); } $mail->setBodyText($txtBody); $mail->send(); }
/** * Send a notification * * @param Array $recipients the list of recipients * @param Array $headers the additional headers * @param String $subject the subject of the message * @param String $htmlBody the html content of the message * @param String $txtBody the text content of the message * * @return Void */ protected function sendReminder(Tracker_Artifact $artifact, $recipients, $headers, $subject, $htmlBody, $txtBody) { $hp = Codendi_HTMLPurifier::instance(); $breadcrumbs = array(); $project = $this->getTracker()->getProject(); $trackerId = $this->getTracker()->getID(); $artifactId = $artifact->getID(); $mail_enhancer = new MailEnhancer(); $breadcrumbs[] = '<a href="' . get_server_url() . '/projects/' . $project->getUnixName(true) . '" />' . $project->getPublicName() . '</a>'; $breadcrumbs[] = '<a href="' . get_server_url() . '/plugins/tracker/?tracker=' . (int) $trackerId . '" />' . $hp->purify($this->getTracker()->getName()) . '</a>'; $breadcrumbs[] = '<a href="' . get_server_url() . '/plugins/tracker/?aid=' . (int) $artifactId . '" />' . $hp->purify($this->getTracker()->getName() . ' #' . $artifactId) . '</a>'; $mail_enhancer->addPropertiesToLookAndFeel('breadcrumbs', $breadcrumbs); $mail_enhancer->addPropertiesToLookAndFeel('title', $hp->purify($subject)); $mail_enhancer->addHeader("X-Codendi-Project", $this->getTracker()->getProject()->getUnixName()); $mail_enhancer->addHeader("X-Codendi-Tracker", $this->getTracker()->getItemName()); $mail_enhancer->addHeader("X-Codendi-Artifact-ID", $artifact->getId()); foreach ($headers as $header) { $mail_enhancer->addHeader($header['name'], $header['value']); } $mail_notification_builder = new MailNotificationBuilder(new MailBuilder(TemplateRendererFactory::build())); $mail_notification_builder->buildAndSendEmail($project, $recipients, $subject, $htmlBody, $txtBody, get_server_url() . $artifact->getUri(), trackerPlugin::TRUNCATED_SERVICE_NAME, $mail_enhancer); }
/** * Fetch the html code to display the field value in tooltip * * @param Tracker_Artifact $artifact * @param Tracker_Artifact_ChangesetValue_Integer $value The changeset value of this field * @return string The html code to display the field value in tooltip */ protected function fetchTooltipValue(Tracker_Artifact $artifact, Tracker_Artifact_ChangesetValue $value = null) { return $this->getArtifactRank($artifact->getID()); }