/**
  * 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();
 }
Пример #2
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();
 }
Пример #3
0
 /**
  * @param string $templateIdentifier
  * @param string $format
  * @param array $variables
  * @return string
  */
 protected function renderEmailBody($templateIdentifier, $format, array $variables)
 {
     // Default package to use
     $templatePackage = $this->templatePackage ? $this->templatePackage : 'Sandstorm.UserManagement';
     $standaloneView = new StandaloneView();
     $request = $standaloneView->getRequest();
     $request->setControllerPackageKey($templatePackage);
     $request->setFormat($format);
     $templatePathAndFilename = sprintf('resource://' . $templatePackage . '/Private/EmailTemplates/%s.%s', $templateIdentifier, $format);
     $standaloneView->setTemplatePathAndFilename($templatePathAndFilename);
     $standaloneView->assignMultiple($variables);
     return $standaloneView->render();
 }
Пример #4
0
 /**
  * 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;
 }
 /**
  * @param NodeInterface $node
  * @return string
  * @throws NeosException
  */
 public function render(NodeInterface $node)
 {
     if ($this->privilegeManager->isPrivilegeTargetGranted('TYPO3.Neos:Backend.GeneralAccess') === false) {
         return '';
     }
     /** @var $actionRequest ActionRequest */
     $actionRequest = $this->controllerContext->getRequest();
     $innerView = new StandaloneView($actionRequest);
     $innerView->setTemplatePathAndFilename('resource://TYPO3.Neos/Private/Templates/Backend/Content/Container.html');
     $innerView->setFormat('html');
     $innerView->setPartialRootPath('resource://TYPO3.Neos/Private/Partials');
     $user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
     $innerView->assignMultiple(array('node' => $node, 'modules' => $this->menuHelper->buildModuleList($this->controllerContext), 'sites' => $this->menuHelper->buildSiteList($this->controllerContext), 'user' => $user));
     return $innerView->render();
 }
Пример #6
0
 /**
  * @param string $sitePackage
  * @param string $siteName
  * @param string $baseDomain
  * @return Site
  */
 public function importSiteFromTemplate($sitePackage, $siteName, $baseDomain = '')
 {
     if (empty($baseDomain)) {
         $request = Request::createFromEnvironment();
         $baseDomain = $request->getBaseUri()->getHost();
     }
     $siteTemplate = new StandaloneView();
     $siteTemplate->setTemplatePathAndFilename(FLOW_PATH_PACKAGES . 'Sites/' . $sitePackage . '/Resources/Private/Templates/Content/Sites.xml');
     $siteTemplate->assignMultiple(['siteName' => $siteName, 'siteNodeName' => \TYPO3\TYPO3CR\Utility::renderValidNodeName($siteName), 'packageKey' => $sitePackage]);
     $generatedSiteImportXmlContent = $siteTemplate->render();
     $dataTemporaryPath = $this->environment->getPathToTemporaryDirectory();
     $temporarySiteXml = $dataTemporaryPath . uniqid($siteName) . '.xml';
     file_put_contents($temporarySiteXml, $generatedSiteImportXmlContent);
     $site = $this->siteImportService->importFromFile($temporarySiteXml);
     $domain = new Domain();
     $domain->setActive(true);
     $domain->setSite($site);
     $domain->setHostPattern(\TYPO3\TYPO3CR\Utility::renderValidNodeName($siteName) . '.' . $baseDomain);
     $this->domainRepository->add($domain);
     return $site;
 }
Пример #7
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();
 }
Пример #8
0
 /**
  * @test
  * @expectedException \TYPO3\Fluid\View\Exception\InvalidTemplateResourceException
  */
 public function renderThrowsExceptionIfSpecifiedTemplateFileDoesNotExist()
 {
     $this->view->setTemplatePathAndFilename('NonExistingTemplatePath');
     @$this->view->render();
 }