本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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');
}
示例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);
}