本文整理汇总了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');
}
}
示例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));
}
}
示例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));
}
示例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');
}
示例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');
}
示例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);
}
示例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');
}
}
示例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);
}
示例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('/');
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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');
}
示例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();
}