当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element::getName方法代码示例

本文整理汇总了PHP中Zend_Form_Element::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element::getName方法的具体用法?PHP Zend_Form_Element::getName怎么用?PHP Zend_Form_Element::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element的用法示例。


在下文中一共展示了Zend_Form_Element::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: aElement

 /**
  * Render element
  *
  * @param Zend_Form_Element $element
  * @return string
  */
 public function aElement(Zend_Form_Element $element)
 {
     $viewClasses = array($element->getAttrib('class'));
     if ($element->isRequired()) {
         if (!$element->getAttrib('title')) {
             $element->setAttrib('title', 'Field is required');
         }
         $viewClasses[] = 'aForm-field-required';
     }
     if ($element->getValidators()) {
         $viewClasses[] = 'aForm-field-validate';
     }
     if ($element->hasErrors()) {
         $viewClasses[] = 'aForm-field-invalid';
     } elseif ($element->getValue() || !$element->isRequired()) {
         $viewClasses[] = 'aForm-field-valid';
     }
     if ($element->getValidators()) {
         $viewClasses[] = 'aForm-field-validate';
     }
     $element->setAttrib('class', implode(' ', $viewClasses));
     $options = null;
     $separator = null;
     if ($element instanceof Zend_Form_Element_Multi) {
         $options = $element->getMultiOptions();
         $separator = $element->getSeparator();
     }
     return $this->view->{$element->helper}($element->getName(), $element->getValue(), $element->getAttribs(), $options, $separator);
 }
开发者ID:uglide,项目名称:zfcore-transition,代码行数:35,代码来源:AElement.php

示例2: addDefaultDecorators

 /**
  * Adds default decorators to an existing element
  * 
  * @param Zend_Form_Element $element
  */
 public static function addDefaultDecorators(Zend_Form_Element $element)
 {
     $fqName = $element->getName();
     if (null !== ($belongsTo = $element->getBelongsTo())) {
         $fqName = $belongsTo . '-' . $fqName;
     }
     $element->addDecorator('Description', array('tag' => 'p', 'class' => 'description', 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div', 'id' => $fqName . '-element', 'class' => 'form-element'))->addDecorator('Label', array('tag' => 'div', 'tagOptions' => array('id' => $fqName . '-label', 'class' => 'form-label')))->addDecorator('HtmlTag2', array('tag' => 'div', 'id' => $fqName . '-wrapper', 'class' => 'form-wrapper'));
 }
开发者ID:nhochong,项目名称:qlkh-sgu,代码行数:13,代码来源:Form.php

示例3: renderLabel

 public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = $element->getName();
     }
     return '<div class="pointer" onClick = goToErrorLabel(\'' . $element->getId() . '\')>' . $this->getMarkupElementLabelStart() . $view->escape($label) . $this->getMarkupElementLabelEnd() . '</div>';
 }
开发者ID:knatorski,项目名称:SMS,代码行数:8,代码来源:FormErrorsGoTo.php

示例4: setupSingleElement

 /**
  * Setup per-element properties like labels, and classes
  */
 protected function setupSingleElement(Zend_Form_Element $elm)
 {
     // determine if this element has an error. (Will be used below)
     $elmHasError = count($elm->getMessages()) > 0;
     // set element values from the language pack
     $elm->setLabel($this->lang->get('form.label.' . $elm->getName()));
     // display info about required length if validator exists
     if ($elm->getValidator('StringLength')) {
         $elm->setDescription(sprintf($this->lang->get('form.description.' . $elm->getName()), $elm->getValidator('StringLength')->getMin(), $elm->getValidator('StringLength')->getMax()));
     } else {
         $elm->setDescription($this->lang->get('form.description.' . $elm->getName()));
     }
     // Duplicating type attr to classname in case we need to support IE6
     // and want to be able to directly target the element without using
     // input[type=text]
     $zendType = $elm->getType();
     $className = strtolower(substr($zendType, strrpos($zendType, '_') + 1));
     $elm->setAttrib('class', $className);
     // wrap this stuff up in a html div with class 'element'
     $elm->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'element'));
     // determine if element has error and use that to determine prefix char.
     // 1. There seems to be no way to add html to the reqPrefix
     // 2. There seems to be no way to add a custom classname to the div tag
     if ($elm->getName() != 'submit') {
         $reqChar = $elmHasError ? '! ' : '* ';
         $elm->addDecorator('Label', array('placement' => 'prepend', 'tag' => 'div', 'requiredPrefix' => $reqChar));
     }
     // use custom error decorator that attempts to replace default error
     // messages by the ones supplied by My_LanguagaPack
     $errorDecorator = new My_Decorator_Errors();
     $errorDecorator->setLanguagePack($this->lang);
     $elm->addDecorator($errorDecorator);
     // wrap everything so far in a li tag, give it class error if elm has error
     // ATT: using array to create alias for allready used HtmlTag decorator
     $liClass = $elmHasError ? 'error' : '';
     $elm->addDecorator(array('outerLi' => 'HtmlTag'), array('tag' => 'li', 'class' => $liClass));
 }
