array() , _ACTION_MAPPINGS => array() ); /** * @access protected * @var array */ protected $_aaOptions = array(); /** * @access protected * @var array */ protected $_aaSecureFW = array( 'igep/views/igep_regenerarVentana.php' , 'phrame.php?action=volverPrincipal' ); /** * Create a MappingManager. * * @return boolean */ public function __construct() { trigger_error( 'MappingManager is a virtual class, please extend for your application' ); return false; } /** * Add a map to the mapping. * * @access protected * @param string $psIdent Name (ID) of the mapping. * @param string $psType Type (Action class name) to execute. * @param string $psInput Input template to call back to if validating form fails [optional]. * @param bool $pbValidate Whether or not to validate the form [optional]. * @return boolean Sucess. */ protected function _AddMapping( $psIdent, $psType, $psInput='', $pbValidate=false ) { if (!is_string($psIdent) || 0 == strlen($psIdent)) { trigger_error("invalid mapping identifier '$psIdent'"); return false; } if (!is_string($psType) || 0 == strlen($psType)) { trigger_error("invalid mapping type '$psType'"); return false; } if (!is_bool($pbValidate)) { $pbValidate = (1 == $pbValidate); } $a_new_map = array( _TYPE => $psType , _INPUT => $psInput , _VALIDATE => $pbValidate , _ACTION_FORWARDS => array() ); $this->_aaMap[_ACTION_MAPPINGS][$psIdent] = $a_new_map; return true; } /** * Add a forward to an existing mapping. * * @access protected * @param string $psMapIdent Name (ID) of the mapping. * @param string $psFwdIdent Name (ID) of forward. * @param string $psPath Path of forward. * @param int $piRedir Redirect or normal forward [optional]. * @return boolean Sucess. */ protected function _AddForward( $psMapIdent, $psFwdIdent, $psPath='_DEFAULT_', $piRedir=0 ) { if (!array_key_exists($psMapIdent, $this->_aaMap[_ACTION_MAPPINGS])) { trigger_error("invalid mapping identifier '$psMapIdent'"); return false; } if (!is_string($psFwdIdent) || 0 == strlen($psFwdIdent)) { trigger_error("invalid mapping forward identifier '$psFwdIdent'"); return false; } if (!is_string($psPath) || 0 == strlen($psPath)) { trigger_error("invalid mapping forward path '$psPath'"); return false; } elseif ('_DEFAULT_' == $psPath) { $psPath = $this->_aaMap[_ACTION_MAPPINGS][$psMapIdent][_INPUT]; } if (1 != $piRedir) { $piRedir = 0; } $a_new_fwd = array ( _PATH => $psPath , _REDIRECT => $piRedir ); $this->_aaMap[_ACTION_MAPPINGS][$psMapIdent][_ACTION_FORWARDS][$psFwdIdent] = $a_new_fwd; //Incluimos el forward en el parse de seguridad if(strpos($psPath,'phrame.php?action=')===0) { $params = strpos($psPath,'&'); if($params !== false) { $ini = $params; $psPath = substr($psPath, 0, $ini); } $this->_aaSecureFW[] = $psPath; } else { $ini = strpos($psPath,'view=')+5; $params = strpos($psPath,'&'); ($params)?$fin=$params-strlen($psPath):$fin=strlen($psPath); $this->_aaSecureFW[] = substr($psPath, $ini, $fin); } return true; } //Fin de _AddForward /** * Metodo _SetOptions * * @access protected * @param string $psDefaultAction * @param string $psErrorHandler * @param int $piCache * @param int $piErrorReporting */ protected function _SetOptions( $psDefaultAction='ShowView' , $psErrorHandler='handle_error' , $piCache=0 , $piErrorReporting=-1 ) { if (!1 == $piCache) { $piCache = 0; } if (-1 == $piErrorReporting) { $piErrorReporting = E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE; } $this->_aaOptions = array( _CACHE => $piCache , _ERROR_REPORTING => $piErrorReporting , _ERROR_HANDLER => $psErrorHandler , _DEFAULT_ACTION => $psDefaultAction ); } //Fin de _SetOptions /** * Metodo _SetOptions * * @access protected * @param array $mappings */ protected function _MergeMappings( $mappings ) { $mapmerge = array_merge( $this->_aaMap[_ACTION_MAPPINGS], $mappings->_aaMap[_ACTION_MAPPINGS] ); $this->_aaMap[_ACTION_MAPPINGS] = $mapmerge; } //Fin de _MergeMappings /** * Retrieve mappings. * * @access public * @return array */ public function getMappings() { return $this->_aaMap; } //Fin de getMappings /** * Retrieve Option * * @access public * @return array */ public function getOptions() { return $this->_aaOptions; } //Fin de getOptions /** * Metodo getSecureFW * * @access public * @return string[] */ public function getSecureFW() { return $this->_aaSecureFW; } //Fin de getSecureFW } //End MappingManager