當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Form_Element_Hidden::setOptions方法代碼示例

本文整理匯總了PHP中Zend_Form_Element_Hidden::setOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Form_Element_Hidden::setOptions方法的具體用法?PHP Zend_Form_Element_Hidden::setOptions怎麽用?PHP Zend_Form_Element_Hidden::setOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Form_Element_Hidden的用法示例。


在下文中一共展示了Zend_Form_Element_Hidden::setOptions方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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');
     //source
     //alias 	aliasNotLogged 	viewIdentifier 	viewTitle 	params 	isStatic
     //metaKeywords 	metaDescription
     $id = new Zend_Form_Element_Hidden('urlAliasId');
     $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/'))));
     $this->addElement($id);
     $source = new Zend_Form_Element_Text('source');
     $source->setOptions(array('label' => 'Source', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($source);
     $alias = new Zend_Form_Element_Text('alias');
     $alias->setOptions(array('label' => 'Alias', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($alias);
     $params = new Zend_Form_Element_Text('params');
     $params->setOptions(array('value' => '{"module":"frontend","controller":"__","action":"__"}', 'label' => 'Params', 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($params);
     $isStatic = new Zend_Form_Element_Text('isStatic');
     $isStatic->setOptions(array('label' => 'isStatic', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($isStatic);
     $metaKeywords = new Zend_Form_Element_Text('metaKeywords');
     $metaKeywords->setOptions(array('label' => 'metaKeywords', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($metaKeywords);
     $metaDescription = new Zend_Form_Element_Text('metaDescription');
     $metaDescription->setOptions(array('label' => 'metaDescription', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($metaDescription);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => $this->t('Save'), 'required' => true));
     $this->addElement($submit);
 }
開發者ID:omusico,項目名稱:logica,代碼行數:40,代碼來源:UrlRewritingForm.php

示例2: init

 public function init()
 {
     // init the parent
     parent::init();
     // set the form's method
     $this->setMethod('post');
     $id = new Zend_Form_Element_Hidden('id');
     $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/'))));
     $this->addElement($id);
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($firstname);
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($lastname);
     $checkEmailNotJunk = new Zend_Validate_Callback(array($this, 'emailNotJetable'));
     $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email'));
     $email = new Zend_Form_Element_Text('email');
     $email->setOptions(array('label' => $this->t('Email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $checkEmailNotJunk, $uniqueEmailValidator)));
     $this->addElement($email);
     $raisonsocial = new Zend_Form_Element_Text('raison sociale');
     $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($raisonsocial);
     //        $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3)));
     //        $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".');
     $status = new Zend_Form_Element_Radio('status');
     $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté')));
     $this->addElement($status);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100));
     $this->addElement($submit);
 }
開發者ID:omusico,項目名稱:logica,代碼行數:32,代碼來源:UserProspectForm.php

示例3: init

 /**
  * Overrides init() in App_Form
  * 
  * @access public
  * @return void
  */
 public function init()
 {
     parent::init();
     $config = App_DI_Container::get('ConfigObject');
     // add an anti-CSRF token to all forms
     $csrfHash = new Zend_Form_Element_Hash('csrfhash');
     $csrfHash->setOptions(array('required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'salt' => $config->security->csrfsalt . get_class($this)));
     $this->addElement($csrfHash);
     $formName = new Zend_Form_Element_Hidden('formName');
     $formName->setOptions(array('filters' => array('StringTrim', 'StripTags'), 'value' => get_class($this)));
     $this->addElement($formName);
 }
開發者ID:nic162,項目名稱:Zend-Framework-Skeleton,代碼行數:18,代碼來源:Form.php

示例4: 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');
     $id = new Zend_Form_Element_Hidden('id');
     $id->setOptions(array('required' => true, 'validators' => array(new Zend_Validate_Regex('/^\\d*$/'))));
     $this->addElement($id);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setOptions(array('label' => 'Yes, delete it', 'required' => true));
     $this->addElement($submit);
 }
開發者ID:omusico,項目名稱:logica,代碼行數:19,代碼來源:DeleteForm.php

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

示例6: 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');
     $groupModel = new Group();
     $groupsOptions = $groupModel->findPairs();
     $uniqueUsernameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'username'));
     $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email'));
     $groupsInArrayValidator = new Zend_Validate_InArray(array_keys($groupsOptions));
     $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".');
     $username = new Zend_Form_Element_Text('username');
     $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueUsernameValidator)));
     $this->addElement($username);
     $email = new Zend_Form_Element_Text('email');
     $email->setOptions(array('label' => 'Email', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueEmailValidator)));
     $this->addElement($email);
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setOptions(array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($firstname);
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setOptions(array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($lastname);
     $phoneNumber = new Zend_Form_Element_Text('phone_number');
     $phoneNumber->setOptions(array('label' => 'Phone number', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty')));
     $this->addElement($phoneNumber);
     $groups = new Zend_Form_Element_MultiCheckbox('groups');
     $groups->setOptions(array('label' => 'Select the one or more user groups for this user', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $groupsInArrayValidator), 'multiOptions' => $groupsOptions));
     $this->addElement($groups);
     $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', 'required' => true, 'order' => 100));
     $this->addElement($submit);
     $this->addDisplayGroup(array('username', 'email', 'firstname', 'lastname', 'phone_number'), 'userdata')->getDisplayGroup('userdata')->setLegend('User details');
     $this->addDisplayGroup(array('groups'), 'usergroups')->getDisplayGroup('usergroups')->setLegend('Groups');
 }
開發者ID:nic162,項目名稱:Zend-Framework-Skeleton,代碼行數:45,代碼來源:UserForm.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');
     $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_Hidden::setOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。