*
  • name - Logical name by which this instance may be looked up in * relationship to a particular ActionMapping.
  • *
  • path - The absolute or relative URI to which control should be * forwarded or redirected.
  • *
  • redirect - Set to 1 if the ActionController should kill the * session and redirect on the URI. [0]
  • * * * @author Arnold Cano * @version $Id: ActionForward.php,v 1.3 2007-06-01 11:27:42 afelixf Exp $ * @package Phrame */ class ActionForward extends ObjectUtil { /** * Logical name by which this instance may be looked up in relationship to a particular ActionMapping. * @access protected * @var string $_name */ var $_name; /** * The absolute or relative URI to which control should be forwarded or redirected. * @access protected * @var string $_path */ protected $_path; /** * Set to true if the ActionController should kill the session and redirect on the URI. * @access protected * @var bool $_redirect */ protected $_redirect = false; /** * @access public * @var array $_saco */ var $_saco = null; /** * Create an ActionForward with the specified values. * * @access public * @param string $name * @param string[] $forward Array: [ _PATH => string, _REDIRECT => bool] */ public function __construct( $name, $forward=null ) { $this->setName( $name ); if( is_null($forward) ) { $forward[_PATH] = ''; $forward[_REDIRECT] = false; } $this->setPath( $forward[_PATH] ); $this->setRedirect( $forward[_REDIRECT] ); $this->_saco = array(); } //Fin del constructor /** * Get the name of the ActionForward. * * @access public * @return string */ function getName() { return $this->_name; } //Fin de getName /** * Set the name of the ActionForward. * * @access public * @param string $name */ function setName( $name ) { $this->_name = $name; } //Fin de setName /** * Get the path of the ActionForward. * * @access public * @return string */ function getPath() { return $this->_path; } //Fin de getPath /** * Set the path of the ActionForward. * * @access public * @param string $path */ function setPath( $path ) { $this->_path = $path; } //Fin de setPath /** * Get the redirect flag of the ActionForward. * * @access public * @return bool */ function getRedirect() { return $this->_redirect; } //Fin de getRedirect /** * Set the redirect flag of the ActionForward. * * @access public * @param bool $redirect */ function setRedirect( $redirect ) { $this->_redirect = $redirect; } //Fin de setRedirect /** * Appends the add_path string to the forward-path. * Does not url-encode the $add_path. * @access public * @param string $add_path */ function appendPath($add_path) { // add the add_path $this->_path .= $add_path; } //Fin de appendPath /** * Add an attribute (key and value pair) to the forward-path. * This urlencodes both key and value before appending to the forward-path. * @access public * @param string $key * @param string $value */ function setAttribute($key, $value) { // construct string, encoding both key and value $add_path = htmlentities(urlencode($key)); $add_path .= "="; $add_path .= htmlentities(urlencode($value)); // check to see if $this->_path has an ? already if (strpos($this->_path, "?")) { $add_path = "&".$add_path; } else { $add_path = "?".$add_path; } // append it to the path $this->appendPath($add_path); } //Fin de setAttribute /** * Fija un valor en la colección. * * @access public * @param string $clave Clave del objeto en la colección. * @param string $valor Valor del objeto de la colección. */ function put( $key, $value ) { $this->_saco[$key] = $value; } //Fin de put /** * Obtiene un valor en la colección. * * @access public * @param string $clave Clave de la colección. * @return mixed */ public function get( $key ) { if (isset($key) && isset($this->_saco[$key])) { return $this->_saco[$key]; } } //Fin de get }//End ActionForward