开发者ID:TBeijen,项目名称:Zend_Form_Without_MVC,代码行数:40,代码来源:My_Form_Renderer_Edit.php

示例5: renderFormElement

 /**
  * Enter description here ...
  * @param Zend_Form_Element $element
  * @author Tung Ly
  */
 public function renderFormElement($element, $vertical = 0)
 {
     if ($element->getType() != "Zend_Form_Element_Checkbox") {
         $element->setAttrib('class', $element->getAttrib('class') . ' form-control');
     }
     if ($element->isRequired()) {
         $element->setLabel($element->getLabel() . ' *');
         $element->setAttrib('class', $element->getAttrib('class') . ' required');
     }
     switch ($element->getType()) {
         case 'Zend_Form_Element_Textarea':
             $element->setAttrib('rows', 5);
             $element->setAttrib('cols', 80);
             break;
         case 'Zend_Form_Element_Hidden':
             return $element;
         default:
             break;
     }
     $error = '';
     if ($element->hasErrors()) {
         $error = 'has-error';
     }
     if ($element->getType() == 'Zend_Form_Element_Textarea') {
     }
     $btn = array('Zend_Form_Element_Submit', 'Zend_Form_Element_Reset');
     if (in_array($element->getType(), $btn)) {
         //$t ='<button type="reset" class="btn"><i class="icon-refresh"></i> '.$element->getLabel().'</button>';
         $t = '<div class="span2">' . $element . '</div>';
     } else {
         $label = trim(preg_replace("/([A-Z])/", " \$1", "{$element->getLabel()}"), ' ');
         $variables = array('%%ERROR_CLASS%%' => $error, '%%ELEMENT_NAME%%' => $element->getName(), '%%ELEMENT_LABEL%%' => $label, '%%ELEMENT%%' => $element, '%%HELP_MESSAGE%%' => current($element->getMessages()));
         $t = str_replace(array_keys($variables), $variables, $this->_getTemplate($vertical));
     }
     return $t;
 }
开发者ID:hocondoimeo,项目名称:giasu-tam.com,代码行数:41,代码来源:RenderFormElement.php

示例6: addElement

 /**
  * Add element to stack
  *
  * @param  Zend_Form_Element $element
  * @return Zend_Form_DisplayGroup
  */
 public function addElement(Zend_Form_Element $element)
 {
     $this->_elements[$element->getName()] = $element;
     $this->_groupUpdated = true;
     // Display group will now handle display of element
     if (null !== ($form = $this->getForm())) {
         $form->removeFromIteration($element->getName());
     }
     return $this;
 }
开发者ID:Riges,项目名称:KawaiViewModel,代码行数:16,代码来源:DisplayGroup.php

