當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Controller_Action_Helper_FlashMessenger::addMessage方法代碼示例

本文整理匯總了PHP中Zend_Controller_Action_Helper_FlashMessenger::addMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Controller_Action_Helper_FlashMessenger::addMessage方法的具體用法?PHP Zend_Controller_Action_Helper_FlashMessenger::addMessage怎麽用?PHP Zend_Controller_Action_Helper_FlashMessenger::addMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Controller_Action_Helper_FlashMessenger的用法示例。


在下文中一共展示了Zend_Controller_Action_Helper_FlashMessenger::addMessage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkAuth

 public function checkAuth()
 {
     if (!$this->isPublic() && !Zend_Auth::getInstance()->hasIdentity()) {
         $this->_flash->addMessage('You must be logged in');
         $this->_redirector->gotoSimple('login', 'account');
     }
 }
開發者ID:ajbrown,項目名稱:bitnotion,代碼行數:7,代碼來源:Action.php

示例2: _flash

 /**
  * Uklada stavove zpravy
  *
  * @param string $message Zprava
  * @param const $status Status
  * @param bool $nextRequest Zobrazit hned, nebo az pri dalsim requestu
  */
 protected function _flash($message, $status, $nextRequest = true)
 {
     if ($nextRequest == false) {
         $this->view->flash = array('message' => $message, 'status' => $status);
     } else {
         $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');
         $this->_flashMessenger->addMessage(array('message' => $message, 'status' => $status));
     }
 }
開發者ID:besters,項目名稱:My-Base,代碼行數:16,代碼來源:Action.php

示例3: testClearMessages

 public function testClearMessages()
 {
     $this->helper->addMessage('foo');
     $this->helper->addMessage('bar');
     $this->assertTrue($this->helper->hasMessages());
     $this->assertEquals(2, count($this->helper));
     $this->helper->clearMessages();
     $this->assertFalse($this->helper->hasMessages());
     $this->assertEquals(0, count($this->helper));
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:10,代碼來源:FlashMessengerTest.php

示例4: authenticateAction

 public function authenticateAction()
 {
     try {
         $user = Pocs_User::login($this->getRequest()->getParam('un'), $this->getRequest()->getParam('pw'), $this->_getAuth(), $this->_getAcl());
     } catch (Exception $e) {
         $this->_flashMessenger->addMessage($e->getMessage());
         $this->_helper->redirector('index', 'login');
     }
     $this->_flashMessenger->addMessage(Zend_Debug::dump($user, 'Authenticated User', false));
     //TODO: Redirect somewhere useful..
     $this->_helper->redirector('index', 'login');
 }
開發者ID:stm555,項目名稱:proof-of-concepts,代碼行數:12,代碼來源:LoginController.php

示例5: deleteAction

 public function deleteAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper('layout')->disableLayout();
     if ($this->getRequest()->isPost()) {
         $id = $this->_getParam('id', 0);
         $contactDb = new Contacts_Model_DbTable_Contact();
         $contactDb->deleteContact($id);
         $phoneDb = new Contacts_Model_DbTable_Phone();
         $phones = $phoneDb->getPhone($id);
         foreach ($phones as $phone) {
             $phoneDb->deletePhone($phone['id']);
         }
         $emailDb = new Contacts_Model_DbTable_Email();
         $emails = $emailDb->getEmail($id);
         foreach ($emails as $email) {
             $emailDb->deleteEmail($email['id']);
         }
         $internetDb = new Contacts_Model_DbTable_Internet();
         $internets = $internetDb->getInternet($id);
         foreach ($internets as $internet) {
             $internetDb->deleteInternet($internet['id']);
         }
     }
     $this->_flashMessenger->addMessage('MESSAGES_SUCCESFULLY_DELETED');
 }
開發者ID:dewawi,項目名稱:dewawi,代碼行數:26,代碼來源:ContactController.php

示例6: addMessage

 /**
  * addMessage() - Add a message to flash message
  *
  * @param  string $message
  * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface
  */
 public function addMessage($message, $type = self::MSG_SUCCESS)
 {
     $msg = new stdClass();
     $msg->type = $type;
     $msg->message = $message;
     return parent::addMessage($msg);
 }
