Mage_Core_Controller_Varien_Action Class Reference

Inheritance diagram for Mage_Core_Controller_Varien_Action:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Front_Action Mage_Install_Controller_Action Mage_Adminhtml_Api_RoleController Mage_Adminhtml_Api_UserController Mage_Adminhtml_Catalog_CategoryController Mage_Adminhtml_Catalog_DatafeedsController Mage_Adminhtml_Catalog_Product_Action_AttributeController Mage_Adminhtml_Catalog_Product_AttributeController Mage_Adminhtml_Catalog_Product_GalleryController Mage_Adminhtml_Catalog_Product_GroupController Mage_Adminhtml_Catalog_Product_ReviewController Mage_Adminhtml_Catalog_Product_SetController Mage_Adminhtml_Catalog_ProductController Mage_Adminhtml_Catalog_SearchController Mage_Adminhtml_CatalogController Mage_Adminhtml_Checkout_AgreementController Mage_Adminhtml_Cms_BlockController Mage_Adminhtml_Cms_PageController Mage_Adminhtml_Controller_Sales_Creditmemo Mage_Adminhtml_Controller_Sales_Invoice Mage_Adminhtml_Controller_Sales_Shipment Mage_Adminhtml_Customer_ConfigController Mage_Adminhtml_Customer_GroupController Mage_Adminhtml_Customer_OnlineController Mage_Adminhtml_CustomerController Mage_Adminhtml_DashboardController Mage_Adminhtml_Extensions_ConfigController Mage_Adminhtml_Extensions_ConsoleController Mage_Adminhtml_Extensions_CustomController Mage_Adminhtml_Extensions_FileController Mage_Adminhtml_Extensions_LocalController Mage_Adminhtml_Extensions_RemoteController Mage_Adminhtml_IndexController Mage_Adminhtml_JsonController Mage_Adminhtml_Media_EditorController Mage_Adminhtml_Media_UploaderController Mage_Adminhtml_Newsletter_ProblemController Mage_Adminhtml_Newsletter_QueueController Mage_Adminhtml_Newsletter_SubscriberController Mage_Adminhtml_Newsletter_TemplateController Mage_Adminhtml_NotificationController Mage_Adminhtml_Permissions_RoleController Mage_Adminhtml_Permissions_UserController Mage_Adminhtml_Poll_AnswerController Mage_Adminhtml_PollController Mage_Adminhtml_Promo_CatalogController Mage_Adminhtml_Promo_QuoteController Mage_Adminhtml_Promo_WidgetController Mage_Adminhtml_PromoController Mage_Adminhtml_RatingController Mage_Adminhtml_Report_CustomerController Mage_Adminhtml_Report_ProductController Mage_Adminhtml_Report_ReviewController Mage_Adminhtml_Report_SalesController Mage_Adminhtml_Report_ShopcartController Mage_Adminhtml_Report_TagController Mage_Adminhtml_ReportController Mage_Adminhtml_Rss_CatalogController Mage_Adminhtml_Rss_OrderController Mage_Adminhtml_Sales_Order_CreateController Mage_Adminhtml_Sales_Order_View_GiftmessageController Mage_Adminhtml_Sales_OrderController Mage_Adminhtml_SalesController Mage_Adminhtml_SitemapController Mage_Adminhtml_System_AccountController Mage_Adminhtml_System_BackupController Mage_Adminhtml_System_CacheController Mage_Adminhtml_System_ConfigController Mage_Adminhtml_System_Convert_ProfileController Mage_Adminhtml_System_CurrencyController Mage_Adminhtml_System_DesignController Mage_Adminhtml_System_Email_TemplateController Mage_Adminhtml_System_StoreController Mage_Adminhtml_SystemController Mage_Adminhtml_TagController Mage_Adminhtml_Tax_Class_CustomerController Mage_Adminhtml_Tax_Class_ProductController Mage_Adminhtml_Tax_ClassController Mage_Adminhtml_Tax_RateController Mage_Adminhtml_Tax_RuleController Mage_Adminhtml_UrlrewriteController Mage_Bundle_SelectionController Mage_Compiler_ProcessController Mage_Downloadable_FileController Mage_GoogleBase_ItemsController Mage_GoogleBase_SelectionController Mage_GoogleBase_TypesController Mage_GoogleOptimizer_IndexController Mage_AmazonPayments_AspController Mage_AmazonPayments_CbaController Mage_Api_Controller_Action Mage_Catalog_CategoryController Mage_Catalog_IndexController Mage_Catalog_Product_CompareController Mage_Catalog_ProductController Mage_Catalog_Seo_SitemapController Mage_CatalogSearch_AdvancedController Mage_CatalogSearch_AjaxController Mage_CatalogSearch_ResultController Mage_CatalogSearch_TermController Mage_Checkout_CartController Mage_Checkout_Controller_Action Mage_Checkout_IndexController Mage_Checkout_Multishipping_AddressController Mage_Cms_IndexController Mage_Cms_PageController Mage_Contacts_IndexController Mage_Core_AjaxController Mage_Core_IndexController Mage_Customer_AccountController Mage_Customer_AddressController Mage_Customer_ReviewController Mage_Directory_CurrencyController Mage_Downloadable_CustomerController Mage_Downloadable_DownloadController Mage_GiftMessage_IndexController Mage_GoogleCheckout_ApiController Mage_GoogleCheckout_RedirectController Mage_Newsletter_ManageController Mage_Newsletter_SubscriberController Mage_Paypal_ExpressController Mage_Paypal_StandardController Mage_PaypalUk_ExpressController Mage_Poll_VoteController Mage_ProductAlert_AddController Mage_ProductAlert_UnsubscribeController Mage_Review_CustomerController Mage_Review_ProductController Mage_Rss_CatalogController Mage_Rss_IndexController Mage_Rss_OrderController Mage_Sales_DownloadController Mage_Sales_OrderController Mage_Sendfriend_ProductController Mage_Shipping_ShippingController Mage_Shipping_TrackingController Mage_Tag_CustomerController Mage_Tag_IndexController Mage_Tag_ListController Mage_Tag_ProductController Mage_Wishlist_IndexController Mage_Wishlist_SharedController Mage_Install_IndexController Mage_Install_WizardController

