本文整理汇总了PHP中Zend_Controller_Action_Helper_FlashMessenger类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action_Helper_FlashMessenger类的具体用法?PHP Zend_Controller_Action_Helper_FlashMessenger怎么用?PHP Zend_Controller_Action_Helper_FlashMessenger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Controller_Action_Helper_FlashMessenger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
}
示例2: 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);
}
示例3: 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);
}
示例4: indexAction
public function indexAction()
{
$toolbar = new Statistics_Form_Toolbar();
$options = $this->_helper->Options->getOptions($toolbar, $this->_user['clientid']);
$params = $this->_helper->Params->getParams($toolbar, $options);
$charts = new Statistics_Model_Charts();
$charts->createCharts(13, 500, 300, $this->view->translate('STATISTICS_UNCATEGORIZED'), $params, $options);
$quotesDb = new Sales_Model_DbTable_Quote();
$quotes = $quotesDb->fetchAll($quotesDb->select()->where('quoteid = ?', 0)->order('id desc')->limit(5));
$this->view->quotes = $quotes;
$salesordersDb = new Sales_Model_DbTable_Salesorder();
$salesorders = $salesordersDb->fetchAll($salesordersDb->select()->where('salesorderid = ?', 0)->order('id desc')->limit(5));
$this->view->salesorders = $salesorders;
$invoicesDb = new Sales_Model_DbTable_Invoice();
$invoices = $invoicesDb->fetchAll($invoicesDb->select()->where('invoiceid = ?', 0)->order('id desc')->limit(5));
$this->view->invoices = $invoices;
$quoterequestsDb = new Purchases_Model_DbTable_Quoterequest();
$quoterequests = $quoterequestsDb->fetchAll($quoterequestsDb->select()->where('quoterequestid = ?', 0)->order('id desc')->limit(5));
$this->view->quoterequests = $quoterequests;
$purchaseordersDb = new Purchases_Model_DbTable_Purchaseorder();
$purchaseorders = $purchaseordersDb->fetchAll($purchaseordersDb->select()->where('purchaseorderid = ?', 0)->order('id desc')->limit(5));
$this->view->purchaseorders = $purchaseorders;
$this->view->options = $options;
$this->view->toolbar = new Application_Form_Toolbar();
$this->view->messages = $this->_flashMessenger->getMessages();
}
示例5: checkAuth
public function checkAuth()
{
if (!$this->isPublic() && !Zend_Auth::getInstance()->hasIdentity()) {
$this->_flash->addMessage('You must be logged in');
$this->_redirector->gotoSimple('login', 'account');
}
}
示例6: _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));
}
}
示例7: 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));
}
示例8: 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');
}
示例9: searchAction
public function searchAction()
{
$this->_helper->viewRenderer->setRender('index');
$this->_helper->getHelper('layout')->disableLayout();
$lenght = $this->_getParam('lenght', 25);
$toolbar = new Statistics_Form_Toolbar();
$options = $this->_helper->Options->getOptions($toolbar, $this->_user['clientid']);
$params = $this->_helper->Params->getParams($toolbar, $options);
$chart = new Statistics_Model_Charts();
$chart->createCharts($lenght, 1000, 400, $this->view->translate("STATISTICS_UNCATEGORIZED"), $params, $options);
$this->view->lenght = $lenght;
$this->view->options = $options;
$this->view->toolbar = $toolbar;
$this->view->messages = $this->_flashMessenger->getMessages();
}
示例10: 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);
}
示例11: postDispatch
/**
* Events after the controller dispatching
*/
public function postDispatch()
{
$infoProfiler = '';
//-------------------------
$request = $this->getRequest();
if ($this->_breadcrumbs) {
$this->view->breadcrumbs = $this->_breadcrumbs;
$this->view->title = $this->_breadcrumbs->getTitle();
}
//Передадим признак Ajax запроса
$this->view->isAjaxRequest = $this->_isAjaxRequest;
//Передадим сообщения в шаблоны
$this->view->messages = $this->_flashMessenger->getMessages();
// Запомним время выполения цикла диспетчеризации
$params = $request->getParams();
foreach ($params as $key => $value) {
if (!is_string($value)) {
continue;
}
if ($infoProfiler) {
$infoProfiler .= "{$key} = {$value}<br>";
} else {
$infoProfiler .= $this->Translate("Время выполнения запроса") . ":<br />{$key} = {$value}<br />";
}
}
$infoProfiler .= "<br />" . $this->Translate("Равно") . " = ";
Default_Plugin_SysBox::profilerTime2Registry($this->_startTimeDispatch, $infoProfiler);
}
示例12: testDirectProxiesToAddMessage
public function testDirectProxiesToAddMessage()
{
$this->markTestSkipped();
$this->helper->direct('foo');
$this->assertTrue($this->helper->hasMessages());
$this->assertEquals(1, count($this->helper));
}
示例13: 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('/');
}
}
示例14: 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;
}
示例15: viewAction
/**
* View feed information
*
* @return void
*/
public function viewAction()
{
//get flash messages
$this->view->messages = $this->_flashMessenger->getMessages();
$id = $this->getRequest()->getParam('id');
//get feedinfo
$feeds = new Feeds();
$this->view->feed = $feeds->getBySlug($id);
if (!$this->view->feed) {
throw new Zend_Exception('Feed doesn\'t exist');
}
$this->view->feed->views++;
$this->view->feed->save();
//get posts
$limit = 5;
$page = $this->getRequest()->getParam('page') ? $this->getRequest()->getParam('page') : 1;
$posts = new Posts();
$this->view->posts = $posts->getByFeedId($this->view->feed->id, $page, $limit);
$total = $posts->getByFeedId($this->view->feed->id, $page, 0, true)->total;
$this->view->paginator = Zend_Paginator::factory($total);
$this->view->paginator->setCurrentPageNumber($page);
$this->view->paginator->setItemCountPerPage($limit);
$this->view->keywords = implode('', array('ifphp', 'news aggragator', 'support,' . $this->view->feed->title));
$this->view->description = 'ifPHP, The PHP news Aggragator: ' . $this->view->feed->description;
}