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


PHP Zend_Form_Element类代码示例

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


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

示例1: _applyDecorators

 /**
  * Change the current decorators
  *
  * @param \Zend_Form_Element $element
  * @param array $decorators
  */
 private function _applyDecorators(\Zend_Form_Element $element, array $decorators)
 {
     $element->clearDecorators();
     foreach ($decorators as $decorator) {
         call_user_func_array(array($element, 'addDecorator'), $decorator);
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:13,代码来源:Table.php

示例2: addElement

 /**
  * Add element to stack
  *
  * @param  \Zend_Form_Element $element
  * @return \Zend_Form_DisplayGroup
  */
 public function addElement(\Zend_Form_Element $element)
 {
     $decorators = $element->getDecorators();
     $decorator = array_shift($decorators);
     $element->setDecorators(array($decorator, array('Description', array('class' => 'description')), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label'), array(array('labelCell' => 'HtmlTag'), array('tag' => 'td', 'class' => 'label')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $this->_alternate))));
     return parent::addElement($element);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:13,代码来源:TabGroup.php

示例3: init

 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setAttribs(array('class' => 'form-horizontal'));
     $decoratorField = new My_Decorator_FieldLogin();
     $elements = array();
     // Add email field
     $input = new Zend_Form_Element_Text('email', array('required' => true, 'label' => 'Email Address:', 'id' => 'email', 'placeholder' => 'Your email..', 'class' => 'form-control', 'type' => 'email'));
     $validator = new Zend_Validate_EmailAddress();
     $validator->setOptions(array('domain' => false));
     $input->addValidators(array($validator, new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add password field
     $input = new Zend_Form_Element_Password('password', array('required' => true, 'label' => 'Password:', 'id' => 'password', 'class' => 'form-control', 'placeholder' => 'Your password..'));
     $input->addValidators(array(new Zend_Validate_NotEmpty()));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     // Add checkbox field
     $input = new Zend_Form_Element_Checkbox('rememberMe', array('label' => 'Remember me', 'id' => 'rememberMe', 'class' => 'checkbox', 'type' => 'checkbox'));
     $decoratorCheckBox = new My_Decorator_CheckBox();
     $input->addDecorator($decoratorCheckBox);
     $elements[] = $input;
     $input = new Zend_Form_Element('resetpass', array('label' => 'Reset your password', 'id' => 'resetpass', 'class' => 'form-control', 'value' => 'resetpass'));
     $input->addDecorator(new My_Decorator_AnchoraForm());
     $elements[] = $input;
     //Add Submit button
     $input = new Zend_Form_Element_Submit('submit', array('Label' => '', 'class' => 'btn btn-default', 'value' => 'Login'));
     $input->addDecorator($decoratorField);
     $elements[] = $input;
     $this->addElements($elements);
     $this->addDisplayGroup(array('email', 'password', 'resetpass', 'rememberMe', 'submit'), 'displgrp', array('decorators' => array('FormElements', 'Fieldset')));
 }
开发者ID:cioionut,项目名称:products-webEcommerce,代码行数:34,代码来源:Login.php

示例4: addDefaultValidators

 private function addDefaultValidators(Zend_Form_Element $element, $meta)
 {
     if (!$meta['NULLABLE'] && $meta['PRIMARY'] != true) {
         $element->setRequired(true);
         $element->setAllowEmpty(false);
     }
 }
开发者ID:roed,项目名称:zend-mvc-extend,代码行数:7,代码来源:Abstract.php

示例5: buildForm

 public function buildForm()
 {
     $this->clearElements();
     $hourForm = new Zend_Form_SubForm();
     foreach ($this->data as $record) {
         $elm = new Zend_Form_Element((string) $record['id']);
         $elm->setValue($record);
         $hourForm->addElement($elm);
     }
     $this->addSubForm($hourForm, $this->key_existing);
     // add template element
     $newForm = new Zend_Form_SubForm();
     $elm = new Zend_Form_Element('__unique__');
     $newForm->addElement($elm);
     // add elements based on $_POST, (this is crap but will do for now)
     if (isset($_POST['hour_new'])) {
         foreach ($_POST['hour_new'] as $idx => $values) {
             if ($idx != '__unique__') {
                 $elm = new Zend_Form_Element($idx);
                 $elm->setValue($values);
                 $newForm->addElement($elm);
             }
         }
     }
     $this->addSubForm($newForm, $this->key_new);
 }
开发者ID:TBeijen,项目名称:Zend_Form_Dynamic,代码行数:26,代码来源:My_Form_Hours.php

示例6: 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

示例7: 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

示例8: setupElement

 public function setupElement()
 {
     $element = new Zend_Form_Element('foo');
     $element->addValidator('Alnum')->addValidator('Alpha')->setView($this->getView());
     $element->isValid('abc-123');
     $this->element = $element;
     $this->decorator->setElement($element);
 }
开发者ID:lortnus,项目名称:zf1,代码行数:8,代码来源:ErrorsTest.php

示例9: buildInput

 /**
  * Construit un champ de type input (générique) avec le helper de Zend correspondant a ce champ
  *
  * @brief	construit un champ générique
  * @author	francoisespinet
  * 	@param Zend_Form_Element $oElement
  */
 protected function buildInput(Zend_Form_Element $oElement, $bNoErreurs = false)
 {
     //ajout des erreurs si besoin
     if ($oElement->getAttrib(self::FORM_HAS_ERROR) && !$bNoErreurs) {
         return $this->formAddErreurChamp($oElement->renderViewHelper(), $oElement->hasErrors());
     } else {
         return $oElement->renderViewHelper();
     }
 }
开发者ID:netixx,项目名称:Stock,代码行数:16,代码来源:Abstract.php

示例10: isValid

 /**
  * Overrides isValid() from Zend_Validate_Interface
  *
  * @param string $value
  * @access public
  * @return bool
  */
 public function isValid($value)
 {
     if (NULL === $this->_element) {
         require_once 'Zend/Exception.php';
         throw new Zend_Exception('You must add a Zend_Form_Element to the SameAs validator prior to calling the isValid() method');
     }
     if ($value != $this->_element->getValue()) {
         $this->_error(self::NOT_THE_SAME);
         return FALSE;
     }
     return TRUE;
 }
开发者ID:omusico,项目名称:logica,代码行数:19,代码来源:SameAs.php

示例11: init

 public function init()
 {
     $this->setMethod('post');
     $cat = new Zend_Form_Element_Select('G_P_CAT');
     $cat->setLabel('Kategorie: ')->addValidator('alnum')->setRequired(true)->addMultiOptions(array('Adresse' => 'Adresse', 'Falle' => 'Falle', 'Brutstätte' => 'Brutstätte'));
     $name = new Zend_Form_Element_Text('G_P_NAME');
     $name->setLabel('Name: ')->addValidator('Alnum', true, array('allowWhiteSpace' => true))->setRequired(true);
     $lat = new Zend_Form_Element('G_P_LAT');
     $lat->setLabel('Lat: ')->setRequired(true)->addValidator('Between', true, array(0, 180));
     $lng = new Zend_Form_Element('G_P_LNG');
     $lng->setLabel('Lon: ')->setRequired(true)->addValidator('Between', true, array(0, 180));
     $submit = new Zend_Form_Element_Submit('senden');
     $this->addElements(array($name, $cat, $lat, $lng, $submit));
 }
开发者ID:ThalerR,项目名称:GEBL,代码行数:14,代码来源:Point.php

示例12: init

 public function init()
 {
     $this->setMethod('post');
     $typ = new Zend_Form_Element_Select('G_TYP');
     $typ->setLabel('Typ: ')->addValidator('alnum')->setRequired(true)->addMultiOptions(array(1 => 'Adresse', 2 => 'Falle', 3 => 'Brutstätte'));
     $name = new Zend_Form_Element_Text('G_NAME');
     $name->setLabel('Name: ')->addValidator('Alnum', true, array('allowWhiteSpace' => true))->setRequired(true);
     $lat = new Zend_Form_Element('G_LAT');
     $lat->setLabel('Lat: ')->setRequired(true)->addValidator('Between', true, array(0, 180));
     $lon = new Zend_Form_Element('G_LON');
     $lon->setLabel('Lon: ')->setRequired(true)->addValidator('Between', true, array(0, 180));
     $submit = new Zend_Form_Element_Submit('senden');
     $this->addElements(array($name, $typ, $lat, $lon, $submit));
 }
开发者ID:ThalerR,项目名称:GEBL,代码行数:14,代码来源:Geopoint.php

示例13: _getClassNames

 /**
  * Extract the class names from a Zend_Form_Element if given or from the
  * base form
  *
  * @param Zend_Form_Element $element
  * @return array
  */
 protected function _getClassNames(Zend_Form_Element $element = null)
 {
     if (null !== $element) {
         return explode(' ', $element->getAttrib('class'));
     }
     return explode(' ', $this->getAttrib('class'));
 }
开发者ID:rprosenc,项目名称:zend-form-decorators-bootstrap,代码行数:14,代码来源:Form.php

示例14: __construct

 public function __construct($spec = '', $options = '')
 {
     parent::__construct($spec, $options);
     //		$table = new AttributeDescriptor();
     //		$select = $table->select();
     //		$select->order(AttributeDescriptor::COL_NAME);
     //		$select->where(AttributeDescriptor::COL_SHOW_IN_LIST . "= ?", 1);
     //		if ($group != '') {
     //			$select->where(AttributeDescriptor::COL_GROUP . "= ?",$group);
     //		}
     //		$rowset = $table->fetchAll($select);
     //		$array = $rowset->toArray();
     //		$optArray = array(null=>'Please select');
     //
     //		foreach ($array as $value) {
     //			$optArray = $optArray + array($value[AttributeDescriptor::COL_ID]=>$value[AttributeDescriptor::COL_NAME]);
     //		}
     //		$this->setMultiOptions($optArray);
     $from = new Zend_Form_Element_Text($spec);
     $this->setIsArray(TRUE);
     $to = new Zend_Form_Element_Text($spec);
     $this->setIsArray(TRUE);
     $this->add($from);
     $this->add($to);
     //$this->
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:26,代码来源:PROTOBetween.php

示例15: setClassToAnElement

 /**
  * Set an error class into element HtmlTag decorator
  *
  * @param Zend_Form_Element $element Element to 'decorate' for the error.
  * @param string $styleClass CSS class name.
  *
  * @return void
  */
 protected function setClassToAnElement(Zend_Form_Element $element, $styleClass)
 {
     $htmlTagDecorator = $element->getDecorator('HtmlTag');
     if (!empty($htmlTagDecorator)) {
         $class = $htmlTagDecorator->getOption('class');
         $htmlTagDecorator->setOption('class', $class . ' ' . $styleClass);
     }
     $element->setAttrib('class', $element->getAttrib('class') . ' ' . $styleClass);
 }
开发者ID:dafik,项目名称:dfi,代码行数:17,代码来源:Form.php


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