List of all members.

Public Member Functions

 __construct (Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs=array())
 hasAction ($action)
 getRequest ()
 getResponse ()
 getFlag ($action, $flag='')
 setFlag ($action, $flag, $value)
 getFullActionName ($delimiter='_')
 getLayout ()
 loadLayout ($handles=null, $generateBlocks=true, $generateXml=true)
 addActionLayoutHandles ()
 loadLayoutUpdates ()
 generateLayoutXml ()
 generateLayoutBlocks ()
 renderLayout ($output='')
 dispatch ($action)
 getActionMethodName ($action)
 preDispatch ()
 postDispatch ()
 norouteAction ($coreRoute=null)
 noCookiesAction ()

Public Attributes

const FLAG_NO_CHECK_INSTALLATION = 'no-install-check'
const FLAG_NO_DISPATCH = 'no-dispatch'
const FLAG_NO_PRE_DISPATCH = 'no-preDispatch'
const FLAG_NO_POST_DISPATCH = 'no-postDispatch'
const FLAG_NO_START_SESSION = 'no-startSession'
const FLAG_NO_DISPATCH_BLOCK_EVENT = 'no-beforeGenerateLayoutBlocksDispatch'
const FLAG_NO_COOKIES_REDIRECT = 'no-cookies-redirect'
const PARAM_NAME_SUCCESS_URL = 'success_url'
const PARAM_NAME_ERROR_URL = 'error_url'
const PARAM_NAME_REFERER_URL = 'referer_url'
const PARAM_NAME_BASE64_URL = 'r64'
const PARAM_NAME_URL_ENCODED = 'uenc'
const PROFILER_KEY = 'mage::dispatch::controller::action'

Protected Member Functions

 _construct ()
 _forward ($action, $controller=null, $module=null, array $params=null)
 _initLayoutMessages ($messagesStorage)
 _redirectUrl ($url)
 _redirect ($path, $arguments=array())
 _redirectSuccess ($defaultUrl)
 _redirectError ($defaultUrl)
 _redirectReferer ($defaultUrl=null)
 _getRefererUrl ()
 _isUrlInternal ($url)
 _getRealModuleName ()
 _rewrite ()
 _validateFormKey ()

Protected Attributes

 $_request
 $_response
 $_realModuleName
 $_flags = array()
 $_cookieCheckActions = array()


Detailed Description

Definition at line 37 of file Action.php.


Constructor & Destructor Documentation

