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


PHP FormInterface::get方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $request = $this->getRequest();
     $logContent = '';
     // initialize when no submit anymore
     $data = [];
     $data['logmessage'] = $this->form->get('logmessage')->getValue();
     if ($request->isPost()) {
         $this->form->setData($request->getPost());
         if ($this->form->isValid()) {
             $data = $this->form->getData();
             $this->loggerPriority = $data['logpriority'];
             if ($data['logformat'] !== 'simple') {
                 $this->loggerConfig['writers'][0]['options']['formatter']['name'] = $data['logformat'];
                 unset($this->loggerConfig['writers'][0]['options']['formatter']['options']);
             }
         }
     }
     $logger = new Logger($this->loggerConfig);
     // save log data to buffer and make it variable
     ob_start();
     $logger->log((int) $this->loggerPriority, $data['logmessage']);
     $logContent = ob_get_clean();
     return new ViewModel(['form' => $this->form, 'logContent' => $logContent]);
 }
开发者ID:shitikovkirill,项目名称:LearnZF2,代码行数:25,代码来源:IndexController.php

示例2: createAction

 public function createAction()
 {
     $this->contactForm->get('avatar')->setValue('building');
     if ($this->getRequest()->isPost()) {
         $this->contactForm->setData($this->getRequest()->getPost());
         if ($this->contactForm->isValid()) {
             $person = $this->contactService->createCompany($this->contactForm->getData());
             return $this->redirect()->toRoute('contacts/view', ['type' => ContactEntry::TYPE_COMPANY, 'id' => $person->getId()->toString()]);
         }
     }
     return new ViewModel(['contactForm' => $this->contactForm]);
 }
开发者ID:zource,项目名称:zource,代码行数:12,代码来源:Company.php

示例3: render

 /**
  * Renders the error messages.
  * @param \Zend\Form\FormInterface $oForm
  * @return string
  */
 public function render(\Zend\Form\FormInterface $oForm, $sMessage, $bDismissable = false)
 {
     $errorHtml = sprintf($this->messageOpenFormat, $sMessage);
     $sMessagesArray = array();
     foreach ($oForm->getMessages() as $fieldName => $sMessages) {
         foreach ($sMessages as $sMessage) {
             if ($oForm->get($fieldName)->getAttribute('id')) {
                 $sMessagesArray[] = sprintf('<a href="#%s">%s</a>', $oForm->get($fieldName)->getAttribute('id'), $oForm->get($fieldName)->getLabel() . ': ' . $sMessage);
             } else {
                 $sMessagesArray[] = $oForm->get($fieldName)->getLabel() . ': ' . $sMessage;
             }
         }
     }
     return $this->dangerAlert($errorHtml . implode($this->messageSeparatorString, $sMessagesArray) . $this->messageCloseString, $bDismissable);
 }
开发者ID:Alfredao,项目名称:zf2-twb-bundle,代码行数:20,代码来源:TwbBundleFormErrors.php

示例4: resetPasswordAction

 public function resetPasswordAction()
 {
     $code = $this->params('code');
     if ($code) {
         $this->resetPasswordForm->get('code')->setValue($code);
     }
     if ($this->getRequest()->isPost()) {
         $this->resetPasswordForm->setData($this->getRequest()->getPost());
         if ($this->resetPasswordForm->isValid()) {
             $data = $this->resetPasswordForm->getData();
             $this->passwordChanger->resetAccountPassword($data['code'], $data['credential']);
             return $this->redirect()->toRoute('login');
         }
     }
     return new ViewModel(['resetPasswordForm' => $this->resetPasswordForm, 'code' => $code]);
 }
开发者ID:zource,项目名称:zource,代码行数:16,代码来源:Request.php

