![]() |
Documentación GVHIDRA 3.1.5
|
Métodos públicos | |
ActionController ($options) | |
process ($mappings, $request) | |
_processMapping ($mappings, $request) | |
_processAction ($actionMapping, $actionForm) | |
_processForward ($actionForward) | |
Campos de datos | |
$_options | |
$_actionMappings | |
$_actions |
The ActionController class represents the controller in the Model-View-Controller (MVC) design pattern. The ActionController receives and processes all requests that change the state of the application.
Generally, a "Model2" application is architected as follows:
The standard version of ActionController implements the following logic for each incoming HTTP request. You can override some or all of this functionality by subclassing this class and implementing your own version of the processing.
The standard version of ActionController is configured based on the following initialization parameters, which you will specify in the options for your application. Subclasses that specialize this ActionController are free to define additional initialization parameters.
Definición en la línea 56 del archivo ActionController.php.
_processAction | ( | $ | actionMapping, |
$ | actionForm | ||
) |
Ask the specified Action instance to handle this request.
private
ActionMapping | $actionMapping | |
ActionForm | $actionForm |
Definición en la línea 144 del archivo ActionController.php.
{ $name = $actionMapping->getName(); $type = $actionMapping->getType(); $action = $this->_actions->get($name); if (!is_object($action)) { if (!class_exists($type)) { if($type=='') trigger_error("Se ha intentado ejecutar la accin '$name' y no est programada para la clase actual. Compruebe el fichero de la clase y el mappings.php de su aplicacin."); else trigger_error("Se ha producido un error intentado ejecutar la accin '$name' de la clase '$type'. Compruebe el nombre de la clase y su accesibilidad (fichero include.php)."); return; } //Guardamos la referencia del modulo si es la primera pantalla del modulo a la que accedemos. if(isset($_REQUEST['modActv'])){ IgepSession::guardaVariable('global','modActv',$_REQUEST['modActv']); //Borramos el contenido de los paneles anteriores IgepSession::_borrarPanelesVisitados(); } //Si el panel ya existe lo recuperamos de la Session if(IgepSession::existePanel($type)&&(strpos($type,'gvHidraForm')===false)){ $action = IgepSession::damePanel($type); if(method_exists($action,'regenerarInstancia')) $action->regenerarInstancia(''); else{ IgepSession::borraPanel($type); IgepDebug::setDebug(PANIC,'Error al recuperar la instancia de '.$type.'. Puede deberse a un error en el constructor. Se crea una nueva instancia.'); $action = new $type(); } } else{ IgepDebug::setDebug(DEBUG_IGEP,'Creamos una instancia de la clase '.$type); $action = new $type(); } if ($this->_options[_CACHE]) { $this->_actions->put($name, $action); } } if(is_callable($this->_options[_ERROR_HANDLER])) set_error_handler($this->_options[_ERROR_HANDLER]); if(!$action->obj_errorNegocio->hayError()) $actionForward = $action->perform($actionMapping, $actionForm); else{ $action->obj_errorNegocio->limpiarError(); unset($action); $actionForward = new ActionForward('IgepInicioAplicacion'); $actionForward->_path = 'index.php?view=igep/views/aplicacion.php'; //Borramos cualquier referencia a la clase en la SESSION IgepSession::borraPanel($type); } if(is_callable($this->_options[_ERROR_HANDLER])) restore_error_handler(); return $actionForward; }
_processForward | ( | $ | actionForward | ) |
Forward to the specified destination.
private
ActionForward | $actionForward |
Definición en la línea 204 del archivo ActionController.php.
{ $salto =''; switch($actionForward->getName()){ case 'gvHidraValidationError': $path=''; $claseManejadora = $actionForward->get('IGEPclaseManejadora'); $salto = "Location: index.php?view=igep/views/igep_regenerarVentana.php&IGEPpath=$path&IGEPclaseManejadora=$claseManejadora"; break; case 'IgepOperacionOculto': $path = $actionForward->getPath(); $salto = "Location: $path"; break; case 'IgepSaltoVentana': $path = $actionForward->get('IGEPaccionDestinoSalto'); $salto = "Location: $path"; break; default: $path = $actionForward->getPath(); //REVIEW: Toni PHRAME /* La variable clase Manejadora no est definida, por tanto se podr eliminar. */ $claseManejadora =''; $salto ="Location: index.php?view=igep/views/igep_regenerarVentana.php&IGEPpath=$path&IGEPclaseManejadora=$claseManejadora"; } header($salto); }
_processMapping | ( | $ | mappings, |
$ | request | ||
) |
Identify and return an appropriate ActionMapping.
private
array | $mappings | |
array | $request |
Definición en la línea 122 del archivo ActionController.php.
{ $name = $request[_ACTION]; $mapping = $mappings[_ACTION_MAPPINGS][$name]; $actionMapping = $this->_actionMappings->get($name); if (!is_object($actionMapping)) { $actionMapping = new ActionMapping($name, $mapping); if ($this->_options[_CACHE]) { $this->_actionMappings->put($name, $actionMapping); } } return $actionMapping; }
ActionController | ( | $ | options | ) |
Create a ActionController specifying the options.
public
array | $options |
Definición en la línea 77 del archivo ActionController.php.
process | ( | $ | mappings, |
$ | request | ||
) |
Process the request.
public
array | $mappings | |
array | $request |
Definición en la línea 95 del archivo ActionController.php.
{ if (!is_array($mappings)) { trigger_error('Invalid mappings file'); return; } if (!is_array($request)) { trigger_error('Invalid request'); return; } //error_reporting($this->_options[_ERROR_REPORTING]); $actionMapping = $this->_processMapping($mappings, $request); //Creamos el ActionForm (un Hasmap sobre el request) $actionForm = new HashMap($request); $actionForward = $this->_processAction($actionMapping, $actionForm); if (is_object($actionForward)) { $this->_processForward($actionForward); } }
$_actionMappings |
Definición en la línea 65 del archivo ActionController.php.
$_actions |
Definición en la línea 69 del archivo ActionController.php.
$_options |
Definición en la línea 61 del archivo ActionController.php.