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