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


PHP Zend_Form_SubForm::addElement方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     $this->setAttrib('enctype', 'multipart/form-data');
     $element = new Zend_Form_Element_File('filename');
     $element->setLabel('Foto')->setDescription('Maximale grootte van de foto is 1mb')->setRequired(true)->setValidators(array(array('Count', false, 1), array('Size', false, 1024000), array('Extension', false, 'jpg,png,gif')))->setDestination(APPLICATION_PATH . '/../public/images/uploads/holidayhome/photos');
     $this->addElement($element);
     $this->addDisplayGroup(array('filename'), 'photogroup', array('legend' => 'Foto', 'class' => 'file'));
     $subForm = new Zend_Form_SubForm('Translation');
     foreach (Model_Hm_Lang::listAll() as $lang) {
         $subSubForm = new Zend_Form_SubForm($lang->code);
         $element = new Zend_Form_Element_Text('title');
         $element->setLabel('Titel')->setRequired(true)->setValidators(array(array('stringLength', null, array('min' => 4, 'max' => 64))));
         $subSubForm->addElement($element);
         $element = new Zend_Form_Element_Textarea('description');
         $element->setLabel('Omschrijving')->setAttrib('rows', 2)->setAttrib('class', 'autoexpand')->setRequired(true)->setValidators(array(array('stringLength', null, array('min' => 40))));
         $subSubForm->addElement($element);
         $subSubForm->addDisplayGroup(array('title', 'description'), $lang->code, array('class' => 'textarea', 'legend' => $lang->name));
         $this->bhvkSubDecorators($subSubForm);
         $subForm->addSubForm($subSubForm, $lang->code);
     }
     $this->bhvkSubDecorators($subForm);
     $this->addSubForm($subForm, 'Translation');
     $element = new Zend_Form_Element_Submit('photo_submit');
     $element->setLabel('Verwerken')->setAttrib('class', 'submit');
     $this->addElement($element);
     $this->addDisplayGroup(array('photo_submit'), 'submit', array('class' => 'submit'));
     $this->bhvkDecorators();
     $this->bhvkDecorateSubmit('photo_submit');
     $this->bhvkDecorateFile($this->getElement('filename'));
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:31,代码来源:Photo.php

示例2: buildForm

 public function buildForm()
 {
     $this->clearElements();
     $hourForm = new Zend_Form_SubForm();
     foreach ($this->data as $record) {
         $elm = new Zend_Form_Element((string) $record['id']);
         $elm->setValue($record);
         $hourForm->addElement($elm);
     }
     $this->addSubForm($hourForm, $this->key_existing);
     // add template element
     $newForm = new Zend_Form_SubForm();
     $elm = new Zend_Form_Element('__unique__');
     $newForm->addElement($elm);
     // add elements based on $_POST, (this is crap but will do for now)
     if (isset($_POST['hour_new'])) {
         foreach ($_POST['hour_new'] as $idx => $values) {
             if ($idx != '__unique__') {
                 $elm = new Zend_Form_Element($idx);
                 $elm->setValue($values);
                 $newForm->addElement($elm);
             }
         }
     }
     $this->addSubForm($newForm, $this->key_new);
 }
开发者ID:TBeijen,项目名称:Zend_Form_Dynamic,代码行数:26,代码来源:My_Form_Hours.php

