本文整理汇总了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');
}
}
示例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'));
}
}
示例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);
}
示例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');
}
示例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'));
}
}
示例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);
}
示例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');
}
}
示例8: error
protected function error(Form $form, \Exception $e)
{
Debugger::log($e);
$form->addError($form->getTranslator()->translate('Something went wrong'));
}
示例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');
}
}
示例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');
}
}
示例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');
}
}