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


PHP Presenter::flashMessage方法代码示例

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


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

示例1: flashMessage

	/**
	 * Saves the message to template, that can be displayed after redirect
	 *
	 * @param  string
	 * @param  string
	 * @return stdClass
	 */
	public function flashMessage($message, $type = 'info')
	{
		$types = $this->getContext()->params['flashes'];
		if (isset($types[$type])) {
			$type = $types[$type];
		}

		return parent::flashMessage($message, $type);
	}
开发者ID:norbe,项目名称:framework,代码行数:16,代码来源:Presenter.php

示例2: newWriterFormSucceeded

 public function newWriterFormSucceeded($form, $values)
 {
     if (!$this->presenter->user->isLoggedIn()) {
         try {
             $this->captchaManager->checkCaptcha($values->captcha);
         } catch (\Exception $e) {
             $this->presenter->flashMessage($e->getMessage());
             $this->presenter->redirect('this');
         }
         $values->byUser = null;
     } else {
         $values->contact = $this->presenter->user->getIdentity()->mail;
         $values->byUser = $this->presenter->user->id;
     }
     try {
         $this->articleManager->addNewWriter($values);
     } catch (\Exception $e) {
         $form->addError($e->getMessage());
     }
 }
开发者ID:kivi8,项目名称:ars-poetica,代码行数:20,代码来源:SendArticle.php

示例3: flashMessage

 /**
  * @param string
  * @param string
  * @param bool
  * @return \stdClass
  */
 public function flashMessage($message, $type = 'info', $withoutSession = FALSE)
 {
     if ($withoutSession) {
         $this->_flashes[] = $flash = (object) array('message' => $message, 'type' => $type);
     } else {
         $flash = parent::flashMessage($message, $type);
     }
     $id = $this->getParameterId('flash');
     $messages = $this->getPresenter()->getFlashSession()->{$id};
     $this->getTemplate()->flashes = array_merge((array) $messages, $this->_flashes);
     return $flash;
 }
开发者ID:jedenweb,项目名称:framework,代码行数:18,代码来源:Presenter.php

示例4: create

 /**
  * @param string $name
  * @param Selection $selection
  * @param bool $processForm
  * @return mixed
  * @throws FormNotExistsException
  */
 public function create($name, Selection $selection, $processForm = TRUE)
 {
     $className = '\\App\\AdminModule\\Form\\' . $name;
     if (!class_exists($className)) {
         throw new FormNotExistsException("Form class {$className} does not exist!");
     }
     if ($this->presenter === NULL) {
         throw new InvalidArgumentException('Presenter must be set!');
     }
     $form = new $className($this->db, $selection);
     if ($processForm) {
         $form->onSuccess[] = function ($form) {
             $form->process();
             if ($form->valid && !$form->hasErrors()) {
                 $this->presenter->flashMessage('Úspěšně uloženo', 'success');
                 $this->presenter->redirect('this');
             }
         };
     }
     return $form;
 }
开发者ID:ondrs,项目名称:nette-bootstrap,代码行数:28,代码来源:FormFactory.php

示例5: hasFileError

 /**
  * Return file upload error message.
  * @param  FileUpload $file
  * @param  UI\Presenter $presenter
  * @return bool
  */
 public static function hasFileError(FileUpload $file, UI\Presenter &$presenter, $noFileError = TRUE)
 {
     switch ($file->getError()) {
         case UPLOAD_ERR_INI_SIZE:
             $presenter->flashMessage('The uploaded file exceeds the upload_max_filesize directive in php.ini.', 'error');
             $return = FALSE;
             break;
         case UPLOAD_ERR_FORM_SIZE:
             $presenter->flashMessage('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', 'error');
             $return = FALSE;
             break;
         case UPLOAD_ERR_PARTIAL:
             $presenter->flashMessage('The uploaded file was only partially uploaded.', 'error');
             $return = FALSE;
             break;
         case UPLOAD_ERR_NO_FILE:
             if ($noFileError === FALSE) {
                 $presenter->flashMessage('No file was uploaded.', 'error');
             }
             $return = $noFileError;
             break;
         case UPLOAD_ERR_NO_TMP_DIR:
             $presenter->flashMessage('Missing a temporary folder.', 'error');
             $return = FALSE;
             break;
         case UPLOAD_ERR_CANT_WRITE:
             $this->flashMessage('Failed to write file to disk.', 'error');
             $return = FALSE;
             break;
         case UPLOAD_ERR_EXTENSION:
             $presenter->flashMessage('File upload stopped by extension.', 'error');
             $return = FALSE;
             break;
         default:
             $presenter->flashMessage('Chyba při zpracování souboru ' . $file->getName(), 'error');
             $return = FALSE;
             break;
     }
     return $return;
 }
开发者ID:RadH-CZ,项目名称:utils,代码行数:46,代码来源:Files.php

示例6: flashMessage

 /**
  * @param  string|array
  * @param  string
  * @param  \Exception|NULL $e
  * @return \stdClass
  */
 public function flashMessage($message, $type = 'info', \Exception $e = NULL)
 {
     if (is_array($message)) {
         $el = (string) Html::el()->setHtml(array_shift($message));
         if (strpos($el, '%') !== FALSE) {
             $el = preg_replace_callback('/%([bius])%/', function ($m) use(&$message) {
                 if (count($message)) {
                     return (string) Html::el($m[1] === 's' ? NULL : $m[1])->setText(array_shift($message));
                 }
             }, $el);
         }
         $el = Html::el()->setHtml($el);
     } else {
         $el = Html::el()->setText($message);
     }
     if ($e) {
         $el = Html::el()->add($el)->add(Html::el('br'))->add(Html::el('small')->setText($e->getMessage()));
     }
     return parent::flashMessage($el, $type);
 }
开发者ID:milo,项目名称:web-project,代码行数:26,代码来源:BasePresenter.php

示例7: flashMessage

 /**
  * @param string $message
  * @param string $type
  * @param string $title
  * @return \stdClass
  */
 public function flashMessage($message, $type = Flash::SUCCESS, $title = '')
 {
     $message = $this->translator->translate($message, null, ['AHOJ']);
     $flash = parent::flashMessage($message, $type);
     switch ($type) {
         case Flash::SUCCESS:
             $flash->title = 'Výborně!';
             break;
         case Flash::ERROR:
             $flash->title = 'Chyba!';
             break;
         case Flash::INFO:
             $flash->title = 'Informace!';
             break;
         case Flash::WARNING:
             $flash->title = 'Upozornění!';
             break;
         default:
             $flash->title = $title;
             break;
     }
     return $flash;
 }
开发者ID:vladimirantos,项目名称:Pallete,代码行数:29,代码来源:BasePresenter.php

示例8: flashMessage

 public function flashMessage($message, $type = "info")
 {
     $message = $this->translator->translate($message);
     return parent::flashMessage($message, $type);
 }
开发者ID:soundake,项目名称:pd,代码行数:5,代码来源:BasePresenter.php

示例9: flashMessage

 /**
  * Additionally redraws snippet with flash messages.
  *
  * @param        $message
  * @param string $type
  * @return \stdClass|void
  */
 public function flashMessage($message, $type = 'info')
 {
     parent::flashMessage($message, $type);
     $this['flashMessage']->redrawControl();
 }
开发者ID:zaxxx,项目名称:zaxcms,代码行数:12,代码来源:Presenter.php


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