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


PHP Form\Fieldset类代码示例

本文整理汇总了PHP中Zend\Form\Fieldset的典型用法代码示例。如果您正苦于以下问题:PHP Fieldset类的具体用法?PHP Fieldset怎么用?PHP Fieldset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: load

 /**
  * Load upload prevalue editor
  *
  * @return string
  */
 public function load()
 {
     $parameters = $this->getConfig();
     $elements = array();
     $optionsValues = !empty($parameters['options']) ? $parameters['options'] : array();
     $fieldset = new Fieldset('Available options');
     $element = new Element\MultiCheckbox('options');
     $element->setAttribute('selected', $optionsValues);
     $element->setAttribute('class', 'input-checkbox');
     $element->setValueOptions(array(array('value' => 'maxNumberOfFiles', 'label' => 'Is multiple', 'selected' => empty($optionsValues['maxNumberOfFiles']) ? false : true)));
     $fieldset->add($element);
     $elements[] = $fieldset;
     $element = new Element\MultiCheckbox('mime_list');
     $mimeList = array('image/gif', 'image/jpeg', 'image/png', 'image/tiff', 'image/svg+xml', 'text/css', 'text/csv', 'text/html', 'text/javascript', 'text/plain', 'text/xml', 'video/mpeg', 'video/mp4', 'video/quicktime', 'video/x-ms-wmv', 'video/x-msvideo', 'video/x-flv', 'audio/mpeg', 'audio/x-ms-wma', 'audio/vnd.rn-realaudio', 'audio/x-wav');
     $options = array();
     foreach ($mimeList as $mime) {
         $options[] = array('value' => $mime, 'label' => $mime, 'selected' => !in_array($mime, empty($parameters['mime_list']) ? array() : $parameters['mime_list']) ? false : true);
     }
     $element->setValueOptions($options);
     $element->setAttribute('class', 'input-checkbox');
     $fieldset = new Fieldset('Mime list');
     $fieldset->add($element);
     $elements[] = $fieldset;
     return $this->addPath(__DIR__)->render('upload-prevalue.phtml', array('elements' => $elements));
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:30,代码来源:PrevalueEditor.php

示例2: testCanRenderFieldsets

 /**
  * @outputBuffering disabled
  */
 public function testCanRenderFieldsets()
 {
     $this->expectOutputRegex('/<form(.*)<fieldset(.*)<\\/fieldset>(.*)<fieldset(.*)<\\/fieldset>(.*)<\\/form>/');
     $form = new NetsensiaForm();
     $form->addHidden('test1', 'testvalue');
     $hidden = new Element\Hidden('asdasd');
     $hidden->setValue('123');
     $form->add($hidden);
     $element1 = new Text('testelement1');
     $element1->setLabel('Test Element');
     $element1->setAttribute('icon', 'pencil');
     $element2 = new Text('testelement2');
     $element2->setLabel('Test Element 2');
     $element2->setAttribute('icon', 'pencil');
     $fieldset1 = new Fieldset('testfieldset1');
     $fieldset1->add($element1);
     $fieldset2 = new Fieldset('testfieldset2');
     $fieldset2->add($element2);
     $form->add($fieldset1);
     $form->add($fieldset2);
     $helpers = new HelperPluginManager();
     $helpers->setService('formElement', new FormElement());
     $view = new PhpRenderer();
     $view->setHelperPluginManager($helpers);
     $viewHelper = new BootstrapForm();
     $viewHelper->setView($view);
     $viewHelper($form, 'testform', '/');
 }
开发者ID:netsensia,项目名称:zf2-foundation,代码行数:31,代码来源:BootstrapFormTest.php

示例3: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     if ($fieldset->getName()) {
         return parent::renderFieldset($view, $fieldset);
     }
     // Reimplement form renderer to align submit button with elements from Preferences fieldset.
     $output = "<div class='table'>\n";
     foreach ($this->get('Preferences') as $element) {
         if ($element instanceof \Zend\Form\Fieldset) {
             $output .= $view->htmlElement('span', $view->translate($element->getLabel()), array('class' => 'label'), true) . "\n";
             $output .= $view->htmlElement('fieldset', "<legend></legend>\n" . $this->renderFieldset($view, $element));
         } else {
             $output .= $view->formRow($element, 'prepend', false);
             if ($element->getMessages()) {
                 $output .= "\n<div class='row'>\n<span class='cell'></span>\n";
                 $output .= $view->formElementErrors($element, array('class' => 'errors'));
                 $output .= "\n</div>";
             }
         }
         $output .= "\n";
     }
     $output .= "<div class='row'>\n";
     $output .= "<span class='cell'></span>\n";
     $output .= $view->formRow($this->get('Submit'));
     $output .= "\n</div>\n</div>\n";
     return $output;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:28,代码来源:AbstractForm.php

示例4: testCanSetCustomOptionFromConstructor

 public function testCanSetCustomOptionFromConstructor()
 {
     $fieldset = new Fieldset('foo', array('custom' => 'option'));
     $options = $fieldset->getOptions();
     $this->assertArrayHasKey('custom', $options);
     $this->assertEquals('option', $options['custom']);
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:7,代码来源:FieldsetTest.php

示例5: addButtons

 public function addButtons()
 {
     $fieldSet = new Fieldset('buttons');
     $fieldSet->setAttributes(array('class' => 'dots-form-buttons'));
     $fieldSet->add(array('name' => 'cancel', 'options' => array('label' => 'Cancel'), 'attributes' => array('type' => 'button', 'class' => 'btn', 'data-action' => 'link_cancel')));
     $fieldSet->add(array('name' => 'save', 'options' => array('label' => 'Save'), 'attributes' => array('type' => 'button', 'class' => 'btn btn-primary', 'data-action' => 'link_save')));
     $this->add($fieldSet);
 }
开发者ID:Ellipizle,项目名称:dotscms,代码行数:8,代码来源:Link.php

示例6: __construct

 /**
  * Produce a form element.
  *
  * @param Affiliation    $affiliation
  * @param ProjectService $projectService
  */
 public function __construct(Affiliation $affiliation, ProjectService $projectService)
 {
     parent::__construct($affiliation->getId());
     foreach ($projectService->parseEditYearRange() as $year) {
         $fieldSet = new Fieldset($year);
         $fieldSet->add(['type' => 'Zend\\Form\\Element\\Text', 'name' => 'cost', 'attributes' => ['class' => 'form-control cost-input year-' . $year, 'label' => 'cost', 'placeholder' => _("txt-cost")]]);
         $this->add($fieldSet);
     }
 }
开发者ID:debranova,项目名称:project,代码行数:15,代码来源:CostPerAffiliationFieldset.php

示例7: setUp

 public function setUp()
 {
     $fs = new Fieldset('test', ['type' => "text"]);
     $fs->setAttribute('class', 'myclass1 myclass2');
     $fs->setName('myField');
     $target = new Form();
     $target->add($fs);
     $this->target = $target;
 }
开发者ID:utrenkner,项目名称:YAWIK,代码行数:9,代码来源:FormTest.php

示例8: prepareConfig

 /**
  * Prepare elements for configuration
  *
  * @return void
  */
 public function prepareConfig()
 {
     $options = $this->getModel()->getConfig();
     $fieldset = new Fieldset('config');
     $language = new Element\Select('language');
     $language->setLabel('Language')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('class', 'form-control col-lg-10')->setValueOptions($this->getModel()->getLanguages())->setValue($options['language']);
     $fieldset->add($language);
     $ga = new Element\Text('data_ga_property_id');
     $ga->setLabel('Google Analytics property ID')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('class', 'form-control col-lg-10')->setValue($options['data_ga_property_id']);
     $fieldset->add($ga);
     $showOnDashboard = new Element\Checkbox('show_stats');
     $showOnDashboard->setLabel('Show stats on dashboard')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('id', 'show_stats')->setAttribute('class', 'input-checkbox')->setValue($options['show_stats']);
     $fieldset->add($showOnDashboard);
     $profileId = new Element\Text('profile_id');
     $profileId->setLabel('AddThis Profile ID')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('class', 'form-control col-lg-10')->setValue($options['profile_id']);
     $fieldset->add($profileId);
     $username = new Element\Text('username');
     $username->setLabel('AddThis Username')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('class', 'form-control col-lg-10')->setValue($options['username']);
     $fieldset->add($username);
     $password = new Element\Password('password');
     $password->setLabel('AddThis Password')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('class', 'form-control col-lg-10')->setValue($options['password']);
     $fieldset->add($password);
     $dataTrackClickback = new Element\Checkbox('data_track_clickback');
     $dataTrackClickback->setLabel('Track clickback')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('id', 'data_track_clickback')->setAttribute('class', 'input-checkbox')->setValue($options['data_track_clickback']);
     $fieldset->add($dataTrackClickback);
     $dataTrackAddressbar = new Element\Checkbox('data_track_addressbar');
     $dataTrackAddressbar->setLabel('Track adressbar')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('id', 'data_track_addressbar')->setAttribute('class', 'input-checkbox')->setValue($options['data_track_addressbar']);
     $fieldset->add($dataTrackAddressbar);
     $jsonConfig = new Element\Textarea('config_json');
     $jsonConfig->setLabel('Json config')->setLabelAttributes(array('class' => 'col-lg-2 control-label'))->setAttribute('class', 'form-control col-lg-10')->setValue($options['config_json']);
     $fieldset->add($jsonConfig);
     $this->add($fieldset);
     $this->getInputFilter()->add(array('type' => 'Zend\\InputFilter\\InputFilter', 'language' => array('name' => 'language', 'required' => true), 'data_ga_property_id' => array('name' => 'data_ga_property_id', 'required' => false), 'profile_id' => array('name' => 'profile_id', 'required' => false, 'validators' => array(array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'Can not connect to addthis api'), 'callback' => function ($value, $context = array()) {
         if (empty($context['username']) or empty($context['password'])) {
             return false;
         }
         return true;
     })))), 'show_stats' => array('name' => 'show_stats', 'required' => false), 'password' => array('name' => 'password', 'required' => false, 'validators' => array(array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'Can not connect to addthis api'), 'callback' => function ($value, $context = array()) {
         if (empty($context['username']) or empty($context['profile_id'])) {
             return false;
         }
         return true;
     })))), 'username' => array('name' => 'username', 'required' => false, 'validators' => array(array('name' => 'Callback', 'options' => array('messages' => array(\Zend\Validator\Callback::INVALID_VALUE => 'Can not connect to addthis api'), 'callback' => function ($value, $context = array()) {
         $client = new Client('https://api.addthis.com/analytics/1.0/pub/shares.json', array('sslverifypeer' => false));
         $client->setParameterGet(array('username' => $context['username'], 'password' => $context['password'], 'pubid' => $context['profile_id']));
         try {
             $response = $client->send();
             if ($response->isSuccess() == 200) {
                 return true;
             }
         } catch (\Exception $e) {
             //don't care
         }
         return false;
     })))), 'data_track_clickback' => array('name' => 'data_track_clickback', 'required' => false), 'data_track_addressbar' => array('name' => 'data_track_addressbar', 'required' => false), 'json_config' => array('name' => 'json_config', 'required' => false)), 'config');
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:61,代码来源:AddThis.php

