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