• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Form_Element类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: prepareConfigElement

 /**
  * Remove cookie.jar if configs change and convert form password to password element
  * @param string $section
  * @param string $namespace
  * @param unknown_type $key
  * @param Zend_Form_Element $element
  * @param Zend_Form $form
  * @param Zend_Controller_Action $controller
  */
 public function prepareConfigElement($section, $namespace, $key, Zend_Form_Element $element, Zend_Form $form, Zend_Controller_Action $controller)
 {
     // nothing to do if this isn't the right section
     if ($namespace != $this->getId()) {
         return;
     }
     // remove cookie.jar if somethings has value
     if (!$form->isErrors() && !is_null($element->getValue())) {
         $this->clearLastCheck();
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:20,代码来源:UpdateNotifier.php


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


示例18: removeAllDecorators

 /**
  * Remove all decorators to the specified zend form element
  * @param \Zend_Form_Element $element the element to remove the decorators from
  */
 public function removeAllDecorators(\Zend_Form_Element $element)
 {
     $element->removeDecorator("Description");
     $element->removeDecorator("HtmlTag");
     $element->removeDecorator("Label");
     $element->removeDecorator("DtDdWrapper");
     $element->removeDecorator("Errors");
 }
开发者ID:berliozd,项目名称:cherbouquin,代码行数:12,代码来源:ZendForm.php


示例19: init

 public function init()
 {
     $this->setMethod('post');
     $g_name = new Zend_Form_Element_Text('G_NAME');
     $g_name->setLabel('Name des Punktes: ')->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));
     //->setAttrib('disabled', 'true');
     $lon = new Zend_Form_Element('G_LON');
     $lon->setLabel('Lon: ')->setRequired(true)->addValidator('Between', true, array(0, 180));
     //->setAttrib('disabled', 'true');
     $b_name = new Zend_Form_Element_Text('B_NAME');
     $b_name->setLabel('Name der Brutstaette: ')->addValidator('Alnum', true, array('allowWhiteSpace' => true))->setRequired(true);
     $groesse = new Zend_Form_Element('B_GROESSE');
     $groesse->setLabel('Größe: ')->setRequired(true)->addValidator('Int')->addValidator('Between', true, array(0, 100));
     $gewaesser_art = new Zend_Form_Element_Text('B_GEWAESSER_ART');
     $gewaesser_art->setLabel('Gewässer Art: ')->addValidator('Alnum', true, array('allowWhiteSpace' => true));
     $zugang = new Zend_Form_Element_Text('B_ZUGANG');
     $zugang->setLabel('Zugang: ')->addValidator('Alnum', true, array('allowWhiteSpace' => true));
     $bek_art = new Zend_Form_Element_Text('B_BEK_ART');
     $bek_art->setLabel('Bekämpfung Art: ')->addValidator('Alnum', true, array('allowWhiteSpace' => true));
     $text = new Zend_Form_Element_Textarea('B_TEXT');
     $text->setLabel('Text: ')->addValidator('Alnum', true, array('allowWhiteSpace' => true))->setAttrib('rows', '5')->setAttrib('cols', '50');
     $submit = new Zend_Form_Element_Submit('senden');
     $this->addElements(array($g_name, $lat, $lon, $b_name, $groesse, $gewaesser_art, $zugang, $bek_art, $text, $submit));
     //Layout
     $this->addDisplayGroup(array('G_NAME', 'G_LAT', 'G_LON'), 'geopoint', array('legend' => 'Koordinaten des Punktes'));
     $contact = $this->getDisplayGroup('geopoint');
     $contact->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'style' => 'float:left;'))));
     $this->addDisplayGroup(array('B_NAME', 'B_GROESSE', 'B_GEWAESSER_ART', 'B_ZUGANG', 'B_BEK_ART', 'B_TEXT'), 'brutstaette', array('legend' => 'Daten zur Brutstaette'));
     $pass = $this->getDisplayGroup('brutstaette');
     $pass->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('style' => 'float:right'))));
     $this->addDisplayGroup(array('senden'), 'submitbutton', array('legend' => 'Daten Abschicken'));
     $pass = $this->getDisplayGroup('submitbutton');
     $pass->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true, 'style' => 'float:left'))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'style' => 'width:98%')), 'Form'));
 }
开发者ID:ThalerR,项目名称:GEBL,代码行数:37,代码来源:Brutstaette.php


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Form_Element_Button类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Form_DisplayGroup类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap