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


PHP Zend_Form_Element::setLabel方法代码示例

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


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

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

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

示例3:

 /**
  * Creates the registration form and it's elements.
  * Also sets the validation techniques for the fields
  */
 function __construct()
 {
     parent::__construct();
     $this->setName('Registration');
     $this->setMethod('POST');
     $this->setAction('/user/register');
     $username = new Zend_Form_Element('username');
     $username->setLabel('Username');
     $username->setRequired(true);
     $username->addValidator('NotEmpty', true);
     $username->addValidator(new Zend_Validate_StringLength(6, 10), true);
     $username->addValidator('Alnum', true);
     $username->addValidator(new User_Models_Forms_Validators_IsUnique('username'));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password');
     $password->setRequired(true);
     $password->addValidator('NotEmpty', true);
     $password->addValidator(new Zend_Validate_StringLength(6, 10));
     $gender = new Zend_Form_Element_Select('gender');
     $gender->setLabel('Gender');
     $gender->setMultiOptions(array('Male' => 'Male', 'Female' => 'Female'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email');
     $email->setRequired(true);
     $email->addValidator('NotEmpty', true);
     $email->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $email->addValidator(new User_Models_Forms_Validators_IsUnique('email'));
     $paymentEmail = new Zend_Form_Element_Text('paymentEmail');
     $paymentEmail->setLabel('Payment Email');
     $paymentEmail->setRequired(true);
     $paymentEmail->addValidator('NotEmpty', true);
     $paymentEmail->addValidator(new User_Models_Forms_Validators_EmailAddress(), true);
     $paymentEmail->addValidator(new User_Models_Forms_Validators_IsUnique('paymentEmail'));
     $countries = new Zend_Form_Element_Select('country');
     $countries->setMultiOptions(self::getCountries());
     $countries->setLabel('Country');
     $countries->addValidator('NotEmpty');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Register');
     $this->addElements(array($username, $password, $gender, $email, $paymentEmail, $countries, $submit));
 }
开发者ID:kakarot1991,项目名称:paid-to-click-cms,代码行数:45,代码来源:Registration.php

示例4:

 function __construct()
 {
     parent::__construct();
     $this->setName('Registration');
     $this->setMethod('POST');
     $this->setAction('/user/login');
     $username = new Zend_Form_Element('username');
     $username->setLabel('Username');
     $username->setRequired(true);
     $username->addValidator('NotEmpty', true);
     $username->addValidator(new Zend_Validate_StringLength(6, 10));
     $username->addValidator('Alnum', true);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password');
     $password->setRequired(true);
     $password->addValidator('NotEmpty', true);
     $password->addValidator(new Zend_Validate_StringLength(6, 10));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Register');
     $this->addElements(array($username, $password, $submit));
 }
开发者ID:kakarot1991,项目名称:paid-to-click-cms,代码行数:21,代码来源:Login.php

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

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

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

示例8: setLabel

 public function setLabel($label)
 {
     $this->setAttrib('label', $label);
     return parent::setLabel($label);
 }
开发者ID:jager,项目名称:cms,代码行数:5,代码来源:Link.php

示例9: testRenderCanReplaceContent

 public function testRenderCanReplaceContent()
 {
     $callback = 'Zend_Form_Decorator_CallbackTest_TestCallback';
     $element = new Zend_Form_Element('foobar');
     $element->setLabel('Label Me');
     $this->decorator->setOptions(array('callback' => $callback, 'placement' => false))->setElement($element);
     $content = $this->decorator->render('foo bar');
     $this->assertNotContains('foo bar', $content, $content);
     $this->assertContains($element->getName(), $content);
     $this->assertContains($element->getLabel(), $content);
 }
开发者ID:omusico,项目名称:logica,代码行数:11,代码来源:CallbackTest.php

示例10: replaceElement

 /**
  *
  * @param Zend_Form_Element|string $element
  * @return Zend_Form_Element 
  */
 public function replaceElement($element)
 {
     $name = $element->getName();
     $previousElement = $this->getElement($name);
     if ($previousElement) {
         $label = $this->getElement($name)->getLabel();
         $element->setLabel($label);
     }
     $this->addElement($element);
     return $this;
 }
开发者ID:abdala,项目名称:la,代码行数:16,代码来源:Form.php


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