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


PHP Zend_Form_Element_Select::setOptions方法代码示例

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


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

示例1: init

 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $userid = new Zend_Form_Element_Hidden('UserID');
     $userid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
     $username = new Zend_Form_Element_Text('Username');
     $username->setOptions(array('label' => 'Username', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $birthday = new Zend_Form_Element_Text('Birthday');
     $birthday->setOptions(array('label' => 'Birthday', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $role = new Zend_Form_Element_Select('Role');
     $role->setOptions(array('label' => 'User Type', 'MultiOptions' => array(3 => 'User', 2 => 'IT', 1 => 'Admin', 0 => 'SuperAdmin')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label'))));
     $fullname = new Zend_Form_Element_Text('FullName');
     $fullname->setOptions(array('label' => 'FullName'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $email = new Zend_Form_Element_Text('Email');
     $email->setOptions(array('label' => 'Email', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $group = new Zend_Form_Element_Text('Group');
     $group->setOptions(array('label' => 'Group'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $phone = new Zend_Form_Element_Text('Phone');
     $phone->setOptions(array('label' => 'Phone'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $address = new Zend_Form_Element_Textarea('Address');
     $address->setOptions(array('label' => 'Address', 'style' => "width: 200px; height: 150px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
     $this->setName('user-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $role, $fullname, $email, $birthday, $group, $phone, $address))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form'));
 }
开发者ID:laiello,项目名称:mock-project,代码行数:25,代码来源:User.php

示例2: init

 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $itemid = new Zend_Form_Element_Hidden('ItemID');
     $itemid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
     $maTS = new Zend_Form_Element_Text('MaTS');
     $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $tenTS = new Zend_Form_Element_Text('TenTS');
     $tenTS->setOptions(array('label' => 'Tên tài sản', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $descr = new Zend_Form_Element_Textarea('Description');
     $descr->setOptions(array('label' => 'Mô tả', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
     $type = new Zend_Form_Element_Select('Type');
     $type->setOptions(array('label' => 'Loại bảo mật', 'required' => TRUE, 'MultiOptions' => array(1 => 'Bảo mật thấp', 0 => 'Bảo mật cao')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label'))));
     $startDate = new Zend_Form_Element_Text('StartDate');
     $startDate->setOptions(array('label' => 'Bắt đầu SD', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $price = new Zend_Form_Element_Text('Price');
     $price->setOptions(array('label' => 'Giá', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $warrantyTime = new Zend_Form_Element_Text('WarrantyTime');
     $warrantyTime->setOptions(array('label' => 'Bảo hành', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $status = new Zend_Form_Element_Select('Status');
     $status->setOptions(array('label' => 'Tình trạng', 'required' => TRUE, 'MultiOptions' => array(0 => 'Có thể mượn', 1 => 'Đang cho mượn', 2 => 'Hỏng')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label'))));
     $place = new Zend_Form_Element_Textarea('Place');
     $place->setOptions(array('label' => 'Địa điểm hiện tại', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
     $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($itemid, $maTS, $tenTS, $descr, $type, $startDate, $price, $warrantyTime, $status, $place))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form'));
 }
开发者ID:laiello,项目名称:mock-project,代码行数:27,代码来源:Item.php

示例3: init

 public function init()
 {
     $this->setName('transfer_source');
     $this->setAttrib('class', 'form-inline');
     $host1 = new Zend_Form_Element_Text('host1');
     $host1->setAttrib('class', 'form-control')->setLabel('host1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Hostname');
     $edit = new Zend_Form_Element_Hidden('edit');
     //$edit->setLabel('Edition Mode');
     //$edit->clearDecorators();
     $host1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $user1 = new Zend_Form_Element_Text('user1');
     $user1->setLabel('user1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress');
     $user1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $password1 = new Zend_Form_Element_Text('password1');
     $password1->setLabel('pass1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $password1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3'))));
     $action = new Zend_Form_Element_Select('action');
     $action->setOptions(array('1' => 'source', '2' => 'target'));
     $action->setAttrib('class', 'form-control');
     $action->options = array('1' => 'source', '2' => 'target');
     $action->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-2'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit');
     $submit->setAttrib('class', 'btn btn-default');
     $submit->setAttrib('value', 'transfer_source');
     $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'colspan' => 2, 'align' => 'center')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $this->addElements(array($edit, $host1, $user1, $password1, $action, $submit));
     $this->setDecorators(array('FormElements', 'Form'));
 }
开发者ID:graniasty,项目名称:imap_zend,代码行数:29,代码来源:AddToTransfer_u.php

示例4: init

 public function init()
 {
     //        if (!$this->hasTranslator()) {
     //            $this->setTranslator(Zend_Registry::get('Zend_Translate'));
     //        }
     $requestid = new Zend_Form_Element_Hidden('RequestID');
     $requestid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden'))));
     $maTS = new Zend_Form_Element_Text('MaTS');
     $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     //
     //        $UserID = new Zend_Form_Element_Text('UserID');
     //        $UserID->setOptions(array(
     //                    'label' => 'UserID',
     //                    'required' => TRUE,
     //                    'filters' => array('StringTrim')
     //                ))
     //                ->setDecorators(array(
     //                    array('ViewHelper', array('helper' => 'formText')),
     //                    array('Label', array('class' => 'label'))
     //                ));
     $utype = new Zend_Form_Element_Select('Type');
     $utype->setOptions(array('label' => 'Loại yêu cầu', 'required' => TRUE, 'MultiOptions' => array(0 => 'Yêu cầu mượn TS', 1 => 'Yêu cầu nâng cấp')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label'))));
     $detail = new Zend_Form_Element_Textarea('Detail');
     $detail->setOptions(array('label' => 'Chi tiết yêu cầu', 'style' => "width: 200px; height: 100px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
     $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($requestid, $maTS, $utype, $detail))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form'));
 }
开发者ID:laiello,项目名称:mock-project,代码行数:26,代码来源:Request.php

示例5: elementSelect

 protected function elementSelect($title, $options, $conf = null)
 {
     $element = new Zend_Form_Element_Select($title);
     if (is_array($options)) {
         $element->setOptions($options);
     } else {
         $element->setLabel($options);
     }
     return $element;
 }
开发者ID:BGCX262,项目名称:zx-zf-hg-to-git,代码行数:10,代码来源:Form.php

示例6: init

 public function init()
 {
     $name = new Zend_Form_Element_Text('Name');
     $name->setOptions(array('label' => 'Name', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $email = new Zend_Form_Element_Text('Email');
     $email->setOptions(array('label' => 'Email', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $subject = new Zend_Form_Element_Select('Subject');
     $subject->setOptions(array('label' => 'Subject', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label'))));
     $content = new Zend_Form_Element_Textarea('Content');
     $content->setOptions(array('label' => 'Content', 'style' => "width: 300px; height: 200px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label'))));
     $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($name, $email, $subject, $content))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form'));
 }
开发者ID:laiello,项目名称:mock-project,代码行数:12,代码来源:Mail.php

示例7: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $uniqueGroupNameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'groups', 'field' => 'name'));
     $groupModel = new Group();
     $parentIdOptions = $groupModel->findPairs();
     $name = new Zend_Form_Element_Text('name');
     $name->setOptions(array('label' => 'Name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueGroupNameValidator)));
     $this->addElement($name);
     $parentId = new Zend_Form_Element_Select('parent_id');
     $parentId->setOptions(array('label' => 'Parent group', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $parentIdOptions));
     $this->addElement($parentId);
     $id = new Zend_Form_Element_Hidden('id');
     $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/'))));
     $this->addElement($id);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => 'Save user group', 'required' => true));
     $this->addElement($submit);
 }
开发者ID:omusico,项目名称:logica,代码行数:28,代码来源:GroupForm.php

示例8: init

 /**
  * Overrides init() in Zend_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $flagModel = new Flag();
     $flagIdOptions = $flagModel->findPairs();
     $name = new Zend_Form_Element_Text('name');
     $name->setOptions(array('label' => 'Name', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($name);
     $flagId = new Zend_Form_Element_Select('flag_id');
     $flagId->setOptions(array('label' => 'Flag', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $flagIdOptions));
     $this->addElement($flagId);
     $description = new Zend_Form_Element_Text('description');
     $description->setOptions(array('label' => 'Description', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($description);
     $id = new Zend_Form_Element_Hidden('id');
     $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/'))));
     $this->addElement($id);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => 'Save privilege', 'required' => TRUE));
     $this->addElement($submit);
 }
开发者ID:omusico,项目名称:logica,代码行数:30,代码来源:PrivilegeForm.php


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