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


PHP Zend_Form::removeDecorator方法代码示例

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


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

示例1: addSubForm

 public function addSubForm(Zend_Form $form, $name, $order = null)
 {
     $form->loadDefaultDecorators();
     $form->removeDecorator('Form');
     $form->addDecorator('Fieldset')->addDecorator('DtDdWrapper');
     $form->setElementsBelongTo($name);
     return parent::addSubForm($form, $name, $order);
 }
开发者ID:laiello,项目名称:wanderson,代码行数:8,代码来源:FormAbstract.php

示例2: indexAction

 function indexAction()
 {
     $this->setupCache('default');
     $this->level = 500;
     $this->requirePriviledges();
     $this->toTpl('theInclude', 'profile');
     $data = $this->_request->getParams();
     $this->toTpl('module_title', $this->t('Profile of') . " " . $data['profile']);
     //check if the user is trying to view his profile
     $edit = false;
     if ($data['profile'] == 'me' || !$data['profile'] || $data['profile'] == 'index') {
         $profile = $_SESSION['user']['username'];
         $edit = true;
     } else {
         $profile = $data['profile'];
         $edit = false;
     }
     //try to get the user...
     $user = $this->getUserByName($profile);
     //now we need to get the data for this user
     $user['data'] = $this->getUserData($user['id']);
     //now if the user is viewing his profile, we need to create a nice form in order for him to edit the data
     if ($edit) {
         //get the fields
         $fields = $this->getUserProfileFields();
         $form = new Zend_Form();
         $form->setView($this->tpl);
         $form->setAttrib('class', 'form');
         $form->removeDecorator('dl');
         $form->setAction($this->config->host->folder . '/profiles/update')->setMethod('post');
         foreach ($fields as $k => $v) {
             switch ($v['field_type']) {
                 case "selectbox":
                     $values = explode(",", $v['default_value']);
                     break;
                 default:
                     $values = $v['default_value'];
                     break;
             }
             $form->addElement($this->getFormElement(array('name' => $v['name'], 'value' => $v['field_type'], 'title' => $this->t(ucfirst($v['name'])), 'use_pool' => 'valuesAsKeys', 'pool_type' => $values, 'novalue' => true), $user['data'][$v['name']]));
         }
         $form->addElement($this->getFormElement(array('name' => 'uid', 'value' => 'hidden'), $user['id']));
         $submit = new Zend_Form_Element_Submit('save');
         $submit->setLabel($this->t("Update"));
         $submit->setAttrib('class', "btn btn-primary");
         $form->addElement($submit);
         $form = $this->doQoolHook('pre_assign_user_profile_form', $form);
         $this->toTpl('formTitle', $this->t("Update your profile"));
         $this->toTpl('theForm', $form);
         $user = $this->doQoolHook('pre_assign_profiles_own_user_data', $user);
     } else {
         $user = $this->doQoolHook('pre_assign_profiles_user_data', $user);
     }
     $this->doQoolHook('pre_load_profiles_tpl');
     $this->toTpl('user', $user);
 }
开发者ID:basdog22,项目名称:Qool,代码行数:56,代码来源:ProfilesController.php

示例3: testRemovingNamedDecoratorShouldWork

 /**
  * @group ZF-3069
  */
 public function testRemovingNamedDecoratorShouldWork()
 {
     $this->form->setDecorators(array('FormElements', array(array('div' => 'HtmlTag'), array('tag' => 'div')), array(array('fieldset' => 'HtmlTag'), array('tag' => 'fieldset'))));
     $decorators = $this->form->getDecorators();
     $this->assertTrue(array_key_exists('div', $decorators));
     $this->assertTrue(array_key_exists('fieldset', $decorators));
     $this->form->removeDecorator('div');
     $decorators = $this->form->getDecorators();
     $this->assertFalse(array_key_exists('div', $decorators));
     $this->assertTrue(array_key_exists('fieldset', $decorators));
 }
开发者ID:rafalwrzeszcz,项目名称:zf2,代码行数:14,代码来源:FormTest.php

示例4: build

 public static function build($formConfig)
 {
     $decorators = array();
     if ($formConfig->useInternalError) {
         $decorators[] = new Saf_Form_Zend_Helper_Error(array('class' => 'formErrors', 'id' => $newFormId . 'Errors', 'placement' => 'append', 'escape' => false));
     }
     $newForm = new Zend_Form();
     $newForm->setConfig($formConfig);
     $newForm->removeDecorator('HtmlTag');
     $newFormId = $newForm->getId();
     $formDecorator = $newForm->getDecorator('Form');
     $elementDecorator = $newForm->getDecorator('FormElements');
     $decorators[] = $elementDecorator;
     $decorators[] = $formDecorator;
     $newForm->setDecorators($decorators);
     foreach ($newForm->getElements() as $element) {
         self::fixElement($element);
     }
     return $newForm;
 }