示例9: addSiteEnableCheckbox

 public function addSiteEnableCheckbox($event)
 {
     $siteSettings = $this->getServiceLocator()->get('Omeka\\SiteSettings');
     $form = $event->getParam('form');
     $fieldset = new Fieldset('sharing');
     $fieldset->setLabel('Sharing');
     $enabledMethods = $siteSettings->get('sharing_methods', array());
     $fieldset->add(['name' => 'sharing_methods', 'type' => 'multiCheckbox', 'options' => ['label' => 'Enable Sharing module for these methods', 'value_options' => ['fb' => ['label' => 'Facebook', 'value' => 'fb', 'selected' => in_array('fb', $enabledMethods)], 'twitter' => ['label' => 'Twitter', 'value' => 'twitter', 'selected' => in_array('twitter', $enabledMethods)], 'tumblr' => ['label' => 'Tumblr', 'value' => 'tumblr', 'selected' => in_array('tumblr', $enabledMethods)], 'pinterest' => ['label' => 'Pinterest', 'value' => 'pinterest', 'selected' => in_array('pinterest', $enabledMethods)], 'email' => ['label' => 'Email', 'value' => 'email', 'selected' => in_array('email', $enabledMethods)], 'embed' => ['label' => 'Embed codes', 'value' => 'embed', 'selected' => in_array('embed', $enabledMethods)]]], 'attributes' => ['required' => false]]);
     $form->add($fieldset);
 }
