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


PHP Zend_Form_Element_Checkbox::getName方法代码示例

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


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

示例1: simpleCheckbox

 /**
  * Helper function for generating simple checkbox HTML fragments
  *
  * @param Zend_Form_Element_Checkbox $element
  * @param string $cssEtc optional attribute string for <input> tags
  * @param string $wrapInputHtml optional HTML that wraps each <input>, split by an asterisk
  * @param string $wrapLabelHtml optional HTML that wraps each <label>, split by an asterisk
  *
  * @return string
  */
 public function simpleCheckbox($element, $cssEtc = '', $wrapInputHtml = '', $wrapLabelHtml = '')
 {
     $wrapInputHtmlStart = $wrapInputHtmlEnd = $wrapLabelHtmlStart = $wrapLabelHtmlEnd = '';
     if (strpos($wrapInputHtml, '*') !== false) {
         list($wrapInputHtmlStart, $wrapInputHtmlEnd) = explode('*', $wrapInputHtml);
     }
     if (strpos($wrapLabelHtml, '*') !== false) {
         list($wrapLabelHtmlStart, $wrapLabelHtmlEnd) = explode('*', $wrapLabelHtml);
     }
     $output = '';
     $checkedValue = $element->options['checkedValue'];
     $output .= sprintf("%s<input type=\"checkbox\" name=\"%s\" id=\"%s\" value=\"%s\"%s%s />%s<label for=\"%s\">%s</label>%s%s\n", $wrapInputHtmlStart, $element->getName(), $element->getId(), $checkedValue, (string) $checkedValue == (string) $element->getValue() ? ' checked="checked"' : '', $cssEtc != '' ? " {$cssEtc}" : '', $wrapLabelHtmlStart, $element->getId(), $element->getLabel(), $wrapLabelHtmlEnd, $wrapInputHtmlEnd);
     return $output;
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:24,代码来源:SimpleCheckbox.php

示例2: __construct

 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setName('class');
     $this->setIsArray(true);
     $classname = new Zend_Form_Element_Text(Model_ClassGenerator_FormToClass::$nameKey);
     $classname->setLabel('Class name')->setRequired(true)->addValidator('NotEmpty', true);
     $classComment = new Zend_Form_Element_Textarea(Model_ClassGenerator_FormToClass::$commentKey);
     $classComment->setLabel('Class comment/description');
     $classComment->setAttrib('cols', '50')->setAttrib('rows', '4');
     $persistenceOn = new Zend_Form_Element_Checkbox(Model_ClassGenerator_FormToClass::$withPersistenceKey);
     $persistenceOn->setLabel('Persistence ON');
     $table = new Zend_Form_Element_Text(Model_ClassGenerator_FormToClass::$tableKey);
     $table->setLabel('Database Table');
     $addFieldDynId = new Zend_Form_Element_Hidden('addFieldDynId');
     $addFieldDynId->setAttrib('id', 'addFieldDynId');
     $addFieldDynId->setValue(1);
     $attributesSf = self::getAttributeSubform();
     $this->addSubForm($attributesSf, 'attributes', 1);
     /*Use table decorator!
             require_once('../application/forms/Decorators/Table.php');
             $this->setDecorators(array(
     			'FormElements',
     			array('Table', array('doNotSetDecorators' => false)),
     			'Form'
     		));
             */
     $add = new Zend_Form_Element_Button('addAttribute');
     $add->setAttrib('id', 'addAttribute');
     $add->setLabel('Add Attribute');
     $remove = new Zend_Form_Element_Button('removeAttribute');
     $remove->setAttrib('id', 'removeAttribute');
     $remove->setLabel('Remove Attribute');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Play!')->setOrder(5);
     $this->addElements(array($classname, $classComment, $persistenceOn, $table));
     $this->addDisplayGroup(array($classname->getName(), $classComment->getName(), $persistenceOn->getName(), $table->getName()), 'Class properties')->setOrder(0);
     $this->addElements(array($add, $remove, $submit, $addFieldDynId));
     $this->addElement('hash', 'no_csrf_foo', array('salt' => 'unique'));
 }
开发者ID:JPustkuchen,项目名称:phppcg,代码行数:40,代码来源:Class.php


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