Source for file AccessFilter.php

Documentation is available at AccessFilter.php

  1. <?php
  2. /**
  3. * Classe de base des accessfilter, Lier aux fichier de configuration
  4. *
  5. * PHP versions 5
  6. @category  PHP
  7. @package   GeoPrisma
  8. @author    Pascal Martin
  9. @copyright 2009, Boreal - Information Strategies
  10. @license   http://www.geoprisma.org/license BSD License
  11. @link      http://www.geoprisma.org
  12. */
  13.  
  14. /**
  15. * Classe de base des accessfilter, Lier aux fichier de configuration
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage AccessFilter
  19. @author     Pascal Martin
  20. */ 
  21. {
  22.     private $m_strName null;
  23.     private $m_objConditions null;
  24.  
  25.     /**
  26.     * Construit un nouvelle instance de org_geoprisma_accessfilter_AccessFilter
  27.     * 
  28.     * @param string $pstrName            AccessFilter name
  29.     * @param array  $pobjArrayConditions AccessFilter conditions
  30.     * 
  31.     * @return org_geoprisma_accessfilter_AccessFilter 
  32.     */
  33.     public function __construct(
  34.         $pstrName,
  35.         $pobjArrayConditions
  36.     {
  37.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($pstrName);
  38.  
  39.         // name & type
  40.         // Available types: BBox, SessionParam
  41.         $this->m_strName $pstrName;
  42.  
  43.         // condition
  44.         $this->m_objArrayConditions new ArrayObject();
  45.         if (is_array($pobjArrayConditions)) 
  46.         {
  47.             foreach ($pobjArrayConditions as $strCondition
  48.             {
  49.                 $this->m_objArrayConditions->append($strCondition);     
  50.             }
  51.         }
  52.     }
  53.  
  54.     /**
  55.     * Return the AccessFilter name
  56.     *
  57.     * @return string 
  58.     */
  59.     public function getName()
  60.     {
  61.         return $this->m_strName;
  62.     }
  63.  
  64.     /**
  65.     * Return the AccessFilter condition
  66.     *
  67.     * @param integer $piCondition Condition index
  68.     *
  69.     * @return string 
  70.     */
  71.     public function getCondition($piCondition)
  72.     {
  73.         return $this->m_objArrayConditions[$piCondition];
  74.     }
  75.  
  76.     /**
  77.     * Return the AccessFilter conditions
  78.     *
  79.     * @return string 
  80.     */
  81.     public function getConditions()
  82.     {
  83.         return $this->m_objArrayConditions;
  84.     }
  85.  
  86.     /**
  87.     * Return the AccessFilter input.
  88.     * input can be a string or something from the session with:
  89.     *   SESSION:session_variable  (Later we could have BD:string)
  90.     *
  91.     * @param string $pstrInput Input string
  92.     *
  93.     * @return string 
  94.     */
  95.     public function readInput($pstrInput)
  96.     {
  97.         $objArrayInputParts explode(':'$pstrInput);
  98.  
  99.         switch($objArrayInputParts[0])
  100.         {
  101.             case 'SESSION':
  102.                 if (isset($objArrayInputParts[1])
  103.                     && isset($_SESSION[$objArrayInputParts[1]])
  104.                 
  105.                 {
  106.                     return $_SESSION[$objArrayInputParts[1]];
  107.                 }
  108.                 break;
  109.             default:
  110.                 return $objArrayInputParts[0];
  111.         }
  112.  
  113.         return '';
  114.     }
  115.     
  116.     /**
  117.     *  Ajout le accessfilter courant (this) dans le xml
  118.     * 
  119.     * @param DOMElement  &$pobjDomElementAccessFilters Noeud xml ou le accessfilter doit Ãªtre ajouter
  120.     * @param DOMDocument &$pobjDomDocument             Document XMl ou le noeud xml accessfilter est ajouter, utiliser pour construire les noeuds
  121.     * 
  122.     * @return void 
  123.     */
  124.     public function insertIntoXML(DOMElement &$pobjDomElementAccessFiltersDOMDocument &$pobjDomDocument)
  125.     {
  126.         $objDomElementAccessFilter $pobjDomDocument->createElement('accessfilter')
  127.         $pobjDomElementAccessFilters->appendChild($objDomElementAccessFilter);        
  128.         $objDomElementName $pobjDomDocument->createElement('name'$this->getName())
  129.         $objDomElementAccessFilter->appendChild($objDomElementName);
  130.     }
  131.     
  132. }
  133.  
  134. ?>

Documentation generated on Mon, 20 Feb 2012 13:46:07 -0500 by phpDocumentor 1.4.1