示例7: testPassingConfigObjectToConstructorSetsObjectState

 public function testPassingConfigObjectToConstructorSetsObjectState()
 {
     $config = new Zend_Config($this->getOptions());
     $element = new Zend_Form_Element($config);
     $this->assertEquals('changed', $element->getName());
     $this->assertEquals('foo', $element->getValue());
     $this->assertEquals('bar', $element->getLabel());
     $this->assertEquals(50, $element->getOrder());
     $this->assertFalse($element->isRequired());
     $this->assertEquals('bar', $element->foo);
     $this->assertEquals('bat', $element->baz);
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:12,代码来源:ElementTest.php

示例8: decorateConfig

 public function decorateConfig($content, Zend_Form_Element $element, array $options)
 {
     $view = $this->getView();
     $value = $view->escape($element->getValue());
     return '<textarea name="' . $view->escape($element->getName()) . '"' . ' class="f-max-size" readonly="readonly"' . ' id="' . $view->escape($element->getId()) . '"' . ' rows="' . (substr_count($value, "\n") + 1) . '" cols="80" style="width: 100%;"' . '>' . $value . '</textarea>';
 }
开发者ID:EZ-NetTools,项目名称:ext-slave-dns-manager,代码行数:6,代码来源:View.php

示例9: _getDefaultElementDecorator

 /**
  * 
  * @param Zend_Form_Element $element
  * @return string[]
  */
 private function _getDefaultElementDecorator(Zend_Form_Element $element)
 {
     $decorator = array();
     if ($element instanceof Zend_Form_Element_Checkbox) {
         $decorator[] = array(array('Label-Open' => 'HtmlTag'), array('tag' => 'label', 'class' => 'checkbox', 'id' => $element->getId() . '-label', 'for' => $element->getName(), 'openOnly' => true));
         $decorator[] = 'ViewHelper';
         $decorator[] = array('CheckBoxLabel');
         $decorator[] = array(array('Label-Closing' => 'HtmlTag'), array('tag' => 'label', 'closeOnly' => true));
         $decorator[] = array('Errors', array('placement' => 'append'));
         $decorator[] = array('Description', array('tag' => 'span', 'class' => 'help-block'));
         $decorator[] = array(array('Inner-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-sm-10'));
         $decorator[] = array(array('Outer-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'));
         return $decorator;
     }
     if ($element instanceof Zend_Form_Element_Submit || $element instanceof Zend_Form_Element_Reset || $element instanceof Zend_Form_Element_Button) {
         $decorator[] = 'ViewHelper';
         return $decorator;
     }
     if ($element instanceof Zend_Form_Element_File) {
         $decorator[] = 'File';
         $decorator[] = 'Errors';
         $decorator[] = array('Description', array('tag' => 'span', 'class' => 'input-file', 'placement' => 'prepend'));
         $decorator[] = array(array('File-Wrapper' => 'HtmlTag'), array('tag' => 'span', 'class' => 'btn btn-default'));
     } else {
         $decorator[] = 'ViewHelper';
         $decorator[] = 'Errors';
         $decorator[] = array('Description', array('tag' => 'span', 'class' => 'help-block'));
     }
     if ($this->_type === self::TYPE_HORIZONTAL) {
         $decorator[] = array(array('Inner-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-sm-10'));
         $decorator[] = array('Label', array('class' => 'control-label col-sm-2'));
         $decorator[] = array(array('Outer-Wrapper' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'));
     } else {
         $decorator[] = 'Label';
         $decorator[] = array('HtmlTag', array('tag' => 'div', 'class' => 'form-group'));
     }
     return $decorator;
 }
开发者ID:cliftonscott,项目名称:zend-twitter-bootstrap,代码行数:43,代码来源:Form.php

示例10: renderLabel

 /**
  * Render element label
  *
  * @param  Zend_Form_Element $element
  * @param  Zend_View_Interface $view
  * @return string
  */
 public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = $element->getName();
         // Translate element name
         if (null !== ($translator = $element->getTranslator())) {
             $label = $translator->translate($label);
         }
     }
     if ($this->getEscape()) {
         $label = $view->escape($label);
     }
     return $this->getMarkupElementLabelStart() . $label . $this->getMarkupElementLabelEnd();
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:22,代码来源:FormErrors.php

示例11: getCompareName

 /**
  * Returns the name of the compared element.
  *
  * @return string
  */
 protected function getCompareName()
 {
     return $this->element->getName();
 }
开发者ID:matthimatiker,项目名称:molcomponents,代码行数:9,代码来源:ElementRelation.php

示例12: setElementDecorator

 /**
  * Static function that adds all the elements in 1 wrapping element instead of dt, dd structure
  *
  * @param $elm
  * @return void
  */
 public static function setElementDecorator(Zend_Form_Element $elm)
 {
     $elm->addPrefixPath('Glitch_Form_Decorator', 'Glitch/Form/Decorator/', 'decorator');
     $labelSettings = array();
     if ($elm->getDecorator('Label')) {
         $labelSettings = $elm->getDecorator('Label')->getOptions();
         unset($labelSettings['tag']);
         //Tag should never be needed when you call this method
     }
     $class = 'wrapper';
     if ($elm->getAttrib('wrapperClass')) {
         $class .= ' ' . $elm->getAttrib('wrapperClass');
         $elm->setAttrib('wrapperClass', null);
     }
     if ($elm instanceof Zend_Form_Element_Hidden) {
         $class .= ' hidden';
     }
     $elm->clearDecorators()->addDecorator('Label', $labelSettings)->addDecorator('ViewHelper')->addDecorator('Description', array('escape' => false))->addDecorator('Errors')->addDecorator('Wrapper', array('tag' => 'div', 'id' => $elm->getName() . '-wrapper', 'class' => $class));
     if ($elm instanceof Zend_Form_Element_Submit) {
         $elm->removeDecorator('Label');
     }
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:28,代码来源:Form.php

示例13: addCampo

 /**
  * Adiciona o elemento na lista para ser renderizado somente quando necessário
  *
  * @param Zend_Form_Element $oElemento
  * @throws Exception
  */
 public function addCampo(Zend_Form_Element $oElemento)
 {
     $sNome = $oElemento->getName();
     if (!isset(self::$aCampos[$sNome])) {
         self::$aCampos[$sNome] = $oElemento;
     } else {
         throw new Exception(self::$oTranslate->_(sprintf('O elemento "%s" já foi adicionado no formulário.', $sNome)));
     }
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:15,代码来源:Relatorio.php

示例14: addElement

 public function addElement(Zend_Form_Element $element)
 {
     $this->_elements[$element->getName()] = $element;
 }
开发者ID:crlang44,项目名称:frapi,代码行数:4,代码来源:Group.php

示例15: renderLabel

 /**
  * Render element label
  *
  * @param  Zend_Form_Element $element
  * @param  Zend_View_Interface $view
  * @return string
  */
 public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = $element->getName();
     }
     return $this->getMarkupElementLabelStart() . $view->escape($label) . $this->getMarkupElementLabelEnd();
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:15,代码来源:FormErrors.php


注:本文中的Zend_Form_Element::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。