Ejemplo n.º 1
0
 /**
  * Implementation \Extlib\Mail\Message\MessageInterface::create()
  * 
  * @param string $template
  * @return string|html 
  */
 public function create($template = null)
 {
     if (null !== $template) {
         $this->setScriptName($template);
     }
     $this->layout->assign('content', $this->layout->getView()->render($this->getScript()));
     return $this->layout->render();
 }
Ejemplo n.º 2
0
 /**
  * Build the txt part of the email using the provided scripts
  *
  * @return void
  */
 private function _buildTextBody()
 {
     $viewContent = '';
     if ($this->getTxtView()) {
         $viewContent = $this->view->render($this->getTxtView());
         if (!$this->getTxtLayout()) {
             // no layout, render only the view
             $this->setBodyText($viewContent);
         }
     }
     if ($this->getTxtLayout()) {
         $this->_layout->setLayout($this->getTxtLayout());
         $this->_layout->setView($this->view);
         // assign rendered view to the layout
         $this->_layout->assign('content', $viewContent);
         // render the layout
         $this->setBodyText($this->_layout->render($this->getTxtLayout()));
     }
 }
Ejemplo n.º 3
0
 private function render()
 {
     if ($this->messagesExist) {
         $this->layout = $this->getLayout();
         $messages = $this->messages;
         $tmp = [];
         foreach ($messages as $messageType => $values) {
             if (count($values) > 0) {
                 if ($messageType == self::TYPE_CONFIRMATION) {
                     $messageType = 'success';
                 } elseif ($messageType == self::TYPE_DEBUG) {
                     $messageType = 'information';
                 } elseif ($messageType == self::TYPE_NOTICE) {
                     $messageType = 'alert';
                 }
                 $tmp[$messageType] = $values;
             }
         }
         $this->layout->assign('messages', json_encode($tmp));
         $this->resetMessages();
     }
 }
Ejemplo n.º 4
0
 /**
  * Assign value for view
  * 
  * @param string $spec     Variable which is used in view
  * @param string $value    Value of variable
  * 
  * @return Vi_Layout
  */
 public function assign($spec, $value = null)
 {
     $this->_view->assign($spec, $value);
     parent::assign($spec, $value);
     return $this;
 }
Ejemplo n.º 5
0
 /**
  * @return void
  */
 public function testAssignWithArrayPopulatesPropertiesAccessibleViaOverloading()
 {
     $layout = new Zend_Layout();
     $layout->assign(array('foo' => 'bar', 'bar' => 'baz'));
     $this->assertEquals('bar', $layout->foo);
     $this->assertEquals('baz', $layout->bar);
 }