Esempio n. 1
0
 /**
  * Overloading: allow rendering specific decorators
  *
  * Call renderDecoratorName() to render a specific decorator.
  *
  * @param  string $method
  * @param  array $args
  * @return \MUtil_Html_HtmlElement or at least something that implements the \MUtil_Html_HtmlInterface interface
  * @throws \Zend_Form_Exception for invalid decorator or invalid method call
  */
 public function __call($method, $args)
 {
     if ('render' == substr($method, 0, 6)) {
         return parent::__call($method, $args);
     }
     $elem = \MUtil_Html::createArray($method, $args);
     $value = $this->getValue();
     if (!$value instanceof \MUtil_Html_ElementInterface) {
         $value = new \MUtil_Html_Sequence();
     }
     $value->append($elem);
     $this->setValue($value);
     return $elem;
 }
 /**
  * For backward compatibility, allow \MUtil_Html calls to set or append to the title
  *
  * @param type $method
  * @param type $args
  * @return \Gems_Form_TabSubForm
  */
 public function __call($method, $args)
 {
     if ('render' == substr($method, 0, 6)) {
         return parent::__call($method, $args);
     }
     $elem = \MUtil_Html::createArray($method, $args);
     $value = $this->getAttrib('title');
     $value .= $elem->render($this->getView());
     $this->setAttrib('title', $value);
     //As the decorator might have been added already, update it also
     $decorator = $this->getDecorator('TabPane');
     $options = $decorator->getOption('jQueryParams');
     $options['title'] = strip_tags($value);
     $decorator->setOption('jQueryParams', $options);
     return $this;
 }
Esempio n. 3
0
 /**
  * Adds an HtmlElement to this element
  *
  * @see \MUtil_Html_Creator
  *
  * @param string $name Function name becomes tagname (unless specified otherwise in \MUtil_Html_Creator)
  * @param array $arguments The content and attributes values
  * @return \MUtil_Html_HtmlElement With '$name' tagName
  */
 public function __call($name, array $arguments)
 {
     $elem = \MUtil_Html::createArray($name, $arguments);
     $this[] = $elem;
     return $elem;
 }
Esempio n. 4
0
 public static function smallData($value, $args_array = null)
 {
     $args = func_get_args();
     $element = \MUtil_Lazy::iff($value, \MUtil_Html::createArray('small', array(' [', $args, ']')));
     return $element;
 }
Esempio n. 5
0
 /**
  * Sets the layout to the use of html elements
  *
  * @see \MUtil_Html
  *
  * @param string $html HtmlTag for element or empty sequence when empty
  * @param string $args \MUtil_Ra::args additional arguments for element
  * @return \MUtil_Form (continuation pattern)
  */
 public function setHtml($html = null, $args = null)
 {
     $options = \MUtil_Ra::args(func_get_args(), 1);
     if ($html instanceof \MUtil_Html_ElementInterface) {
         if ($options) {
             foreach ($options as $name => $option) {
                 if (is_int($name)) {
                     $html[] = $option;
                 } else {
                     $html->{$name} = $option;
                 }
             }
         }
     } elseif (null == $html) {
         $html = new \MUtil_Html_Sequence($options);
     } else {
         $html = \MUtil_Html::createArray($html, $options);
     }
     if ($html instanceof \MUtil_Html_FormLayout) {
         $html->setAsFormLayout($this);
     } else {
         // Set this element as the form decorator
         $decorator = new \MUtil_Html_ElementDecorator();
         $decorator->setHtmlElement($html);
         // $decorator->setPrologue($formrep); // Renders hidden elements before this element
         $this->setDecorators(array($decorator, 'AutoFocus', 'Form'));
     }
     $this->_html_element = $html;
     return $this;
 }
Esempio n. 6
0
 /**
  * Add a row with a class and the correct type of default child tag to this element
  *
  * @param mixed $arg_array MUtil::args() values
  * @return \MUtil_Html_TrElement
  */
 public function tr($arg_array = null)
 {
     $args = func_get_args();
     // Set default child tag first and het because otherwise
     // the children are created first and the default child tag
     // is set afterwards.
     if (!array_key_exists('DefaultChildTag', $args)) {
         array_unshift($args, array('DefaultChildTag' => $this->getDefaultRowChildTag()));
     }
     $tr = \MUtil_Html::createArray('tr', $args);
     $this[] = $tr;
     if (!isset($tr->class) && ($class = $this->getDefaultRowClass())) {
         $tr->class = $class;
     }
     return $tr;
 }