示例3: addRows

 /**
  * Adds extra rows to the form
  *
  * @access public
  * @param mixed $data. (default: null)
  * @return void
  */
 public function addRows($start, $end)
 {
     for ($i = $start; $i < $end; $i++) {
         $rows = new Zend_Form_SubForm();
         $rows->setIsArray(true);
         $rows->setOrder($i);
         foreach ($this->_childlist as $col => $name) {
             switch ($col) {
                 case "item_pack_size_id":
                     $rows->addElement("select", $col, array("attribs" => array("class" => "form-control products"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_childlist[$col], "validators" => array(), "belongsTo" => "rows{$i}"));
                     break;
                 case "number":
                     $rows->addElement("select", $col, array("attribs" => array("class" => "form-control manufaturers"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_childlist[$col], "validators" => array(), "belongsTo" => "rows{$i}"));
                     break;
                 default:
                     $rows->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_childlist[$col], "validators" => array(), "belongsTo" => "rows{$i}"));
                     break;
             }
         }
         $rows->addElement("text", "expiry_date", array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "belongsTo" => "rows{$i}"));
         $rows->addElement("hidden", "hdn_vvm_stage", array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "belongsTo" => "rows{$i}"));
         $rows->addElement("hidden", "hdn_available_quantity", array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "belongsTo" => "rows{$i}"));
         $rows->addElement("text", "quantity", array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "belongsTo" => "rows{$i}"));
         foreach ($rows->getElements() as $element) {
             $element->removeDecorator("Label");
             $element->removeDecorator("HtmlTag");
         }
         $this->addSubForm($rows, "rows{$i}");
     }
 }
开发者ID:uppaljs,项目名称:pakistan-vlmis-v2,代码行数:37,代码来源:AddStockIssue.php

示例4: buildFromArray

 public function buildFromArray(array $array)
 {
     $translator = $this->getTranslator();
     if (isset($array[$this->getName()])) {
         $array = $array[$this->getName()];
     }
     foreach ($array as $translationUnit => $variants) {
         $subForm = new Zend_Form_SubForm();
         $this->addSubForm($subForm, $translationUnit);
         foreach ($variants as $language => $text) {
             if (is_array($text)) {
                 if (!isset($text['filename']) || !isset($text['contents'])) {
                     throw new Exception('Invalid data structure for HelpPage Form');
                 }
                 $langSubForm = new Zend_Form_SubForm();
                 $langSubForm->addElement('hidden', 'filename');
                 $langSubForm->addElement('textarea', 'contents', array('label' => $translator->translate("setup_language_{$language}")));
                 $subForm->addSubForm($langSubForm, $language);
             } else {
                 $subForm->addElement('text', $language, array('label' => $translator->translate("setup_language_{$language}"), 'attribs' => array('size' => 90)));
             }
         }
         $subForm->setLegend($translationUnit);
     }
     return $this;
 }
开发者ID:alexukua,项目名称:opus4,代码行数:26,代码来源:HelpPage.php