開發者ID:ncsuwebdev,項目名稱:otframework,代碼行數:13,代碼來源:Messenger.php

示例7: preDispatch

 /**
  * Called before an action is dispatched by Zend_Controller_Dispatcher.
  *
  * This callback allows for proxy or filter behavior.  By altering the
  * request and resetting its dispatched flag (via
  * {@link Zend_Controller_Request_Abstract::setDispatched() setDispatched(false)}),
  * the current action may be skipped.
  *
  * @param  Zend_Controller_Request_Abstract $request
  * @return void
  */
 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $oAuth = Zend_Auth::getInstance();
     $oAcl = $this->getAcl();
     // Default role
     $sRole = 'all';
     if ($oAuth->hasIdentity()) {
         $oIdentity = $oAuth->getIdentity();
         $sRole = isset($oIdentity->sRole) ? $oIdentity->sRole : 'identify';
     }
     $sModule = $request->module;
     $sController = $request->controller;
     $sAction = $request->action;
     $sResource = $sController . ':' . $sAction;
     if ($oAcl->has($sResource)) {
         if (!$oAcl->isAllowed('all', $sResource)) {
             // Access is not allowed
             if (!$oAcl->isAllowed($sRole, $sResource)) {
                 //$flashMessenger = new Zend_Controller_Action_Helper_FlashMessenger();
                 //$flashMessenger->addMessage('Acesso negado');
                 $request->setModuleName('default');
                 $request->setControllerName('index');
                 $request->setActionName('index');
             }
         }
     } else {
         $flashMessenger = new Zend_Controller_Action_Helper_FlashMessenger();
         $flashMessenger->addMessage('Acesso negado');
         $request->setModuleName('default');
         $request->setControllerName('index');
         $request->setActionName('index');
     }
 }
開發者ID:julioprotzek,項目名稱:eventos,代碼行數:44,代碼來源:Acl.php

示例8: addMessage

 /**
  * Agrega un mensaje
  *
  * @param string $message Mensaje a mostrar en pantalla
  * @param string $level   Nivel del mensaje
  *
  * @return void
  */
 public function addMessage($message, $level = self::INFO)
 {
     $msg = new stdClass();
     $msg->message = $message;
     $msg->level = $level;
     parent::addMessage($msg);
 }
開發者ID:luismayta,項目名稱:zrt,代碼行數:15,代碼來源:MyFlashMessenger.php

示例9: verifyEmailAction

 public function verifyEmailAction()
 {
     $user_id = (int) $this->getRequest()->getParam('id');
     $guid = (string) $this->getRequest()->getParam('guid');
     if (!empty($user_id) && !empty($guid)) {
         $model = new Model_User();
         $model = $model->find($user_id);
         if ($model->getEnabled()) {
             $this->_flashMessenger->addMessage("Your account has already been activated, you can now Login.");
             $this->_redirect('/user/login/');
             return;
         }
         if ($guid == hash('sha1', $model->getSalt() . $model->getId() . $model->getPassword())) {
             $model->setEnabled(1);
             $model->setEmailVerified(1);
             $model->save();
             $this->user = $model;
             $this->_flashMessenger->addMessage("Thanks for activating your account, you can now Login.");
             $this->_redirect('/user/login/');
             return;
         } else {
             $this->_redirect('/user/register/');
             return;
         }
     } else {
         $this->_redirect('/');
     }
 }
開發者ID:Zerone,項目名稱:ImJob.org,代碼行數:28,代碼來源:UserController.php

示例10: addMessage

 /**
  * addMessage() - Add a message to flash message
  *
  * @param  string $message
  * @param  string $namespace
  * @return LoSo_Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface
  */
 public function addMessage($message, $namespace = null)
 {
     if (!empty($namespace)) {
         $this->setNamespace($namespace);
     }
     return parent::addMessage($message);
 }
開發者ID:nuxwin,項目名稱:losolib,代碼行數:14,代碼來源:FlashMessenger.php