开发者ID:omeka-s-modules,项目名称:Sharing,代码行数:10,代码来源:Module.php

示例10: __construct

 /**
  * @param GeneralService $mailingService
  */
 public function __construct(GeneralService $mailingService)
 {
     parent::__construct();
     $this->setAttribute('method', 'get');
     $this->setAttribute('action', '');
     $filterFieldset = new Fieldset('filter');
     $filterFieldset->add(['type' => 'Zend\\Form\\Element\\Text', 'name' => 'search', 'attributes' => ['class' => 'form-control', 'placeholder' => _('txt-search')]]);
     $this->add($filterFieldset);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'submit', 'attributes' => ['id' => 'submit', 'class' => 'btn btn-primary', 'value' => _('txt-filter')]]);
     $this->add(['type' => 'Zend\\Form\\Element\\Submit', 'name' => 'clear', 'attributes' => ['id' => 'cancel', 'class' => 'btn btn-warning', 'value' => _('txt-cancel')]]);
 }
开发者ID:iteaoffice,项目名称:general,代码行数:14,代码来源:GenderFilter.php

示例11: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $form = new Form();
     $form->setName('login-form');
     $form->add(array('type' => 'hidden', 'name' => 'ref'));
     $fieldset = new Fieldset();
     $fieldset->add(array('name' => 'login', 'options' => array('label' => 'Login name', 'description' => 'Provide your login key (e.g. email adress)')));
     $fieldset->add(array('type' => 'password', 'name' => 'credential', 'options' => array('label' => 'Password')));
     $form->add($fieldset);
     $form->add($this->forms->get('DefaultButtonsFieldset'));
 }