__construct ( Zend_Controller_Request_Abstract $  request,
Zend_Controller_Response_Abstract $  response,
array invokeArgs = array() 
)

Constructor

Parameters:
Zend_Controller_Request_Abstract $request
Zend_Controller_Response_Abstract $response
array $invokeArgs

Definition at line 99 of file Action.php.

00100     {
00101         $this->_request = $request;
00102         $this->_response= $response;
00103 
00104         Mage::app()->getFrontController()->setAction($this);
00105 
00106         $this->_construct();
00107     }


Member Function Documentation

_construct (  )  [protected]

_forward ( action,
controller = null,
module = null,
array params = null 
) [protected]

Reimplemented in Mage_Adminhtml_Controller_Action.

Definition at line 531 of file Action.php.

00532     {
00533         $request = $this->getRequest();
00534 
00535         if (!is_null($params)) {
00536             $request->setParams($params);
00537         }
00538 
00539         if (!is_null($controller)) {
00540             $request->setControllerName($controller);
00541 
00542             // Module should only be reset if controller has been specified
00543             if (!is_null($module)) {
00544                 $request->setModuleName($module);
00545             }
00546         }
00547 
00548         $request->setActionName($action)
00549             ->setDispatched(false);
00550     }

_getRealModuleName (  )  [protected]

Get real module name (like 'Mage_Module')

Returns:
string

Definition at line 692 of file Action.php.

00693     {
00694         if (empty($this->_realModuleName)) {
00695             $class = get_class($this);
00696             $this->_realModuleName = substr(
00697                 $class,
00698                 0,
00699                 strpos(strtolower($class), '_' . strtolower($this->getRequest()->getControllerName() . 'Controller'))
00700             );
00701         }
00702         return $this->_realModuleName;
00703     }

_getRefererUrl (  )  [protected]

Identify referer url via all accepted methods (HTTP_REFERER, regular or base64-encoded request param)

Returns:
string

Definition at line 648 of file Action.php.

00649     {
00650         $refererUrl = $this->getRequest()->getServer('HTTP_REFERER');
00651         if ($url = $this->getRequest()->getParam(self::PARAM_NAME_REFERER_URL)) {
00652             $refererUrl = $url;
00653         }
00654         if ($url = $this->getRequest()->getParam(self::PARAM_NAME_BASE64_URL)) {
00655             $refererUrl = Mage::helper('core')->urlDecode($url);
00656         }
00657         if ($url = $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED)) {
00658             $refererUrl = Mage::helper('core')->urlDecode($url);
00659         }
00660 
00661         if (!$this->_isUrlInternal($refererUrl)) {
00662             $refererUrl = Mage::app()->getStore()->getBaseUrl();
00663         }
00664         return $refererUrl;
00665     }

_initLayoutMessages ( messagesStorage  )  [protected]

Definition at line 552 of file Action.php.

00553     {
00554         if ($storage = Mage::getSingleton($messagesStorage)) {
00555             $this->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
00556         }
00557         else {
00558             Mage::throwException(
00559                  Mage::helper('core')->__('Invalid messages storage "%s" for layout messages initialization', (string)$messagesStorage)
00560             );
00561         }
00562         return $this;
00563     }

_isUrlInternal ( url  )  [protected]

Check url to be used as internal

Parameters:
string $url
Returns:
bool

Url must start from base secure or base unsecure url

Definition at line 673 of file Action.php.

00674     {
00675         if (strpos($url, 'http') !== false) {
00676             /**
00677              * Url must start from base secure or base unsecure url
00678              */
00679             if ((strpos($url, Mage::app()->getStore()->getBaseUrl()) === 0)
00680                 || (strpos($url, Mage::app()->getStore()->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, true)) === 0)) {
00681                 return true;
00682             }
00683         }
00684         return false;
00685     }

_redirect ( path,
arguments = array() 
) [protected]

Set redirect into responce

Parameters:
string $path
array $arguments

Reimplemented in Mage_Adminhtml_Controller_Action.

Definition at line 583 of file Action.php.

00584     {
00585         $this->getResponse()->setRedirect(Mage::getUrl($path, $arguments));
00586         return $this;
00587     }

_redirectError ( defaultUrl  )  [protected]

Redirect to error page

Parameters:
string $defaultUrl

Definition at line 612 of file Action.php.