示例5: init

 public function init()
 {
     parent::init();
     /*
      * Translations
      */
     $subForm = new Zend_Form_SubForm('Translation');
     $langs = Model_Hm_Lang::listAll();
     foreach ($langs as $lang) {
         $subSubForm = new Zend_Form_SubForm($lang->code);
         $element = new Zend_Form_Element_Text('title');
         $element->setLabel('Titel (eigen)')->setDescription('Deze titel is voor gebruik in eigen administratie.')->setRequired(true);
         $subSubForm->addElement($element);
         $element = new Zend_Form_Element_Text('display_title');
         $element->setLabel('Titel (gebruiker)')->setDescription('Deze titel krijgen de gebruikesr van het systeem te zien.')->setRequired(true);
         $subSubForm->addElement($element);
         $element = new Zend_Form_Element_Textarea('description');
         $element->setLabel('Omschrijving')->setRequired(true)->setValidators(array(array('stringLength', false, array('min' => 40))))->setAttrib('class', 'autoexpand')->setAttrib('rows', 2);
         $subSubForm->addElement($element);
         $subSubForm->addDisplayGroup(array('title', 'display_title', 'description'), $lang->code, array('legend' => $lang->name, 'class' => 'textarea'));
         $subForm->addSubForm($subSubForm, $lang->code);
         $this->bhvkSubDecorators($subSubForm);
     }
     $this->addSubForm($subForm, 'Translation');
     $this->bhvkSubDecorators($subForm);
     /*
      * Submit
      */
     $element = new Zend_Form_Element_Submit('submit_chargeoptional');
     $element->setLabel('Verwerken')->setAttrib('class', 'submit');
     $this->addElement($element);
     $this->addDisplayGroup(array('submit_chargeoptional'), 'submit', array('class' => 'submit'));
     $this->bhvkDecorators();
     $this->bhvkDecorateSubmitElement($this->getElement('submit_chargeoptional'));
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:35,代码来源:Chargeoptional.php

示例6: init

 public function init()
 {
     parent::init();
     $subForm = new Zend_Form_SubForm('Translation');
     $langs = Model_Hm_Lang::listAll();
     foreach ($langs as $lang) {
         $subSubForm = new Zend_Form_SubForm($lang->code);
         $element = new Zend_Form_Element_Text('name');
         $element->setLabel('Naam')->setAttrib('maxlength', 64)->setValidators(array(array('stringLength', false, array('min' => 4, 'max' => 64))))->setRequired(true);
         $subSubForm->addElement($element);
         $element = new Zend_Form_Element_Textarea('description');
         $element->setLabel('Omschrijving')->setRequired(true)->setValidators(array(array('stringLength', false, array('min' => 40))))->setAttrib('class', 'autoexpand')->setAttrib('rows', 2);
         $subSubForm->addElement($element);
         $subSubForm->addDisplayGroup(array('name', 'description'), $lang->code, array('legend' => $lang->name, 'class' => 'textarea'));
         $subForm->addSubForm($subSubForm, $lang->code);
         $this->bhvkSubDecorators($subSubForm);
     }
     $this->addSubForm($subForm, 'Translation');
     $this->bhvkSubDecorators($subForm);
     $element = new Zend_Form_Element_Submit('submit_category');
     $element->setLabel('Verwerken')->setAttrib('class', 'submit');
     $this->addElement($element)->addDisplayGroup(array('submit_category'), 'submit', array('class' => 'submit'));
     $this->bhvkDecorators();
     $this->bhvkDecorateSubmit('submit_category');
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:25,代码来源:Category.php

示例7: addCustomVariable

 protected function addCustomVariable($varname)
 {
     $a = new \Zend_Form_SubForm();
     $a->addElement('note', 'title', array('label' => sprintf($this->translate('Custom Variable "%s"'), $varname)));
     $a->addElement('text', 'description', array('label' => $this->translate('Description'), 'required' => true));
     $a->addElement('text', 'default_value', array('label' => $this->translate('Default value')));
     $this->addSubForm($a, 'cv_' . $varname);
 }
开发者ID:dgoeger,项目名称:icingadirector,代码行数:8,代码来源:IcingaCommandArgumentForm.php

示例8: init

 /**
  */
 public function init()
 {
     $this->addElement('hash', 'csrf');
     $this->addElement('select', 'type', array('label' => getGS('Type'), 'required' => true, 'multioptions' => array('reuters' => 'Thomson Reuters')));
     $config = new Zend_Form_SubForm();
     $config->addElement('text', 'username', array('label' => getGS('Username'), 'required' => true, 'filters' => array('stringTrim')));
     $config->addElement('text', 'password', array('label' => getGS('Password'), 'required' => true, 'filters' => array('stringTrim')));
     $this->addSubForm($config, 'config');
     $this->addElement('submit', 'submit', array('label' => getGS('Add'), 'ignore' => true));
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:12,代码来源:Ingest.php

示例9: initForm

 /**
  */
 public function initForm(Zend_Form $form, ListView $list, MemberView $member = null)
 {
     $newsletter = new Zend_Form_SubForm();
     $newsletter->addElement('checkbox', 'subscriber', array('label' => 'I want to receive newsletter'));
     foreach ($list->groups as $group) {
         $type = $group['form_field'] == 'radio' ? 'radio' : 'multiCheckbox';
         $newsletter->addElement($type, $group['name'], array('label' => $group['name'], 'multioptions' => $group['groups']));
     }
     if ($member !== null) {
         $newsletter->setDefaults(array_merge((array) $member, $member->groups));
     }
     $form->addSubForm($newsletter, 'newsletter');
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:15,代码来源:Newsletter.php

示例10: init

 public function init()
 {
     parent::init();
     /*
      * Options 
      */
     $element = new Zend_Form_Element_Checkbox('per_person');
     $element->setLabel('Per persoon')->setDescription('Selecteer deze optie wanneer u deze kosten 
             	per nacht per persoon wilt rekenen. Laat deze optie leeg 
             	wanneer u de kosten alleen per nacht wilt rekenen.');
     $this->addElement($element);
     $element = new Zend_Form_Element_Checkbox('visible');
     $element->setLabel('Zichtbaar')->setAttrib('checked', 'checked')->setDescription('Selecteer deze optie wanneer u wilt dat de 
             	kosten onzichtbaar worden berekend.');
     $this->addElement($element);
     $this->addDisplayGroup(array('per_person', 'visible'), 'info', array('legend' => 'Opties', 'class' => 'checkbox'));
     /*
      * Text
      */
     $element = new Zend_Form_Element_Text('exp');
     $element->setLabel('Expressies')->setDescription('Waarschuwing! Het is mogelijk om hier speciale 
             	expressies in te vullen. Indien u niet weet wat dit is, laat 
             	het veld leeg. U kunt de applicatie en betaal processen 
             	ernstige schade toebrengen.');
     $this->addElement($element);
     $this->addDisplayGroup(array('exp'), 'expas', array('legend' => 'Expressies'));
     /*
      * Translations
      */
     $subForm = new Zend_Form_SubForm('Translation');
     $langs = Model_Hm_Lang::listAll();
     foreach ($langs as $lang) {
         $subSubForm = new Zend_Form_SubForm($lang->code);
         $element = new Zend_Form_Element_Text('title');
         $element->setLabel('Titel (eigen)')->setDescription('Deze titel is voor gebruik in eigen administratie.')->setRequired(true);
         $subSubForm->addElement($element);
         $element = new Zend_Form_Element_Text('display_title');
         $element->setLabel('Titel (gebruiker)')->setDescription('Deze titel krijgen de gebruikesr van het systeem te zien.')->setRequired(true);
         $subSubForm->addElement($element);
         $element = new Zend_Form_Element_Textarea('description');
         $element->setLabel('Omschrijving')->setRequired(true)->setValidators(array(array('stringLength', false, array('min' => 40))))->setAttrib('class', 'autoexpand')->setAttrib('rows', 2);
         $subSubForm->addElement($element);
         $subSubForm->addDisplayGroup(array('title', 'display_title', 'description'), $lang->code, array('legend' => $lang->name, 'class' => 'textarea'));
         $subForm->addSubForm($subSubForm, $lang->code);
         $this->bhvkSubDecorators($subSubForm);
     }
     $this->addSubForm($subForm, 'Translation');
     $this->bhvkSubDecorators($subForm);
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:49,代码来源:Charge.php

示例11: init

 public function init()
 {
     $translator = $this->getTranslator();
     foreach (array('de', 'en') as $lang) {
         $langForm = new Zend_Form_SubForm();
         $langForm->setLegend($translator->translate("setup_language_{$lang}"));
         $keyForm = new Zend_Form_SubForm();
         $keyForm->addElement('text', 'home_index_index_pagetitle', array('label' => $translator->translate('setup_home_index_index_pagetitle'), 'attribs' => array('size' => 90)));
         $keyForm->addElement('text', 'home_index_index_title', array('label' => $translator->translate('setup_home_index_index_title'), 'attribs' => array('size' => 90)));
         $keyForm->addElement('textarea', 'home_index_index_welcome', array('label' => $translator->translate('setup_home_index_index_welcome'), 'attribs' => array('size' => 90)));
         $keyForm->addElement('textarea', 'home_index_index_instructions', array('label' => $translator->translate('setup_home_index_index_instructions'), 'attribs' => array('size' => 90)));
         $langForm->addSubForm($keyForm, 'key');
         $this->addSubForm($langForm, $lang);
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:15,代码来源:HomePage.php

示例12: addTripLines

 public function addTripLines($tripCount = 1, $startDate, $buses = array())
 {
     // create subform
     $tripLinePanel = new Zend_Form_SubForm();
     $tripLinePanel->setDecorators($this->_displayGroupDecorators)->addAttribs(array('class' => 'fieldsetForm span-8'));
     for ($i = 1; $i <= $tripCount; ++$i) {
         // create bus element
         $bus = $this->_createBusElement($buses);
         // create departure time element
         $departureTime = $this->_createElement('text', 'departureTime', 'Ngày giờ đi', 'Làm ơn nhập ngày giờ đi', true);
         $departureTime->setValue($startDate . ' 00:00:00');
         $departureTime->addValidator(new TBB_Validate_DepartureTime($startDate));
         // create arrival time element
         $arrivalTime = $this->_createElement('text', 'arrivalTime', 'Ngày giờ đến', 'Làm ơn nhập ngày giờ đến', true);
         $arrivalTime->setValue($startDate . ' 00:00:00');
         $arrivalTime->addValidator(new TBB_Validate_ArrivalTime());
         $fare = $this->_createElement('text', 'fare', 'Giá vé', 'Làm ơn nhập giá vé', false, true);
         // create trip line
         $tripLine = new Zend_Form_SubForm();
         $tripLine->setDecorators($this->_displayGroupDecorators)->addAttribs(array('class' => 'span-7'))->setLegend('Chuyến #' . $i);
         // add elements to the tripline
         $tripLine->addElements(array($bus, $departureTime, $arrivalTime, $fare));
         $tripLinePanel->addSubForm($tripLine, $i);
     }
     // add submit button
     $submit = $this->_createSubmitButton();
     $tripLinePanel->addElement($submit);
     $this->addSubForm($tripLinePanel, 'tripLines');
 }
开发者ID:rizkioa,项目名称:etak6,代码行数:29,代码来源:TripCreateMultipleCont.php

示例13: init

 public function init()
 {
     //$this->setSubForms()
     //$this->setIsArray(true);
     //$this->setElementsBelongTo('login');
     $form = new Zend_Form_SubForm();
     $email = $this->createElement('text', 'email');
     $email->addValidator('emailaddress')->setRequired(true)->setLabel('Email');
     $password = $this->createElement('password', "password")->addValidator('stringLength', false, array(6, 20))->setRequired(true)->setLabel('Password')->setBelongsTo('test');
     $submit = $this->createElement('submit', 'submit');
     $form->addElement($email)->addElement($password);
     $form->addElement($submit);
     $this->setSubForms(array('login' => $form));
     if (isset($_GET['redirectTo'])) {
         $redirectTo = $this->createElement('hidden', 'redirectTo')->setValue($_GET['redirectTo']);
         $this->addElement($redirectTo);
     }
 }
开发者ID:adnanali,项目名称:munch,代码行数:18,代码来源:LoginForm.php

示例14: getForm

 public function getForm()
 {
     $form = new Zend_Form();
     $form->addElement('text', 'foo')->addElement('text', 'bar')->addElement('text', 'baz')->addElement('text', 'bat');
     $subForm = new Zend_Form_SubForm();
     $subForm->addElement('text', 'foo')->addElement('text', 'bar')->addElement('text', 'baz')->addElement('text', 'bat');
     $form->addDisplayGroup(array('foo', 'bar'), 'foobar')->addSubForm($subForm, 'sub')->setView(new Zend_View());
     return $form;
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:9,代码来源:DojoTest.php

示例15: addFields

 /**
  * Inclusão de Elementos
  * @param array $fields Conjunto de Identificadores e Conteúdo
  * @return Application_Form_Referencia Próprio Objeto para Encadeamento
  */
 public function addFields(array $fields)
 {
     $form = new Zend_Form_SubForm();
     foreach ($fields as $identifier => $content) {
         $element = new Zend_Dojo_Form_Element_TextBox($identifier);
         $element->setLabel($content)->setRequired(true);
         $form->addElement($element);
     }
     $this->addSubForm($form, 'conteudo');
     return $this;
 }
开发者ID:laiello,项目名称:wanderson,代码行数:16,代码来源:Referencia.php


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