Source for file PGSQLMapContextConfig.php

Documentation is available at PGSQLMapContextConfig.php

  1. <?php
  2. /**
  3. * Get configuration from database using the "MapContext" way of defining it.
  4. *
  5. * PHP versions 5
  6. @category  PHP
  7. @package   GeoPrisma
  8. @author    Alexandre Dube
  9. @copyright 2010, Nippour Geomatik
  10. @license   http://www.geoprisma.org/license BSD License
  11. @link      http://www.geoprisma.org
  12. */
  13.  
  14. /**
  15. * Get configuration from database using the "MapContext" way of defining it.
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage Config
  19. @author     Alexandre Dube
  20. */ 
  21. {
  22.     /**
  23.     * @var org_geoprisma_config_PGSQLMapContextConfig 
  24.     */
  25.     private static $s_objInstance null;
  26.  
  27.     /**
  28.     * @var boolean Whether the driver should create (MapPanel and Layer) OR
  29.     *               (Map and MapFishLayerTree) widgets
  30.     */
  31.     private static $s_bUseLegacyWidgets false;
  32.     
  33.     protected $m_objArrayService = null;
  34.     protected $m_objArrayLayout = null;
  35.     protected $m_objArrayDatastore = null;
  36.     protected $m_objArrayWidget = null;
  37.     protected $m_objArrayAccessFilter = null;
  38.     protected $m_objArrayResource = null;
  39.     protected $m_objArrayOtherResource = null;
  40.     protected $m_objArrayField = null;
  41.  
  42.     /**
  43.     * @var array 
  44.     */
  45.     protected $m_objArrayClonedWidgetNames = null;
  46.  
  47.     /**
  48.     * @var string 
  49.     */
  50.     private static $s_strConnection null;
  51.  
  52.     /**
  53.     * @var object 
  54.     */
  55.     private $m_objDB null;
  56.  
  57.     /**
  58.     * @var integer 
  59.     */
  60.     private static $s_iCurrentSession = -1;
  61.     private static $s_iCurrentMapContext = -1;
  62.     private static $s_iCurrentApplication = -1;
  63.  
  64.     /**
  65.     * @var string 
  66.     */
  67.     private static $s_strCurrentSessionName "";
  68.     private static $s_strCurrentMapContextName "";
  69.     private static $s_strCurrentApplicationName "";
  70.  
  71.     /**
  72.     * @var string 
  73.     */
  74.     private static $s_strServiceFeature "service";
  75.     private static $s_strDataStoreFeature "datastore";
  76.     private static $s_strResourceFeature "resource";
  77.     private static $s_strFieldFeature "field";
  78.     private static $s_strMapContextFeature "mapcontext";
  79.     private static $s_strWidgetFeature "widget";
  80.     private static $s_strAccessFilterFeature "accessfilter";
  81.     private static $s_strApplicationFeature "application";
  82.     private static $s_strSessionFeature "session";
  83.  
  84.     private static $s_strTablePrefix "mcconfig_";
  85.     private static $s_strTableOptionSuffix "option";
  86.  
  87.     /**
  88.     * @var array 
  89.     *
  90.     *  Only used if isUsingLegacyWidgets() != true
  91.     */
  92.     protected $m_objArrayLayerResourceOptions = array(
  93.         "visibility" => "visibility",
  94.         "maxscaledenom" => "minscale",
  95.         "minscaledenom" => "maxscale"
  96.     );
  97.  
  98.     protected $m_objArrayProcessList = array(
  99.         "getProcessList",
  100.         "getAuthorizedResources"
  101.     );
  102.     
  103.     /**
  104.     * @var array 
  105.     */
  106.     protected $m_objArrayServiceTypes = array(
  107.         => org_geoprisma_service_WMSService::TYPE,
  108.         => org_geoprisma_service_TileCacheService::TYPE,
  109.         => org_geoprisma_service_FeatureServerService::TYPE,
  110.         => org_geoprisma_service_GYMOService::TYPE,
  111.         => org_geoprisma_service_WidgetService::TYPE,
  112.         => org_geoprisma_service_MapServerService::TYPE,
  113.         => org_geoprisma_service_MapFishPrintService::TYPE,
  114.         => org_geoprisma_service_FileService::TYPE,
  115.         => org_geoprisma_service_WFSService::TYPE,
  116.         10 => org_geoprisma_service_HttpRequestService::TYPE,
  117.         11 => org_geoprisma_service_WPSService::TYPE,
  118.         12 => org_geoprisma_service_TMSService::TYPE
  119.     );
  120.  
  121.     /**
  122.     * @var array 
  123.     */
  124.     protected $m_objArrayApplicationTypes = array(
  125.         => "extjs"
  126.     );
  127.  
  128.     /**
  129.     * @var array 
  130.     */
  131.     protected $m_objArrayWidgetTypes = array(
  132.         => "map",
  133.         => "mapfishlayertree",
  134.         => "mapfishrecenter",
  135.         => "measuretool",
  136.         => "queryonclick",
  137.         => "resultextgrid",
  138.         11 => "initialview",
  139.         12 => "zoomslider",
  140.         13 => "mouseposition",
  141.         14 => "getmouseposition",
  142.         15 => "scale",
  143.         16 => "editfeature_create",
  144.         17 => "editfeature_update",
  145.         18 => "editfeature_delete",
  146.         19 => "featurepanel_form",
  147.         20 => "featurepanel_selector",
  148.         22 => "geoexttoolbar",
  149.         25 => "shortcut",
  150.         26 => "geoextux_geonamessearchcombo",
  151.         27 => "geoextux_redliningpanel",
  152.         28 => "pdfprint",
  153.         29 => "wmslayeradder",
  154.         30 => "geoextux_shortcutcombo",
  155.         31 => "geoextux_zoomto",
  156.         32 => "htwindow",
  157.         33 => "unselectall",
  158.         34 => "geoextprintform",
  159.         35 => "filetreepanel",
  160.         36 => "geoextux_layertreebuilder",
  161.         37 => "mappanel",
  162.         38 => "layer",
  163.         39 => "querybyrect",
  164.         40 => "featurepanel_attributeform",
  165.         41 => "featurepanel_customform",
  166.         42 => "geoextux_wmsbrowser",
  167.         43 => "vectorlayer",
  168.         44 => "resultvectorlayer",
  169.         45 => "queryonclickwizard",
  170.         46 => "geoextux_printpreview",
  171.         47 => "wfsfilterbuilder",
  172.         48 => "templatepopup",
  173.         49 => "toggle",
  174.         50 => "editfeature_split",
  175.         51 => "editfeature_drag",
  176.         52 => "editfeature_copy",
  177.         53 => "editfeature_confirm",
  178.         54 => "keepactivesession",
  179.         55 => "applyfilter",
  180.         // for user-defined widgets, use numbers grater than 9999 ??
  181.         10000 => "livemarker",
  182.         10666 => "multiprojectionmouseposition"
  183.  
  184.     );
  185.  
  186.  
  187.     /**
  188.     * Construct a new instance of org_geoprisma_config_PGSQLMapContextConfig.
  189.     * Force the use of 'getInstance' (Singleton)
  190.     * 
  191.     * @throws org_geoprisma_exception_BadPGSQLMapContextConfig
  192.     * 
  193.     * @return org_geoprisma_config_PGSQLMapContextConfig 
  194.     */
  195.     private function __construct()
  196.     {
  197.         $this->m_objArrayService = new ArrayObject();
  198.         $this->m_objArrayDatastore = new ArrayObject();
  199.         $this->m_objArrayResource = new ArrayObject();
  200.         $this->m_objArrayOtherResource = new ArrayObject();
  201.         $this->m_objArrayWidget = new ArrayObject();
  202.         $this->m_objArrayExclusiveUnboundWidgetName = array();
  203.         $this->m_objArrayAccessFilter = new ArrayObject();
  204.         $this->m_objArrayLayout = new ArrayObject();
  205.         $this->m_objArrayField = new ArrayObject();
  206.  
  207.         $this->m_objArrayClonedWidgetNames = array();
  208.  
  209.         $this->load();
  210.     }
  211.  
  212.     // ====================
  213.     //  connection methods
  214.     // ====================
  215.  
  216.     /**
  217.     * Connect to database using connection string.
  218.     * 
  219.     * @return void 
  220.     */
  221.     protected function connect()
  222.     {
  223.         if ($this->m_objDB
  224.         {
  225.             return;
  226.         }
  227.  
  228.         $this->m_objDB pg_connect($this->getConnectionString())
  229.  
  230.         if (!$this->m_objDB
  231.         {
  232.             throw new Exception("Unable to connect to the database");
  233.         }
  234.     }
  235.  
  236.     /**
  237.     * Disconnect from database.
  238.     * 
  239.     * @return void 
  240.     */
  241.     protected function disconnect()
  242.     {
  243.         pg_close($this->m_objDB);
  244.         $this->m_objDB null;
  245.     }
  246.  
  247.     // ==============
  248.     //  LOAD methods
  249.     // ==============
  250.  
  251.     /**
  252.     * Get config from database.
  253.     * 
  254.     * @return void 
  255.     */
  256.     protected function load()
  257.     {
  258.         try
  259.         {
  260.             // connect to db
  261.             $this->connect();
  262.  
  263.             // First, check if there is/are 'osmresource' parameter(s) in the
  264.             // url, meaning a specific list of Resources accessed
  265.             $objArrayResourceNames $this->getResourceNamesFromRequest();
  266.             if (count($objArrayResourceNames0
  267.             {
  268.                 $this->loadFromResourceList(
  269.                     $objArrayResourceNamesarray('loadFields' => false)
  270.                 );
  271.             }
  272.             // Else, that means we load the whole config.  Check if we load from
  273.             // it from a Session id (not PHP Session, but GeoPrisma session)
  274.             else if (self::getCurrentSession(!= -1
  275.                 || self::getCurrentSessionName(!= ""
  276.             
  277.             {
  278.                 $this->loadFromSession();
  279.             }
  280.             // Else, check if we load from MapContext + Application combinaison
  281.             else if ((self::getCurrentMapContext(!= -|| self::getCurrentMapContextName(!= "")
  282.                 && (self::getCurrentApplication(!= -|| self::getCurrentApplicationName(!= ""
  283.             
  284.             {
  285.                 $this->loadFromMapContext();
  286.             }
  287.             // well, there is nothing to load from...
  288.             else
  289.             {
  290.                 exit("no session OR mapcontext+application defined");
  291.             }
  292.             
  293.             $this->disconnect();
  294.  
  295.             // test
  296.             //print_r($this->getAuthorizedResources());
  297.  
  298.             //print_r($this);
  299.             //exit("\nok");
  300.         }
  301.         catch(Exception $objError)
  302.         {
  303.             throw new org_geoprisma_exception_BadPGSQLMapContextConfigException($objError->__toString());       
  304.         }  
  305.     }
  306.     
  307.     /**
  308.     * Using current 'Session' id or name, get the according 'MapContext' and
  309.     *     'Application' ids and load them.
  310.     * 
  311.     * @return void 
  312.     */
  313.     protected function loadFromSession()
  314.     {
  315.         if (self::getCurrentSession(!= -1
  316.         {
  317.             $objArrayOptions array(
  318.                 'singleRecord' => self::getCurrentSession()
  319.             );
  320.         }
  321.         else
  322.         {
  323.             $objArrayOptions array(
  324.                 'singleRecordName' => self::getCurrentSessionName()
  325.             );
  326.         }
  327.  
  328.         $objSession $this->getRecords(
  329.             $this->getSessionFeatureName(),
  330.             $objArrayOptions
  331.         );
  332.  
  333.         if (self::getCurrentSession(== -1
  334.         {
  335.             self::setCurrentSession($objSession['id']);
  336.         }
  337.  
  338.         self::setCurrentMapContext(
  339.             $objSession[$this->getMapContextFeatureName().'_id']
  340.         );
  341.         self::setCurrentApplication(
  342.             $objSession[$this->getApplicationFeatureName().'_id']
  343.         );
  344.  
  345.         $this->loadFromMapContext();
  346.     }
  347.  
  348.     /**
  349.     * Using current 'MapContext' id, load :
  350.     *     Resources, DataStores, Services, Fields and MapWidget.
  351.     * 
  352.     * @return void 
  353.     */
  354.     protected function loadFromMapContext()
  355.     {
  356.         // get mapcontext with resource ids
  357.         $strForeignFeature $this->getResourceFeatureName();
  358.         $objArrayOptions array(
  359.             'foreignFeature' => $strForeignFeature,
  360.             'getOptions' => true
  361.         );
  362.  
  363.         if (self::getCurrentMapContext(!= -1
  364.         {
  365.             $objArrayOptions['singleRecord'self::getCurrentMapContext();
  366.         }
  367.         else
  368.         {
  369.             $objArrayOptions['singleRecordName']
  370.                 = self::getCurrentMapContextName();
  371.         }
  372.  
  373.         $objMapContext $this->getRecords(
  374.             $this->getMapContextFeatureName(),
  375.             $objArrayOptions
  376.         );
  377.  
  378.         if (self::getCurrentMapContext(== -1
  379.         {
  380.             self::setCurrentMapContext($objMapContext['id']);
  381.         }
  382.  
  383.         // get resource ids array
  384.         $objArrayResourceIds $this->getForeignIds(
  385.             array($objMapContext)$strForeignFeature
  386.         );
  387.  
  388.         // load service, datastore, fields and resources from resource ids list
  389.         $this->loadFromResourceList($objArrayResourceIds);
  390.  
  391.         // load layout and widgets
  392.         $this->loadFromApplication();
  393.  
  394.         if ($this->isUsingLegacyWidgets()) 
  395.         {
  396.             // load map widget from mapcontext
  397.             $this->loadMapWidget($objMapContext);
  398.         }
  399.         else
  400.         {
  401.             // load mappanel and layer widgets from mapcontext
  402.             $this->loadMapPanelWidget($objMapContext);
  403.             $this->loadLayerWidgets($objMapContext);
  404.         }
  405.     }
  406.  
  407.     /**
  408.     * Using a resource ids array, load : Resources, DataStores, Services and
  409.     *     (optionnally) Fields.
  410.     * 
  411.     * @param array $pobjArrayResourceIds A resource id list
  412.     * @param array $pobjArrayOptions     Options for this method.
  413.     * 
  414.     * @return void 
  415.     */
  416.     protected function loadFromResourceList(
  417.         $pobjArrayResourceIds,
  418.         $pobjArrayOptions array('loadFields' => true'otherResources' => false)
  419.     {
  420.         $bLoadFields $pobjArrayOptions['loadFields'];
  421.         if (isset($pobjArrayOptions['otherResources'])) 
  422.         {
  423.             $bOtherResources $pobjArrayOptions['otherResources'];
  424.         }
  425.         else
  426.         {
  427.             $bOtherResources false;
  428.         }
  429.  
  430.         // get resources with datastore ids
  431.         $objArrayForeignFeatures array($this->getDataStoreFeatureName());
  432.         array_push($objArrayForeignFeatures$this->getAccessFilterFeatureName());
  433.         if ($bLoadFields
  434.         {
  435.             array_push($objArrayForeignFeatures$this->getFieldFeatureName());
  436.         }
  437.  
  438.         $objArrayOptions array(
  439.             'specificRecords' => $pobjArrayResourceIds,
  440.             'foreignFeatures' => $objArrayForeignFeatures,
  441.             'getOptions' => true
  442.         );
  443.  
  444.         if (self::getCurrentMapContext(!= -1
  445.         {
  446.             $objArrayOptions['orderingTable']
  447.                 = $this->getMapContextFeatureName();
  448.             $objArrayOptions['orderingMasterFeatureId']
  449.                 = self::getCurrentMapContext();
  450.         }
  451.  
  452.         if ($bLoadFields
  453.         {
  454.             $objArrayOptions['foreignOrdering'array(
  455.                 $this->getFieldFeatureName()
  456.             );
  457.         }
  458.  
  459.         $objArrayResources $this->getRecords(
  460.             $this->getResourceFeatureName(),
  461.             $objArrayOptions
  462.         );
  463.  
  464.         // get datastore ids array
  465.         $objArrayDatastoreIds $this->getForeignIds(
  466.             $objArrayResources$objArrayForeignFeatures[0]
  467.         );
  468.  
  469.         if ($bLoadFields
  470.         {
  471.             // get fields ids array
  472.             $objArrayFieldIds $this->getForeignIds(
  473.                 $objArrayResources$objArrayForeignFeatures[2]
  474.             );
  475.  
  476.             // get fields
  477.             $objArrayOptions array(
  478.                 'specificRecords' => $objArrayFieldIds,
  479.                 'getOptions' => true,
  480.                 'orderingTable' => $this->getResourceFeatureName()
  481.             );
  482.             $objArrayFields $this->getRecords(
  483.                 $this->getFieldFeatureName(),
  484.                 $objArrayOptions
  485.             );
  486.         }
  487.  
  488.         // get datastores
  489.         $strForeignFeature $this->getServiceFeatureName();
  490.         $objArrayOptions array(
  491.             'specificRecords' => $objArrayDatastoreIds,
  492.             'getOptions' => true
  493.         );
  494.         $objArrayDataStores $this->getRecords(
  495.             $this->getDataStoreFeatureName(),
  496.             $objArrayOptions
  497.         );
  498.  
  499.         // get service ids array
  500.         $objArrayServiceIds $this->getForeignIds(
  501.             $objArrayDataStores$strForeignFeature
  502.         );
  503.  
  504.         // get services
  505.         $objArrayOptions array(
  506.             'specificRecords' => $objArrayServiceIds,
  507.             'getOptions' => true
  508.         );
  509.         $objArrayServices $this->getRecords(
  510.             $this->getServiceFeatureName(),
  511.             $objArrayOptions
  512.         );
  513.  
  514.         // get accessfilters
  515.         $objArrayAccessFilterIds $this->getForeignIds(
  516.             $objArrayResources$objArrayForeignFeatures[1]
  517.         );
  518.  
  519.         $objArrayOptions array(
  520.             'specificRecords' => $objArrayAccessFilterIds,
  521.             'getOptions' => true
  522.         );
  523.         $objArrayAccessFilters $this->getRecords(
  524.             $this->getAccessFilterFeatureName(),
  525.             $objArrayOptions
  526.         );
  527.  
  528.         // ======
  529.         //  load
  530.         // ======
  531.  
  532.         $this->loadServices($objArrayServices);
  533.         $this->loadDatastores($objArrayDataStores);
  534.         $this->loadAccessFilters($objArrayAccessFilters);
  535.         if ($bLoadFields
  536.         {
  537.             $this->loadFields($objArrayFields);
  538.         }
  539.         $this->loadResources(
  540.             $objArrayResources,
  541.             Array('otherResources' => $bOtherResources)
  542.         );
  543.     }
  544.  
  545.     /**
  546.     * Using current 'Application' id, load : Layout and Widgets
  547.     * 
  548.     * @return void 
  549.     */
  550.     protected function loadFromApplication()
  551.     {
  552.         // get application with widget ids
  553.         $strForeignFeature $this->getWidgetFeatureName();
  554.         $objArrayOptions array(
  555.             'foreignFeature' => $strForeignFeature
  556.         );
  557.  
  558.         if (self::getCurrentApplication(!= -1
  559.         {
  560.             $objArrayOptions['singleRecord'self::getCurrentApplication();
  561.         }
  562.         else
  563.         {
  564.             $objArrayOptions['singleRecordName']
  565.                 = self::getCurrentApplicationName();
  566.         }
  567.  
  568.         $objApplication $this->getRecords(
  569.             $this->getApplicationFeatureName(),
  570.             $objArrayOptions
  571.         );
  572.  
  573.         if (self::getCurrentApplication(== -1
  574.         {
  575.             self::setCurrentApplication($objApplication['id']);
  576.         }
  577.  
  578.         // get widgets ids array
  579.         $objArrayWidgetIds $this->getForeignIds(
  580.             array($objApplication)$strForeignFeature
  581.         );
  582.  
  583.         // get widgets
  584.         $objArrayOptions array(
  585.             'specificRecords' => $objArrayWidgetIds,
  586.             'getOptions' => true,
  587.             'optionOrdering' => true
  588.         );
  589.  
  590.         if (self::getCurrentApplication(!= -1
  591.         {
  592.             $objArrayOptions['orderingTable']
  593.                 = $this->getApplicationFeatureName();
  594.             $objArrayOptions['orderingMasterFeatureId']
  595.                 = self::getCurrentApplication();
  596.         }
  597.  
  598.         $objArrayWidgets $this->getRecords(
  599.             $this->getWidgetFeatureName(),
  600.             $objArrayOptions
  601.         );
  602.  
  603.         // ======
  604.         //  load
  605.         // ======
  606.  
  607.         $this->loadLayout($objApplication);
  608.         $this->loadWidgets($objArrayWidgets);
  609.         $this->adjustWidgetsContainingClonedWidgets();
  610.     }
  611.  
  612.  
  613.     /**
  614.     * Load all 'org_geoprisma_service_Service' object inside the service array
  615.     *     from the database.
  616.     * 
  617.     * @param array $pobjArrayServices Array of service records
  618.     * 
  619.     * @return void 
  620.     */
  621.     protected function loadServices($pobjArrayServices)
  622.     {
  623.         foreach ($pobjArrayServices as $objService)
  624.         {
  625.             $strType $this->m_objArrayServiceTypes[$objService['type']];
  626.  
  627.             $this->m_objArrayService[$objService['id']] (
  628.                 org_geoprisma_service_ServiceFactory::getService(
  629.                     $strType$objService
  630.                 )
  631.             );  
  632.         }
  633.     }
  634.     
  635.     /**
  636.     * Load the 'org_geoprisma_layout_Layout' object using the application
  637.     * record.
  638.     * 
  639.     * @param array $pobjApplication A single application record.
  640.     * 
  641.     * @return void 
  642.     */
  643.     protected function loadLayout($pobjApplication)
  644.     {
  645.         $this->m_objArrayLayout[$pobjApplication['id']] 
  646.             = new org_geoprisma_layout_Layout(
  647.                 (string)$pobjApplication['id'],
  648.                 (string)$pobjApplication['template'],
  649.                 (string)$this->m_objArrayApplicationTypes[$pobjApplication['type']]
  650.         );
  651.     }
  652.    
  653.     /**
  654.     * Load all 'org_geoprisma_datastore_Datastore' objects inside the datastore
  655.     * array using datastore records.
  656.     * 
  657.     * @param array $pobjArrayDatastores Array of datastore records
  658.     * 
  659.     * @return void 
  660.     */
  661.     private function loadDatastores($pobjArrayDatastores)
  662.     {
  663.         foreach ($pobjArrayDatastores as $objDatastore)
  664.         {
  665.             $this->m_objArrayDatastore->append(
  666.                 new org_geoprisma_datastore_Datastore(
  667.                     $objDatastore['id'],
  668.                     $this->m_objArrayService[$objDatastore[$this->getServiceFeatureName().'_id']],
  669.                     $objDatastore['layers'],
  670.                     $objDatastore['options']
  671.                 )
  672.             );
  673.         }
  674.     }
  675.  
  676.     /**
  677.     * Load all 'org_geoprisma_accessfilter_AccessFilter' objects inside the accessfilter
  678.     * array using accessfilter records.
  679.     * 
  680.     * @param array $pobjArrayAccessFilters Array of accessfilter records
  681.     * 
  682.     * @return void 
  683.     */
  684.     private function loadAccessFilters($pobjArrayAccessFilters)
  685.     {
  686.         foreach ($pobjArrayAccessFilters as $objAccessFilter)
  687.         {
  688.             $objArrayConditions array();
  689.             foreach ($objAccessFilter['options'as $strName => $strValue
  690.             {
  691.                 if ($strName == 'condition'
  692.                 {
  693.                     $objArrayConditions[$strValue;
  694.                 }
  695.             }
  696.  
  697.             $this->m_objArrayAccessFilter->append(
  698.                 new org_geoprisma_accessfilter_AccessFilter(
  699.                     $objAccessFilter['id'],
  700.                     $objArrayConditions
  701.                 )
  702.             );
  703.         }
  704.     }
  705.  
  706.     /**
  707.     * Load all 'org_geoprisma_field_Field' objects inside the field array using
  708.     *     field records.
  709.     * 
  710.     * @param array $pobjArrayFields Array of field records
  711.     * 
  712.     * @return void 
  713.     */
  714.     private function loadFields($pobjArrayFields)
  715.     {
  716.         foreach ($pobjArrayFields as $objField)
  717.         {
  718.             $objArrayOption new ArrayObject();
  719.  
  720.             // field title (with i18n support)
  721.             if ($objField['key'!= '' && $objField['domain'!= ''
  722.             {
  723.                 $strTitle array(
  724.                     'key' => $objField['key'],
  725.                     'domain' => $objField['domain']
  726.                 );
  727.             }
  728.             else
  729.             {
  730.                 $strTitle = (string)$objField['title'];
  731.             }
  732.  
  733.             $this->m_objArrayField->append(
  734.                 new org_geoprisma_field_Field(
  735.                     $objField['id'],
  736.                     $objField['name'],
  737.                     $objField,
  738.                     $strTitle
  739.                 )
  740.             );
  741.         }
  742.     }
  743.     
  744.     /**
  745.     * Load all 'org_geoprisma_widget_Widget' objects inside the widget
  746.     * array using widget records.
  747.     * 
  748.     * @param array $pobjArrayWidgets Array of widget records
  749.     * 
  750.     * @return void 
  751.     */
  752.     protected function loadWidgets($pobjArrayWidgets)
  753.     {
  754.         foreach ($pobjArrayWidgets as $objWidgetRecord)
  755.         {
  756.             $bAddWidget false;
  757.  
  758.             $objWidget org_geoprisma_widget_WidgetFactory::getWidget(
  759.                 $this->m_objArrayWidgetTypes[$objWidgetRecord['type']],
  760.                 $objWidgetRecord
  761.             );
  762.  
  763.             $objArrayResourceOptions
  764.                 = $objWidget->getMandatoryResourceOptionList();
  765.  
  766.             // if widget doesn't need to be linked to any resource, add it.
  767.             if ($objArrayResourceOptions === null
  768.             {
  769.                 // the name 'linkResource' becomes irrevelant here, but the
  770.                 // purpose of this method should remain the same (call before
  771.                 // each widget added and do custom stuff with or without a
  772.                 // resource)...  If the method returns
  773.                 if ($objWidget->linkResource(null$this!== false
  774.                 {
  775.                     // add widget to config only
  776.                     $this->m_objArrayWidget[$objWidget->getName()$objWidget;
  777.                 }
  778.             }
  779.             else
  780.             {
  781.                 foreach ($this->getResources(as $objResource)
  782.                 {
  783.                     $bHasRequiredOptions 
  784.                         = $objWidget->resourceHasRequiredWidgetOptions(
  785.                             $objResource
  786.                         );
  787.  
  788.                     // if resource has all required options used by the widget
  789.                     // and user is authorized to access the resource, add the
  790.                     // the widget and add the resource to it.
  791.                     if ($bHasRequiredOptions
  792.                         && org_geoprisma_acl_ACLFactory::getACL()->isAuthorized($objResource$objWidget->getAction())
  793.                     
  794.                     {
  795.                         // if widget and resource has a 1:1 relation, then it
  796.                         // must be cloned first.
  797.                         if ($objWidget->mustClone()) 
  798.                         {
  799.                             $objWidgetClone clone $objWidget;
  800.                             $strOriginalName $objWidgetClone->getName();
  801.                             $strCloneName $strOriginalName.'_'.uniqid();
  802.                             $this->addCloneName(
  803.                                 $strOriginalName$strCloneName
  804.                             );
  805.  
  806.                             $objWidgetClone->setName($strCloneName);
  807.  
  808.                             $objArrayWidgetResourceOptions 
  809.                                 = $objWidgetClone->getOptionsFromResource(
  810.                                     $objResource
  811.                                 );
  812.  
  813.                             foreach ($objArrayWidgetResourceOptions 
  814.                                      as $objOption
  815.                             {
  816.                                 $objWidgetClone->addOrReplaceOption(
  817.                                     $objOption
  818.                                 );
  819.                             }
  820.  
  821.                             // if clone linked, then add widget to resource and
  822.                             // add it to widget array
  823.                             if ($objWidgetClone->linkResource($objResource$this!== false
  824.                             {
  825.                                 $objResource->addWidget($objWidgetClone);
  826.                                 $this->m_objArrayWidget[$objWidgetClone->getName()$objWidgetClone;
  827.                             }
  828.                         }
  829.                         // the widget has a 1:x relation with resources, so
  830.                         // we simply need to  link 
  831.                         else
  832.                         {
  833.                             $bAddWidget true;
  834.  
  835.                             // if linked, then add widget to resource
  836.                             if ($objWidget->linkResource($objResource$this!== false)
  837.                             {
  838.                                 $objResource->addWidget($objWidget);
  839.                             }
  840.                         }
  841.                     }
  842.                 // end of foreach resources
  843.  
  844.                 if ($bAddWidget
  845.                 {
  846.                     $this->m_objArrayWidget[$objWidget->getName()$objWidget;
  847.                 }
  848.  
  849.             // end of 'else'
  850.  
  851.         // end of foreach widgets
  852.     }
  853.  
  854.     /**
  855.     * Add a new clone name in the 'clone' array using the original name as
  856.     *     the key.
  857.     *
  858.     * @param string $pstrOriginalName The original name
  859.     * @param string $pstrCloneName    The name of the clone
  860.     * 
  861.     * @return void 
  862.     */
  863.     protected function addCloneName($pstrOriginalName$pstrCloneName
  864.     {
  865.         if (!isset($this->m_objArrayClonedWidgetNames[$pstrOriginalName])) 
  866.         {
  867.             $this->m_objArrayClonedWidgetNames[$pstrOriginalNamearray();
  868.         }
  869.  
  870.         array_push(
  871.             $this->m_objArrayClonedWidgetNames[$pstrOriginalName],
  872.             $pstrCloneName
  873.         );
  874.     }
  875.  
  876.     /**
  877.     * This config driver sometimes clones widget and change their name.  The
  878.     *     names that appears in some widgets have to be changed accordingly.
  879.     *     This is done using the 'getCloneNames' method.
  880.     * 
  881.     * @return void 
  882.     */
  883.     protected function adjustWidgetsContainingClonedWidgets(
  884.     {
  885.         // key : widgettype that can contain reference to cloned widgets
  886.         // value : the node name to check
  887.         $objArrayWidgetsToCheck array(
  888.             "geoexttoolbar" => "widget",
  889.             "toolbar" => "widget",
  890.             "queryonclick" => "featurepanel"
  891.         );
  892.  
  893.         foreach ($this->m_objArrayWidget as $objWidget
  894.         {
  895.             $strType $objWidget->getType();
  896.  
  897.             if (!isset($objArrayWidgetsToCheck[$strType])) 
  898.             {
  899.                 continue;
  900.             }
  901.  
  902.             $strSingleNodeName $objArrayWidgetsToCheck[$strType];
  903.             $strMultipleNodeName $strSingleNodeName."s";
  904.  
  905.             try
  906.             {
  907.                 $objOption $objWidget->getOption($strSingleNodeName);
  908.  
  909.                 $objArrayClonedNames $this->getCloneNames(
  910.                     $objOption->getValue()
  911.                 );
  912.  
  913.                 if ($objArrayClonedNames !== false
  914.                 {
  915.                     if (count($objArrayClonedNames== 1
  916.                     {
  917.                         $objOption->setValue($objArrayClonedNames[0]);
  918.                     }
  919.                     else
  920.                     {
  921.                         $objOption->setValue($objArrayClonedNames);
  922.                         $objOption->setName($objOption->getName().'s');
  923.                     }
  924.                 }
  925.             }
  926.             catch(Exception $objError)
  927.             {
  928.                 try
  929.                 {
  930.                     $objArrayNewValues array();
  931.  
  932.                     $objOption $objWidget->getOption($strMultipleNodeName);
  933.                     $objArrayWidgetNames $objOption->getValue();
  934.  
  935.                     foreach ($objArrayWidgetNames as $strWidgetName
  936.                     {
  937.                         $objArrayClonedNames $this->getCloneNames(
  938.                             $strWidgetName
  939.                         );
  940.  
  941.                         if ($objArrayClonedNames !== false
  942.                         {
  943.                             $objArrayNewValues array_merge(
  944.                                 $objArrayNewValues$objArrayClonedNames
  945.                             );
  946.                         }
  947.                         else
  948.                         {
  949.                             array_push($objArrayNewValues$strWidgetName);
  950.                         }
  951.                     }
  952.  
  953.                     $objOption->setValue($objArrayNewValues);
  954.                 }
  955.                 catch(Exception $objError{
  956.                     // no option was found, so carry on...
  957.                 }
  958.             
  959.         }
  960.     }
  961.     
  962.     /**
  963.     * Load all 'org_geoprisma_resource_Resource' objects inside the resource
  964.     * array using resource records.  Since widgets are no longer directly
  965.     * attached to resources, they are loaded separately.
  966.     * 
  967.     * @param array $pobjArrayResources Array of resource records
  968.     * @param array $pobjArrayOptions   Array of options for this method
  969.     * 
  970.     * @return void 
  971.     */
  972.     protected function loadResources(
  973.         $pobjArrayResources,
  974.         $pobjArrayOptions array('otherResources' => false)
  975.     {
  976.         $bOtherResources $pobjArrayOptions['otherResources'];
  977.         if ($bOtherResources
  978.         {
  979.             $objArrayDestResource 'm_objArrayOtherResource';
  980.         }
  981.         else
  982.         {
  983.             $objArrayDestResource 'm_objArrayResource';
  984.         }
  985.         
  986.         foreach ($pobjArrayResources as $objResource
  987.         {
  988.             // resource name
  989.             $strName = (string)$objResource['id'];
  990.  
  991.             // resource acl name
  992.             $strACLName = (string)$objResource['acl_name'];
  993.  
  994.             // resource title (with i18n support)
  995.             if ($objResource['key'!= '' && $objResource['domain'!= ''
  996.             {
  997.                 $strTitle array(
  998.                     'key' => $objResource['key'],
  999.                     'domain' => $objResource['domain']
  1000.                 );
  1001.             }
  1002.             else
  1003.             {
  1004.                 $strTitle = (string)$objResource['name'];
  1005.             }
  1006.  
  1007.             $objArrayDatastore new ArrayObject();
  1008.             $objArrayField new ArrayObject();
  1009.             $objArrayWidget new ArrayObject();
  1010.             $objArrayAccessFilter new ArrayObject();
  1011.             $objArrayOption new ArrayObject();
  1012.             
  1013.             // get datastores
  1014.             if (isset($objResource[$this->getDataStoreFeatureName()])) 
  1015.             {
  1016.                 foreach ($objResource[$this->getDataStoreFeatureName()as $strDatastore)
  1017.                 {
  1018.                     $objArrayDatastore[$strDatastore
  1019.                         = $this->getDatastore((string)$strDatastore);
  1020.                 }
  1021.             }
  1022.  
  1023.             // get fields (if any)
  1024.             if (isset($objResource[$this->getFieldFeatureName()])) 
  1025.             {
  1026.                 foreach ($objResource[$this->getFieldFeatureName()as $strField)
  1027.                 {
  1028.                     $objArrayField[$strField
  1029.                         = $this->getField((string)$strField);
  1030.                 }
  1031.             }
  1032.  
  1033.             // create options
  1034.             foreach ($objResource['options'
  1035.                      as $strOptionName => $strOptionValue
  1036.             {
  1037.                 $objArrayOption->append(
  1038.                     new org_geoprisma_option_Option(
  1039.                         $strOptionName$strOptionValue
  1040.                     )
  1041.                 );
  1042.             }
  1043.             
  1044.             // get accessfilters
  1045.             if (isset($objResource[$this->getAccessFilterFeatureName()])) 
  1046.             {
  1047.                 foreach ($objResource[$this->getAccessFilterFeatureName()as $strAccessFilter)
  1048.                 {
  1049.                     $objArrayAccessFilter[$strAccessFilter
  1050.                         = $this->getAccessFilter((string)$strAccessFilter);
  1051.                 }
  1052.             }
  1053.             
  1054.             // append new resource
  1055.             $this->$objArrayDestResource->append(
  1056.                 new org_geoprisma_resource_Resource(
  1057.                     $strName,
  1058.                     $objArrayDatastore,
  1059.                     $objArrayWidget,
  1060.                     $objArrayAccessFilter,
  1061.                     $objArrayOption,
  1062.                     $strTitle,
  1063.                     $objArrayField,
  1064.                     $strACLName
  1065.                 )
  1066.             );
  1067.         }
  1068.     }
  1069.  
  1070.     /**
  1071.     * Load all 'org_geoprisma_resource_Resource' objects inside the other resource array.
  1072.     * 
  1073.     * @return void 
  1074.     */
  1075.     protected function loadOtherResources()
  1076.     {
  1077.         $objArrayOptions array(
  1078.             //'specificRecords' => $pobjArrayResourceIds,
  1079.             'foreignFeatures' => $objArrayForeignFeatures,
  1080.             'getOptions' => false
  1081.         );
  1082.         $this->connect();
  1083.  
  1084.         //get les resources.
  1085.         $objArrayOtherResources $this->getRecords(
  1086.             $this->getResourceFeatureName(),
  1087.             $objArrayOptions
  1088.         );
  1089.         
  1090.         $objArrayOtherResourceIds Array();
  1091.         //créer un array d'id qui sera charger par la fontion loadFromResourceList.
  1092.         foreach ($objArrayOtherResources as $objOtherResource
  1093.         {
  1094.             $objArrayOtherResourceIds[$objOtherResource['id'];
  1095.         }
  1096.  
  1097.         $pobjArrayOptions array('loadFields' => true'otherResources' => true);
  1098.         $iSavedMapContext self::getCurrentMapContext();
  1099.         self::setCurrentMapContext(-1);
  1100.  
  1101.         $this->loadFromResourceList(
  1102.             $objArrayOtherResourceIds,
  1103.             $pobjArrayOptions
  1104.         );
  1105.  
  1106.         self::getCurrentMapContext($iSavedMapContext);
  1107.         $this->disconnect();
  1108.     }
  1109.     /**
  1110.     * Create the 'mappanel' widget and append it to widget array using the
  1111.     * MapContext record.
  1112.     *
  1113.     * Only used if isUsingLegacyWidgets() != true
  1114.     * 
  1115.     * @param array $pobjMapContext The MapContext record.
  1116.     * 
  1117.     * @return void 
  1118.     */
  1119.     protected function loadMapPanelWidget($pobjMapContext)
  1120.     {
  1121.         $objArrayMapPanel array(
  1122.             'name' => $pobjMapContext['name'],
  1123.             'options' => $pobjMapContext['options']
  1124.         );
  1125.         $objMapPanelWidget new org_geoprisma_widget_GenericWidget('mappanel'$objArrayMapPanel);
  1126.  
  1127.         // add mappanel widget as first element of the widget array
  1128.         $this->m_objArrayWidget = new ArrayObject(
  1129.             array('mappanel'=>$objMapPanelWidget+
  1130.             (array)$this->m_objArrayWidget
  1131.         );
  1132.     }
  1133.  
  1134.     /**
  1135.     * For each resource, create 'layer' widgets according to the datastores
  1136.     * they have, link them to and append them to widget array.
  1137.     *
  1138.     * Only used if isUsingLegacyWidgets() != true
  1139.     * 
  1140.     * @return void 
  1141.     */
  1142.     protected function loadLayerWidgets()
  1143.     {
  1144.         $objArrayLayers array();
  1145.         $objArrayResources $this->getResources();
  1146.         $bAddLayer false;
  1147.  
  1148.         foreach ($objArrayResources as $objResource)
  1149.         {
  1150.             $objArrayResourceOptions $objResource->getOptions();
  1151.             $objArrayDataStores $objResource->getDatastores();
  1152.             $strResourceName $objResource->getName();
  1153.  
  1154.             foreach ($objArrayDataStores as $objDataStore)
  1155.             {
  1156.                 $objService $objDataStore->getService();
  1157.                 $strServiceType $objService->getType();
  1158.                 $strServiceName $objService->getName();
  1159.                 $strDataStoreName $objDataStore->getName();
  1160.  
  1161.                 switch ($strServiceType{
  1162.                     // WMS
  1163.                     case org_geoprisma_service_WMSService::TYPE:
  1164.                         $objTileCacheDS
  1165.                             = $objResource->getDatastoreByServiceType(
  1166.                                 org_geoprisma_service_TileCacheService::TYPE
  1167.                             );
  1168.  
  1169.                         $objTMSDS
  1170.                             = $objResource->getDatastoreByServiceType(
  1171.                                 org_geoprisma_service_TMSService::TYPE
  1172.                             );
  1173.  
  1174.                         // add WMS layer if there is no tilecache or tms
  1175.                         // datastore
  1176.                         $bAddLayer ($objTileCacheDS || $objTMSDS)
  1177.                             ? false true;
  1178.                         
  1179.                         break;
  1180.  
  1181.                     // TileCache, GYMO and TMS
  1182.                     case org_geoprisma_service_TileCacheService::TYPE:
  1183.                     case org_geoprisma_service_GYMOService::TYPE:
  1184.                     case org_geoprisma_service_TMSService::TYPE:
  1185.                         // always add tilecache, gymo and tms layers
  1186.                         $bAddLayer true;
  1187.                         break;
  1188.  
  1189.                     // FeatureServer & WFS
  1190.                     case org_geoprisma_service_FeatureServerService::TYPE:
  1191.                     case org_geoprisma_service_WFSService::TYPE:
  1192.                         // if there is at least one widget requiring to interact
  1193.                         // with a vector layer OR the resource only has one 
  1194.                         // datastore, add a 'featureserver' or 'wfs' layer
  1195.                         $bLayerNeededByWidgets
  1196.                             = $objResource->hasWidgetUsingServiceType(
  1197.                                 $strServiceType
  1198.                             );
  1199.  
  1200.                         if ($bLayerNeededByWidgets
  1201.                             || $objResource->getDatastores()->count(== 1
  1202.                         
  1203.                         {
  1204.                             $bAddLayer true;
  1205.                         }
  1206.  
  1207.                         break;
  1208.                 }
  1209.  
  1210.                 if ($bAddLayer
  1211.                 {
  1212.                     $objArrayLayerOptions 
  1213.                         = $this->getLayerOptionsFromResourceOptions(
  1214.                             (array)$objArrayResourceOptions,
  1215.                             $strServiceType
  1216.                         );
  1217.  
  1218.                     $objArrayLayerOptions array_merge(
  1219.                         $objService->getDefaultLayerOptions($this),
  1220.                         $objArrayLayerOptions,
  1221.                         array('servicetype' => $strServiceType)
  1222.                     );
  1223.  
  1224.                     $strLayerId "layer_S".$strServiceName."_DS".
  1225.                         $strDataStoreName."_R".$strResourceName;
  1226.  
  1227.                     $objLayerWidget new org_geoprisma_widget_GenericWidget(
  1228.                         'layer',
  1229.                         array(
  1230.                             'id' => $strLayerId,
  1231.                             'options' => $objArrayLayerOptions
  1232.                         )
  1233.                     );
  1234.  
  1235.                     $objArrayLayers[$strLayerId$objLayerWidget;
  1236.                     $objResource->addWidget($objLayerWidget);
  1237.  
  1238.                     $bAddLayer false;
  1239.                 }
  1240.             }
  1241.         }
  1242.  
  1243.         // add all created layer widgets to the widget array
  1244.         // add mappanel widget as first element of the widget array
  1245.         $this->m_objArrayWidget = new ArrayObject(
  1246.             (array)$this->m_objArrayWidget +
  1247.             $objArrayLayers
  1248.         );
  1249.     }
  1250.  
  1251.     /**
  1252.     * Load 'org_geoprisma_widget_MapWidget' object and append to widget
  1253.     * array using MapContext record.
  1254.     * 
  1255.     * @param array $pobjMapContext The MapContext record.
  1256.     * 
  1257.     * @return void 
  1258.     */
  1259.     protected function loadMapWidget($pobjMapContext)
  1260.     {
  1261.         // create layers
  1262.         $objArrayLayers array();
  1263.         $objArrayWMSServiceLayerKeys array();
  1264.         $objArrayResources $this->getResources();
  1265.         foreach ($objArrayResources as $objResource)
  1266.         {
  1267.             $objArrayResourceOptions $objResource->getOptions();
  1268.             $objArrayDataStores $objResource->getDatastores();
  1269.             $strResourceName $objResource->getName();
  1270.  
  1271.             foreach ($objArrayDataStores as $objDataStore)
  1272.             {
  1273.                 $objService $objDataStore->getService();
  1274.                 $strServiceType $objService->getType();
  1275.                 $strServiceName $objService->getName();
  1276.  
  1277.                 $objArrayLayerOptions 
  1278.                     = $this->getLayerOptionsFromResourceOptions(
  1279.                         (array)$objArrayResourceOptions,
  1280.                         $strServiceType
  1281.                     );
  1282.  
  1283.                 switch ($strServiceType{
  1284.                     // WMS
  1285.                     case org_geoprisma_service_WMSService::TYPE:
  1286.                         $objTileCacheDS
  1287.                             = $objResource->getDatastoreByServiceType(
  1288.                                 org_geoprisma_service_TileCacheService::TYPE
  1289.                             );
  1290.  
  1291.                         // if resource has tilecache datastore, don't add a
  1292.                         // wms layer.  Remove the node from the layertree as
  1293.                         // well
  1294.                         if ($objTileCacheDS
  1295.                         {
  1296.                             $objMapFishLayerTree 
  1297.                                 = $this->getMapFishLayerTreeWidget();
  1298.                             if ($objMapFishLayerTree
  1299.                             {
  1300.                                 $objMapFishLayerTree->removeLeaf(
  1301.                                     $objMapFishLayerTree->getNodes(),
  1302.                                     $strResourceName,
  1303.                                     $strServiceType
  1304.                                 );
  1305.                             }
  1306.                             break;
  1307.                         }
  1308.  
  1309.                         // check if a layer object with the same service name
  1310.                         // has already been created.  If not, create a new layer
  1311.                         // and keep the layer+servicename link using an array.
  1312.                         if (!isset($objArrayWMSServiceLayerKeys[$strServiceName])) 
  1313.                         {
  1314.                             $strLayerName "L_".$strServiceType."_R_".$strResourceName;
  1315.                             $objArrayLayerOptions array_merge(
  1316.                                 $objService->getDefaultLayerOptions($this),
  1317.                                 $objArrayLayerOptions,
  1318.                                 array('layername' => $strLayerName)
  1319.                             );
  1320.                             array_push(
  1321.                                 $objArrayLayers
  1322.                                 array(
  1323.                                     'resourcenames' => array($strResourceName),
  1324.                                     'servicetype' => $strServiceType,
  1325.                                     'options' => $objArrayLayerOptions
  1326.                                 )
  1327.                             );
  1328.  
  1329.                             // keep the layer+service name link
  1330.                             $objArrayWMSServiceLayerKeys[$strServiceName]
  1331.                                 = count($objArrayLayers1;
  1332.                         }
  1333.                         else
  1334.                         {
  1335.                             array_push($objArrayLayers[$objArrayWMSServiceLayerKeys[$strServiceName]]['resourcenames']$strResourceName);
  1336.                             $objArrayLayers[$objArrayWMSServiceLayerKeys[$strServiceName]]['options']['layername'.= "_".$strResourceName;
  1337.                         }
  1338.                         break;
  1339.  
  1340.                     // TileCache
  1341.                     case org_geoprisma_service_TileCacheService::TYPE:
  1342.                         $strLayerName "L_".$strServiceType."_R_".$strResourceName;
  1343.                         $objArrayLayerOptions array_merge(
  1344.                             $objService->getDefaultLayerOptions($this),
  1345.                             $objArrayLayerOptions,
  1346.                             array('layername' => $strLayerName)
  1347.                         );
  1348.                         array_push(
  1349.                             $objArrayLayers,
  1350.                             array(
  1351.                                 'resourcenames' => array($strResourceName),
  1352.                                 'servicetype' => $strServiceType,
  1353.                                 'options' => $objArrayLayerOptions
  1354.                             )
  1355.                         );
  1356.                         break;
  1357.  
  1358.                     // FeatureServer
  1359.                     case org_geoprisma_service_FeatureServerService::TYPE:
  1360.                     case org_geoprisma_service_WFSService::TYPE:
  1361.                         // if there are no widgets requiring direct 
  1362.                         // interaction AND there and resource has more than
  1363.                         // one datastore, don't add a 'featureserver' or 'wfs'
  1364.                         // layer
  1365.                         $bLayerNeededByWidgets
  1366.                             = $objResource->hasWidgetUsingServiceType(
  1367.                                 $strServiceType
  1368.                             );
  1369.  
  1370.                         if ($bLayerNeededByWidgets
  1371.                             || $objResource->getDatastores()->count(== 1
  1372.                         
  1373.                         {
  1374.                             $strLayerName "L_".$strServiceType."_R_".$strResourceName;
  1375.                             $objArrayLayerOptions array_merge(
  1376.                                 $objService->getDefaultLayerOptions($this),
  1377.                                 $objArrayLayerOptions,
  1378.                                 array('layername' => $strLayerName)
  1379.                             );
  1380.                             array_push(
  1381.                                 $objArrayLayers,
  1382.                                 array(
  1383.                                     'resourcenames' => array($strResourceName),
  1384.                                     'servicetype' => $strServiceType,
  1385.                                     'options' => $objArrayLayerOptions
  1386.                                 )
  1387.                             );
  1388.                         }
  1389.                         // if the layer is not added, we need to make sure
  1390.                         // the according layertree node is removed as well
  1391.                         else
  1392.                         {
  1393.                             $objMapFishLayerTree 
  1394.                                 = $this->getMapFishLayerTreeWidget();
  1395.                             if ($objMapFishLayerTree
  1396.                             {
  1397.                                 $objMapFishLayerTree->removeLeaf(
  1398.                                     $objMapFishLayerTree->getNodes(),
  1399.                                     $strResourceName,
  1400.                                     $strServiceType
  1401.                                 );
  1402.                             }
  1403.                         }
  1404.                         break;
  1405.  
  1406.                     // GYMO
  1407.                     case org_geoprisma_service_GYMOService::TYPE:
  1408.                         $strLayerName "L_".$strServiceType."_R_".$strResourceName;
  1409.                         $objArrayLayerOptions array_merge(
  1410.                             $objService->getDefaultLayerOptions($this),
  1411.                             $objArrayLayerOptions,
  1412.                             array('layername' => $strLayerName)
  1413.                         );
  1414.                         array_push(
  1415.                             $objArrayLayers,
  1416.                             array(
  1417.                                 'resourcenames' => array($strResourceName),
  1418.                                 'servicetype' => $strServiceType,
  1419.                                 'options' => $objArrayLayerOptions
  1420.                             )
  1421.                         );
  1422.                         break;
  1423.                 }
  1424.             }
  1425.         }
  1426.  
  1427.         // create map with layers
  1428.         $objArrayMap array(
  1429.             'name' => $pobjMapContext['name'],
  1430.             'options' => $pobjMapContext['options'],
  1431.             'layers' => $objArrayLayers
  1432.         );
  1433.  
  1434.         $this->m_objArrayWidget['map'new org_geoprisma_widget_MapWidget($objArrayMap);
  1435.     }
  1436.  
  1437.     // ==========================================================
  1438.     //  getRecords method and utilities (connecting to database)
  1439.     // ==========================================================
  1440.  
  1441.     /**
  1442.     * Get records from specific table.
  1443.     *
  1444.     * @param sring $pstrFeature      Name of the feature we need to get
  1445.     * @param array $pobjArrayOptions Array of options used to fetch more
  1446.     *                                 elements inside the records
  1447.     * 
  1448.     * @return void 
  1449.     */
  1450.     protected function getRecords $pstrFeature$pobjArrayOptions=array() )
  1451.     {
  1452.         // when set to true, get the records options as well
  1453.         $bGetOptions = isset($pobjArrayOptions['getOptions']
  1454.             ? $pobjArrayOptions['getOptions'null;
  1455.  
  1456.         // merge record options to the record properties OR create a separate
  1457.         // 'options' array to put them there
  1458.         $bMergeOptions = isset($pobjArrayOptions['mergeOptions'])
  1459.             ? $pobjArrayOptions['mergeOptions'null;
  1460.  
  1461.         // when set, get foreign records as well in defined foreignFeatures
  1462.         $objArrayForeignFeatures = isset($pobjArrayOptions['foreignFeatures'])
  1463.             ? $pobjArrayOptions['foreignFeatures'array();
  1464.  
  1465.         // when set, get foreign records as well in defined foreignFeature
  1466.         if (isset($pobjArrayOptions['foreignFeature'])) 
  1467.         {
  1468.             array_push(
  1469.                 $objArrayForeignFeatures,
  1470.                 $pobjArrayOptions['foreignFeature']
  1471.             );
  1472.         }
  1473.  
  1474.         // if set, get a single record using a specific id.  Not compatible
  1475.         // with 'singleRecordName' nor 'specificRecords'.
  1476.         $iSingleRecord = isset($pobjArrayOptions['singleRecord'])
  1477.             ? $pobjArrayOptions['singleRecord'null;
  1478.  
  1479.         // if set, get a single record using a specific name.  Not compatible
  1480.         // with 'singleRecord' nor 'specificRecords'.
  1481.         $strSingleRecordName = isset($pobjArrayOptions['singleRecordName'])
  1482.             ? $pobjArrayOptions['singleRecordName'null;
  1483.  
  1484.         // if set, get records from the specified list of ids.  Not compatible
  1485.         // with 'singleRecordName' nor 'singleRecord'.
  1486.         $objArraySpecificRecords = isset($pobjArrayOptions['specificRecords'])
  1487.             ? $pobjArrayOptions['specificRecords'null;
  1488.  
  1489.         // the name of the table related to the feature
  1490.         $strTable $this->getTableName($pstrFeature);
  1491.  
  1492.         // the name of the ordering table to use to order the features
  1493.         $strOrderTable null;
  1494.         $strOrderMasterFeature null;
  1495.         if (isset($pobjArrayOptions['orderingTable'])) 
  1496.         {            
  1497.             $strOrderTable $this->getRelationTableName(
  1498.                 $pobjArrayOptions['orderingTable'],
  1499.                 $pstrFeature
  1500.             );
  1501.             $strOrderMasterFeature $pobjArrayOptions['orderingTable'];
  1502.         }
  1503.  
  1504.         // the id of the 'master' feature used when ordering.  Is not mandatory
  1505.         // for all kinds of features.
  1506.         $iOrderMasterId null;
  1507.         if (isset($pobjArrayOptions['orderingMasterFeatureId'])) 
  1508.         {
  1509.             $iOrderMasterId $pobjArrayOptions['orderingMasterFeatureId'];
  1510.         }
  1511.  
  1512.         // when set to 'true', order the options by 'order'
  1513.         $bOptionOrdering = isset($pobjArrayOptions['optionOrdering'])
  1514.             ? $pobjArrayOptions['optionOrdering'null;
  1515.  
  1516.         // when set to 'true', foreign requests are going to be ordered by 
  1517.         // 'order'
  1518.         $objArrayForeignOrdering = isset($pobjArrayOptions['foreignOrdering']
  1519.             ? $pobjArrayOptions['foreignOrdering'array();
  1520.  
  1521.         $bWhere false;
  1522.  
  1523.         $strSQL 'SELECT '.$strTable.'.* ';
  1524.         $strSQL .= ($strOrderTable", ".$strOrderTable.".order " "";
  1525.         $strSQL .= 'FROM '.$strTable;
  1526.         $strSQL .= ($strOrderTable", ".$strOrderTable "";
  1527.         if ($iSingleRecord
  1528.         {
  1529.             $strSQL .= " WHERE ".$strTable.".id='".$iSingleRecord."'";
  1530.             $bWhere true;
  1531.         }
  1532.         else if ($objArraySpecificRecords
  1533.         {
  1534.             $objArrayWhere array();
  1535.             for ($iIter=0$iLen=count($objArraySpecificRecords)$iIter<$iLen$iIter++)
  1536.             {
  1537.                 $objArrayWhere[$iIter$strTable.".id='".$objArraySpecificRecords[$iIter]."'";
  1538.             }
  1539.             $strSQL .= " WHERE ( ".implode(" OR "$objArrayWhere)." ) ";
  1540.             $bWhere true;
  1541.         }
  1542.         else if ($strSingleRecordName
  1543.         {
  1544.             $strSQL .= " WHERE ".$strTable.".name='".$strSingleRecordName."'";
  1545.             $bWhere true;
  1546.         }
  1547.         
  1548.         if ($strOrderTable
  1549.         {
  1550.             $strSQL .= ($bWhere" AND " " WHERE ";
  1551.             $strSQL .= $strOrderTable.'.'.$pstrFeature.'_id = '.
  1552.                     $strTable.'.id';
  1553.             if ($iOrderMasterId
  1554.             {
  1555.                 $strSQL .= " AND ".$strOrderTable.'.'.$strOrderMasterFeature.
  1556.                     '_id = '.$iOrderMasterId;
  1557.             }
  1558.             $bWhere true;
  1559.         }
  1560.         $strSQL .= ($strOrderTable' ORDER BY "order"' "";
  1561.  
  1562.         $objArrayRecords array();
  1563.         $objResult pg_query($this->m_objDB$strSQL);
  1564.  
  1565.         if ($objResult
  1566.         {
  1567.             // fetch results
  1568.             while (($objArrayRow pg_fetch_assoc($objResult)) !== false)
  1569.             {
  1570.                 $objArrayRecords[$objArrayRow['id']] $objArrayRow;
  1571.                 if ($bGetOptions && !$bMergeOptions
  1572.                 {
  1573.                     $objArrayRecords[$objArrayRow['id']]['options'array();
  1574.                 }
  1575.             }
  1576.             pg_free_result($objResult);
  1577.  
  1578.             // at least one record is required if asking for a specific one(s)
  1579.             if (count($objArrayRecords== 
  1580.                 && ($iSingleRecord || $objArraySpecificRecords || $strSingleRecordName)
  1581.             
  1582.             {
  1583.                 $strMessage "Failed to fetch the specific \"$pstrFeature\" record(s)";
  1584.                 throw new Exception($strMessage);
  1585.             }
  1586.  
  1587.             // if we were using the 'single record name' method, keep track of
  1588.             // its id from now on
  1589.             if ($strSingleRecordName
  1590.             {
  1591.                 $objArrayRecord end($objArrayRecords);
  1592.                 $iSingleRecord $objArrayRecord['id'];
  1593.             }
  1594.  
  1595.             // get options (optional) START
  1596.             if ($bGetOptions
  1597.             {
  1598.                 $strOptionTable $this->getOptionTableName($pstrFeature);
  1599.  
  1600.                 $objArraySQL array();
  1601.                 array_push(
  1602.                     $objArraySQL,
  1603.                     "SELECT $strOptionTable.* FROM $strTable$strOptionTable"
  1604.                 );
  1605.                 array_push(
  1606.                     $objArraySQL,
  1607.                     'WHERE '.$strOptionTable.'.'.$pstrFeature.'_id ='
  1608.                 );
  1609.                 array_push(
  1610.                     $objArraySQL,
  1611.                     $strTable.'.id'
  1612.                 );
  1613.  
  1614.                 $strSQL implode(" "$objArraySQL);
  1615.  
  1616.                 if ($iSingleRecord
  1617.                 {
  1618.                     $strSQL .= " AND ".$pstrFeature."_id='".$iSingleRecord."'";
  1619.                 }
  1620.                 else if ($objArraySpecificRecords
  1621.                 {
  1622.                     $objArrayWhere array();
  1623.                     for ($iIter=0$iLen=count($objArraySpecificRecords)$iIter<$iLen$iIter++)
  1624.                     {
  1625.                         $objArrayWhere[$iIter$pstrFeature."_id='".$objArraySpecificRecords[$iIter]."'";
  1626.                     }
  1627.                     $strSQL .= " AND ( ".implode(" OR "$objArrayWhere)." )";
  1628.                 }
  1629.  
  1630.                 if ($bOptionOrdering
  1631.                 {
  1632.                     $strSQL .= 'ORDER BY '.$strOptionTable.'."order"';
  1633.                 }
  1634.  
  1635.                 $objArrayOptions array();
  1636.                 $objResult pg_query($this->m_objDB$strSQL);
  1637.                 if ($objResult
  1638.                 {
  1639.                     while (($objArrayRow pg_fetch_assoc($objResult)) !== false)
  1640.                     {
  1641.                         array_push($objArrayOptions$objArrayRow);
  1642.                         if ($bMergeOptions
  1643.                         {
  1644.                             $objArrayRow['options'array();
  1645.                         }
  1646.                     }
  1647.                     pg_free_result($objResult);
  1648.  
  1649.                     $iNumRec count($objArrayOptions);
  1650.                     for ($iIter=0$iIter<$iNumRec$iIter++)
  1651.                     {
  1652.                         // if option has 'domain' and 'key' properties set, then
  1653.                         // create the option value from these values
  1654.                         if (isset($objArrayOptions[$iIter]['domain'])
  1655.                             && isset($objArrayOptions[$iIter]['key'])
  1656.                             && $objArrayOptions[$iIter]['domain'!= ""
  1657.                             && $objArrayOptions[$iIter]['key'!= ""
  1658.                         
  1659.                         {
  1660.                             $objArrayValue array(
  1661.                                 'domain' => $objArrayOptions[$iIter]['domain'],
  1662.                                 'key' => $objArrayOptions[$iIter]['key']
  1663.                             );
  1664.                         }
  1665.                         else
  1666.                         {
  1667.                             $objArrayValue $objArrayOptions[$iIter]['value'];
  1668.                         }
  1669.  
  1670.                         $strOptionName $objArrayOptions[$iIter]['name'];
  1671.  
  1672.                         if (!$bMergeOptions
  1673.                         {
  1674.                             $this->setOptionValue(
  1675.                                 $objArrayRecords[$objArrayOptions[$iIter][$pstrFeature.'_id']]['options'],
  1676.                                 $strOptionName,
  1677.                                 $objArrayValue
  1678.                             );
  1679.                         }
  1680.                         else
  1681.                         {
  1682.                             $this->setOptionValue(
  1683.                                 $objArrayRecords[$objArrayOptions[$iIter][$pstrFeature.'_id']],
  1684.                                 $strOptionName,
  1685.                                 $objArrayValue
  1686.                             );
  1687.                         }
  1688.                     }
  1689.                 
  1690.             }
  1691.             // get options (optional) END
  1692.  
  1693.             // get associated records from all foreign tables
  1694.             foreach ($objArrayForeignFeatures as $strForeignFeature)
  1695.             {
  1696.                 $strAssociatedTable $this->getRelationTableName(
  1697.                     $pstrFeature,
  1698.                     $strForeignFeature
  1699.                 );
  1700.                 
  1701.                 $objArraySQL array();
  1702.                 array_push($objArraySQL"SELECT $strAssociatedTable.*");
  1703.                 array_push($objArraySQL"FROM $strTable$strAssociatedTable");
  1704.                 array_push(
  1705.                     $objArraySQL,
  1706.                     'WHERE '.$strAssociatedTable.'.'.$pstrFeature.'_id = '
  1707.                 );
  1708.                 array_push(
  1709.                     $objArraySQL,
  1710.                     $strTable.'.id'
  1711.                 );
  1712.  
  1713.                 if ($iSingleRecord
  1714.                 {
  1715.                     array_push(
  1716.                         $objArraySQL,
  1717.                         " AND ".$pstrFeature."_id='".$iSingleRecord."'"
  1718.                     );
  1719.                 }
  1720.                 else if ($objArraySpecificRecords
  1721.                 {
  1722.                     $objArrayWhere array();
  1723.                     $iLen count($objArraySpecificRecords);
  1724.                     for ($iIter=0$iIter<$iLen$iIter++)
  1725.                     {
  1726.                         $objArrayWhere[$iIter$pstrFeature."_id='".$objArraySpecificRecords[$iIter]."'";
  1727.                     }
  1728.                     array_push(
  1729.                         $objArraySQL,
  1730.                         " AND ( ".implode(" OR "$objArrayWhere)." )"
  1731.                     );
  1732.                 }
  1733.  
  1734.                 if (in_array($strForeignFeature$objArrayForeignOrdering)) 
  1735.                 {
  1736.                     array_push(
  1737.                         $objArraySQL,
  1738.                         'ORDER BY '.$strAssociatedTable.'."order"'
  1739.                     );
  1740.                 }
  1741.  
  1742.                 $strSQL implode(" "$objArraySQL);
  1743.  
  1744.                 $objArrayAssociatedRecords array();
  1745.                 $objResult pg_query($this->m_objDB$strSQL);
  1746.                 if ($objResult
  1747.                 {
  1748.                     while (($objArrayRow pg_fetch_assoc($objResult)) !== false)
  1749.                     {
  1750.                         array_push($objArrayAssociatedRecords$objArrayRow);
  1751.                     }
  1752.                     pg_free_result($objResult);
  1753.  
  1754.                     $iNumRec count($objArrayAssociatedRecords);
  1755.                     for ($iIter=0$iIter<$iNumRec$iIter++)
  1756.                     {
  1757.                         if (!isset($objArrayRecords[$objArrayAssociatedRecords[$iIter][$pstrFeature.'_id']][$strForeignFeature])) 
  1758.                         {
  1759.                             $objArrayRecords[$objArrayAssociatedRecords[$iIter][$pstrFeature.'_id']][$strForeignFeaturearray();
  1760.                         }
  1761.                         array_push($objArrayRecords[$objArrayAssociatedRecords[$iIter][$pstrFeature.'_id']][$strForeignFeature]$objArrayAssociatedRecords[$iIter][$strForeignFeature.'_id']);
  1762.                     }
  1763.                 }
  1764.             }
  1765.         }
  1766.         else
  1767.         {
  1768.             $strMessage "An unknown error occured while querying the DB.";
  1769.             throw new Exception($strMessage);
  1770.         }
  1771.  
  1772.         if ($iSingleRecord
  1773.         {
  1774.             return array_shift($objArrayRecords);
  1775.         }
  1776.         else
  1777.         {
  1778.             return $objArrayRecords;
  1779.         }
  1780.     }
  1781.  
  1782.     /**
  1783.     * Set a new property to an array.  If the property already exists, create
  1784.     *     a 'parent' property with the same name + an 's' at the end and push
  1785.     *     the values into it.  If the 'parent' array already exists, simply push
  1786.     *     it.
  1787.     *
  1788.     * @param array  &$pobjArrayOptions Array of options
  1789.     * @param string $pstrName          The name of the option to set
  1790.     * @param object $pobjValue         The value of the new option to set
  1791.     * 
  1792.     * @return void 
  1793.     */
  1794.     protected function setOptionValue(
  1795.         array &$pobjArrayOptions$pstrName$pobjValue
  1796.     {
  1797.  
  1798.         $strParent $pstrName."s";
  1799.  
  1800.         if (isset($pobjArrayOptions[$strParent])) 
  1801.         {
  1802.             array_push($pobjArrayOptions[$strParent]$pobjValue);
  1803.         }
  1804.         else
  1805.         {
  1806.             // if option was already set, create the
  1807.             // 'parent' array and unset old option
  1808.             if (isset($pobjArrayOptions[$pstrName])) 
  1809.             {
  1810.                 $objArrayOption array();
  1811.                                     
  1812.                 // push old value and unset it
  1813.                 array_push($objArrayOption$pobjArrayOptions[$pstrName]);
  1814.                 unset($pobjArrayOptions[$pstrName]);
  1815.  
  1816.                 // push new value
  1817.                 array_push($objArrayOption$pobjValue);
  1818.  
  1819.                 // set new 'parent' array option
  1820.                 $pobjArrayOptions[$strParent$objArrayOption;
  1821.             }
  1822.             else
  1823.             {
  1824.                 $pobjArrayOptions[$pstrName$pobjValue;
  1825.             }
  1826.         }
  1827.     }
  1828.  
  1829.     // =========
  1830.     //  GETTERS
  1831.     // =========
  1832.  
  1833.     // -------------------------------
  1834.     //  org_geoprisma objects getters
  1835.     // -------------------------------
  1836.  
  1837.     /**
  1838.     * Retourne un object service
  1839.     * 
  1840.     * @param string $pstrServiceName Service Name
  1841.     * 
  1842.     * @return org_geoprisma_service_Service 
  1843.     */
  1844.     public function getService($pstrServiceName)
  1845.     
  1846.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($pstrServiceName);
  1847.         
  1848.         foreach ($this->m_objArrayService as $objService)
  1849.         {
  1850.             if ($objService->getName(== $pstrServiceName
  1851.             {
  1852.                 return $objService;
  1853.             }   
  1854.         }
  1855.  
  1856.         // we may be asking for a service that doesn't need to be linked to
  1857.         // datastores and resources, so try to get it manually.  We need to
  1858.         // reconnect to the database first.  If the service is not found at
  1859.         // this point, then the 'getRecords' method will throw the according
  1860.         // error so no need to do that here.
  1861.         $this->connect();
  1862.         $objServiceRecord $this->getRecords(
  1863.             $this->getServiceFeatureName(),
  1864.             array('singleRecord' => $pstrServiceName)
  1865.         );
  1866.  
  1867.         $strType $this->m_objArrayServiceTypes[$objServiceRecord['type']];
  1868.         $this->m_objArrayService[$objServiceRecord['id']] (
  1869.                 $strType$objServiceRecord
  1870.             )
  1871.         );
  1872.         $this->disconnect();
  1873.  
  1874.         return $this->m_objArrayService[$objServiceRecord['id']];
  1875.     }
  1876.     
  1877.     /**
  1878.     * Retourne la liste de service disponible service
  1879.     * 
  1880.     * @return ArrayObject of org_geoprisma_service_Service
  1881.     */
  1882.     public function getServices()
  1883.     {
  1884.         return $this->m_objArrayService;
  1885.     
  1886.     
  1887.     /**
  1888.     * Retourne un object layout
  1889.     * 
  1890.     * @param string $pstrLayoutName Layout name
  1891.     * 
  1892.     * @return org_geoprisma_layout_Layout 
  1893.     */
  1894.     public function getLayout($pstrLayoutName)
  1895.     {
  1896.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($pstrLayoutName);
  1897.         
  1898.         foreach ($this->m_objArrayLayout as $objLayout)
  1899.         {
  1900.             if ($objLayout->getName(== $pstrLayoutName
  1901.             {
  1902.                 return $objLayout
  1903.             }
  1904.         }
  1905.         throw new org_geoprisma_exception_LayoutNotFoundException($pstrLayoutName);
  1906.     }
  1907.     
  1908.     /**
  1909.     * Retourne la liste des layouts disponible
  1910.     * 
  1911.     * @return ArrayObject of org_geoprisma_layout_Layout
  1912.     */
  1913.     public function getLayouts()
  1914.     {
  1915.         return $this->m_objArrayLayout;
  1916.     }   
  1917.     
  1918.     
  1919.     /**
  1920.     * Retourne un object datastore
  1921.     * 
  1922.     * @param string $pstrDatastoreName Datastore name
  1923.     * 
  1924.     * @return org_geoprisma_datastore_Datastore 
  1925.     */
  1926.     public function getDatastore($pstrDatastoreName)
  1927.     {
  1928.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($pstrDatastoreName);
  1929.         
  1930.         foreach ($this->m_objArrayDatastore as $objDatastore)
  1931.         {
  1932.             if ($objDatastore->getName(== $pstrDatastoreName
  1933.             {
  1934.                 return $objDatastore
  1935.             }        
  1936.         }
  1937.         throw new org_geoprisma_exception_DatastoreNotFoundException($pstrDatastoreName);
  1938.     }
  1939.     
  1940.     /**
  1941.     * Retourne la liste des datastores disponible
  1942.     * 
  1943.     * @return ArrayObject of org_geoprisma_datastore_Datastore
  1944.     */
  1945.     public function getDatastores()
  1946.     {
  1947.         return $this->m_objArrayDatastore;
  1948.     }
  1949.  
  1950.     /**
  1951.     * Retourne un object widget
  1952.     * 
  1953.     * @param string $pstrWidgetName Widget name
  1954.     * 
  1955.     * @return org_geoprisma_widget_Widget 
  1956.     */
  1957.     public function getWidget($pstrWidgetName)
  1958.     {
  1959.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($pstrWidgetName)
  1960.         
  1961.         foreach ($this->m_objArrayWidget as $objWidget)
  1962.         {
  1963.             if ($objWidget->getName(== $pstrWidgetName
  1964.             {
  1965.                 return $objWidget
  1966.             }        
  1967.         }
  1968.         throw new org_geoprisma_exception_WidgetNotFoundException($pstrWidgetName);
  1969.     }
  1970.     
  1971.     /**
  1972.     * Retourne la liste des widget disponible
  1973.     * 
  1974.     * @return ArrayObject of org_geoprisma_widget_Widget
  1975.     */
  1976.     public function getWidgets()
  1977.     {
  1978.         return $this->m_objArrayWidget;   
  1979.     }
  1980.  
  1981.     /**
  1982.     * Retorrne un object accessfilter
  1983.     * 
  1984.     * @param string  $pstrAccessFilterName AccessFilter name
  1985.     * @param boolean $pbKey                Returns the key or the value.
  1986.     *                                      'value' by default.
  1987.     * 
  1988.     * @return org_geoprisma_accessfilter_AccessFilter 
  1989.     */
  1990.     public function getAccessFilter($pstrAccessFilterName$pbKey=false)
  1991.     {
  1992.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($pstrAccessFilterName)
  1993.         
  1994.         foreach ($this->m_objArrayAccessFilter as $iKey => $objAccessFilter)
  1995.         {
  1996.             if ($objAccessFilter->getName(== $pstrAccessFilterName
  1997.             {
  1998.                 return ($pbKey$iKey $objAccessFilter ;
  1999.             }        
  2000.         }
  2001.         throw new org_geoprisma_exception_OptionNotFoundException($pstrAccessFilterName);
  2002.     }
  2003.     
  2004.     /**
  2005.     * Retorrne la liste des accessfilter disponible
  2006.     * 
  2007.     * @return ArrayObject of org_geoprisma_accessfilter_AccessFilter
  2008.     */
  2009.     public function getAccessFilters()
  2010.     {
  2011.         return $this->m_objArrayAccessFilter;   
  2012.     }
  2013.     
  2014.     
  2015.     /**
  2016.     * Retourne un object resource
  2017.     * 
  2018.     * @param string $pstrResourceName Resource name
  2019.     * 
  2020.     * @return org_geoprisma_resource_Resource 
  2021.     */
  2022.     public function getResource($pstrResourceName)
  2023.     {
  2024.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($pstrResourceName);
  2025.         
  2026.         foreach ($this->m_objArrayResource as $objResource)
  2027.         {
  2028.             if ($objResource->getName(== $pstrResourceName
  2029.             {
  2030.                 return $objResource
  2031.             }        
  2032.         }
  2033.         throw new org_geoprisma_exception_ResourceNotFoundException($pstrResourceName);        
  2034.     }
  2035.     
  2036.     /**
  2037.     * Retourne la liste des resources disponible du mapcontext
  2038.     * 
  2039.     * @return ArrayObject of org_geoprisma_resource_Resource
  2040.     */
  2041.     public function getResources()
  2042.     {
  2043.         return $this->m_objArrayResource;
  2044.     }
  2045.     
  2046.     /**
  2047.     * Retourne la liste de tous les resources disponibles.
  2048.     * 
  2049.     * @return ArrayObject of org_geoprisma_resource_Resource
  2050.     */
  2051.     public function getOtherResources()
  2052.     {
  2053.         if (!count($this->m_objArrayOtherResource)) 
  2054.         {
  2055.             $this->loadOtherResources();
  2056.         }
  2057.         return $this->m_objArrayOtherResource;
  2058.     }
  2059.  
  2060.     /**
  2061.     * Get a specific field object using its id
  2062.     * 
  2063.     * @param string $piFieldId Field id
  2064.     * 
  2065.     * @return org_geoprisma_field_Field 
  2066.     */
  2067.     public function getField($piFieldId)
  2068.     {
  2069.         com_borealis_foundation_util_Assert::assertIsNotEmptyString($piFieldId);
  2070.         
  2071.         foreach ($this->m_objArrayField as $objField)
  2072.         {
  2073.             if ($objField->getId(== $piFieldId
  2074.             {
  2075.                 return $objField
  2076.             }        
  2077.         }
  2078.         throw new org_geoprisma_exception_FieldNotFoundException($piFieldId);
  2079.     }
  2080.     
  2081.     /**
  2082.     * Retourne la liste des fields disponible
  2083.     * 
  2084.     * @return ArrayObject of org_geoprisma_field_Field
  2085.     */
  2086.     public function getFields()
  2087.     {
  2088.         return $this->m_objArrayField;
  2089.     }
  2090.  
  2091.     /**
  2092.     * Get org_geoprisma_widget_MapFishLayerTree widget
  2093.     *
  2094.     * Only used if isUsingLegacyWidgets() == true
  2095.     *
  2096.     * @return org_geoprisma_widget_MapFishLayerTree or false if not found
  2097.     */
  2098.     public function getMapFishLayerTreeWidget(
  2099.     {
  2100.         foreach ($this->getWidgets(as $objWidget
  2101.         {
  2102.             if ($objWidget->getType(== org_geoprisma_widget_MapFishLayerTreeWidget::MAP_FISH_LAYER_TREE_WIDGET
  2103.             {
  2104.                 return $objWidget;
  2105.             }
  2106.         }
  2107.  
  2108.         return false;
  2109.     }
  2110.  
  2111.     // ---------------------
  2112.     //  utility get methods
  2113.     // ---------------------
  2114.  
  2115.     /**
  2116.     * return instanceof org_geoprisma_config_PGSQLMapContextConfig
  2117.     * return instanceof org_geoprisma_config_Config
  2118.     * return instanceof com_borealis_foundation_util_Singleton
  2119.     * 
  2120.     * @return org_geoprisma_config_PGSQLMapContextConfig 
  2121.     */
  2122.     public static function getInstance()
  2123.     {
  2124.         if (self::$s_objInstance === null
  2125.         {
  2126.             self::$s_objInstance new org_geoprisma_config_PGSQLMapContextConfig();
  2127.         }
  2128.  
  2129.         return self::$s_objInstance;
  2130.     }
  2131.  
  2132.     /**
  2133.     * Returns an array of foreign ids from a record list
  2134.     * 
  2135.     * @param array  $pobjArrayRecords   array of records
  2136.     * @param string $pstrForeignFeature name of the foreign table
  2137.     * 
  2138.     * @return array 
  2139.     */
  2140.     protected function getForeignIds($pobjArrayRecords$pstrForeignFeature)
  2141.     {
  2142.         $objArrayForeignIds array();
  2143.         foreach ($pobjArrayRecords as $objRecord)
  2144.         {
  2145.             if (isset($objRecord[$pstrForeignFeature])) 
  2146.             {
  2147.                 foreach ($objRecord[$pstrForeignFeatureas $iForeignId)
  2148.                 {
  2149.                     if (!in_array($iForeignId$objArrayForeignIds)) 
  2150.                     {
  2151.                         array_push($objArrayForeignIds$iForeignId);
  2152.                     }
  2153.                 }
  2154.             }
  2155.             else if (isset($objRecord[$pstrForeignFeature."_id"])) 
  2156.             {
  2157.                 $iForeignId $objRecord[$pstrForeignFeature."_id"];
  2158.                 if (!in_array($iForeignId$objArrayForeignIds)) 
  2159.                 {
  2160.                     array_push($objArrayForeignIds$iForeignId);
  2161.                 }
  2162.             }
  2163.         }
  2164.  
  2165.         asort($objArrayForeignIds);
  2166.  
  2167.         return $objArrayForeignIds;
  2168.     }
  2169.  
  2170.     /**
  2171.     * Browse each resource option.  If it's an option ending by any servicetype,
  2172.     *     check if it's equal to given servicetype in parameter.  If not, skip
  2173.     *     the option.
  2174.     *
  2175.     * Then, if the option is inside the 'LayersResourcesOptions' array, use
  2176.     *     the alternate name (the key is the resource option, the value is the
  2177.     *     related layer option to use instead).
  2178.     *
  2179.     * Finally, push the option inside an array.  In the end, this method returns
  2180.     *     the complete list of options from a resource for a specific layer
  2181.     *     given a servicetype.
  2182.     * 
  2183.     * @param array  $pobjArrayResourceOptions Array of options of a specific
  2184.     *                                          org_geoprisma_resource_Resource
  2185.     *                                          object.
  2186.     * @param string &$pstrServiceType         Service type
  2187.     * 
  2188.     * @return array 
  2189.     */
  2190.     public function getLayerOptionsFromResourceOptions(
  2191.         $pobjArrayResourceOptions&$pstrServiceType
  2192.     {
  2193.         $objArrayLayerOptions array();
  2194.         $objArrayLayerResourceOptions $this->getLayerResourceOptions();
  2195.         $objArrayServiceTypes $this->getServiceTypes();
  2196.  
  2197.         foreach ($pobjArrayResourceOptions as $objResourceOption
  2198.         {
  2199.             $bSkipOption false;
  2200.             $bAllowReplace false;
  2201.             $strLayerOptionName $objResourceOption->getName();
  2202.  
  2203.             // check if the option ends with a 'servicetype' string.  If it
  2204.             // does, make sure it's the same as the service type in params, els
  2205.             // skip it
  2206.             foreach ($objArrayServiceTypes as $strServiceType
  2207.             {
  2208.                 $strPattern "/$strServiceType$/";
  2209.  
  2210.                 preg_match(
  2211.                     $strPattern,
  2212.                     $strLayerOptionName,
  2213.                     $objArrayMatches
  2214.                 );
  2215.  
  2216.                 if (count($objArrayMatches== 1
  2217.                 {
  2218.                     if ($objArrayMatches[0!= $pstrServiceType
  2219.                     {
  2220.                         $bSkipOption true;
  2221.                         break;
  2222.                     }
  2223.                     else
  2224.                     {
  2225.                         $strLayerOptionName 
  2226.                             = substr(
  2227.                                 $strLayerOptionName,
  2228.                                 0,
  2229.                                 strlen($pstrServiceType* -1
  2230.                             );
  2231.  
  2232.                         // since the option is set specifically for this 
  2233.                         // service type, we allow replacement of existing
  2234.                         // options with the same name.
  2235.                         $bAllowReplace true;
  2236.                     }
  2237.                 }
  2238.             }
  2239.  
  2240.             if ($this->isUsingLegacyWidgets()) 
  2241.             {
  2242.                 $objArrayLayerResourceOptions
  2243.                     = $this->getLayerResourceOptions();
  2244.  
  2245.                 // if option is set LayerResourceOptions array, then use the
  2246.                 // alternative name instead
  2247.                 if (isset($objArrayLayerResourceOptions[$strLayerOptionName])) 
  2248.                 {
  2249.                     $strLayerOptionName 
  2250.                         = $objArrayLayerResourceOptions[$strLayerOptionName];
  2251.                 }
  2252.             }
  2253.  
  2254.             if ($bSkipOption
  2255.             {
  2256.                 continue;
  2257.             }
  2258.  
  2259.             // if option is set LayerResourceOptions array, then use the
  2260.             // alternative name instead
  2261.             if (isset($objArrayLayerResourceOptions[$strLayerOptionName])) 
  2262.             {
  2263.                 $strLayerOptionName 
  2264.                     = $objArrayLayerResourceOptions[$strLayerOptionName];
  2265.             }
  2266.  
  2267.             // set new option.  Skip if already set unless 'allow replace' flag
  2268.             // is true
  2269.  
  2270.             if (!isset($objArrayLayerOptions[$strLayerOptionName]
  2271.                 || $bAllowReplace
  2272.             
  2273.             {
  2274.                 $objArrayLayerOptions[$strLayerOptionName
  2275.                     = $objResourceOption->getValue();
  2276.             }
  2277.         }
  2278.  
  2279.         return $objArrayLayerOptions;
  2280.     }
  2281.  
  2282.     /**
  2283.     * Returns the array of clone names.  If the 'key' parameter is set, returns
  2284.     *     only a portion of the array (if it exists, else returns false).
  2285.     *
  2286.     * @param string $pstrKey Optional key refering to an orignal name.  Defaults
  2287.     *                         to false.
  2288.     * 
  2289.     * @return array or false
  2290.     */
  2291.     protected function getCloneNames($pstrKey=false
  2292.     {
  2293.         $objArrayReturn false;
  2294.  
  2295.         if ($pstrKey
  2296.         {
  2297.             if (isset($this->m_objArrayClonedWidgetNames[$pstrKey])) 
  2298.             {
  2299.                 $objArrayReturn $this->m_objArrayClonedWidgetNames[$pstrKey];
  2300.             }
  2301.         }
  2302.         else
  2303.         {
  2304.             $objArrayReturn $this->m_objArrayClonedWidgetNames;
  2305.         }
  2306.         
  2307.         return $objArrayReturn;
  2308.     }
  2309.  
  2310.     /**
  2311.     * Returns how many resources the current loaded mapcontext has and which
  2312.     *     resources and actions the current logged role has access to (their names).
  2313.     *
  2314.     * @param array $pobjArrayActions Actions.  In order to be considered
  2315.     *                                 'authorized', the role must have all
  2316.     *                                 action defined there allowed.
  2317.     * @param array $pobjArrayOptions Options for this method
  2318.     * 
  2319.     * @return array containing 2 keys : 'total' (integer), 'authorized'
  2320.     *                (array) and 'authorizedActions' (array)
  2321.     */
  2322.     public function getAuthorizedResources(
  2323.         $pobjArrayActions=array("read")
  2324.         $pobjArrayOptions=array('otherResources' => false)
  2325.     {
  2326.         $objArrayAuthorizedResources array();
  2327.         $objArrayAuthorizedResourcesActions array();
  2328.         $bOtherResources $pobjArrayOptions['otherResources'];
  2329.         if ($bOtherResources
  2330.         {
  2331.             $strGetResourceFunction 'getOtherResources';
  2332.         }
  2333.         else
  2334.         {
  2335.             $strGetResourceFunction 'getResources';
  2336.         }
  2337.  
  2338.         foreach ($this->$strGetResourceFunction(as $objResource
  2339.         {
  2340.             $objArrayAuthorizedResourcesActions[$objResource->getName()array();
  2341.             $bAllAuthorized true;
  2342.             foreach ($pobjArrayActions as $strAction
  2343.             {
  2344.                 $bIsAuthorized
  2345.                     = org_geoprisma_acl_ACLFactory::getACL()->isAuthorized(
  2346.                         $objResource$strAction
  2347.                     );
  2348.  
  2349.                 if (!$bIsAuthorized
  2350.                 {
  2351.                     $bAllAuthorized false;
  2352.                 }
  2353.                 else
  2354.                 {
  2355.                     $objArrayAuthorizedResourcesActions[$objResource->getName()][$strActiontrue;
  2356.                 }
  2357.             }
  2358.  
  2359.             if ($bAllAuthorized
  2360.             {
  2361.                 array_push(
  2362.                     $objArrayAuthorizedResources,
  2363.                     $objResource->getName()
  2364.                 );
  2365.             }
  2366.         }
  2367.  
  2368.         return array(
  2369.             'total' => count($objArrayAuthorizedResources),
  2370.             'authorized' => $objArrayAuthorizedResources,
  2371.             'authorizedActions' => $objArrayAuthorizedResourcesActions
  2372.         );
  2373.     }
  2374.  
  2375.      /**
  2376.      * Get reource name strings from current request (from the 'osmresource'
  2377.      *     parameter).  This is the first method called by this config.
  2378.      *
  2379.      *     If there ARE resources in the url, that means the access is made from
  2380.      *     the proxy, so we don't need to load everything, just the requested
  2381.      *     Resources, their DataStores and Services.
  2382.      *
  2383.      * @return array 
  2384.      */
  2385.     public function getResourceNamesFromRequest()
  2386.     {
  2387.         $objArrayResources array();
  2388.  
  2389.         if (isset($_REQUEST&& isset($_REQUEST['osmresource'])) 
  2390.         {
  2391.             if (is_array($_REQUEST['osmresource'])) 
  2392.             {
  2393.                 $objArrayResources $_REQUEST['osmresource'];
  2394.             }
  2395.             else
  2396.             {
  2397.                 $objArrayResources array($_REQUEST['osmresource']);    
  2398.             }
  2399.         }
  2400.  
  2401.         return $objArrayResources;
  2402.     }
  2403.  
  2404.     // ------------------------
  2405.     //  other property getters
  2406.     // ------------------------
  2407.  
  2408.     /**
  2409.     * Get connection string.
  2410.     *
  2411.     * @return string 
  2412.     */
  2413.     public static function getConnectionString()
  2414.     {
  2415.         return self::$s_strConnection;
  2416.     }
  2417.  
  2418.  
  2419.     /**
  2420.     * Returns all service types
  2421.     * 
  2422.     * @return array 
  2423.     */
  2424.     public function getServiceTypes()
  2425.     {
  2426.         return $this->m_objArrayServiceTypes;
  2427.     }
  2428.  
  2429.     /**
  2430.     * Get config session id
  2431.     *
  2432.     * @return integer 
  2433.     */
  2434.     public static function getCurrentSession()
  2435.     {
  2436.         return self::$s_iCurrentSession;
  2437.     }
  2438.  
  2439.     /**
  2440.     * Get config session name
  2441.     *
  2442.     * @return string 
  2443.     */
  2444.     public static function getCurrentSessionName()
  2445.     {
  2446.         return self::$s_strCurrentSessionName;
  2447.     }
  2448.  
  2449.     /**
  2450.     * Get config mapcontext id
  2451.     *
  2452.     * @return integer 
  2453.     */
  2454.     public static function getCurrentMapContext()
  2455.     {
  2456.         return self::$s_iCurrentMapContext;
  2457.     }
  2458.  
  2459.     /**
  2460.     * Get config mapcontext name
  2461.     *
  2462.     * @return string 
  2463.     */
  2464.     public static function getCurrentMapContextName()
  2465.     {
  2466.         return self::$s_strCurrentMapContextName;
  2467.     }
  2468.  
  2469.     /**
  2470.     * Get config application id
  2471.     *
  2472.     * @return integer 
  2473.     */
  2474.     public static function getCurrentApplication()
  2475.     {
  2476.         return self::$s_iCurrentApplication;
  2477.     }
  2478.  
  2479.     /**
  2480.     * Get config application name
  2481.     *
  2482.     * @return string 
  2483.     */
  2484.     public static function getCurrentApplicationName()
  2485.     {
  2486.         return self::$s_strCurrentApplicationName;
  2487.     }
  2488.  
  2489.     /**
  2490.     * Get service feature name
  2491.     *
  2492.     * @return string 
  2493.     */
  2494.     public static function getServiceFeatureName()
  2495.     {
  2496.         return self::$s_strServiceFeature;
  2497.     }
  2498.  
  2499.     /**
  2500.     * Get datastore feature name
  2501.     *
  2502.     * @return string 
  2503.     */
  2504.     public static function getDataStoreFeatureName()
  2505.     {
  2506.         return self::$s_strDataStoreFeature;
  2507.     }
  2508.  
  2509.     /**
  2510.     * Get resource feature name
  2511.     *
  2512.     * @return string 
  2513.     */
  2514.     public static function getResourceFeatureName()
  2515.     {
  2516.         return self::$s_strResourceFeature;
  2517.     }
  2518.  
  2519.     /**
  2520.     * Get field feature name
  2521.     *
  2522.     * @return string 
  2523.     */
  2524.     public static function getFieldFeatureName()
  2525.     {
  2526.         return self::$s_strFieldFeature;
  2527.     }
  2528.  
  2529.     /**
  2530.     * Get mapcontext feature name
  2531.     *
  2532.     * @return string 
  2533.     */
  2534.     public static function getMapContextFeatureName()
  2535.     {
  2536.         return self::$s_strMapContextFeature;
  2537.     }
  2538.  
  2539.     /**
  2540.     * Get widget feature name
  2541.     *
  2542.     * @return string 
  2543.     */
  2544.     public static function getWidgetFeatureName()
  2545.     {
  2546.         return self::$s_strWidgetFeature;
  2547.     }
  2548.  
  2549.     /**
  2550.     * Get widget feature name
  2551.     *
  2552.     * @return string 
  2553.     */
  2554.     public static function getAccessFilterFeatureName()
  2555.     {
  2556.         return self::$s_strAccessFilterFeature;
  2557.     }
  2558.  
  2559.     /**
  2560.     * Get application feature name
  2561.     *
  2562.     * @return string 
  2563.     */
  2564.     public static function getApplicationFeatureName()
  2565.     {
  2566.         return self::$s_strApplicationFeature;
  2567.     }
  2568.  
  2569.     /**
  2570.     * Get session feature name
  2571.     *
  2572.     * @return string 
  2573.     */
  2574.     public static function getSessionFeatureName()
  2575.     {
  2576.         return self::$s_strSessionFeature;
  2577.     }
  2578.  
  2579.     /**
  2580.     * Get table prefix string
  2581.     *
  2582.     * @return string 
  2583.     */
  2584.     public static function getTablePrefix()
  2585.     {
  2586.         return self::$s_strTablePrefix;
  2587.     }
  2588.  
  2589.     /**
  2590.     * Get option table suffix string
  2591.     *
  2592.     * @return string 
  2593.     */
  2594.     public static function getOptionTableSuffix()
  2595.     {
  2596.         return self::$s_strTableOptionSuffix;
  2597.     }
  2598.  
  2599.     /**
  2600.     * Get table name using a given feature name.
  2601.     *
  2602.     * @param string $pstrFeatureName Name of the feature
  2603.     *
  2604.     * @return string 
  2605.     */
  2606.     public static function getTableName($pstrFeatureName)
  2607.     {
  2608.         return self::getTablePrefix().$pstrFeatureName;
  2609.     }
  2610.  
  2611.     /**
  2612.     * Get option table name using a given feature name.
  2613.     *
  2614.     * @param string $pstrFeatureName Name of the feature
  2615.     *
  2616.     * @return string 
  2617.     */
  2618.     public static function getOptionTableName($pstrFeatureName)
  2619.     {
  2620.         return self::getTablePrefix().$pstrFeatureName.self::getOptionTableSuffix();
  2621.     }
  2622.  
  2623.     /**
  2624.     * Get relation table name using a given master feature name and a slave
  2625.     *     feature name.
  2626.     *
  2627.     * @param string $pstrMasterFeatureName Name of the master feature
  2628.     * @param string $pstrSlaveFeatureName  Name of the slave feature
  2629.     *
  2630.     * @return string 
  2631.     */
  2632.     public static function getRelationTableName(
  2633.         $pstrMasterFeatureName$pstrSlaveFeatureName
  2634.     {
  2635.         return self::getTablePrefix().$pstrMasterFeatureName.$pstrSlaveFeatureName;
  2636.     }
  2637.  
  2638.     /**
  2639.     * Get option table name using a given feature name.
  2640.     *
  2641.     * @param string $pstrMasterFeatureName Name of the master feature
  2642.     * @param string $pstrSlaveFeatureName  Name of the slave feature
  2643.     *
  2644.     * @return string 
  2645.     */
  2646.     public static function getRelationOptionTableName(
  2647.         $pstrMasterFeatureName$pstrSlaveFeatureName
  2648.     {
  2649.         return self::getTablePrefix().$pstrMasterFeatureName.$pstrSlaveFeatureName.self::getOptionTableSuffix();
  2650.     }
  2651.  
  2652.     /**
  2653.     * Get whether the config should use the 'legacy' widgets
  2654.     *     (Map and MapFishLayerTree) or not (MapPanel and Layer).
  2655.     *
  2656.     * @return boolean 
  2657.     */
  2658.     public static function isUsingLegacyWidgets()
  2659.     {
  2660.         return self::$s_bUseLegacyWidgets;
  2661.     }
  2662.  
  2663.     /**
  2664.     * Returns the layer 'resource options' array.
  2665.     *
  2666.     * Only used when isUsingLegacyWidgets() == true
  2667.     * 
  2668.     * @return array 
  2669.     */
  2670.     public function getLayerResourceOptions(
  2671.     {
  2672.         return $this->m_objArrayLayerResourceOptions;
  2673.     }
  2674.  
  2675.     // =========
  2676.     //  SETTERS
  2677.     // =========
  2678.  
  2679.     /**
  2680.     * Set connection string.
  2681.     *
  2682.     * @param string $pstrConnection Connection string used when connecting to
  2683.     *                                database
  2684.     *
  2685.     * @return void 
  2686.     */
  2687.     public static function setConnectionString($pstrConnection)
  2688.     {
  2689.         self::$s_strConnection $pstrConnection;
  2690.     }
  2691.  
  2692.     /**
  2693.     * Set config session id
  2694.     *
  2695.     * @param integer $piValue Value
  2696.     *
  2697.     * @return void 
  2698.     */
  2699.     public static function setCurrentSession($piValue)
  2700.     {
  2701.         self::$s_iCurrentSession $piValue;
  2702.     }
  2703.  
  2704.     /**
  2705.     * Set config session name
  2706.     *
  2707.     * @param string $pstrValue Value
  2708.     *
  2709.     * @return void 
  2710.     */
  2711.     public static function setCurrentSessionName($pstrValue)
  2712.     {
  2713.         self::$s_strCurrentSessionName $pstrValue;
  2714.     }
  2715.  
  2716.     /**
  2717.     * Set config mapcontext id
  2718.     *
  2719.     * @param integer $piValue Value
  2720.     *
  2721.     * @return void 
  2722.     */
  2723.     public static function setCurrentMapContext($piValue)
  2724.     {
  2725.         self::$s_iCurrentMapContext $piValue;
  2726.     }
  2727.  
  2728.     /**
  2729.     * Set config mapcontext name
  2730.     *
  2731.     * @param string $pstrValue Value
  2732.     *
  2733.     * @return void 
  2734.     */
  2735.     public static function setCurrentMapContextName($pstrValue)
  2736.     {
  2737.         self::$s_strCurrentMapContextName $pstrValue;
  2738.     }
  2739.  
  2740.     /**
  2741.     * Set config application id
  2742.     *
  2743.     * @param integer $piValue Value
  2744.     *
  2745.     * @return void 
  2746.     */
  2747.     public static function setCurrentApplication($piValue)
  2748.     {
  2749.         self::$s_iCurrentApplication $piValue;
  2750.     }
  2751.  
  2752.     /**
  2753.     * Set config application name
  2754.     *
  2755.     * @param string $pstrValue Value
  2756.     *
  2757.     * @return void 
  2758.     */
  2759.     public static function setCurrentApplicationName($pstrValue)
  2760.     {
  2761.         self::$s_strCurrentApplicationName $pstrValue;
  2762.     }
  2763.  
  2764.     /**
  2765.     * Set service feature name
  2766.     *
  2767.     * @param string $pstrValue Value
  2768.     *
  2769.     * @return void 
  2770.     */
  2771.     public static function setServiceFeatureName($pstrValue)
  2772.     {
  2773.         self::$s_strServiceFeature $pstrValue;
  2774.     }
  2775.  
  2776.     /**
  2777.     * Set datastore feature name
  2778.     *
  2779.     * @param string $pstrValue Value
  2780.     *
  2781.     * @return void 
  2782.     */
  2783.     public static function setDataStoreFeatureName($pstrValue)
  2784.     {
  2785.         self::$s_strDataStoreFeature $pstrValue;
  2786.     }
  2787.  
  2788.     /**
  2789.     * Set resource feature name
  2790.     *
  2791.     * @param string $pstrValue Value
  2792.     *
  2793.     * @return void 
  2794.     */
  2795.     public static function setResourceFeatureName($pstrValue)
  2796.     {
  2797.         self::$s_strResourceFeature $pstrValue;
  2798.     }
  2799.  
  2800.     /**
  2801.     * Set field feature name
  2802.     *
  2803.     * @param string $pstrValue Value
  2804.     *
  2805.     * @return void 
  2806.     */
  2807.     public static function setFieldFeatureName($pstrValue)
  2808.     {
  2809.         self::$s_strFieldFeature $pstrValue;
  2810.     }
  2811.  
  2812.     /**
  2813.     * Set mapcontext feature name
  2814.     *
  2815.     * @param string $pstrValue Value
  2816.     *
  2817.     * @return void 
  2818.     */
  2819.     public static function setMapContextFeatureName($pstrValue)
  2820.     {
  2821.         self::$s_strMapContextFeature $pstrValue;
  2822.     }
  2823.  
  2824.     /**
  2825.     * Set widget feature name
  2826.     *
  2827.     * @param string $pstrValue Value
  2828.     *
  2829.     * @return void 
  2830.     */
  2831.     public static function setWidgetFeatureName($pstrValue)
  2832.     {
  2833.         self::$s_strWidgetFeature $pstrValue;
  2834.     }
  2835.  
  2836.  
  2837.     /**
  2838.     * Set accessfilter feature name
  2839.     *
  2840.     * @param string $pstrValue Value
  2841.     *
  2842.     * @return void 
  2843.     */
  2844.     public static function setAccessFilterFeatureName($pstrValue)
  2845.     {
  2846.         self::$s_strAccessFilterFeature $pstrValue;
  2847.     }
  2848.  
  2849.     /**
  2850.     * Set application feature name
  2851.     *
  2852.     * @param string $pstrValue Value
  2853.     *
  2854.     * @return void 
  2855.     */
  2856.     public static function setApplicationFeatureName($pstrValue)
  2857.     {
  2858.         self::$s_strApplicationFeature $pstrValue;
  2859.     }
  2860.  
  2861.     /**
  2862.     * Set session feature name
  2863.     *
  2864.     * @param string $pstrValue Value
  2865.     *
  2866.     * @return void 
  2867.     */
  2868.     public static function setSessionFeatureName($pstrValue)
  2869.     {
  2870.         self::$s_strSessionFeature $pstrValue;
  2871.     }
  2872.  
  2873.     /**
  2874.     * Set table prefix string
  2875.     *
  2876.     * @param string $pstrValue Value
  2877.     *
  2878.     * @return void 
  2879.     */
  2880.     public static function setTablePrefix($pstrValue)
  2881.     {
  2882.         self::$s_strTablePrefix $pstrValue;
  2883.     }
  2884.  
  2885.     /**
  2886.     * Set option table suffix string
  2887.     *
  2888.     * @param string $pstrValue Value
  2889.     *
  2890.     * @return void 
  2891.     */
  2892.     public static function setOptionTableSuffix($pstrValue)
  2893.     {
  2894.         self::$s_strTableOptionSuffix $pstrValue;
  2895.     }
  2896.     /**
  2897.     * Set legacy widget using (flag)
  2898.     *
  2899.     * @param string $pstrValue Value
  2900.     *
  2901.     * @return void 
  2902.     */
  2903.     public static function useLegacyWidgets($pstrValue)
  2904.     {
  2905.         self::$s_bUseLegacyWidgets $pstrValue;
  2906.     }
  2907. }
  2908.  
  2909. ?>

Documentation generated on Thu, 19 Jan 2012 00:08:48 +0400 by phpDocumentor 1.4.1