00613     {
00614         $errorUrl = $this->getRequest()->getParam(self::PARAM_NAME_ERROR_URL);
00615         if (empty($errorUrl)) {
00616             $errorUrl = $defaultUrl;
00617         }
00618         if (!$this->_isUrlInternal($errorUrl)) {
00619             $errorUrl = Mage::app()->getStore()->getBaseUrl();
00620         }
00621         $this->getResponse()->setRedirect($errorUrl);
00622         return $this;
00623     }

_redirectReferer ( defaultUrl = null  )  [protected]

Set referer url for redirect in responce

Parameters:
string $defaultUrl
Returns:
Mage_Core_Controller_Varien_Action

Reimplemented in Mage_Adminhtml_Controller_Action.

Definition at line 631 of file Action.php.

00632     {
00633 
00634         $refererUrl = $this->_getRefererUrl();
00635         if (empty($refererUrl)) {
00636             $refererUrl = empty($defaultUrl) ? Mage::getBaseUrl() : $defaultUrl;
00637         }
00638 
00639         $this->getResponse()->setRedirect($refererUrl);
00640         return $this;
00641     }

_redirectSuccess ( defaultUrl  )  [protected]

Redirect to success page

Parameters:
string $defaultUrl

Definition at line 594 of file Action.php.

00595     {
00596         $successUrl = $this->getRequest()->getParam(self::PARAM_NAME_SUCCESS_URL);
00597         if (empty($successUrl)) {
00598             $successUrl = $defaultUrl;
00599         }
00600         if (!$this->_isUrlInternal($successUrl)) {
00601             $successUrl = Mage::app()->getStore()->getBaseUrl();
00602         }
00603         $this->getResponse()->setRedirect($successUrl);
00604         return $this;
00605     }

_redirectUrl ( url  )  [protected]

Set redirect url into response

Parameters:
string $url
Returns:
Mage_Core_Controller_Varien_Action

Definition at line 571 of file Action.php.

00572     {
00573         $this->getResponse()->setRedirect($url);
00574         return $this;
00575     }

_rewrite (  )  [protected]

Support for controllers rewrites

Example of configuration: <global> <routers> <core_module> <rewrite> <core_controller> <to>new_route/new_controller</to> <override_actions>true</override_actions> <actions> <core_action><to>new_module/new_controller/new_action</core_action> </actions> <core_controller> </rewrite> </core_module> </routers> </global>

This will override: 1. core_module/core_controller/core_action to new_module/new_controller/new_action 2. all other actions of core_module/core_controller to new_module/new_controller

Returns:
boolean true if rewrite happened

Definition at line 731 of file Action.php.

00732     {
00733         $route = $this->getRequest()->getRouteName();
00734         $controller = $this->getRequest()->getControllerName();
00735         $action = $this->getRequest()->getActionName();
00736 
00737         $rewrite = Mage::getConfig()->getNode('global/routers/'.$route.'/rewrite/'.$controller);
00738         if (!$rewrite) {
00739             return false;
00740         }
00741 
00742         if (!($rewrite->actions && $rewrite->actions->$action) || $rewrite->is('override_actions')) {
00743             $t = explode('/', (string)$rewrite->to);
00744             if (sizeof($t)!==2 || empty($t[0]) || empty($t[1])) {
00745                 return false;
00746             }
00747             $t[2] = $action;
00748         } else {
00749             $t = explode('/', (string)$rewrite->actions->$action->to);
00750             if (sizeof($t)!==3 || empty($t[0]) || empty($t[1]) || empty($t[2])) {
00751                 return false;
00752             }
00753         }
00754 
00755         $this->_forward(
00756             $t[2]==='*' ? $action : $t[2],
00757             $t[1]==='*' ? $controller : $t[1],
00758             $t[0]==='*' ? $route : $t[0]
00759         );
00760 
00761         return true;
00762     }

_validateFormKey (  )  [protected]

Validate Form Key

Returns:
bool

Definition at line 769 of file Action.php.

00770     {
00771         if (!($formKey = $this->getRequest()->getParam('form_key', null))
00772             || $formKey != Mage::getSingleton('core/session')->getFormKey()) {
00773             return false;
00774         }
00775         return true;
00776     }

addActionLayoutHandles (  ) 

Definition at line 236 of file Action.php.

