本文整理汇总了PHP中Zend_Form_Element_Hash::setTimeout方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Hash::setTimeout方法的具体用法?PHP Zend_Form_Element_Hash::setTimeout怎么用?PHP Zend_Form_Element_Hash::setTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Hash
的用法示例。
在下文中一共展示了Zend_Form_Element_Hash::setTimeout方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
/*
* Some people consider this to be "interface" stuff,
* to be done in the view. Personally, I think 'action' and 'method'
* can be done here, though the fact that we need the view object
* in order to ender the url for the action suggests that it, too, should
* be in the view. But 'name' and 'attribs' really are kind of view-ish.
*
* Still, I like the idea that the view-script is so simple, just render the form.
*
* @todo To be discussed.
*/
$this->setMethod('post')->setAction($this->getView()->url(array('module' => 'auth', 'controller' => 'login', 'action' => 'index')))->setAttrib('class', 'box')->setName('Login');
# Email
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator('EmailAddress');
# Password
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$hash = new Zend_Form_Element_Hash('csrf', array('salt' => 'unique'));
$hash->setTimeout(300)->addErrorMessage('Form timed out. Please reload the page & try again');
# Submit
$submit = new Zend_Form_Element_Submit('login');
# Create
$this->addElements(array($email, $password, $submit));
}
开发者ID:MarS2806,项目名称:Zend-Framework--Doctrine-ORM--PHPUnit--Ant--Jenkins-CI--TDD-,代码行数:27,代码来源:Login.php
示例2: init
/**
* (non-PHPdoc)
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
$txtTitle = $this->createElement('text', 'title')->setLabel('LBL_TITLE')->setRequired(TRUE)->addFilter('StripTags')->setAttrib('maxlength', 200);
$this->addElement($txtTitle);
$txtIntroContent = $this->createElement('textarea', 'introcontent')->setLabel('CONTENT_INTRO')->setRequired(true)->setAttrib('cols', 40)->setAttrib('rows', 5)->addValidator(new Zend_Validate_LessThan(1024));
$this->addElement($txtIntroContent);
$txtContent = $this->createElement('textarea', 'content')->setLabel('LBL_CONTENT')->setRequired(true)->setAttrib('cols', 40)->setAttrib('rows', 5)->addValidator(new Zend_Validate_LessThan(1024));
$this->addElement($txtContent);
$cbCategory = $this->createElement('select', 'category_id')->setLabel("LBL_CATEGORY")->setRequired(true);
$this->addElement($cbCategory);
$rbPublished = $this->createElement("radio", "published")->setLabel("LBL_PUBLISHED")->setValue(1)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbPublished);
$id = $this->createElement('hidden', 'id');
$id->setDecorators(array('ViewHelper'));
$this->addElement($id);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(300);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SUBMIT');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}
示例3: init
/**
* (non-PHPdoc)
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
$id = $this->createElement('hidden', 'id');
$id->setDecorators(array('ViewHelper'));
$this->addElement($id);
$name = $this->createElement('text', 'name')->setLabel('LBL_TITLE')->setRequired(TRUE)->setAttrib('size', 40);
$this->addElement($name);
/* @var $rbPublished Zend_Form_Element_Radio */
$rbPublished = $this->createElement("radio", "published")->setLabel("LBL_PUBLISHED")->setValue(1);
$rbPublished->addMultiOption(0, "LBL_NO");
$rbPublished->addMultiOption(1, "LBL_YES");
$this->addElement($rbPublished);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$btnSubmit = $this->createElement('submit', 'submit');
$btnSubmit->setLabel('LBL_SUBMIT');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setAttrib('class', 'btn btn-info');
$this->addElement($btnSubmit);
}
示例4: init
/**
* (non-PHPdoc)
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
$this->setMethod('post');
$id = $this->createElement('hidden', 'id')->setDecorators(array('ViewHelper'));
$this->addElement($id);
$txtTitle = $this->createElement('text', 'title')->setLabel('LBL_TITLE')->setRequired(TRUE)->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_Alpha(true))->setAttrib('maxlength', 200);
$this->addElement($txtTitle);
$txtDescription = $this->createElement('textarea', 'description')->setAttrib('cols', 40)->setAttrib('rows', 5)->setLabel('LBL_DESCRIPTION')->setRequired(FALSE)->addValidator(new Zend_Validate_LessThan(1024));
$this->addElement($txtDescription);
$image = $this->createElement('file', 'image')->setLabel('LBL_IMAGE')->setRequired(false)->addValidator('Count', false, 1)->addValidator('Size', false, 102400)->addValidator('Extension', false, 'jpg, jpeg, png, gif')->addValidator('NotExists', false, DIR_MOD_CONTACT_IMG_UPLOADS)->setDestination(DIR_MOD_CONTACT_IMG_UPLOADS);
$this->addElement($image);
$rbPublished = $this->createElement("radio", "published")->setLabel("LBL_PUBLISHED")->setValue(1)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbPublished);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SUBMIT');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}
示例5: init
/**
* (non-PHPdoc)
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
$id = $this->createElement('hidden', 'id');
$id->setDecorators(array('ViewHelper'));
$this->addElement($id);
$name = $this->createElement('text', 'name')->setLabel('LBL_TITLE')->setRequired(TRUE)->setAttrib('size', 40);
$this->addElement($name);
/* @var $rbPublished Zend_Form_Element_Radio */
$rbPublished = $this->createElement("radio", "published")->setLabel("LBL_PUBLISHED")->setValue(1);
$rbPublished->addMultiOption(0, "LBL_NO");
$rbPublished->addMultiOption(1, "LBL_YES");
$this->addElement($rbPublished);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SAVE');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}
示例6: init
/**
* (non-PHPdoc)
* @see Zend_Form::init()
*/
public function init()
{
#$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
$txtName = $this->createElement('text', 'name');
$txtName->setLabel('ACL_ROLE')->setRequired(TRUE)->setAttrib('size', '40')->addValidator(new Zend_Validate_NotEmpty());
$this->addElement($txtName);
$mdlRole = new Acl_Model_Role();
$roles = $mdlRole->getRoles();
$cbRole = $this->createElement("select", "parent_id");
$cbRole->setLabel("ACL_ROLE_PARENT")->setRequired(FALSE);
if ($roles->count() > 0) {
foreach ($roles as $role) {
$cbRole->addMultiOption($role->id, $role->name);
}
}
$this->addElement($cbRole);
$mdlSkin = new System_Model_Skin();
$skin = $mdlSkin->getSkinSelected();
$skinName = is_null($skin) ? 'default' : strtolower($skin->name);
$layouts = new Zend_Config_Xml(APPLICATION_PATH . '/layouts/scripts/' . $skinName . '/layouts.xml');
$layouts = $layouts->files->layout->toArray();
$cbDesktopLayout = $this->createElement("select", "desktop_layout");
$cbDesktopLayout->setLabel('LBL_DESKTOP_LAYOUT');
$cbDesktopLayout->setRequired(true);
$cbMobileLayout = $this->createElement("select", "mobile_layout");
$cbMobileLayout->setLabel('LBL_MOBILE_LAYOUT');
$cbMobileLayout->setRequired(true);
foreach ($layouts as $layout) {
$cbDesktopLayout->addMultiOption($layout, $layout);
$cbMobileLayout->addMultiOption($layout, $layout);
}
$this->addElement($cbDesktopLayout);
$this->addElement($cbMobileLayout);
$txtPriority = $this->createElement('text', 'priority');
$txtPriority->setLabel('ACL_PRIORITY')->setRequired(TRUE)->setAttrib('size', 10)->setAttrib('maxlength', 2)->addValidator(new Zend_Validate_NotEmpty());
$this->addElement($txtPriority);
$id = $this->createElement('hidden', 'id');
$id->setDecorators(array('ViewHelper'));
$this->addElement($id);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SAVE');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}
示例7: init
/**
* L'inizializzazione del form, dove vengono scritti i vari campi che lo comporranno.
*/
public function init()
{
$this->setName('form_login');
$this->setMethod(Zend_Form::METHOD_POST);
$this->addElement('text', 'email', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'Email Address:'));
$this->addElement('password', 'password', array('filters' => array('StringTrim'), 'required' => true, 'label' => 'Password:'));
$this->addElement('submit', 'login', array('label' => 'Login'));
$Token = new Zend_Form_Element_Hash('token');
$Token->setSalt(sha1(uniqid(mt_rand(), true)));
$Token->setTimeout(60);
$this->addElement($Token);
}
示例8: init
/**
* Init default fields for menu item form
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
$this->setMethod('post');
$id = $this->createElement('hidden', 'id')->setOrder(1)->setDecorators(array('ViewHelper'));
$this->addElement($id);
$menuId = $this->createElement('hidden', 'menu_id')->setOrder(2)->setRequired(TRUE)->setDecorators(array('ViewHelper'));
$this->addElement($menuId);
$txtTitle = $this->createElement('text', 'title')->setOrder(3)->setLabel('LBL_TITLE')->setRequired(TRUE)->addFilter('StripTags')->setAttrib('size', 40)->setAttrib('maxlength', 50);
$this->addElement($txtTitle);
$txtDescription = $this->createElement('text', 'description')->setOrder(4)->setLabel('LBL_DESCRIPTION')->setRequired(FALSE)->addFilter('StripTags')->setAttrib('size', 40)->setAttrib('maxlength', 150)->addValidator(new Zend_Validate_LessThan(150));
$this->addElement($txtDescription);
$txtAlias = $this->createElement('text', 'id_alias')->setOrder(5)->setLabel('MENU_ITEM_ID_ALIAS')->addFilter('StripTags')->setAttrib('size', 40)->addValidator(new Zend_Validate_LessThan(50));
#->addValidator( new Zend_Validate_Alnum() );
$this->addElement($txtAlias);
$cbParent = $this->createElement('select', 'parent_id')->setOrder(6)->setLabel("MENU_ITEM_PARENT")->setRequired(true);
$this->addElement($cbParent);
$cbWType = $this->createElement('select', 'wtype')->setOrder(7)->setLabel('MENU_ITEM_WINDOW_TYPE')->setRequired(true)->addMultiOption('_self', '_self')->addMultiOption('_parent', '_parent')->addMultiOption('_blank', '_blank');
$this->addElement($cbWType);
$rbPublished = $this->createElement("radio", "published")->setOrder(8)->setLabel("LBL_PUBLISHED")->setValue(1)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbPublished);
$rbVisible = $this->createElement("radio", "isvisible")->setOrder(9)->setLabel("LBL_VISIBLE")->setValue(1)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbVisible);
$txtCssClass = $this->createElement('text', 'css_class')->setOrder(10)->setLabel('LBL_CSS_CLASS')->setAttrib('maxlength', 50)->addValidator(new Zend_Validate_LessThan(50));
$this->addElement($txtCssClass);
$hExternal = $this->createElement("hidden", "external")->setValue(0)->setOrder(99995)->setDecorators(array('ViewHelper'));
$this->addElement($hExternal);
$mId = $this->createElement("hidden", "mid")->setOrder(99996)->setDecorators(array('ViewHelper'));
$this->addElement($mId);
$hResource = $this->createElement("hidden", "resource_id")->setOrder(99997)->setDecorators(array('ViewHelper'));
$this->addElement($hResource);
$hMod = $this->createElement("hidden", "mod")->setDecorators(array('ViewHelper'))->setOrder(99998);
$this->addElement($hMod);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(300);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SUBMIT');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setOrder(99999);
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}
示例9: init
/**
* (non-PHPdoc)
*
* @see Zend_Form::init()
*/
public function init()
{
$this->setTranslator();
// this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$txtFullname = $this->createElement('text', 'fullname')->setLabel("LBL_FULLNAME")->setRequired(true)->setAttrib('size', 40)->addFilters(array(new Zend_Filter_StringToLower(), new Zend_Filter_StringTrim(), new Zend_Filter_Alpha(true)))->addValidators(array(new Zend_Validate_Alpha(true), new Zend_Validate_StringLength(array('min' => 5, 'max' => 200))));
$this->addElement($txtFullname);
$txtEmail = $this->createElement('text', 'email')->setLabel("ACL_EMAIL")->setRequired(TRUE)->setAttrib('size', 40)->addFilters(array(new Zend_Filter_StringToLower(), new Zend_Filter_StringTrim()))->addValidator(new Zend_Validate_EmailAddress());
$txtEmail->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'os_acl_account', 'field' => 'email')));
$this->addElement($txtEmail);
$txtEmailAlternative = $this->createElement('text', 'email_alternative')->setLabel("ACL_EMAIL_ALTERNATIVE")->setRequired(TRUE)->setAttrib('size', 40)->addFilters(array(new Zend_Filter_StringToLower(), new Zend_Filter_StringTrim()))->addValidator(new Zend_Validate_EmailAddress());
$txtEmailAlternative->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'os_acl_account', 'field' => 'email_alternative')));
$this->addElement($txtEmailAlternative);
$txtPassword = $this->createElement('password', 'password')->setLabel('ACL_PASSWORD')->setRequired(TRUE)->setAttrib('size', 40)->addValidator(new Zend_Validate_StringLength(array('min' => '6')));
$this->addElement($txtPassword);
$txtPassword2 = $this->createElement('password', 'password2')->setLabel('ACL_REPEAT_PASSWORD')->setRequired(TRUE)->setAttrib('size', 40)->addValidator('Identical', false, array('password'))->addValidator(new Zend_Validate_StringLength(array('min' => '6')));
$this->addElement($txtPassword2);
$mdlRole = new Acl_Model_Role();
$roles = $mdlRole->getRoles();
$cbRole = $this->createElement("select", "role_id")->setLabel("ACL_ROLE")->setRequired(TRUE);
// >addMultiOption ( 0, "LABEL_SELECT_ROLE" );
if ($roles->count() > 0) {
foreach ($roles as $role) {
$cbRole->addMultiOption($role->id, $role->name);
}
}
$this->addElement($cbRole);
$id = $this->createElement('hidden', 'id');
$id->setDecorators(array('ViewHelper'));
$this->addElement($id);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SAVE');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}
示例10: init
/**
* Init default fields for widget form
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->translator = Zend_Registry::get('Zend_Translate');
$this->setTranslator();
$hId = $this->createElement("hidden", "id")->setOrder($this->order++);
$this->addElement($hId);
$wId = $this->createElement("hidden", "wid")->setOrder($this->order++);
$this->addElement($wId);
$txtTitle = $this->createElement("text", "title")->setOrder($this->order++)->setLabel("LBL_TITLE")->addFilter('StripTags')->addValidator(new Zend_Validate_LessThan(100))->setRequired(true);
$this->addElement($txtTitle);
$rbShowTitle = $this->createElement("radio", "showtitle");
$rbShowTitle->setRequired(TRUE)->setOrder($this->order++)->setLabel("LBL_SHOWTITLE")->setValue(0)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbShowTitle);
$cbPosition = $this->createElement("select", "position")->setOrder($this->order++)->setLabel("LBL_POSITION")->setRequired(true);
$this->addElement($cbPosition);
$rbPublished = $this->createElement("radio", "published")->setOrder($this->order++)->setLabel("LBL_PUBLISHED")->setValue(1)->setRequired(true)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbPublished);
$rbRenderFor = $this->createElement("radio", "renderfor")->setOrder($this->order++)->setLabel("MENU_RENDER_FOR")->setValue(0)->setRequired(true)->setMultiOptions(array($this->translator->translate("LBL_ALL"), $this->translator->translate("LBL_SELECTED_ONLY")));
$this->addElement($rbRenderFor);
$cbMenuItem = $this->createElement("multiselect", "menuitem")->setOrder($this->order++)->setLabel("MENU_ITEM");
$this->addElement($cbMenuItem);
$hMod = $this->createElement("hidden", "mod")->setOrder(99998);
$this->addElement($hMod);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SUBMIT');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setOrder(99999);
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}
示例11: init
/**
* (non-PHPdoc)
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
/*$mdlResource = new Acl_Model_Resource();
$resources = $mdlResource->getRegisteredList();
$cbResource = $this->createElement("multiselect", "resources_id");
$cbResource->setLabel("LABEL_RESOURCES")
->setRequired( FALSE );
if ( $resources->count() > 0 ) {
foreach ( $resources as $resource ) {
$lblResource = $resource->module.' > '.$resource->controller.' > '.$resource->actioncontroller;
$cbResource->addMultiOption( $resource->id, $lblResource );
}
}
$this->addElement( $cbResource );*/
$id = $this->createElement('hidden', 'id');
$id->setDecorators(array('ViewHelper'));
$this->addElement($id);
#$hRs = $this->createElement('hidden', 'hrs');
#$this->addElement($hRs);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SAVE');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
#$this->clearDecorators();
#$this->addDecorator('HtmlTag', array('tag'=>'ul'));
#$this->addDecorator('form');
}
示例12: init
/**
* Init default fields for widget form
* @see Zend_Form::init()
*/
public function init()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->translator = Zend_Registry::get('Zend_Translate');
$this->setTranslator();
$hId = $this->createElement("hidden", "id")->setOrder($this->order++);
$this->addElement($hId);
$wId = $this->createElement("hidden", "wid")->setOrder($this->order++);
$this->addElement($wId);
$txtTitle = $this->createElement("text", "title")->setOrder($this->order++)->setLabel("LBL_TITLE")->addFilter('StripTags')->addValidator(new Zend_Validate_LessThan(100))->setRequired(true);
$this->addElement($txtTitle);
$rbShowTitle = $this->createElement("radio", "showtitle");
$rbShowTitle->setRequired(TRUE)->setOrder($this->order++)->setLabel("LBL_SHOWTITLE")->setValue(0)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbShowTitle);
$cbPosition = $this->createElement("select", "position")->setOrder($this->order++)->setLabel("LBL_POSITION")->setRequired(true);
$this->addElement($cbPosition);
$rbPublished = $this->createElement("radio", "published")->setOrder($this->order++)->setLabel("LBL_PUBLISHED")->setValue(1)->setRequired(true)->setMultiOptions(array("LBL_NO", "LBL_YES"));
$this->addElement($rbPublished);
$rbRenderFor = $this->createElement("radio", "renderfor")->setOrder($this->order++)->setLabel("MENU_RENDER_FOR")->setValue(0)->setRequired(true)->setMultiOptions(array($this->translator->translate("LBL_ALL"), $this->translator->translate("LBL_SELECTED_ONLY")));
$this->addElement($rbRenderFor);
$cbMenuItem = $this->createElement("multiselect", "menuitem")->setOrder($this->order++)->setLabel("MENU_ITEM");
$this->addElement($cbMenuItem);
$hMod = $this->createElement("hidden", "mod")->setOrder(99998);
$this->addElement($hMod);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$btnSubmit = $this->createElement('submit', 'submit');
$btnSubmit->setLabel('LBL_SUBMIT');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setAttrib('class', 'btn btn-info');
$this->addElement($btnSubmit);
}
示例13: publicDisplay
/**
* Render a front-end contact form
*/
public function publicDisplay()
{
$this->_addClassNames('well');
$this->setMethod(Zend_Form::METHOD_POST);
$this->setTranslator();
$txtFullName = $this->createElement('text', 'fullname')->setLabel('LBL_FULLNAME')->setRequired(true)->addFilter(new Zend_Filter_Alpha(true))->addValidator(new Zend_Validate_Alpha(true))->addFilter(new Zend_Filter_StripTags())->setAttrib('maxlength', 255);
$this->addElement($txtFullName);
$txtTelephone = $this->createElement('text', 'telephone')->setLabel('LBL_TELEPHONE')->setRequired(true)->addFilter(new Zend_Filter_Digits())->addValidator(new Zend_Validate_Digits())->setAttrib('maxlength', 255);
$this->addElement($txtTelephone);
$txtEmail = $this->createElement('text', 'email')->setLabel('LBL_EMAIL')->setRequired(true)->addValidator(new Zend_Validate_EmailAddress())->setAttrib('maxlength', 200);
$this->addElement($txtEmail);
$txtWebpage = $this->createElement('text', 'webpage')->setLabel('LBL_WEBPAGE')->setRequired(FALSE)->addValidator(new OS_Application_Validators_Url())->setAttrib('maxlength', 200);
$this->addElement($txtWebpage);
$txtCountry = $this->createElement('text', 'country')->setLabel('LBL_COUNTRY')->setRequired(false)->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_Alpha(true))->addValidator(new Zend_Validate_Alpha(true))->setAttrib('maxlength', 100);
$this->addElement($txtCountry);
$txtCity = $this->createElement('text', 'city')->setLabel('LBL_CITY')->setRequired(false)->addFilter(new Zend_Filter_StripTags())->addFilter(new Zend_Filter_Alpha(true))->addValidator(new Zend_Validate_Alpha(true))->setAttrib('maxlength', 100);
$this->addElement($txtCity);
$txtMessage = $this->createElement('textarea', 'message')->setAttrib('cols', 40)->setAttrib('rows', 3)->setLabel('LBL_MESSAGE')->setRequired(TRUE)->addFilter(new Zend_Filter_Alnum(true))->addValidator(new Zend_Validate_Alnum(true))->addValidator(new Zend_Validate_LessThan(1024));
$this->addElement($txtMessage);
$token = new Zend_Form_Element_Hash('token');
$token->setSalt(md5(uniqid(rand(), TRUE)));
$token->setTimeout(60);
$token->setDecorators(array('ViewHelper'));
$this->addElement($token);
$submitOptions = array('buttonType' => Twitter_Bootstrap_Form_Element_Button::BUTTON_LINK, 'type' => 'submit', 'buttonType' => 'default');
$btnSubmit = new Twitter_Bootstrap_Form_Element_Button('submit', $submitOptions);
$btnSubmit->setLabel('LBL_SUBMIT');
$btnSubmit->removeDecorator('Label');
$btnSubmit->setDecorators(array(array('FieldSize'), array('ViewHelper'), array('Addon'), array('ElementErrors'), array('Description', array('tag' => 'p', 'class' => 'help-block')), array('HtmlTag', array('tag' => 'div', 'class' => 'controls')), array('Wrapper')));
$btnSubmit->removeDecorator('Label');
$this->addElement($btnSubmit);
}