示例11: addAction

 public function addAction()
 {
     $form = new Front_Form_Contact();
     if ($this->_request->isPost()) {
         $data = $this->_request->getPost();
         if ($form->isValid($data)) {
             $dataFiltrees = $form->getValues();
             $contact = new Application_Model_Contact();
             $contact->setPrenom($dataFiltrees['prenom'])->setNom($dataFiltrees['nom'])->setEmail($dataFiltrees['email'])->setTelephone($dataFiltrees['telephone']);
             $this->mapper->insert($contact);
             $this->_flashMessenger->addMessage('Le contact ' . $contact->getPrenom() . ' a bien été créé');
             $this->_redirector->gotoRouteAndExit(['controller' => 'contact'], null, true);
         }
     }
     $this->view->contactForm = $form;
 }
開發者ID:bioub,項目名稱:Formation_ZF1_Viveris_2016_02,代碼行數:16,代碼來源:ContactController.php

示例12: addMessage

 /**
  * Add a message with a status
  * @param string|array     $message   The message to add. You can group Messages in one status by passing them as an Array
  * @param string $status    The status to add to the message, one of: success, info, warning or danger
  * @param string $namespace The messages namespace
  */
 public function addMessage($message, $status = null, $namespace = null)
 {
     if (!$status) {
         $status = $this->_defaultStatus;
     }
     $message = array($message, $status);
     parent::addMessage($message, $namespace);
     return $this;
 }
開發者ID:GemsTracker,項目名稱:MUtil,代碼行數:15,代碼來源:FlashMessenger.php

示例13: checkRequiredParams

 /**
  * Checks the parameters that are required
  *
  * @param array $requiredParams
  * @return boolean
  */
 public function checkRequiredParams(array $requiredParams)
 {
     $return = true;
     foreach ($requiredParams as $param) {
         if (!$this->_getParam($param)) {
             $this->_flashMessenger->addMessage('Unable to required field ' . $param);
             $return = false;
         }
     }
     return $return;
 }
開發者ID:vishaleyes,項目名稱:cookingwithzend,代碼行數:17,代碼來源:Controller.php

示例14: deleteAction

 public function deleteAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper('layout')->disableLayout();
     if ($this->getRequest()->isPost()) {
         $id = $this->_getParam('id', 0);
         $clientDb = new Admin_Model_DbTable_Client();
         $clientDb->deleteClient($id);
     }
     $this->_flashMessenger->addMessage('MESSAGES_SUCCESFULLY_DELETED');
 }
開發者ID:dewawi,項目名稱:dewawi,代碼行數:11,代碼來源:ClientController.php

示例15: editAction

 public function editAction()
 {
     header('Content-type: application/json');
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper('layout')->disableLayout();
     $request = $this->getRequest();
     $id = $this->_getParam('id', 0);
     $activeTab = $request->getCookie('tab', null);
     $configDb = new Admin_Model_DbTable_Config();
     $config = $configDb->getConfig($id);
     if ($this->isLocked($config['locked'], $config['lockedtime'])) {
         if ($request->isPost()) {
             header('Content-type: application/json');
             $this->_helper->viewRenderer->setNoRender();
             $this->_helper->getHelper('layout')->disableLayout();
             echo Zend_Json::encode(array('message' => $this->view->translate('MESSAGES_LOCKED')));
         } else {
             $this->_flashMessenger->addMessage('MESSAGES_LOCKED');
             $this->_helper->redirector('index');
         }
     } else {
         $configDb->lock($id, $this->_user['id'], $this->_date);
         $form = new Admin_Form_Config();
         if ($request->isPost()) {
             $data = $request->getPost();
             $element = key($data);
             if (isset($form->{$element}) && $form->isValidPartial($data)) {
                 $data['modified'] = $this->_date;
                 $data['modifiedby'] = $this->_user['id'];
                 $configDb = new Admin_Model_DbTable_Config();
                 $configDb->updateConfig($id, $data);
                 echo Zend_Json::encode($configDb->getConfig($id));
             } else {
                 echo Zend_Json::encode(array('message' => $this->view->translate('MESSAGES_FORM_IS_INVALID')));
             }
         }
     }
     $this->view->messages = $this->_flashMessenger->getMessages();
 }
開發者ID:dewawi,項目名稱:dewawi,代碼行數:39,代碼來源:IndexController.php


注:本文中的Zend_Controller_Action_Helper_FlashMessenger::addMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。