00237     {
00238         $update = $this->getLayout()->getUpdate();
00239 
00240         // load store handle
00241         $update->addHandle('STORE_'.Mage::app()->getStore()->getCode());
00242 
00243         // load theme handle
00244         $package = Mage::getSingleton('core/design_package');
00245         $update->addHandle('THEME_'.$package->getArea().'_'.$package->getPackageName().'_'.$package->getTheme('layout'));
00246 
00247         // load action handle
00248         $update->addHandle(strtolower($this->getFullActionName()));
00249 
00250         return $this;
00251     }

dispatch ( action  ) 

preDispatch() didn't change the action, so we can continue

Definition at line 355 of file Action.php.

00356     {
00357         try {
00358             $actionMethodName = $this->getActionMethodName($action);
00359 
00360             if (!is_callable(array($this, $actionMethodName))) {
00361                 $actionMethodName = 'norouteAction';
00362             }
00363 
00364             Varien_Profiler::start(self::PROFILER_KEY.'::predispatch');
00365             $this->preDispatch();
00366             Varien_Profiler::stop(self::PROFILER_KEY.'::predispatch');
00367 
00368             if ($this->getRequest()->isDispatched()) {
00369                 /**
00370                  * preDispatch() didn't change the action, so we can continue
00371                  */
00372                 if (!$this->getFlag('', self::FLAG_NO_DISPATCH)) {
00373                     $_profilerKey = self::PROFILER_KEY.'::'.$this->getFullActionName();
00374 
00375                     Varien_Profiler::start($_profilerKey);
00376                     $this->$actionMethodName();
00377                     Varien_Profiler::stop($_profilerKey);
00378 
00379                     Varien_Profiler::start(self::PROFILER_KEY.'::postdispatch');
00380                     $this->postDispatch();
00381                     Varien_Profiler::stop(self::PROFILER_KEY.'::postdispatch');
00382                 }
00383             }
00384         }
00385         catch (Mage_Core_Controller_Varien_Exception $e) {
00386             // set prepared flags
00387             foreach ($e->getResultFlags() as $flagData) {
00388                 list($action, $flag, $value) = $flagData;
00389                 $this->setFlag($action, $flag, $value);
00390             }
00391             // call forward, redirect or an action
00392             list($method, $parameters) = $e->getResultCallback();
00393             switch ($method) {
00394                 case Mage_Core_Controller_Varien_Exception::RESULT_REDIRECT:
00395                     list($path, $arguments) = $parameters;
00396                     $this->_redirect($path, $arguments);
00397                     break;
00398                 case Mage_Core_Controller_Varien_Exception::RESULT_FORWARD:
00399                     list($action, $controller, $module, $params) = $parameters;
00400                     $this->_forward($action, $controller, $module, $params);
00401                     break;
00402                 default:
00403                     $actionMethodName = $this->getActionMethodName($method);
00404                     $this->getRequest()->setActionName($method);
00405                     $this->$actionMethodName($method);
00406                     break;
00407             }
00408         }
00409     }

generateLayoutBlocks (  ) 

Definition at line 290 of file Action.php.

00291     {
00292         $_profilerKey = self::PROFILER_KEY . '::' . $this->getFullActionName();
00293         // dispatch event for adding xml layout elements
00294         if(!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) {
00295             Mage::dispatchEvent(
00296                 'controller_action_layout_generate_blocks_before',
00297                 array('action'=>$this, 'layout'=>$this->getLayout())
00298             );
00299         }
00300 
00301         // generate blocks from xml layout
00302         Varien_Profiler::start("$_profilerKey::layout_generate_blocks");
00303         $this->getLayout()->generateBlocks();
00304         Varien_Profiler::stop("$_profilerKey::layout_generate_blocks");
00305 
00306         if(!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) {
00307             Mage::dispatchEvent(
00308                 'controller_action_layout_generate_blocks_after',
00309                 array('action'=>$this, 'layout'=>$this->getLayout())
00310             );
00311         }
00312 
00313         return $this;
00314     }

generateLayoutXml (  ) 

Definition at line 271 of file Action.php.

