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


PHP Zend_Form_Element_Select::getName方法代码示例

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


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

示例1: simpleSelect

 /**
  * Helper function for generating simple select HTML fragments
  *
  * @param Zend_Form_Element_Select $element
  * @param string $cssEtc optional attribute string for <select> tag
  * @param string $wrapOptionHtml optional HTML that wraps each <option>, split by an asterisk
  *
  * @return string
  */
 public function simpleSelect($element, $cssEtc = '', $wrapOptionHtml = '')
 {
     $wrapOptionHtmlStart = $wrapOptionHtmlEnd = '';
     if (strpos($wrapOptionHtml, '*') !== false) {
         list($wrapOptionHtmlStart, $wrapOptionHtmlEnd) = explode('*', $wrapOptionHtml);
     }
     $output = sprintf("<select name=\"%s\" id=\"%s\"%s>\n", $element->getName(), $element->getId(), $cssEtc != '' ? " {$cssEtc}" : '');
     $options = $element->getMultiOptions();
     foreach ($options as $key => $val) {
         $output .= sprintf("  %s<option value=\"%s\"%s>%s</option>%s\n", $wrapOptionHtmlStart, $key, (string) $key == (string) $element->getValue() && $key !== '' ? ' selected="selected"' : '', $val, $wrapOptionHtmlEnd);
     }
     $output .= "</select>\n";
     return $output;
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:23,代码来源:SimpleSelect.php

示例2: init

 public function init()
 {
     $this->setName(strtolower(get_class()));
     $this->setMethod("post");
     $this->setAction("/admin/ask/chatsender");
     $oFormName = new Zend_Form_Element_Hidden("form_name");
     $oFormName->setValue(get_class());
     $oFormName->setIgnore(FALSE)->removeDecorator("Label");
     $this->addElement($oFormName);
     $oChatUserRecipientId = new Zend_Form_Element_Select("chat_user_recipient_id");
     $oChatUserRecipientId->setLabel("Wybierz konsultanta:")->setFilters($this->_aFilters);
     $oChatUserRecipientId->addValidator(new Zend_Validate_InArray(array_keys($this->_aChatUserRecipients)));
     $oChatUserRecipientId->addValidator(new AppCms2_Validate_IsOnline());
     $oChatUserRecipientId->addMultiOptions($this->_aChatUserRecipients);
     $oChatUserRecipientId->setRequired(TRUE);
     //$oChatUserRecipientId->setAttrib("class", "valid");
     $this->addElement($oChatUserRecipientId);
     $oFirstName = new Zend_Form_Element_Text("first_name");
     $oFirstName->setLabel("Imię i nazwisko:")->setFilters($this->_aFilters);
     $oFirstName->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true)));
     $oFirstName->setRequired(TRUE)->setValue(trim($this->_aUser["first_name"] . " " . $this->_aUser["last_name"]));
     //$oFirstName->setAttrib("class", "valid");
     $this->addElement($oFirstName);
     $oEmailAddress = new Zend_Form_Element_Text("email_address");
     $oEmailAddress->setLabel("Adres e-mail:")->setFilters($this->_aFilters);
     $oEmailAddress->addValidator(new Zend_Validate_EmailAddress());
     $oEmailAddress->setRequired(TRUE)->setValue($this->_aUser[$oEmailAddress->getName()]);
     //$oEmailAddress->setAttrib("class", "valid");
     $this->addElement($oEmailAddress);
     $oUserCategoryId = new Zend_Form_Element_Select("user_category_id");
     $oUserCategoryId->setLabel("Kategoria użytkownika:")->setFilters($this->_aFilters);
     $oUserCategoryId->addMultiOptions($this->_aCategory);
     $oUserCategoryId->setRequired(TRUE)->setValue($this->_aUser[$oUserCategoryId->getName()]);
     $oUserCategoryId->setAttrib("class", "valid");
     //$this->addElement($oUserCategoryId);
     $oPhone = new Zend_Form_Element_Text("phone");
     $oPhone->setLabel("Numer telefonu:")->setFilters($this->_aFilters);
     $oPhone->addValidator(new AppCms2_Validate_CellPhone());
     $oPhone->setRequired(FALSE)->setValue($this->_aUser["phone_number"]);
     $oPhone->setAttrib("class", "valid");
     //$this->addElement($oPhone);
     $oBBarcode = new Zend_Form_Element_Text("bbarcode_id");
     $oBBarcode->setLabel("Numer karty bibliotecznej:")->setFilters($this->_aFilters);
     $oBBarcode->addValidator(new AppCms2_Validate_BBarcode());
     $oBBarcode->addValidator(new Zend_Validate_Digits());
     $oBBarcode->setRequired(FALSE)->setValue($this->_aUser[$oBBarcode->getName()]);
     $oBBarcode->setAttrib("class", "valid");
     //$this->addElement($oBBarcode);
     //$this->addDisplayGroup(array($oPhone, $oBBarcode), "not_valid", array("legend" => "Wprowadzenie poniższych danych nie jest obowiązkowe, ale ułatwi udzielenie odpowiedzi lub skontaktowanie się z Państwem telefonicznie"));
     $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
     $this->getElement("csrf_token")->removeDecorator("Label");
     $oSubmit = $this->createElement("submit", "submit");
     $oSubmit->setLabel("Dalej");
     $this->addElement($oSubmit);
     $oViewScript = new Zend_Form_Decorator_ViewScript();
     $oViewScript->setViewModule("admin");
     $oViewScript->setViewScript("_forms/_defaultform.phtml");
     $this->clearDecorators();
     $this->setDecorators(array(array($oViewScript)));
     $oElements = $this->getElements();
     foreach ($oElements as $oElement) {
         $oElement->setFilters($this->_aFilters);
         $oElement->removeDecorator("Errors");
     }
 }
开发者ID:lstaszak,项目名称:zf_zk_aleph,代码行数:65,代码来源:ChatStart.php


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