當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。