00272     {
00273         $_profilerKey = self::PROFILER_KEY . '::' . $this->getFullActionName();
00274         // dispatch event for adding text layouts
00275         if(!$this->getFlag('', self::FLAG_NO_DISPATCH_BLOCK_EVENT)) {
00276             Mage::dispatchEvent(
00277                 'controller_action_layout_generate_xml_before',
00278                 array('action'=>$this, 'layout'=>$this->getLayout())
00279             );
00280         }
00281 
00282         // generate xml from collected text updates
00283         Varien_Profiler::start("$_profilerKey::layout_generate_xml");
00284         $this->getLayout()->generateXml();
00285         Varien_Profiler::stop("$_profilerKey::layout_generate_xml");
00286 
00287         return $this;
00288     }

getActionMethodName ( action  ) 

Definition at line 411 of file Action.php.

00412     {
00413         $method = $action.'Action';
00414         return $method;
00415     }

getFlag ( action,
flag = '' 
)

Retrieve flag value

Parameters:
string $action
string $flag
Returns:
bool

Definition at line 146 of file Action.php.

00147     {
00148         if (''===$action) {
00149             $action = $this->getRequest()->getActionName();
00150         }
00151         if (''===$flag) {
00152             return $this->_flags;
00153         }
00154         elseif (isset($this->_flags[$action][$flag])) {
00155             return $this->_flags[$action][$flag];
00156         }
00157         else {
00158             return false;
00159         }
00160     }

getFullActionName ( delimiter = '_'  ) 

Retrieve full bane of current action current controller and current module

Parameters:
string $delimiter
Returns:
string

Definition at line 186 of file Action.php.

00187     {
00188         return $this->getRequest()->getRouteName().$delimiter.
00189             $this->getRequest()->getControllerName().$delimiter.
00190             $this->getRequest()->getActionName();
00191     }

getLayout (  ) 

Retrieve current layout object

Returns:
Mage_Core_Model_Layout

Definition at line 198 of file Action.php.

00199     {
00200         return Mage::getSingleton('core/layout');
00201     }

getRequest (  ) 

Retrieve request object

Returns:
Mage_Core_Controller_Request_Http

Definition at line 124 of file Action.php.

00125     {
00126         return $this->_request;
00127     }

getResponse (  ) 

Retrieve response object

Returns:
Mage_Core_Controller_Response_Http

Definition at line 134 of file Action.php.

00135     {
00136         return $this->_response;
00137     }

hasAction ( action  ) 

Definition at line 114 of file Action.php.

00115     {
00116         return is_callable(array($this, $this->getActionMethodName($action)));
00117     }

loadLayout ( handles = null,
generateBlocks = true,
generateXml = true 
)

Load layout by handles(s)

Parameters:
string $handles
string $cacheId
boolean $generateBlocks
Returns:
Mage_Core_Controller_Varien_Action

Reimplemented in Mage_Adminhtml_Controller_Action.

Definition at line 211 of file Action.php.

00212     {
00213         // if handles were specified in arguments load them first
00214         if (false!==$handles && ''!==$handles) {
00215             $this->getLayout()->getUpdate()->addHandle($handles ? $handles : 'default');
00216         }
00217 
00218         // add default layout handles for this action
00219         $this->addActionLayoutHandles();
00220 
00221         $this->loadLayoutUpdates();
00222 
00223         if (!$generateXml) {
00224             return $this;
00225         }
00226         $this->generateLayoutXml();
00227 
00228         if (!$generateBlocks) {
00229             return $this;
00230         }
00231         $this->generateLayoutBlocks();
00232 
00233         return $this;
00234     }

loadLayoutUpdates (  ) 

Definition at line 253 of file Action.php.

00254     {
00255         $_profilerKey = self::PROFILER_KEY . '::' .$this->getFullActionName();
00256 
00257         // dispatch event for adding handles to layout update
00258         Mage::dispatchEvent(
00259             'controller_action_layout_load_before',
00260             array('action'=>$this, 'layout'=>$this->getLayout())
00261         );
00262 
00263         // load layout updates by specified handles
00264         Varien_Profiler::start("$_profilerKey::layout_load");
00265         $this->getLayout()->getUpdate()->load();
00266         Varien_Profiler::stop("$_profilerKey::layout_load");
00267 
00268         return $this;
00269     }

noCookiesAction (  ) 

Reimplemented in Mage_Cms_IndexController.

Definition at line 509 of file Action.php.

