コード例 #1
0
ファイル: MessageController.php プロジェクト: kleitz/bzion
 protected function prepareTwig()
 {
     $groups = Group::getGroups($this->getMe()->getId());
     Service::getTemplateEngine()->addGlobal("groups", $groups);
     $creator = new MessageSearchFormCreator();
     $searchForm = $creator->create();
     Service::getTemplateEngine()->addGlobal("searchForm", $searchForm->createView());
 }
コード例 #2
0
ファイル: HTMLController.php プロジェクト: bchhun/bzion
 /**
  * Prepare the twig global variables
  */
 private function addTwigGlobals()
 {
     if ($this->twigReady) {
         return;
     }
     $request = $this->getRequest();
     // Add global variables to the twig templates
     $twig = Service::getTemplateEngine();
     $twig->addGlobal("me", $this->getMe());
     $twig->addGlobal("model", new ModelFetcher());
     $twig->addGlobal("request", $request);
     $twig->addGlobal("session", $request->getSession());
     $twig->addGlobal("app", new AppGlobal($this->parent, $this->container));
     $this->prepareTwig();
     $this->twigReady = true;
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: bchhun/bzion
 /**
  * Renders a view
  * @param  string $view       The view name
  * @param  array  $parameters An array of parameters to pass to the view
  * @return string The rendered view
  */
 protected function render($view, $parameters = array())
 {
     Debug::startStopwatch('view.render');
     $template = Service::getTemplateEngine();
     $ret = $template->render($view, $parameters);
     Debug::finishStopwatch('view.render');
     return $ret;
 }
コード例 #4
0
ファイル: EventSubscriber.php プロジェクト: kleitz/bzion
 /**
  * Notify the user about a notification by e-
  * @param \Notification $notification The notification that will be mailed
  */
 public function emailNotification(\Notification $notification)
 {
     $text = \Service::getTemplateEngine()->render('Notification/item.html.twig', array('notification' => $notification));
     return $this->sendEmails(trim(strip_tags($text)), array($notification->getReceiver()->getId()), 'notification', array('notification' => $notification, 'text' => $text));
 }