Info.php

Go to the documentation of this file.
00001 <?php
00002 
00031 class Robo47_Form_Decorator_Info extends Zend_Form_Decorator_Abstract
00032 {
00033 
00037     protected $_placement = self::PREPEND;
00041     protected $_info = '';
00042 
00048     public function setPlacement($placement)
00049     {
00050         $this->_placement = strtoupper($placement);
00051         return $this;
00052     }
00053 
00059     public function setInfo($info)
00060     {
00061         $this->_info = $info;
00062         return $this;
00063     }
00064 
00069     public function getInfo()
00070     {
00071         return $this->_info;
00072     }
00073 
00079     public function render($content)
00080     {
00081         $element = $this->getElement();
00082         $view = $element->getView();
00083         if (null === $view) {
00084             return $content;
00085         }
00086 
00087         $separator = $this->getSeparator();
00088         $placement = $this->getPlacement();
00089 
00090         $info = $this->getInfo();
00091 
00092         switch ($placement) {
00093             case self::PREPEND:
00094                 $return = $info . $separator . $content;
00095                 break;
00096             case self::APPEND:
00097             default:
00098                 $return = $content . $separator . $info;
00099                 break;
00100         }
00101         return $return;
00102     }
00103 }