示例5: changesAction

 public function changesAction()
 {
     $siteId = $this->services->getUtilityService()->getSiteId();
     $site = $this->services->getSiteService()->find($siteId);
     $fromControl = $this->dateIntervalForm->get(DateIntervalForm::FROM_DATE_NAME);
     $toControl = $this->dateIntervalForm->get(DateIntervalForm::TO_DATE_NAME);
     $lastDate = $site->getLastUpdate();
     $lastDate->setTime(23, 59, 59);
     $fromControl->setAttribute('max', $lastDate->format('Y-m-d'));
     $toControl->setAttribute('max', $lastDate->format('Y-m-d'));
     $from = clone $lastDate;
     $from->sub(new \DateInterval('P1M'));
     $to = $lastDate;
     $fromControl->setValue($from->format('Y-m-d'));
     $toControl->setValue($to->format('Y-m-d'));
     $request = $this->getRequest();
     if ($request->isPost()) {
         $this->dateIntervalForm->setData($request->getPost());
         if ($this->dateIntervalForm->isValid()) {
             $from = \DateTime::createFromFormat('Y-m-d', $fromControl->getValue());
             $to = \DateTime::createFromFormat('Y-m-d', $toControl->getValue());
         }
     }
     $from->setTime(0, 0, 0);
     $to->setTime(23, 59, 59);
     $result = array('intervalForm' => $this->dateIntervalForm, 'site' => $site, 'members' => $this->getMembersData($siteId, $from, $to), 'pages' => $this->getPagesData($siteId, $from, $to), 'revisions' => $this->getRevisionsData($siteId, $from, $to), 'votes' => $this->getVotesData($siteId, $from, $to));
     return new ViewModel($result);
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:28,代码来源:ChangesController.php

示例6: render

 /**
  * @param string $content
  * @param array $attribs
  * @param ElementInterface $element
  * @param FormInterface $form
  * @return string
  */
 public function render($content, array $attribs = [], ElementInterface $element = null, FormInterface $form = null)
 {
     if ($form && $form->hasAttribute('class')) {
         $class = $form->getAttribute('class');
         if (strpos($class, 'form-inline') !== false) {
             return $content;
         }
         if (strpos($class, 'form-horizontal') !== false && empty($attribs['class']) && $form->has('submit') && $form->has('reset')) {
             if ($form->get('submit') === $element) {
                 $attribs['class'] = 'col-xs-12 col-sm-8';
             } elseif ($form->get('reset') === $element) {
                 $attribs['class'] = 'col-xs-12 col-sm-4';
             }
         }
     }
     return parent::render($content, $attribs);
 }
开发者ID:coolms,项目名称:twbs,代码行数:24,代码来源:FormGroupCol.php

示例7: renderAdditional

 public function renderAdditional(FormInterface $form, $type)
 {
     $result = '';
     foreach ($this->contactTypes[$type] as $fieldName => $fieldOptions) {
         $result .= $this->renderElement($form->get($fieldName), $fieldOptions, true);
     }
     return $result;
 }
开发者ID:zource,项目名称:zource,代码行数:8,代码来源:ContactForm.php

示例8: editAction

 public function editAction()
 {
     $project = $this->projectRepository->find($this->params('projectId'));
     if ($project === null) {
         $this->getResponse()->setStatusCode(404);
         return;
     }
     $this->projectForm->get('client')->setValue($project->getClient()->getName());
     $this->projectForm->bind($project);
     if ($this->getRequest()->isPost()) {
         $this->projectForm->setData($this->getRequest()->getPost());
         if ($this->projectForm->isValid()) {
             $this->projectService->persist($this->projectForm->getData());
             $this->redirect()->toRoute('clients/show', ['clientId' => $project->getClient()->getId()], ['fragment' => 'project-table']);
         }
     }
     return new ViewModel(['form' => $this->projectForm]);
 }
开发者ID:DavidHavl,项目名称:Ajasta,代码行数:18,代码来源:ProjectController.php

示例9: row

 /**
  * @param $name
  * @return Element
  */
 public function row($name)
 {
     if (isset($this->cache[$name])) {
         return $this->cache[$name];
     }
     $elem = $this->form->get($name);
     if ($elem instanceof ZendElement) {
         $return = new Element($elem, $this->renderer);
         $this->cache[$name] = $return;
         return $return;
     }
     throw new \DomainException('Invalid form element object.');
 }
开发者ID:hanif,项目名称:stokq,代码行数:17,代码来源:Form.php


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