phpDocumentor ZNF
Action
[ class tree: ZNF ] [ index: ZNF ] [ all elements ]

Source for file ActionMapping.php

Documentation is available at ActionMapping.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4.  * PHP version 5
  5.  *
  6.  * This source file is subject to version 2.1 of the GNU Lesser General Public
  7.  * License, that is bundled with this package in the file COPYING, available
  8.  * through the world wide web at the following URI:
  9.  * http://www.gnu.org/copyleft/lesser.html.
  10.  *
  11.  * @package    ZNF
  12.  * @subpackage Action
  13.  * @author     Alessandro Rossini <http://www.alessandrorossini.org>
  14.  * @author     Graziano Liberati <http://www.liberati.org>
  15.  * @copyright  2004-2007 The ZNF Development Team
  16.  * @license    LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
  17.  * @version    SVN $Id: ActionMapping.php 43 2007-06-26 23:36:35Z aronnax $
  18.  * @since      Release 0.5.0
  19.  * @link       http://www.zeronotice.org
  20.  */
  21.  
  22. /**
  23.  * <i>ZNF_Action_ActionMapping</i> represents the informations that the controller <i>ZNF_Action_RequestProcessor</i> knows about the mapping.
  24.  *
  25.  * The mapping is considered from a particular request to an instance of a
  26.  * particular <i>ZNF_Action_Action</i> class.
  27.  *
  28.  * The <i>ZNF_Action_ActionMapping</i> instance used to select a particular
  29.  * <i>ZNF_Action_Action</i> is passed on to that <i>ZNF_Action_Action</i>,
  30.  * thereby providing access to any custom configuration taken from the
  31.  * module configuration file and included in the <i>ZNF_Action_ActionMapping</i>
  32.  * object.
  33.  *
  34.  * @access     public
  35.  * @package    ZNF
  36.  * @subpackage Action
  37.  * @author     Alessandro Rossini <http://www.alessandrorossini.org>
  38.  * @author     Graziano Liberati <http://www.liberati.org>
  39.  * @copyright  2004-2007 The ZNF Development Team
  40.  * @license    LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
  41.  * @version    SVN $Id: ActionMapping.php 43 2007-06-26 23:36:35Z aronnax $
  42.  * @since      Release 0.5.0
  43.  * @link       http://www.zeronotice.org
  44.  */
  45. {
  46.  
  47.     /**
  48.      * The <i>forward</i> attribute of the <i>action</i> element.
  49.      *
  50.      * @access protected
  51.      * @var string $_forward 
  52.      */
  53.     protected $_forward = null;
  54.  
  55.     /**
  56.      * The <i>include</i> attribute of the <i>action</i> element.
  57.      *
  58.      * @access protected
  59.      * @var string $_include 
  60.      */
  61.     protected $_include = null;
  62.  
  63.     /**
  64.      * The <i>input</i> attribute of the <i>action</i> element.
  65.      *
  66.      * @access protected
  67.      * @var string $_input 
  68.      */
  69.     protected $_input = null;
  70.  
  71.     /**
  72.      * The <i>name</i> attribute of the <i>action</i> element.
  73.      *
  74.      * @access protected
  75.      * @var string $_name 
  76.      */
  77.     protected $_name = null;
  78.  
  79.     /**
  80.      * The <i>nextPath</i> attribute of the <i>action</i> element.
  81.      *
  82.      * @access protected
  83.      * @var string $_nextPath 
  84.      */
  85.     protected $_nextPath = null;
  86.  
  87.     /**
  88.      * The <i>parameter</i> attribute of the <i>action</i> element.
  89.      *
  90.      * @access protected
  91.      * @var string $_parameter 
  92.      */
  93.     protected $_parameter = null;
  94.  
  95.     /**
  96.      * The <i>parameterValue</i> attribute of the <i>action</i> element.
  97.      *
  98.      * @access protected
  99.      * @var string $_parameterValue 
  100.      */
  101.     protected $_parameterValue = null;
  102.  
  103.     /**
  104.      * The <i>path</i> attribute of the <i>action</i> element.
  105.      *
  106.      * @access protected
  107.      * @var string $_path 
  108.      */
  109.     protected $_path = null;
  110.  
  111.     /**
  112.      * The <i>roles</i> attribute of the <i>action</i> element.
  113.      *
  114.      * @access protected
  115.      * @var string $_roles 
  116.      */
  117.     protected $_roles = null;
  118.  
  119.     /**
  120.      * The <i>scope</i> attribute of the <i>action</i> element.
  121.      *
  122.      * @access protected
  123.      * @var string $_scope 
  124.      */
  125.     protected $_scope = null;
  126.  
  127.     /**
  128.      * The <i>type</i> attribute of the <i>action</i> element.
  129.      *
  130.      * @access protected
  131.      * @var string $_type 
  132.      */
  133.     protected $_type = null;
  134.  
  135.     /**
  136.      * The <i>validate</i> attribute of the <i>action</i> element.
  137.      *
  138.      * @access protected
  139.      * @var string $_validate 
  140.      */
  141.     protected $_validate = null;
  142.  
  143.     /**
  144.      * The <i>forward</i> elements of the <i>global-forwards</i> element.
  145.      *
  146.      * @access protected
  147.      * @var array $_globalForwardsConfig 
  148.      */
  149.     protected $_globalForwardsConfig = null;
  150.  
  151.     /**
  152.      * The <i>forward</i> elements of the <i>action</i> element.
  153.      *
  154.      * @access protected
  155.      * @var array $_forwardsConfig 
  156.      */
  157.     protected $_forwardsConfig = null;
  158.  
  159.     /**
  160.      * Constructs a new <i>ZNF_Action_ActionMapping</i> object.
  161.      *
  162.      * @access public
  163.      * @param array $actionConfig 
  164.      * @param array $globalForwardsConfig 
  165.      */
  166.     public function __construct($actionConfig$globalForwardsConfig)
  167.     {
  168.         $this->setForward($actionConfig['forward']);
  169.         $this->setInclude($actionConfig['include']);
  170.         $this->setInput($actionConfig['input']);
  171.         $this->setName($actionConfig['name']);
  172.         $this->setNextPath($actionConfig['nextPath']);
  173.         $this->setParameter($actionConfig['parameter']);
  174.         $this->setParameterValue($actionConfig['parameterValue']);
  175.         $this->setPath($actionConfig['path']);
  176.         $this->setRoles($actionConfig['roles']);
  177.         $this->setScope($actionConfig['scope']);
  178.         $this->setType($actionConfig['type']);
  179.         $this->setValidate($actionConfig['validate']);
  180.  
  181.         if (isset($actionConfig['forwards-config'])) {
  182.             $this->addForwardsConfig($actionConfig['forwards-config']);
  183.         }
  184.  
  185.         $this->addGlobalForwardsConfig($globalForwardsConfig);
  186.     }
  187.  
  188.     /**
  189.      * Returns the value of the <i>forward</i> property.
  190.      *
  191.      * @access public
  192.      * @return string 
  193.      */
  194.     public function getForward()
  195.     {
  196.         return $this->_forward;
  197.     }
  198.  
  199.     /**
  200.      * Sets the value of the <i>forward</i> property.
  201.      *
  202.      * @access public
  203.      * @param string $value 
  204.      */
  205.     public function setForward($value)
  206.     {
  207.         $this->_forward = $value;
  208.     }
  209.  
  210.     /**
  211.      * Returns the value of the <i>include</i> property.
  212.      *
  213.      * @access public
  214.      * @return string 
  215.      */
  216.     public function getInclude()
  217.     {
  218.         return $this->_include;
  219.     }
  220.  
  221.     /**
  222.      * Sets the value of the <i>include</i> property.
  223.      *
  224.      * @access public
  225.      * @param string $value 
  226.      */
  227.     public function setInclude($value)
  228.     {
  229.         $this->_include = $value;
  230.     }
  231.  
  232.     /**
  233.      * Returns the value of the <i>input</i> property.
  234.      *
  235.      * @access public
  236.      * @return string 
  237.      */
  238.     public function getInput()
  239.     {
  240.         return $this->_input;
  241.     }
  242.  
  243.     /**
  244.      * Sets the value of the <i>input</i> property.
  245.      *
  246.      * @access public
  247.      * @param string $value 
  248.      */
  249.     public function setInput($value)
  250.     {
  251.         $this->_input = $value;
  252.     }
  253.  
  254.     /**
  255.      * Returns the value of the <i>name</i> property.
  256.      *
  257.      * @access public
  258.      * @return string 
  259.      */
  260.     public function getName()
  261.     {
  262.         return $this->_name;
  263.     }
  264.  
  265.     /**
  266.      * Sets the value of the <i>name</i> property.
  267.      *
  268.      * @access public
  269.      * @param string $value 
  270.      */
  271.     public function setName($value)
  272.     {
  273.         $this->_name = $value;
  274.     }
  275.  
  276.     /**
  277.      * Returns the value of the <i>nextPath</i> property.
  278.      *
  279.      * @access public
  280.      * @return string 
  281.      */
  282.     public function getNextPath()
  283.     {
  284.         return $this->_nextPath;
  285.     }
  286.  
  287.     /**
  288.      * Sets the value of the <i>nextPath</i> property.
  289.      *
  290.      * @access public
  291.      * @param string $value 
  292.      */
  293.     public function setNextPath($value)
  294.     {
  295.         $this->_nextPath = $value;
  296.     }
  297.  
  298.     /**
  299.      * Returns the value of the <i>parameter</i> property.
  300.      *
  301.      * @access public
  302.      * @return string 
  303.      */
  304.     public function getParameter()
  305.     {
  306.         return $this->_parameter;
  307.     }
  308.  
  309.     /**
  310.      * Sets the value of the <i>parameter</i> property.
  311.      *
  312.      * @access public
  313.      * @param string $value 
  314.      */
  315.     public function setParameter($value)
  316.     {
  317.         $this->_parameter = $value;
  318.     }
  319.  
  320.     /**
  321.      * Returns the value of the <i>parameterValue</i> property.
  322.      *
  323.      * @access public
  324.      * @return string 
  325.      */
  326.     public function getParameterValue()
  327.     {
  328.         return $this->_parameterValue;
  329.     }
  330.  
  331.     /**
  332.      * Sets the value of the <i>parameterValue</i> property.
  333.      *
  334.      * @access public
  335.      * @param string $value 
  336.      */
  337.     public function setParameterValue($value)
  338.     {
  339.         $this->_parameterValue = $value;
  340.     }
  341.  
  342.     /**
  343.      * Returns the value of the <i>path</i> property.
  344.      *
  345.      * @access public
  346.      * @return string 
  347.      */
  348.     public function getPath()
  349.     {
  350.         return $this->_path;
  351.     }
  352.  
  353.     /**
  354.      * Sets the value of the <i>path</i> property.
  355.      *
  356.      * @access public
  357.      * @param string $value 
  358.      */
  359.     public function setPath($value)
  360.     {
  361.         $this->_path = $value;
  362.     }
  363.  
  364.     /**
  365.      * Returns the value of the <i>roles</i> property.
  366.      *
  367.      * @access public
  368.      * @return string 
  369.      */
  370.     public function getRoles()
  371.     {
  372.         return $this->_roles;
  373.     }
  374.  
  375.     /**
  376.      * Sets the value of the <i>roles</i> property.
  377.      *
  378.      * @access public
  379.      * @param string $value 
  380.      */
  381.     public function setRoles($value)
  382.     {
  383.         $this->_roles = $value;
  384.     }
  385.  
  386.     /**
  387.      * Returns the value of the <i>scope</i> property.
  388.      *
  389.      * @access public
  390.      * @return string 
  391.      */
  392.     public function getScope()
  393.     {
  394.         return $this->_scope;
  395.     }
  396.  
  397.     /**
  398.      * Sets the value of the <i>scope</i> property.
  399.      *
  400.      * @access public
  401.      * @param string $value 
  402.      */
  403.     public function setScope($value)
  404.     {
  405.         $this->_scope = $value;
  406.     }
  407.  
  408.     /**
  409.      * Returns the value of the <i>type</i> property.
  410.      *
  411.      * @access public
  412.      * @return string 
  413.      */
  414.     public function getType()
  415.     {
  416.         return $this->_type;
  417.     }
  418.  
  419.     /**
  420.      * Sets the value of the <i>type</i> property.
  421.      *
  422.      * @access public
  423.      * @param string $value 
  424.      */
  425.     public function setType($value)
  426.     {
  427.         $this->_type = $value;
  428.     }
  429.  
  430.     /**
  431.      * Returns the value of the <i>validate</i> property.
  432.      *
  433.      * @access public
  434.      * @return string 
  435.      */
  436.     public function getValidate()
  437.     {
  438.         return $this->_validate;
  439.     }
  440.  
  441.     /**
  442.      * Sets the value of the <i>validate</i> property.
  443.      *
  444.      * @access public
  445.      * @param string $value 
  446.      */
  447.     public function setValidate($value)
  448.     {
  449.         $this->_validate = $value;
  450.     }
  451.  
  452.     /**
  453.      * Adds the global forwards configuration.
  454.      *
  455.      * @access protected
  456.      * @param array $value 
  457.      */
  458.     protected function addGlobalForwardsConfig($value)
  459.     {
  460.         $this->_globalForwardsConfig = $value;
  461.     }
  462.  
  463.     /**
  464.      * Adds the forwards configuration.
  465.      *
  466.      * @access protected
  467.      * @param array $value 
  468.      */
  469.     protected function addForwardsConfig($value)
  470.     {
  471.         $this->_forwardsConfig = $value;
  472.     }
  473.  
  474.     /**
  475.      * Returns the <i>ZNF_Action_ActionForward</i> object defining how forwarding to the specified logical name should be handled.
  476.      *
  477.      * This is performed by checking the application configuration for the
  478.      * specified forwarding configuration. If no forwarding configuration can
  479.      * be found returns <i>null</i>.
  480.      *
  481.      * @access public
  482.      * @param string $name The result of the <i>ZNF_Action_Action->execute()</i> method
  483.      * @return ZNF_Action_ActionForward 
  484.      */
  485.     public function findForward($name)
  486.     {
  487.         if ($name && is_array($this->_forwardsConfig&& array_key_exists($name$this->_forwardsConfig)) {
  488.             return new ZNF_Action_ActionForward($this->_forwardsConfig[$name]);
  489.         }
  490.  
  491.         if ($name && is_array($this->_globalForwardsConfig&& array_key_exists($name$this->_globalForwardsConfig)) {
  492.             return new ZNF_Action_ActionForward($this->_globalForwardsConfig[$name]);
  493.         }
  494.  
  495.         return null;
  496.     }
  497.  
  498.     /**
  499.      * Destroys the <i>ZNF_Action_ActionMapping</i> object.
  500.      *
  501.      * @access public
  502.      */
  503.     public function __destruct()
  504.     {
  505.     }
  506.  
  507. }
  508.  
  509. /**
  510.  * <i>ZNF_Action_ActionMappingException</i> is the exception type for the <i>ZNF_Action_ActionMapping</i> class.
  511.  *
  512.  * <i>ZNF_Action_ActionMappingException</i> extends the <i>Exception</i> class of PHP5.
  513.  *
  514.  * @access     public
  515.  * @package    ZNF
  516.  * @subpackage Action
  517.  * @author     Alessandro Rossini <http://www.alessandrorossini.org>
  518.  * @author     Graziano Liberati <http://www.liberati.org>
  519.  * @copyright  2004-2007 The ZNF Development Team
  520.  * @license    LGPL License 2.1 <http://www.gnu.org/copyleft/lesser.html>
  521.  * @version    SVN $Id: ActionMapping.php 43 2007-06-26 23:36:35Z aronnax $
  522.  * @since      Release 0.5.0
  523.  * @link       http://www.zeronotice.org
  524.  */
  525. class ZNF_Action_ActionMappingException extends Exception
  526. {
  527. }
  528.  
  529. ?>

Documentation generated on Wed, 14 Nov 2007 23:47:34 +0100 by phpDocumentor 1.4.0