开发者ID:jthurteau,项目名称:saf,代码行数:20,代码来源:Factory.php

示例5: buildLoginForm

 public function buildLoginForm($redirect = false)
 {
     try {
         $form = new Zend_Form();
         $form->setView($this->tpl);
         $form->setAttrib('class', 'form-inline');
         $form->removeDecorator('dl');
         $form->setAction($this->config->host->folder . '/dologin')->setMethod('post');
         if ($redirect) {
             $redir = new Zend_Form_Element_Hidden('redirect');
             $redir->setValue($redirect);
             $form->addElement($redir);
         }
         $username = new Zend_Form_Element_Text('username');
         $username->setDecorators(array("ViewHelper"));
         $username->setAttrib('class', 'input-medium');
         $username->setAttrib('placeholder', $this->t('Username'));
         $username->addValidator('regex', false, array('/^[a-z]/i'));
         $username->setLabel($this->t('Username'));
         $username->setRequired(true);
         $username->addFilter('StringtoLower');
         $password = $form->createElement('password', 'password');
         $password->setDecorators(array("ViewHelper"));
         $password->setAttrib('class', 'input-medium');
         $username->setLabel($this->t('Password'));
         $password->addValidator('StringLength', false, array(6))->setRequired(true);
         $submit = new Zend_Form_Element_Submit('login');
         $submit->setAttrib('class', 'btn');
         $submit->setDecorators(array("ViewHelper"));
         $submit->setLabel($this->t('Login'));
         $form->addElement($username)->addElement($password)->addElement($submit);
         $form = $this->doQoolHook('post_loginform_create', $form);
         $this->toTpl('loginForm', $form);
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:basdog22,项目名称:Qool,代码行数:37,代码来源:IndexController.php

示例6: getLoginForm

 function getLoginForm($redirect)
 {
     $form = new Zend_Form();
     $form->setView($this->tpl);
     $form->setAttrib('class', 'form-inline');
     $form->removeDecorator('dl');
     $form->setAction($this->config->host->folder . '/dologin')->setMethod('post');
     if ($redirect) {
         $redir = new Zend_Form_Element_Hidden('redirect');
         $redir->setValue($redirect);
         $redir->setLabel($this->t('This action requires you login'));
         $form->addElement($redir);
     }
     $username = new Zend_Form_Element_Text('username');
     $username->setDecorators(array("ViewHelper"));
     $username->setAttrib('class', 'input-medium');
     $username->setAttrib('placeholder', $this->language['Username']);
     $username->addValidator('regex', false, array('/^[a-z]/i'));
     $username->setLabel($this->language['Username']);
     $username->setRequired(true);
     $username->addFilter('StringtoLower');
     $password = $form->createElement('password', 'password');
     $password->setDecorators(array("ViewHelper"));
     $password->setAttrib('class', 'input-medium');
     $username->setLabel($this->language['Password']);
     $password->addValidator('StringLength', false, array(6))->setRequired(true);
     $submit = new Zend_Form_Element_Submit('login');
     $submit->setAttrib('class', 'btn');
     $submit->setDecorators(array("ViewHelper"));
     $submit->setLabel($this->t('Login'));
     $form->addElement($username)->addElement($password)->addElement($submit);
     return $form;
 }
开发者ID:basdog22,项目名称:Qool,代码行数:33,代码来源:Action.php

示例7: _getDeleteForm

 /**
  * Get the form used for confirming deletions.
  *
  * @see deleteConfirmAction()
  * @see deleteAction()
  * @return Zend_Form
  */
 protected function _getDeleteForm()
 {
     $form = new Zend_Form();
     $form->setElementDecorators(array('ViewHelper'));
     $form->removeDecorator('HtmlTag');
     $form->addElement('hash', 'confirm_delete_hash');
     $form->addElement('submit', 'Delete', array('class' => 'delete red button'));
     $form->setAction($this->view->url(array('action' => 'delete')));
     return $form;
 }
开发者ID:kyfr59,项目名称:cg35,代码行数:17,代码来源:AbstractActionController.php

示例8: mailtoAction

 /**
  * Creates a form for email sending and assigns it to the template or displays it
  *
  */
 public function mailtoAction()
 {
     $this->totpl('theInclude', 'general');
     Zend_Registry::set('module', 'Mailto User');
     $data = $this->_request->getParams();
     $form = new Zend_Form();
     $form->setView($this->tpl);
     $form->setAttrib('class', 'form');
     $form->removeDecorator('dl');
     $form->setAction($this->config->host->folder . '/admin/mailtouser')->setMethod('post');
     $addon = new Zend_Form_Element_Hidden('fid');
     $addon->setValue($data['id']);
     $form->addElement($addon);
     $form->addElement($this->getFormElement(array("name" => 'tomail', "value" => 'textinput', "title" => $this->t("To mail")), $data['mail']));
     $form->addElement($this->getFormElement(array("name" => 'cc', "value" => 'textinput', "title" => $this->t("MailCC"))));
     $form->addElement($this->getFormElement(array("name" => 'subject', "value" => 'textinput', "title" => $this->t("Subject"))));
     $form->addElement($this->getFormElement(array("name" => 'message', "value" => 'editor', "title" => $this->t("Message"), 'attributes' => array('class' => 'editor span5', 'rows' => 8))));
     $form->addElement('hidden', 'dummy', array('required' => false, 'ignore' => true, 'autoInsertNotEmptyValidator' => false, 'decorators' => array(array('HtmlTag', array('tag' => 'hr', 'id' => 'wmd-button-bar', 'class' => 'divider')))));
     $form->dummy->clearValidators();
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setDecorators(array("ViewHelper"));
     $submit->setLabel($this->t("Send"));
     $form->addElement($submit);
     if ($data['ajaxcalled']) {
         echo $form;
         die;
     }
     $this->totpl('html', $form);
 }
开发者ID:basdog22,项目名称:Qool,代码行数:34,代码来源:Action.php

示例9: testAddSubFormsPerConfig

 /**
  * @group ZF-5613
  */
 public function testAddSubFormsPerConfig()
 {
     // Create form
     $form = new Zend_Form(array('subForms' => array(array('form' => array('elements' => array('foo' => array('text', array('label' => 'Foo', 'decorators' => array('ViewHelper', 'Label')))), 'id' => 'subform1', 'decorators' => array('FormElements')), 'name' => 'subform1', 'order' => 2), array('form' => array('elements' => array('bar' => array('text', array('label' => 'Bar', 'decorators' => array('ViewHelper', 'Label')))), 'id' => 'subform2', 'decorators' => array('FormElements')), 'name' => 'subform2', 'order' => 1))));
     $form->removeDecorator('HtmlTag');
     // Tests
     $subForms = $form->getSubForms();
     $subForm1 = current($subForms);
     $subForm2 = next($subForms);
     $this->assertSame(array('subform1', 'subform2'), array($subForm1->getName(), $subForm2->getName()));
     $expected = '<form enctype="application/x-www-form-urlencoded" action="" method="post">' . PHP_EOL . PHP_EOL . '<label for="subform2-bar" class="optional">Bar</label>' . PHP_EOL . PHP_EOL . '<input type="text" name="subform2[bar]" id="subform2-bar" value="" />' . PHP_EOL . PHP_EOL . '<label for="subform1-foo" class="optional">Foo</label>' . PHP_EOL . PHP_EOL . '<input type="text" name="subform1[foo]" id="subform1-foo" value="" />' . '</form>';
     $this->assertSame($expected, $form->render($this->getView()));
 }
开发者ID:baofeng-beijing,项目名称:zf1.11.x,代码行数:16,代码来源:FormTest.php

示例10: getForms

 /**
  * Возвращает массив объектов Zend_Form мини-форм по типам 
  *
  * @return array
  */
 public function getForms()
 {
     $forms = array();
     foreach ($this->configs as $fieldtype => $template) {
         $form = new Zend_Form($template);
         $form->setElementsBelongTo('fields[]');
         $form->addDisplayGroup(array_keys($template['elements']), 'main', array('legend' => $template['label'], 'class' => 'ui-widget-content'));
         $form->removeDecorator('Form');
         $form->removeDecorator('DtDdWrapper');
         $form->setTranslator($this->translate);
         $forms[$fieldtype] = $form;
     }
     return $forms;
 }
开发者ID:ei-grad,项目名称:phorm,代码行数:19,代码来源:FormsElements.php


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