开发者ID:bitrecruiter,项目名称:CrossApplicantManager,代码行数:11,代码来源:LoginFactory.php

示例12: handleCollections

 /**
  * @param Fieldset $fieldset
  */
 protected function handleCollections(Fieldset $fieldset)
 {
     foreach ($fieldset->getFieldsets() as $childFieldset) {
         // Configure collection:
         if ($childFieldset instanceof Collection) {
             $this->configureInputFilter($childFieldset);
         }
         // Search deeper:
         $this->handleCollections($childFieldset);
     }
 }
开发者ID:phpro,项目名称:zf-annotated-forms,代码行数:14,代码来源:ConfigureCollectionInputFilterListener.php

示例13: addLeadFieldset

 public function addLeadFieldset($name = 'leads', $leadData = array())
 {
     $leadAttributeValuesFieldset = new Fieldset($name, ['use_as_base_fieldset' => false]);
     if ($leadData) {
         foreach ($leadData as $i => $lead) {
             foreach ($lead as $field => $value) {
                 $leadAttributeValuesFieldset->add(array('name' => "{$i}[{$field}]", 'attributes' => array('value' => $value, 'type' => 'hidden')));
             }
         }
     }
     $this->add($leadAttributeValuesFieldset);
     return $leadAttributeValuesFieldset;
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:13,代码来源:ImportForm.php

示例14: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->getName() == 'Deploy') {
         foreach ($fieldset as $element) {
             // Default renderer would prepend
             $output .= $view->formRow($element, 'append') . "\n";
         }
     } else {
         $output .= parent::renderFieldset($view, $fieldset);
     }
     return $output;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:14,代码来源:Update.php

示例15: addSubmissionsFieldset

 public function addSubmissionsFieldset($name = 'submissions', $submissions = array())
 {
     $submissionsFieldset = new Fieldset($name, ['use_as_base_fieldset' => false]);
     if ($submissions) {
         foreach ($submissions as $i => $submission) {
             foreach ($submission as $field => $value) {
                 $submissionsFieldset->add(array('name' => "{$i}[{$field}]", 'attributes' => array('value' => $value, 'type' => 'hidden')));
             }
         }
     }
     $this->add($submissionsFieldset);
     return $submissionsFieldset;
 }
开发者ID:arstropica,项目名称:zf-tenstreet,代码行数:13,代码来源:LeadImportForm.php


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