public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $separator = ' '; $placement = $this->getPlacement(); $tag = $this->getTag(); $tagClass = $this->getClass(); $id = $element->getId(); $errors = $element->getMessages(); if (!empty($errors)) { $errors = implode('. ', $errors) . '.'; } else { $errors = ''; } if (null !== $tag) { $decorator = new Zend_Form_Decorator_HtmlTag(); if (null !== $tagClass) { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-errors', 'class' => $tagClass)); } else { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-errors')); } $errors = $decorator->render($errors); } switch ($placement) { case self::APPEND: return $content . $separator . $errors; case self::PREPEND: return $errors . $separator . $content; } }
public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $label = $this->getLabel(); $separator = $this->getSeparator(); $placement = $this->getPlacement(); $tag = $this->getTag(); $tagClass = $this->getTagClass(); $id = $this->getId(); $class = $this->getClass(); $options = $this->getOptions(); if (empty($label) && empty($tag)) { return $content; } if (!empty($label)) { $options['class'] = $class; $label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options); } else { $label = ' '; } if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); if (null !== $this->_tagClass) { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-label', 'class' => $tagClass)); } else { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-label')); } $label = $decorator->render($label); } $buttons = ' <a id="video" href="#" class="btn btn-mini"><i class="icon-facetime-video"></i> Видео</a> <a id="img" href="#" class="btn btn-mini"><i class="icon-picture"></i> Картинка</a> '; switch ($placement) { case self::APPEND: return $content . $separator . $label . $buttons; case self::PREPEND: return $label . $buttons . $separator . $content; } }
/** * Render a label * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $label = $this->getLabel(); $separator = $this->getSeparator(); $placement = $this->getPlacement(); $tag = $this->getTag(); $tagClass = method_exists($this, 'getTagClass') ? $this->getTagClass() : false; $id = $this->getId(); $class = $this->getClass(); $options = $this->getOptions(); if (empty($label) && empty($tag)) { return $content; } if (in_array(get_class($element), $this->_hiddenLabels)) { $label = ''; } elseif (!empty($label)) { $options['class'] = $class; $label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options); } else { $label = ' '; } if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); if ($tagClass && null !== $this->_tagClass) { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-label', 'class' => $tagClass)); } else { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-label')); } $label = $decorator->render($label); } switch ($placement) { case self::APPEND: return $content . $separator . $label; case self::PREPEND: return $label . $separator . $content; } }
public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $label = $this->getLabel(); $separator = $this->getSeparator(); $placement = $this->getPlacement(); $tag = $this->getTag(); $id = $this->getId(); $class = $this->getClass(); $options = $this->getOptions(); if (empty($label) && empty($tag)) { return $content; } if (!empty($label)) { $options['class'] = $class; $label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options); } else { $label = ' '; } if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); if (isset($options['class']) and $options['class'] != '') { $decorator->setOptions(array('tag' => $tag, 'id' => $this->getElement()->getName() . '-label', 'class' => $options['class'])); } else { $decorator->setOptions(array('tag' => $tag, 'id' => $this->getElement()->getName() . '-label', 'class' => 'label')); } $label = $decorator->render($label); } switch ($placement) { case self::APPEND: return $content . $separator . $label; case self::PREPEND: return $label . $separator . $content; } }
/** * Render a label * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $label = $element->getLabel(); $label = trim($label); if (!empty($label) && null !== ($translator = $element->getTranslator())) { $label = $translator->translate($label); } $separator = $this->getSeparator(); $placement = $this->getPlacement(); $options = $this->getOptions(); $tag = null; if (isset($options['tag'])) { $tag = $options['tag']; unset($options['tag']); } if (empty($label) && empty($tag)) { return $content; } if (!empty($label)) { $label = $view->formLabel($element->getName(), $label, $options); } if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); $decorator->setOptions(array('tag' => $tag)); $label = $decorator->render($label); } switch ($placement) { case self::APPEND: return $content . $separator . $label; case self::PREPEND: return $label . $separator . $content; } }
/** * Render a label * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $label = $this->getLabel(); $separator = $this->getSeparator(); $placement = $this->getPlacement(); $tag = $this->getTag(); $tagClass = $this->getTagClass(); $id = $this->getId(); $class = $this->getClass(); $options = $this->getOptions(); if (empty($label) && empty($tag)) { return $content; } if (!empty($label)) { $options['class'] = $class; $label = trim($label); switch ($placement) { case self::IMPLICIT: // Break was intentionally omitted // Break was intentionally omitted case self::IMPLICIT_PREPEND: $options['escape'] = false; $options['disableFor'] = true; $label = $view->formLabel($element->getFullyQualifiedName(), $label . $separator . $content, $options); break; case self::IMPLICIT_APPEND: $options['escape'] = false; $options['disableFor'] = true; $label = $view->formLabel($element->getFullyQualifiedName(), $content . $separator . $label, $options); break; case self::APPEND: // Break was intentionally omitted // Break was intentionally omitted case self::PREPEND: // Break was intentionally omitted // Break was intentionally omitted default: $label = $view->formLabel($element->getFullyQualifiedName(), $label, $options); break; } } else { $label = ' '; } if (null !== $tag) { //require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); if (null !== $this->_tagClass) { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-label', 'class' => $tagClass)); } else { $decorator->setOptions(array('tag' => $tag, 'id' => $id . '-label')); } $label = $decorator->render($label); } switch ($placement) { case self::APPEND: return $content . $separator . $label; case self::PREPEND: return $label . $separator . $content; case self::IMPLICIT: // Break was intentionally omitted // Break was intentionally omitted case self::IMPLICIT_PREPEND: // Break was intentionally omitted // Break was intentionally omitted case self::IMPLICIT_APPEND: return $label; } }
/** * Render a label * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $label = $this->getTitle(); $separator = $this->getSeparator(); $placement = $this->getPlacement(); $tag = $this->getTag(); $options = $this->getOptions(); if (empty($label) || empty($tag)) { return $content; } //if (!empty($label)) { //$options['class'] = $class; //$label = $view->formLabel($element->getFullyQualifiedName(), trim($label), $options); //} else { // $label = ' '; //} if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); $decorator->setOptions(array('tag' => $tag)); $label = $decorator->render($label); } switch ($placement) { case self::APPEND: return $content . $separator . $label; case self::PREPEND: return $label . $separator . $content; } }
/** * Render a form image * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $tag = $this->getTag(); $placement = $this->getPlacement(); $separator = $this->getSeparator(); $name = $element->getFullyQualifiedName(); $attribs = $this->getAttribs(); $attribs['id'] = $element->getId(); $image = $view->formImage($name, $element->getImageValue(), $attribs); if (null !== $tag) { require_once LIB_DIR . '/Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); $decorator->setOptions(array('tag' => $tag)); $image = $decorator->render($image); } switch ($placement) { case self::PREPEND: return $image . $separator . $content; case self::APPEND: default: return $content . $separator . $image; } }
/** * Render a tooltip * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $tooltip = $element->getAttrib('tooltip'); $tooltip = trim($tooltip); //$element->removeAttrib('tooltip'); if (empty($tooltip)) { return $content; } $view->headScript()->appendFile(\Zend_Controller_Front::getInstance()->getBaseUrl() . '/gems/js/jquery.cluetip.js'); $view->headLink()->appendStylesheet(\Zend_Controller_Front::getInstance()->getBaseUrl() . '/gems/js/jquery.cluetip.css'); $script = "\$('" . $this->getTag() . ".tooltip').cluetip({\n activation: 'click',\n sticky: 'true',\n closeText: '[X]',\n closePosition: 'title',\n width: 450,\n titleAttribute: 'tip',\n splitTitle: '|'})\n \$('#tabContainer').bind( 'tabsselect', function(event, ui) {\n \$(document).trigger('hideCluetip');\n});"; $view->jQuery()->addOnLoad($script); $separator = $this->getSeparator(); $placement = $this->getPlacement(); $class = $this->getClass(); $tag = $this->getTag(); $escape = $this->getEscape(); $options = $this->getOptions(); if ($escape) { $tooltip = $view->escape($tooltip); } $options['tag'] = $tag; $options['tip'] = str_replace('"', '\\"', $tooltip); $decorator = new \Zend_Form_Decorator_HtmlTag($options); $tooltip = $decorator->render($this->getImg()) . $decorator->setOptions(array('class' => 'thetooltip', 'id' => 'tooltip-' . $this->getElement()->getAttrib('id')))->render($tooltip); switch ($placement) { case self::PREPEND: return $tooltip . $separator . $content; case self::APPEND: default: return $content . $separator . $tooltip; } /* Misschien later toch toevoegen */ $helper = $this->getHelper(); return $view->{$helper}($id, $content, $attribs); }
/** * Render a form image * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $image = $this->getImage(); $tag = $this->getTag(); $placement = $this->getPlacement(); $separator = $this->getSeparator(); $options = $this->getOptions(); $image = $view->formImage($element->getName(), $image, $options); if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); $decorator->setOptions(array('tag' => $tag)); $image = $decorator->render($image); } switch ($placement) { case self::PREPEND: return $image . $separator . $content; case self::APPEND: default: return $content . $separator . $image; } }
/** * Render a captcha image * * @param string $content * @return string */ public function render($content) { $element = $this->getElement(); $view = $element->getView(); if (null === $view) { return $content; } $tag = $this->getTag(); $placement = $this->getPlacement(); $separator = $this->getSeparator(); $namespace = $this->getOption('namespace'); $captchaId = $this->getOption('captchaId'); if (!$namespace || !$captchaId) { require_once 'Zend/Form/Decorator/Exception.php'; $exception = new Zend_Form_Decorator_Exception('namespace or captchaId not set'); throw $exception; } $image = '<img src="/app/user/captcha/' . $namespace . '/' . $captchaId . '" alt="CAPTCHA challange" />'; //$red = imagecolorallocate($image, 255, 0,0); if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); $decorator->setOptions(array('tag' => $tag)); $image = $decorator->render($image); } else { $image = '<tr><td> </td><td class=forminput valign="middle" align="left" width="65%">' . $image . '</td></tr>' . "\n"; $image = '<tr><td> </td><td></td></tr><tr><td> </td><td class=forminput valign="middle" align="left" width="65%">Type the characters you see in the picture below.</td></tr>' . "\n" . $image; } logfire('captcha', $image); switch ($placement) { case self::PREPEND: return $image . $separator . $content; case self::APPEND: default: return $content . $separator . $image; } }