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


PHP Form::getTranslator方法代码示例

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


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

示例1: formSucceeded

 /**
  * Zpracovani formulare s anketou
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     $result = TRUE;
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'), 'success');
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'), 'danger');
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:14,代码来源:ArticleVoteFormFactory.php

示例2: formSucceeded

 /**
  * Zpracovani formulare s rubrikou
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     //nova rubrika nebo jeji editace
     $result = empty($values->id) ? $this->newTag($values) : $this->editTag($values);
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'));
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'));
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:15,代码来源:TagFormFactory.php

示例3: error

 protected function error(Form $form, \Exception $e)
 {
     if ($e instanceof \Kdyby\Doctrine\DuplicateEntryException) {
         $form['name']->addError($form->getTranslator()->translate('Name must be unique.'));
         return;
     }
     if ($e instanceof CreateDirectoryException) {
         $form['name']->addError($form->getTranslator()->translate('Failed to create directory.'));
         return;
     }
     if ($e instanceof RenameDirectoryException) {
         $form['name']->addError($form->getTranslator()->translate('Failed to rename directory.'));
         return;
     }
     parent::error($form, $e);
 }
开发者ID:venne,项目名称:files,代码行数:16,代码来源:DirFormService.php

示例4: formPreview

 /**
  * Nahled prispevku pro odeslani
  * @param Form $form
  * @param ArrayHash $values
  */
 public function formPreview(Form $form, $values)
 {
     //ulozeni do session
     $this->commentSession->content = (array) $values;
     $this->template->modal = TRUE;
     $this->template->modalContent = $values->content;
     $this->template->modalTitle = $form->getTranslator()->translate('system.commentPreview');
     $this->redrawControl('modal');
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:14,代码来源:CommentsFactory.php

示例5: formSucceeded

 /**
  * Prihlaseni uzivatele
  * @param Form $form
  * @param ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     if ($values->remember) {
         $this->user->setExpiration('14 days', FALSE);
     } else {
         $this->user->setExpiration('20 minutes', TRUE);
     }
     try {
         $this->user->login($values->username, $values->password);
     } catch (Nette\Security\AuthenticationException $e) {
         $form->addError($form->getTranslator()->translate('system.credentialsLogError'));
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:18,代码来源:SignFormFactory.php

示例6: save

 /**
  * @param \Nette\Application\UI\Form $form
  * @param callable $resetLinkCallback
  */
 protected function save(Form $form, $resetLinkCallback)
 {
     /** @var \Venne\Security\User $user */
     $user = $this->userRepository->findOneBy(array('email' => $form['email']->value));
     if (!$user) {
         $form->addError($form->getTranslator()->translate('User with email %email% does not exist.', null, array('email' => $form['email']->value)));
         return;
     }
     $key = $user->resetPassword();
     $url = Callback::invoke($resetLinkCallback, $key);
     $this->entityManager->persist($user);
     $this->entityManager->flush($user);
     $this->securityManager->sendRecoveryUrl($user, $url);
 }
开发者ID:venne,项目名称:venne,代码行数:18,代码来源:ResetFormService.php

示例7: formSucceeded

 /**
  * Zpracovani formulare s anketou
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     $requestInfo = $this->getRequestInfo($this->request);
     $result = $this->processPoll($this->vote, $requestInfo, $values);
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'), 'success');
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'), 'danger');
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:15,代码来源:PollFactory.php

示例8: error

 protected function error(Form $form, \Exception $e)
 {
     Debugger::log($e);
     $form->addError($form->getTranslator()->translate('Something went wrong'));
 }
开发者ID:venne,项目名称:venne,代码行数:5,代码来源:DoctrineFormService.php

示例9: formSucceeded

 /**
  * Zpracovani formulare s clankem
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     //nastaveni datumu zverejneni
     if (empty($values->publishDate)) {
         $date = new DateTime();
     } else {
         $date = DateTime::createFromFormat('d. m. Y, H:i', $values->publishDate);
     }
     $values->offsetSet('publishDate', $date);
     //novy clanek nebo jeho editace
     $result = empty($values->id) ? $this->newArticle($values) : $this->editArticle($values);
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'), 'success');
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'), 'danger');
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:22,代码来源:ArticleFormFactory.php

示例10: formSucceeded

 /**
  * Zpracovani formulare s clankem
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     //nastaveni hodnot
     if (empty($values->person->surname)) {
         $values->person->surname = NULL;
     }
     //novy uzivatel nebo jeho editace
     $result = empty($values->id) ? $this->newUser($values) : $this->editUser($values);
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'), 'success');
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'), 'danger');
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:19,代码来源:UserFormFactory.php

示例11: formSucceeded

 /**
  * Zpracovani formulare s anketou
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     if (!empty($values->expiration)) {
         $expiration = DateTime::createFromFormat(self::$dateMask, $values->expiration);
         $values->expiration = $expiration;
     } else {
         $values->expiration = NULL;
     }
     if (empty($values->id)) {
         //novy
         $result = $this->newVote($values);
     } else {
         //editace
         $result = $this->editVote($values);
     }
     if ($result) {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestS'), 'success');
     } else {
         $form->getPresenter()->flashMessage($form->getTranslator()->translate('system.requestN'), 'danger');
     }
 }
开发者ID:krupaj,项目名称:my-blog,代码行数:26,代码来源:VoteFormFactory.php


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