本文整理汇总了PHP中Zend_Form::addElements方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::addElements方法的具体用法?PHP Zend_Form::addElements怎么用?PHP Zend_Form::addElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::addElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMailForm
public static function getMailForm($docid)
{
$form = new Zend_Form();
$form->setMethod('post')->setAttrib('onsubmit', 'return checkReply(this);')->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'zend_form')), 'Form'));
$form->addElements(array(array('select', 'to', array('label' => 'To', 'required' => true, 'multiOptions' => array_merge(array('' => ''), array_keys(self::getRecipients($docid))))), array('text', 'replyto', array('label' => 'Your e-mail address', 'validators' => array(array('EmailAddress')))), array('textarea', 'body', array('label' => 'Message body', 'required' => true, 'rows' => '7', 'cols' => '70', 'validators' => array(array('StringLength', true, array(0, 5000))), 'filters' => array('StringTrim')))));
$form->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$form->addElements(array(array('captcha', 'captcha', array('label' => 'Enter safety code', 'required' => true, 'ignore' => true, 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 5, 'timeout' => 600), 'decorators' => array('Captcha', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td'))))), array('submit', 'submit', array('label' => 'Send', 'decorators' => array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array(array('Label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))))));
return $form;
}
示例2: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$image_name = new Zend_Form_Element_Text('image_name');
$image_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên ảnh không được để trống'));
$image_link = new Zend_Form_Element_Textarea('image_link');
$image_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Hình ảnh không được để trống'));
$is_active = new Zend_Form_Element_Radio('is_active');
$is_active->setRequired(true)
->setLabel('is_active')
->setMultiOptions(array("1" => "Có","0" => "Không"));
$image_name->removeDecorator('HtmlTag')->removeDecorator('Label');
$image_link->removeDecorator('HtmlTag')->removeDecorator('Label');
$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($image_name,$image_link,$is_active));
return $form;
}
示例3: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$category_name = new Zend_Form_Element_Text('category_name');
$category_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên danh mục không được để trống'));
/*
$category_parent_id = new Zend_Form_Element_Select('category_parent_id');
$category_parent_id->addMultiOption('', '0');
foreach($this->mDanhmuc->getListDM() as $item)
{
$category_parent_id->addMultiOption($item['category_name'], $item['category_id']);
}
*/
$is_active = $form->createElement("select","is_active",array(
"label" => "Kích hoạt",
"multioptions"=> array(
"0" => "Chưa kích hoạt",
"1" => "Đã kích hoạt")));
$category_name->removeDecorator('HtmlTag')->removeDecorator('Label');
$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($category_name,$is_active));
return $form;
}
示例4: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$user_login = new Zend_Form_Element_Text('user_login');
$user_login->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên đăng nhập không được để trống'));
$user_pass = new Zend_Form_Element_Password('user_pass');
$user_pass->setAttrib('renderPassword', true);
$user_pass->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống'));
$user_fullname = new Zend_Form_Element_Text('user_fullname');
$user_fullname->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên người dùng không được để trống'));
$user_email = new Zend_Form_Element_Text('user_email');
$user_email->addValidator('EmailAddress',true,array('messages'=>'Địa chỉ email không hợp lệ'));
$user_email->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Email không được để trống'));
$user_address = new Zend_Form_Element_Text('user_address');
$user_address->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Địa chỉ không được để trống'));
$user_login->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_pass->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_fullname->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_email->removeDecorator('HtmlTag')->removeDecorator('Label');
$user_address->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($user_login,$user_pass,$user_fullname,$user_email,$user_address));
return $form;
}
示例5: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$youtube_username = new Zend_Form_Element_Text('youtube_username');
$youtube_username->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên tài khoản không được để trống'));
$password = new Zend_Form_Element_Text('password');
$password->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mật khẩu không được để trống'));
$youtube_gallery = new Zend_Form_Element_Text('youtube_gallery');
$youtube_gallery->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên album không được để trống'));
$is_selected = $form->createElement("select","is_selected",array(
"label" => "Kích hoạt",
"multioptions"=> array(
"0" => "Không",
"1" => "Có")));
$youtube_username->removeDecorator('HtmlTag')->removeDecorator('Label');
$password->removeDecorator('HtmlTag')->removeDecorator('Label');
$youtube_gallery->removeDecorator('HtmlTag')->removeDecorator('Label');
$is_selected->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($youtube_username,$password,$youtube_gallery,$is_selected));
return $form;
}
示例6: setForm
function setForm()
{
$form=new Zend_Form;
$form->setMethod('post')->setAction('');
$ads_banner = new Zend_Form_Element_Textarea('ads_banner');
$ads_banner->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Biểu ngữ không được để trống'));
$ads_position = new Zend_Form_Element_Text('ads_position');
$ads_position->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Vị trí không được để trống'));
$ads_name = new Zend_Form_Element_Text('ads_name');
$ads_name->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tên quảng cáo không được để trống'));
$ads_link = new Zend_Form_Element_Text('ads_link');
$ads_link->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Đường dẫn không được để trống'));
$ads_position = $form->createElement("select","ads_position",array(
"label" => "Vị trí",
"multioptions"=> array(
"1" => "Trên",
"2" => "Giữa",
"3" => "Trái",
"4" => "Phải",
"5" => "Nội dung")));
$ads_banner->removeDecorator('HtmlTag')->removeDecorator('Label');
$ads_position->removeDecorator('HtmlTag')->removeDecorator('Label');
$ads_name->removeDecorator('HtmlTag')->removeDecorator('Label');
$ads_link->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($ads_banner,$ads_position,$ads_name,$ads_link));
return $form;
}
示例7: removeAction
public function removeAction()
{
$form = new Zend_Form();
$form->setView(new Zend_View());
$form->setMethod('post');
$form->setAction('');
$form->setAttrib('class', 'devel');
$form->setAttrib('title', 'Remove wizard - ' . $this->getRequest()->getParam('name'));
$handleOptions = explode(',', $this->getRequest()->getParam('handles'));
$referenceOptions = explode(',', $this->getRequest()->getParam('references'));
$handleOptionsUsed = explode(',', $this->getRequest()->getParam('handles_used'));
$handleOptionsHidden = $form->createElement('hidden', 'handles', array('decorators' => array('ViewHelper')));
$referenceOptionsHidden = $form->createElement('hidden', 'references', array('decorators' => array('ViewHelper')));
$handleOptionsUsedHidden = $form->createElement('hidden', 'handles_used', array('decorators' => array('ViewHelper')));
$handle = $form->createElement('radio', 'handle', array('label' => 'Handle', 'required' => true, 'multiOptions' => array_combine($handleOptions, $handleOptions), 'description' => 'NOTE: This are the handles that this block appears in: ' . $this->getRequest()->getParam('handles_used')));
$reference = $form->createElement('radio', 'reference', array('label' => 'Reference', 'required' => true, 'multiOptions' => array_combine($referenceOptions, $referenceOptions)));
$name = $form->createElement('text', 'name', array('label' => 'Name', 'required' => true));
$submit = $form->createElement('submit', 'submit', array('label' => 'Submit'));
$form->addElements(array($handleOptionsHidden, $referenceOptionsHidden, $handleOptionsUsedHidden, $handle, $reference, $name, $submit));
if ($form->isValid($this->getRequest()->getParams())) {
$localXmlWriter = Mage::getModel('devel/writer_localxml');
$localXmlWriter->addRemove($form->handle->getValue(), $form->reference->getValue(), $form->name->getValue());
$localXmlWriter->save();
die('DONE. You need to reload to see changes!');
} else {
$this->loadLayout();
$this->getLayout()->getUpdate()->load('devel_layout_wizard');
$this->getLayout()->generateXml();
$this->loadLayout();
$this->getLayout()->getBlock('devel_wizard_form')->setForm($form);
$this->renderLayout();
}
}
示例8: nodeForm
/**
* Hook for node form - if type is Guestbook Node, add extra fields
*
* @param Zend_Form $form
* @param array $arguments
*/
public function nodeForm(Zend_Form &$form, &$arguments)
{
$item =& array_shift($arguments);
if ($item->type == "guestbook_entry") {
// Add guestbook fields
$name = new Zend_Form_Element_Text('guestbook_name', array('size' => 35));
$name->setLabel('Name');
$name->setRequired(true);
$email = new Zend_Form_Element_Text('guestbook_email', array('size' => 35));
$email->setLabel('Email');
$email->setRequired(true)->addValidator(new Zend_Validate_StringLength(6))->addValidator(new Zend_Validate_EmailAddress());
$url = new Zend_Form_Element_Text('guestbook_homepage', array('size' => 35));
$url->setLabel('Homepage');
$url->setRequired(false)->addValidator(new Zend_Validate_StringLength(4))->addValidator(new Zend_Validate_Hostname());
$form->addElements(array($name, $email, $url));
$options = array('legend' => Zoo::_("Guest information"));
$form->addDisplayGroup(array('guestbook_name', 'guestbook_email', 'guestbook_homepage'), 'guestbook_add', $options);
if ($item->id > 0) {
// Fetch guestbook object
$factory = new Guestbook_Node_Factory();
$guestbook = $factory->find($item->id)->current();
if (!$guestbook) {
$guestbook = $factory->createRow();
}
$values = $guestbook->toArray();
$populate = array();
foreach ($values as $key => $value) {
$populate['guestbook_' . $key] = $value;
}
$form->populate($populate);
}
}
}
示例9: setupDisplayGroups
public function setupDisplayGroups()
{
$this->testCanAddAndRetrieveMultipleElements();
$this->form->addElements(array('test1' => 'text', 'test2' => 'text', 'test3' => 'text', 'test4' => 'text'));
$this->form->addDisplayGroup(array('bar', 'bat'), 'barbat');
$this->form->addDisplayGroup(array('foo', 'baz'), 'foobaz');
}
示例10: setForm
function setForm()
{
$form = new Zend_Form;
$form->setMethod('post')->setAction('');
//$this->setAttrib('enctype','multipart/form-data');
$file = new Zend_Form_Element_File('video_file');
//$file->setAttrib('class','file');
$file->setLabel('video_file');
$file->setRequired(true);
$video_title = new Zend_Form_Element_Text('video_title');
$video_title ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Tiêu đề không được để trống'));
$video_thumbnail=new Zend_Form_Element_Textarea('video_thumbnail');
$video_thumbnail->removeDecorator('HtmlTag')->removeDecorator('Label');
$video_description = new Zend_Form_Element_Textarea('video_description');
$video_description->setAttrib('rows','7');
$video_description ->setRequired(true)->addValidator('NotEmpty',true,array('messages'=>'Mô tả không được để trống'));
$is_active = new Zend_Form_Element_Radio('is_active');
$is_active->setRequired(true)
->setLabel('is_active')
->setMultiOptions(array("1" => "Có","0" => "Không"));
$file->removeDecorator('HtmlTag')->removeDecorator('Label');
$video_title->removeDecorator('HtmlTag')->removeDecorator('Label');
$video_description->removeDecorator('HtmlTag')->removeDecorator('Label');
$is_active->removeDecorator('HtmlTag')->removeDecorator('Label');
$form->addElements(array($file,$video_title,$video_description,$is_active,$video_thumbnail));
return $form;
}
示例11: createCreateAgreementForm
/**
* Create create_agreement form.
*
* @param string $community_id
* @return Zend_Form
*/
public function createCreateAgreementForm($community_id)
{
$form = new Zend_Form();
$form->setAction($this->webroot . '/communityagreement/community/agreementtab?communityId=' . $community_id)->setMethod('post');
$agreement = new Zend_Form_Element_Textarea('agreement');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel($this->t('Save'));
$form->addElements(array($agreement, $submit));
return $form;
}
示例12: getForm
public function getForm()
{
$elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
$form = new Zend_Form();
$form->setAction("/teacher/dashboard/view-student/stid/{$this->_stid}/")->setMethod('post');
$mailSubject = new Zend_Form_Element_Text('subject', array('id' => 'mailsubj', 'label' => 'Subject'));
$mailBody = new Zend_Form_Element_Textarea('mailbody', array('id' => 'mailbody', 'label' => 'Message', 'cols' => 40, 'rows' => 5));
$mailSend = new Zend_Form_Element_Submit('mailsend', array('id' => 'mailsend', 'label' => 'send'));
$form->addElements(array($mailSubject, $mailBody, $mailSend));
return $form;
}
示例13: getForm
public function getForm()
{
$elementDecorators = array(array('Label'), array('ViewHelper'), array('Errors'));
$form = new Zend_Form();
$form->setAction('/student/profile/my-profile/')->setMethod('post');
$mailSubject = new Zend_Form_Element_Text('subject', array('id' => 'mailsubj', 'label' => 'Subject', 'maxLength' => '30'));
$mailBody = new Zend_Form_Element_Textarea('mailbody', array('id' => 'mailbody', 'label' => 'Message', 'cols' => 40, 'rows' => 5));
$mailSend = new Zend_Form_Element_Submit('mailsend', array('id' => 'mailsend', 'label' => 'send'));
$form->addElements(array($mailSubject, $mailBody, $mailSend));
return $form;
}
示例14: createKeyForm
/** create form */
public function createKeyForm()
{
$form = new Zend_Form();
$form->setAction($this->webroot . '/apikey/usertab')->setMethod('post');
$appplication_name = new Zend_Form_Element_Text('appplication_name');
$expiration = new Zend_Form_Element_Text('expiration');
$submit = new Zend_Form_Element_Submit('createAPIKey');
$submit->setLabel($this->t('Generate New API Key'));
$form->addElements(array($appplication_name, $expiration, $submit));
return $form;
}
示例15: createEditBitstreamForm
/** create edit bitstream form */
public function createEditBitstreamForm()
{
$form = new Zend_Form();
$form->setAction($this->webroot . '/item/editbitstream')->setMethod('post');
$name = new Zend_Form_Element_Text('name');
$name->setRequired(true)->addValidator('NotEmpty', true);
$mimetype = new Zend_Form_Element_Text('mimetype');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel($this->t('Save'));
$form->addElements(array($name, $mimetype, $submit));
return $form;
}