本文整理汇总了PHP中Mage_Core_Controller_Request_Http::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http::getParams方法的具体用法?PHP Mage_Core_Controller_Request_Http::getParams怎么用?PHP Mage_Core_Controller_Request_Http::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Controller_Request_Http
的用法示例。
在下文中一共展示了Mage_Core_Controller_Request_Http::getParams方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFromRequest
/**
* @param Mage_Core_Controller_Request_Http $request
* @return string
* @throws Mage_Core_Exception
*/
public function initFromRequest(Mage_Core_Controller_Request_Http $request)
{
if ($request->getParam('expert_mode') == 'on') {
$cronExpression = $request->getParam('cron_expr');
return $cronExpression;
}
try {
// easy mapping
$params = $request->getParams();
$data = new Noovias_Cron_Data_CronExpression($params);
//
$cronExpression = $this->getGenerationService()->generateCronExprFromDataObject($data);
return $cronExpression;
} catch (Exception $e) {
throw new Mage_Core_Exception($e->getMessage());
}
}
示例2: validateSystemStore
/**
* Validate Manage Stores pages actions
*
* @param Mage_Adminhtml_Controller_Action $controller
*/
public function validateSystemStore($controller)
{
// due to design of the original controller, need to run this check only once, on the first dispatch
if (Mage::registry('enterprise_admingws_system_store_matched')) {
return;
} elseif (in_array($this->_request->getActionName(), array('save', 'newWebsite', 'newGroup', 'newStore', 'editWebsite', 'editGroup', 'editStore', 'deleteWebsite', 'deleteWebsitePost', 'deleteGroup', 'deleteGroupPost', 'deleteStore', 'deleteStorePost'))) {
Mage::register('enterprise_admingws_system_store_matched', true, true);
}
switch ($this->_request->getActionName()) {
case 'save':
$params = $this->_request->getParams();
if (isset($params['website'])) {
return $this->_forward();
}
if (isset($params['store']) || isset($params['group'])) {
if (!$this->_role->getWebsiteIds()) {
return $this->_forward();
}
// preventing saving stores/groups for wrong website is handled by their models
}
break;
case 'newWebsite':
return $this->_forward();
break;
case 'newGroup':
// break intentionally omitted
// break intentionally omitted
case 'newStore':
if (!$this->_role->getWebsiteIds()) {
return $this->_forward();
}
break;
case 'editWebsite':
if (!$this->_role->hasWebsiteAccess($this->_request->getParam('website_id'))) {
return $this->_forward();
}
break;
case 'editGroup':
if (!$this->_role->hasStoreGroupAccess($this->_request->getParam('group_id'))) {
return $this->_forward();
}
break;
case 'editStore':
if (!$this->_role->hasStoreAccess($this->_request->getParam('store_id'))) {
return $this->_forward();
}
break;
case 'deleteWebsite':
// break intentionally omitted
// break intentionally omitted
case 'deleteWebsitePost':
return $this->_forward();
break;
case 'deleteGroup':
// break intentionally omitted
// break intentionally omitted
case 'deleteGroupPost':
if ($group = $this->_role->getGroup($this->_request->getParam('item_id'))) {
if ($this->_role->hasWebsiteAccess($group->getWebsiteId(), true)) {
return;
}
}
return $this->_forward();
break;
case 'deleteStore':
// break intentionally omitted
// break intentionally omitted
case 'deleteStorePost':
if ($store = Mage::app()->getStore($this->_request->getParam('item_id'))) {
if ($this->_role->hasWebsiteAccess($store->getWebsiteId(), true)) {
return;
}
}
return $this->_forward();
break;
}
}
示例3: _extractRequestEditValues
/**
* Extract edit values from given request
*
* @param string $type Grid block type
* @param array $config Edited value config
* @param Mage_Core_Controller_Request_Http $request Request object
* @return array
*/
protected function _extractRequestEditValues($type, $config, $request)
{
$idsKey = $config['config']['ids_key'];
$additionalKey = $config['config']['additional_key'];
$valuesKey = $config['config']['values_key'];
$params = array('ids' => $request->getParam($idsKey, array()), 'additional' => $request->getParam($additionalKey, array()), 'values' => $request->getParam($valuesKey, array()), 'global' => array_diff_key($request->getParams(), array_flip(array($idsKey, $additionalKey, $valuesKey))));
return array_map(create_function('$a', 'return (is_array($a) ? $a : array());'), $params);
}
示例4: getAddCartProductInfo
/**
* Return add cart product data
*
* @param Mage_Core_Controller_Request_Http $oRequest
* @return Sitewards_Giveaway_Model_Product_Quantity_Collection
*/
public function getAddCartProductInfo(Mage_Core_Controller_Request_Http $oRequest)
{
$aParams = $oRequest->getParams();
if (isset($aParams['qty'])) {
$iQty = (int) $aParams['qty'];
} else {
$iQty = $this->getDefaultOrderQtyForProductId($aParams['product']);
}
$oProductQuantityCollection = Mage::getModel('sitewards_giveaway/product_quantity_collection');
$oProductQuantity = Mage::getModel('sitewards_giveaway/product_quantity');
$oProductQuantity->setId($aParams['product']);
$oProductQuantity->setQty($iQty);
$oProductQuantityCollection->addItem($oProductQuantity);
return $oProductQuantityCollection;
}
示例5: getDynamicBlockReplacement
/**
* Calls the diehard/load controller without spawning a new request
*
* @param array $params
* @return string
*/
public function getDynamicBlockReplacement($params)
{
// Append dynamic block content to end of page to be replaced by javascript, but not Ajax
if ($params['blocks'] || !empty($params['all_blocks'])) {
// Init store if it has not been yet (page served from cache)
if (!$this->helper()->isAppInited()) {
$this->helper()->initApp();
} else {
// Reset layout
Mage::unregister('_singleton/core/layout');
Mage::getSingleton('core/layout');
// TODO Mage::app()->getLayout() is not reset using the method above!
// TODO Consider resetting Magento entirely using Mage::reset();
}
// Create a sub-request to get JSON response
$uri = $this->getBaseUrl() . '/_diehard/load/ajax';
$request = new Mage_Core_Controller_Request_Http($uri);
$request->setRouteName('diehard');
$request->setModuleName('_diehard');
$request->setControllerName('load');
$request->setActionName('ajax');
$request->setControllerModule('Cm_Diehard');
$request->setParam('full_action_name', $params['full_action_name']);
if (!empty($params['all_blocks'])) {
$request->setParam('all_blocks', 1);
} else {
$request->setParam('blocks', $params['blocks']);
}
$request->setParam('params', $params['params']);
$request->setDispatched(true);
// Override parameters in request singleton (for Mage_Core_Block_Abstract#getRequest())
Mage::app()->getRequest()->clearParams();
Mage::app()->getRequest()->setParams($request->getParams());
Mage::app()->getRequest()->setParams($request->getParam('params'));
// Render sub-request into sub-response object
$response = new Mage_Core_Controller_Response_Http();
require_once Mage::getModuleDir('controllers', 'Cm_Diehard') . '/LoadController.php';
$controller = new Cm_Diehard_LoadController($request, $response);
$controller->dispatch('json');
$replacement = '';
if ($this->helper()->isDebug()) {
$replacement .= '<!-- Dynamic blocks rendered: ' . (empty($params['all_blocks']) ? implode(',', $params['blocks']) : 'ALL') . ' -->' . "\n";
}
$replacement .= "<script type=\"text/javascript\">/* <![CDATA[ */Diehard.replaceBlocks({$response->getBody()});/* ]]> */</script>";
return $replacement;
} else {
if ($this->helper()->isDebug()) {
return '<!-- No dynamic blocks -->';
} else {
return '';
}
}
}