00510     {
00511         $redirect = new Varien_Object();
00512         Mage::dispatchEvent('controller_action_nocookies', array(
00513             'action'    => $this,
00514             'redirect'  => $redirect
00515         ));
00516 
00517         if ($url = $redirect->getRedirectUrl()) {
00518             $this->_redirectUrl($url);
00519         }
00520         elseif ($redirect->getRedirect()) {
00521             $this->_redirect($redirect->getPath(), $redirect->getArguments());
00522         }
00523         else {
00524             $this->loadLayout(array('default', 'noCookie'));
00525             $this->renderLayout();
00526         }
00527 
00528         $this->getRequest()->setDispatched(true);
00529     }

norouteAction ( coreRoute = null  ) 

Reimplemented in Mage_Adminhtml_Controller_Action.

Definition at line 486 of file Action.php.

00487     {
00488         $status = ( $this->getRequest()->getParam('__status__') )
00489             ? $this->getRequest()->getParam('__status__')
00490             : new Varien_Object();
00491 
00492         Mage::dispatchEvent('controller_action_noroute', array('action'=>$this, 'status'=>$status));
00493         if ($status->getLoaded() !== true
00494             || $status->getForwarded() === true
00495             || !is_null($coreRoute) ) {
00496             $this->loadLayout(array('default', 'noRoute'));
00497             $this->renderLayout();
00498         } else {
00499             $status->setForwarded(true);
00500             #$this->_forward('cmsNoRoute', 'index', 'cms');
00501             $this->_forward(
00502                 $status->getForwardAction(),
00503                 $status->getForwardController(),
00504                 $status->getForwardModule(),
00505                 array('__status__' => $status));
00506         }
00507     }

postDispatch (  ) 

Dispatches event after action

Reimplemented in Mage_Core_Controller_Front_Action.

Definition at line 469 of file Action.php.

00470     {
00471         if ($this->getFlag('', self::FLAG_NO_POST_DISPATCH)) {
00472             return;
00473         }
00474 
00475         Mage::dispatchEvent(
00476             'controller_action_postdispatch_'.$this->getFullActionName(),
00477             array('controller_action'=>$this)
00478         );
00479         Mage::dispatchEvent(
00480             'controller_action_postdispatch_'.$this->getRequest()->getRouteName(),
00481             array('controller_action'=>$this)
00482         );
00483         Mage::dispatchEvent('controller_action_postdispatch', array('controller_action'=>$this));
00484     }

preDispatch (  ) 

Dispatches event before action

Reimplemented in Mage_Adminhtml_Controller_Action, Mage_Adminhtml_Catalog_Product_AttributeController, Mage_Adminhtml_Rss_CatalogController, Mage_Adminhtml_Rss_OrderController, Mage_Api_Controller_Action, Mage_Catalog_Seo_SitemapController, Mage_CatalogSearch_TermController, Mage_Checkout_MultishippingController, Mage_Checkout_OnepageController, Mage_Compiler_ProcessController, Mage_Contacts_IndexController, Mage_Core_Controller_Front_Action, Mage_Customer_AccountController, Mage_Customer_AddressController, Mage_Downloadable_CustomerController, Mage_Install_IndexController, Mage_Install_WizardController, Mage_Newsletter_ManageController, Mage_ProductAlert_AddController, Mage_ProductAlert_UnsubscribeController, Mage_Review_ProductController, Mage_Sales_OrderController, and Mage_Wishlist_IndexController.

Definition at line 420 of file Action.php.

00421     {
00422         if (!$this->getFlag('', self::FLAG_NO_CHECK_INSTALLATION)) {
00423             if (!Mage::isInstalled()) {
00424                 $this->setFlag('', self::FLAG_NO_DISPATCH, true);
00425                 $this->_redirect('install');
00426                 return;
00427             }
00428         }
00429 
00430         if ($this->_rewrite()) {
00431             return;
00432         }
00433 
00434         if (!$this->getFlag('', self::FLAG_NO_START_SESSION)) {
00435             $namespace   = $this->getLayout()->getArea();
00436             $checkCookie = in_array($this->getRequest()->getActionName(), $this->_cookieCheckActions);
00437             if ($checkCookie && !Mage::getSingleton('core/cookie')->get($namespace)) {
00438                 $this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, true);
00439             }
00440             Mage::getSingleton('core/session', array('name' => $namespace))->start();
00441         }
00442 
00443         Mage::app()->loadArea($this->getLayout()->getArea());
00444 
00445         if ($this->getFlag('', self::FLAG_NO_COOKIES_REDIRECT) && Mage::getStoreConfig('web/browser_capabilities/cookies')) {
00446             $this->_forward('noCookies', 'index', 'core');
00447             return;
00448         }
00449 
00450         if ($this->getFlag('', self::FLAG_NO_PRE_DISPATCH)) {
00451             return;
00452         }
00453 
00454         Mage::dispatchEvent('controller_action_predispatch', array('controller_action'=>$this));
00455         Mage::dispatchEvent(
00456             'controller_action_predispatch_'.$this->getRequest()->getRouteName(),
00457             array('controller_action'=>$this)
00458         );
00459         Varien_Autoload::registerScope($this->getRequest()->getRouteName());
00460         Mage::dispatchEvent(
00461             'controller_action_predispatch_'.$this->getFullActionName(),
00462             array('controller_action'=>$this)
00463         );
00464     }

