Source for file GenericWidget.php

Documentation is available at GenericWidget.php

  1. <?php
  2. /**
  3. * Widget de générique
  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. * Widget de générique
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage Widget
  19. @author     Pascal Martin
  20. @license    http://www.geoprisma.org/license BSD License
  21. @link       http://www.geoprisma.org
  22. */  
  23. {
  24.     private $m_strType null
  25.  
  26.     /**
  27.     * Construit un instance de org_geoprisma_widget_GenericWidget
  28.     *
  29.     * @param string $pstrType  Widget type
  30.     * @param array  $pobjArray Config array
  31.     * 
  32.     * @return org_geoprisma_widget_GenericWidget 
  33.     */
  34.     public function __construct($pstrType$pobjArray
  35.     {
  36.         if (isset($pobjArray['id'])) 
  37.         {
  38.             $strName = (string)$pobjArray['id'];
  39.         }
  40.         else
  41.         {
  42.             $strName = (string)$pobjArray['name'];
  43.         }
  44.  
  45.         parent::__construct($strName);
  46.         
  47.         $this->m_strType $pstrType;
  48.         $this->loadOptions($pobjArray)
  49.     }
  50.     
  51.     /**
  52.     * Charge la liste des otions
  53.     * 
  54.     * @param array &$pobjArray Config array
  55.     * 
  56.     * @return void 
  57.     */
  58.     private function loadOptions(&$pobjArray)
  59.     {
  60.         $this->m_objArrayOptions = new ArrayObject();
  61.         //$objArrayOptions = $this->getConfigElements($pobjArray['options']);
  62.         $objArrayOptions $pobjArray['options'];
  63.  
  64.         foreach ($objArrayOptions as $strOption => $strValue
  65.         {
  66.             $this->m_objArrayOptions->append(
  67.                 new org_geoprisma_option_Option($strOption$strValue)
  68.             );
  69.         }
  70.     }
  71.     
  72.     /**
  73.     * Retourne le type du widget
  74.     * 
  75.     * @return string 
  76.     */
  77.     public function getType()
  78.     {
  79.         return $this->m_strType;   
  80.     }
  81.     
  82.     /**
  83.     *  Ajout le widget courant (this) dans le xml
  84.     * 
  85.     * @param DOMElement  &$pobjDomElementWidgets Noeud xml ou le widget doit
  86.     *                                             être ajouter
  87.     * @param DOMDocument &$pobjDomDocument       Document XMl ou le noeud xml
  88.     *                                             datastore est ajouter, utiliser
  89.     *                                             pour construire les noeuds
  90.     * 
  91.     * @return void 
  92.     */
  93.     public function insertIntoXML(
  94.         DOMElement &$pobjDomElementWidgetsDOMDocument &$pobjDomDocument
  95.     {
  96.         $objDomElementWidget $pobjDomDocument->createElement('widget');
  97.         $pobjDomElementWidgets->appendChild($objDomElementWidget);
  98.            
  99.         $objDomElementType $pobjDomDocument->createElement(
  100.             'type'$this->getType()
  101.         );
  102.         $objDomElementName $pobjDomDocument->createElement(
  103.             'name'$this->getName()
  104.         );
  105.         $objDomElementWidget->appendChild($objDomElementType);
  106.         $objDomElementWidget->appendChild($objDomElementName);       
  107.             
  108.         $objDomElementOptions $pobjDomDocument->createElement('options');
  109.         $objDomElementWidget->appendChild($objDomElementOptions);        
  110.         foreach ($this->getOptions(as $objOption
  111.         {
  112.             $objOption->insertIntoXML($objDomElementOptions$pobjDomDocument);
  113.         }    
  114.         
  115.         return $objDomElementWidget;   
  116.     }
  117. }
  118.   
  119. ?>

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