/**
  * Sends email for comment approval
  *
  * @param \Lelesys\Plugin\News\Domain\Model\Comment $comment Comment for approval
  * @param \Lelesys\Plugin\News\Domain\Model\News $news The news
  * @return void
  */
 public function sendCommentApprovalNotification(\Lelesys\Plugin\News\Domain\Model\Comment $comment, \Lelesys\Plugin\News\Domain\Model\News $news)
 {
     $this->standaloneView->setTemplatePathAndFilename(FLOW_PATH_PACKAGES . $this->settings['notifications']['emailTemplatePath']);
     $this->standaloneView->assign('comment', $comment);
     $this->standaloneView->assign('adminEmail', $news->getCreatedBy());
     $this->standaloneView->assign('news', $news);
     $emailBody = $this->standaloneView->render();
     $toEmail = $news->getCreatedBy()->getPrimaryElectronicAddress()->getIdentifier();
     $mail = new \TYPO3\SwiftMailer\Message();
     $mail->setFrom(array($this->settings['notifications']['senderAddress'] => $this->settings['notifications']['senderName']))->setContentType('text/html')->setTo($toEmail)->setSubject('Comment Approval')->setBody($emailBody)->send();
 }
 /**
  * Generate a controller with the given name for the given package
  *
  * @param string $packageKey The package key of the controller's package
  * @param string $subpackage An optional subpackage name
  * @param string $controllerName The name of the new controller
  * @param string $modelClassName The name of the model to base the controler on
  * @param boolean $overwrite Overwrite any existing files?
  * @return array An array of generated filenames
  */
 public function generateCrudAction($packageKey, $subpackage, $controllerName, $modelClassName, $actionName, $overwrite = FALSE)
 {
     $controllerName = ucfirst($controllerName);
     $shortModelClassName = substr($modelClassName, strrpos($modelClassName, '\\'));
     $view = new StandaloneView();
     $view->setTemplatePathAndFilename('resource://Sandstorm.CrudForms/Private/Generator/Resources/Private/Templates/' . $actionName . '.html.tmpl');
     $view->assign('subpackage', $subpackage);
     $view->assign('modelClassName', $modelClassName);
     $view->assign('shortModelClassName', $shortModelClassName);
     $fileContent = '{namespace crud=Sandstorm\\CrudForms\\ViewHelpers}' . chr(10) . $view->render();
     $subpackagePath = $subpackage != '' ? $subpackage . '/' : '';
     $this->generateFile('resource://' . $packageKey . '/Private/Templates/' . $subpackagePath . $controllerName . '/' . $actionName . '.html', $fileContent, $overwrite);
     return $this->generatedFiles;
 }
Example #3
0
 /**
  * @param string $key
  * @param Deployment $deployment
  * @param SurfCaptainDeployment $surfCaptainDeployment
  * @return void
  */
 protected function sendHipChatMessage($key, Deployment $deployment, SurfCaptainDeployment $surfCaptainDeployment)
 {
     $settings = $this->getSettingsForFunction($key, $surfCaptainDeployment);
     $pathParts = pathinfo($settings['templatePathAndFilename']);
     $view = new StandaloneView();
     $view->setTemplatePathAndFilename($settings['templatePathAndFilename']);
     $view->setPartialRootPath($pathParts['dirname'] . '/Partials/');
     $view->setPartialRootPath($pathParts['dirname'] . '/Layouts/');
     $view->assign('deployment', $deployment)->assign('surfCaptainDeployment', $surfCaptainDeployment)->assign('settings', $settings);
     $enabled = trim($view->renderSection('Enabled'));
     if (empty($enabled)) {
         return;
     }
     switch (strtolower($pathParts['extension'])) {
         case 'txt':
             $format = HipChatDriver::MESSAGE_FORMAT_TEXT;
             break;
         default:
             $format = HipChatDriver::MESSAGE_FORMAT_HTML;
     }
     switch ($surfCaptainDeployment->getStatus()) {
         case SurfCaptainDeployment::STATUS_RUNNING:
             $color = HipChatDriver::MESSAGE_COLOR_YELLOW;
             break;
         case SurfCaptainDeployment::STATUS_FAILED:
             $color = HipChatDriver::MESSAGE_COLOR_RED;
             break;
         default:
             $color = HipChatDriver::MESSAGE_COLOR_GREEN;
     }
     $this->hipChatDriver->setSettings($settings)->sendMessage($settings['room'], $view->renderSection('Message'), $format, TRUE, $color);
 }
Example #4
0
 /**
  * @param string $key
  * @param Deployment $deployment
  * @param SurfCaptainDeployment $surfCaptainDeployment
  * @return void
  */
 protected function sendMail($key, Deployment $deployment, SurfCaptainDeployment $surfCaptainDeployment)
 {
     $settings = $this->getSettingsForFunction($key, $surfCaptainDeployment);
     $pathParts = pathinfo($settings['templatePathAndFilename']);
     $view = new StandaloneView();
     $view->setTemplatePathAndFilename($settings['templatePathAndFilename']);
     $view->setPartialRootPath($pathParts['dirname'] . '/Partials/');
     $view->setPartialRootPath($pathParts['dirname'] . '/Layouts/');
     $view->assign('deployment', $deployment)->assign('surfCaptainDeployment', $surfCaptainDeployment)->assign('settings', $settings);
     $enabled = trim($view->renderSection('Enabled'));
     if (empty($enabled)) {
         return;
     }
     switch (strtolower($pathParts['extension'])) {
         case 'txt':
             $format = 'text/plain';
             break;
         default:
             $format = 'text/html';
     }
     $mail = new Message();
     $mail->setFrom($settings['from'])->setTo($settings['to'])->setSubject(trim($view->renderSection('Subject')))->setBody(trim($view->renderSection('Body')), $format, 'utf-8');
     if (!empty($settings['cc'])) {
         $mail->setCc($settings['cc']);
     }
     if (!empty($settings['bcc'])) {
         $mail->setBcc($settings['bcc']);
     }
     $mail->send();
 }
Example #5
0
 public function sendPasswordResetLink($email, $cryptJson)
 {
     $baseUrl = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . '/';
     $requestLink = $baseUrl . 'changepassword?code=' . $cryptJson;
     $templatepath = 'resource://Incvisio.LostFound/Private/Templates/Emails/ForgotPassword.html';
     $this->standaloneView->setFormat('html');
     $this->standaloneView->setTemplatePathAndFilename($templatepath);
     $this->standaloneView->assign('requestLink', $requestLink);
     $emailBody = $this->standaloneView->render();
     $mail = new \TYPO3\SwiftMailer\Message();
     $mail->setTo($email)->setFrom(array('*****@*****.**' => 'LostFound UA'))->setSubject('Reset link')->setBody($emailBody, 'text/html')->send();
 }
Example #6
0
 /**
  * TODO: Document this Method! ( render )
  */
 public function render()
 {
     \Debug\Toolbar\Service\DataStorage::save();
     $this->view->assign('modules', \Debug\Toolbar\Service\Collector::getModules());
     return $this->view->render();
 }