renderLayout ( output = ''  ) 

Rendering layout

Parameters:
string $output
Returns:
Mage_Core_Controller_Varien_Action

Definition at line 322 of file Action.php.

00323     {
00324         $_profilerKey = self::PROFILER_KEY . '::' . $this->getFullActionName();
00325 
00326         if ($this->getFlag('', 'no-renderLayout')) {
00327             return;
00328         }
00329 
00330         if (Mage::app()->getFrontController()->getNoRender()) {
00331             return;
00332         }
00333 
00334         Varien_Profiler::start("$_profilerKey::layout_render");
00335 
00336 
00337         if (''!==$output) {
00338             $this->getLayout()->addOutputBlock($output);
00339         }
00340 
00341         Mage::dispatchEvent('controller_action_layout_render_before');
00342         Mage::dispatchEvent('controller_action_layout_render_before_'.$this->getFullActionName());
00343 
00344         #ob_implicit_flush();
00345         $this->getLayout()->setDirectOutput(false);
00346 
00347         $output = $this->getLayout()->getOutput();
00348 
00349         $this->getResponse()->appendBody($output);
00350         Varien_Profiler::stop("$_profilerKey::layout_render");
00351 
00352         return $this;
00353     }

setFlag ( action,
flag,
value 
)

Setting flag value

Parameters:
string $action
string $flag
string $value
Returns:
Mage_Core_Controller_Varien_Action

Definition at line 170 of file Action.php.

00171     {
00172         if (''===$action) {
00173             $action = $this->getRequest()->getActionName();
00174         }
00175         $this->_flags[$action][$flag] = $value;
00176         return $this;
00177     }


Member Data Documentation

$_cookieCheckActions = array() [protected]

$_flags = array() [protected]

Definition at line 83 of file Action.php.

$_realModuleName [protected]

Definition at line 74 of file Action.php.

$_request [protected]

Definition at line 60 of file Action.php.

$_response [protected]

Definition at line 67 of file Action.php.

const FLAG_NO_CHECK_INSTALLATION = 'no-install-check'

Definition at line 39 of file Action.php.

const FLAG_NO_COOKIES_REDIRECT = 'no-cookies-redirect'

Definition at line 45 of file Action.php.

const FLAG_NO_DISPATCH = 'no-dispatch'

Definition at line 40 of file Action.php.

const FLAG_NO_DISPATCH_BLOCK_EVENT = 'no-beforeGenerateLayoutBlocksDispatch'

Definition at line 44 of file Action.php.

const FLAG_NO_POST_DISPATCH = 'no-postDispatch'

Definition at line 42 of file Action.php.

const FLAG_NO_PRE_DISPATCH = 'no-preDispatch'

Definition at line 41 of file Action.php.

const FLAG_NO_START_SESSION = 'no-startSession'

Definition at line 43 of file Action.php.

const PARAM_NAME_BASE64_URL = 'r64'

Definition at line 50 of file Action.php.

const PARAM_NAME_ERROR_URL = 'error_url'

Definition at line 48 of file Action.php.

const PARAM_NAME_REFERER_URL = 'referer_url'

Definition at line 49 of file Action.php.

const PARAM_NAME_SUCCESS_URL = 'success_url'

Definition at line 47 of file Action.php.

const PARAM_NAME_URL_ENCODED = 'uenc'

Definition at line 51 of file Action.php.

const PROFILER_KEY = 'mage::dispatch::controller::action'

Definition at line 53 of file Action.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:54 2009 for Magento by  doxygen 1.5.8