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


PHP Form::setLabel方法代码示例

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


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

示例1: __construct

 public function __construct(Member $memberEntity, Event $eventEntity, ObjectManager $objectManager)
 {
     parent::__construct('entry');
     $this->filter = new InputFilter();
     $dog = new AppElement\ObjectLiveSearch('dog');
     $dog->setOption('object_manager', $objectManager);
     $dog->setOption('target_class', 'Application\\Entity\\Dog');
     $dog->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array('primary' => $memberEntity->getId()), 'orderBy' => array('callName' => 'ASC'))));
     $dog->setEmptyOption('Select a Dog');
     $this->add($dog);
     $dogFilter = new Input('dog');
     $dogFilter->setRequired(true);
     $this->filter->add($dogFilter);
     $entryNum = 0;
     foreach ($eventEntity->getTrials() as $trialEntity) {
         $trial = new Form('trial_' . $trialEntity->getId());
         $trial->setLabel($trialEntity->getDateDisplay());
         $this->add($trial);
         foreach ($trialEntity->getTrialDivisions() as $trialDivisionEntity) {
             $divisionEntity = $trialDivisionEntity->getDivision();
             for ($whichDivisionNum = 1; $whichDivisionNum <= $trialDivisionEntity->getNumOffered(); $whichDivisionNum++) {
                 $entry = new Fieldset('entry_' . $entryNum++);
                 $entry->setOption('twb-layout', 'inline');
                 $entry->setAttribute('data-price', trim($trialDivisionEntity->getEntryFee(), '$'));
                 $entry->setAttribute('class', 'form-group entry-form');
                 $this->add($entry);
                 $entry->filter = new InputFilter();
                 $this->filter->add($entry->filter);
                 $hiddenTrial = new Element\Hidden('trial');
                 $hiddenTrial->setValue($trialEntity->getId());
                 $entry->add($hiddenTrial);
                 $hiddenDivision = new Element\Hidden('division');
                 $hiddenDivision->setValue($divisionEntity->getId());
                 $entry->add($hiddenDivision);
                 $whichDivision = new Element\Hidden('whichDivision');
                 $whichDivision->setValue($whichDivisionNum);
                 $entry->add($whichDivision);
                 $entered = new Element\Checkbox('entered');
                 $entered->setLabel($divisionEntity . ($trialDivisionEntity->getNumOffered() > 1 ? ' #' . $whichDivisionNum : ''));
                 $entry->add($entered);
                 $enteredFilter = new Input('entered');
                 $enteredFilter->setRequired(false);
                 $entry->filter->add($enteredFilter);
                 if (!$divisionEntity->isAllLevels()) {
                     $level = new AppElement\ObjectLiveSearch('level');
                     $level->setOption('object_manager', $objectManager);
                     $level->setOption('target_class', 'Application\\Entity\\Level');
                     $level->setOption('find_method', array('name' => 'findBy', 'params' => array('criteria' => array(), 'orderBy' => array('rank' => 'ASC'))));
                     $level->setEmptyOption('Select a Level');
                     $entry->add($level);
                     $levelFilter = new Input('level');
                     $levelFilter->setRequired(false);
                     $entry->filter->add($levelFilter);
                 }
                 $exhibitionOnly = new Element\Checkbox('exhibitionOnly');
                 $exhibitionOnly->setLabelAttributes(array('class' => 'small col-md-offset-2'));
                 $exhibitionOnly->setLabel('For exhibition only');
                 $entry->add($exhibitionOnly);
                 $exhibitionOnlyFilter = new Input('exhibitionOnly');
                 $exhibitionOnlyFilter->setRequired(false);
                 $entry->filter->add($exhibitionOnlyFilter);
             }
         }
     }
     $buttons = new Form('buttons');
     $buttons->setOption('twb-layout', 'inline');
     $buttons->setAttribute('class', 'form-group');
     $submit = new Element\Submit('submit');
     $submit->setAttribute('class', 'btn-event pull-right');
     $submit->setOption('glyphicon', 'circle-arrow-up');
     $submit->setLabel('Submit Entry');
     $buttons->add($submit);
     $cancel = new Element\Submit('cancel');
     $cancel->setAttribute('formnovalidate', true);
     $cancel->setAttribute('class', 'btn-warning pull-right');
     $cancel->setOption('glyphicon', 'ban-circle');
     $cancel->setLabel('Cancel');
     $buttons->add($cancel);
     $this->add($buttons);
 }
开发者ID:PoetikDragon,项目名称:USCSS,代码行数:80,代码来源:Entry.php


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