/** * Updates client end-point with values received from request: * * @param __IRequest $request * @param __IResponse $response */ public function preFilter(__IRequest &$request, __IResponse &$response) { //update client end-points with values received from request: $request_component_values = __ContextManager::getInstance()->getApplicationContext()->getPropertyContent('REQUEST_CLIENT_ENDPOINT_VALUES'); if ($request->hasParameter($request_component_values)) { $values = $request->getParameter($request_component_values); if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { $scape_chars = array('\\n', '\\r', '\\t'); $double_scape_chars = array('\\\\n', '\\\\r', '\\\\t'); $values = str_replace($scape_chars, $double_scape_chars, $values); $values = stripslashes($values); } $client_values = json_decode($values, true); if (is_array($client_values)) { $ui_binding_manager = __UIBindingManager::getInstance(); foreach ($client_values as $id => $value) { if ($ui_binding_manager->hasUIBinding($id)) { $ui_binding_manager->getUIBinding($id)->getClientEndPoint()->setValue($value); } else { if ($request->hasParameter('viewCode')) { $view_code = $request->getParameter('viewCode'); __ComponentLazyLoader::loadView($view_code); if ($ui_binding_manager->hasUIBinding($id)) { $ui_binding_manager->getUIBinding($id)->getClientEndPoint()->setValue($value); } else { throw __ExceptionFactory::getInstance()->createException('Can not sync component status between client and server'); } } } } } } }
/** * Switch the context to lion admin application, just in case the REQUEST_LION_ADMIN_AREA parameter is present within the request * * @param __IRequest $request * @param __IResponse $response */ public function preFilter(__IRequest &$request, __IResponse &$response) { $admin_area_parameter = __ApplicationContext::getInstance()->getPropertyContent('REQUEST_LION_ADMIN_AREA'); if ($request->hasParameter($admin_area_parameter) && __ApplicationContext::getInstance()->getPropertyContent('LION_ADMIN_ENABLED') == true) { __ContextManager::getInstance()->createContext("LION_ADMIN_AREA", ADMIN_DIR); __ContextManager::getInstance()->switchContext("LION_ADMIN_AREA"); } }
/** * Change the currency in session by a given one if the * currency parameter is present within the request. * */ public function preFilter(__IRequest &$request, __IResponse &$response) { if ($request->hasParameter('currency')) { $currency_iso_code = $request->getParameter('currency'); //set the currency iso code within the CurrencyManager //singleton instance: CurrencyManager::getInstance()->setCurrencyIsoCode($currency_iso_code); } }
public function &callAsRemoteService(__IRequest &$request) { $mapped_parameters = array(); foreach ($this->_arguments as $argument) { $argument_name = $argument->getName(); if ($request->hasParameter($argument_name)) { $parameter_value = $request->getParameter($argument_name); if ($argument->isJson()) { $parameter_value = json_decode($parameter_value, true); } $mapped_parameters[$argument->getIndex()] = $parameter_value; } else { if ($argument->isOptional()) { $mapped_parameters[$argument->getIndex()] = null; } else { throw __ExceptionFactory::getInstance()->createException('Error calling remote service ' . $this->_service . ': missing argument ' . $argument_name); } } } ksort($mapped_parameters); return $this->call($mapped_parameters); }