CorePlugins

# Class: ClientLayers Source Location: /coreplugins/layers/client/ClientLayers.php
### Class Overview
    PluginBase
       |
       --ClientPlugin
          |
          --ClientLayers
Handles layers selection interface | ### Variables $childrenCache $currentScale $frozenLayers $frozenSelectedLayers $frozenUnselectedLayers $hiddenLayers $hiddenSelectedLayers $hiddenUnselectedLayers $layerIds $layers $layersData $layersInit $layersState $log $mapId $nodeId $nodesIds $notAvailableIcon $notAvailableMinusIcon $notAvailablePlusIcon $overrideSwitch $selectedLayers $smarty $unfoldedIds $unfoldedLayerGroups $useNewSwitch | ### Constants RENDERING_DROPDOWN RENDERING_RADIO RENDERING_TREE | ### Methods __construct adjustExportMapRequest ajaxGetPluginResponse ajaxHandleAction buildRequest createSession drawLayersList drawSwitches fetchChildrenFromLayerGroup fetchFrozenSelectedLayers fetchHiddenSelectedLayers fetchLayer fetchLayerIcon fetchRecursively getClassChildren getCurrentScale getFrozenLayers getHiddenLayers getLayerByName getLayerChildren getLayerIds getLayerNode getLayers getLayersInit getLayersMask getLayersSecurityFiltered getMatchingLayers getNewSessionObject getPrintedIconPath getPrintedLayerData getPrintedLayers getPrintedParents getSelectedLayers getUnfoldedLayerGroups handleHttpGetRequest handleHttpPostRequest handleInit handleResult handleSwitches initializeResult isLayerVisibleAtCurrentScale isOutOfRangeIcon loadSession nodesFilterSecurity renderForm saveSession setOutofScaleIcon setSwitch
### Inherited Constants #### Class: ClientPlugin ClientPlugin::ENABLE_LEVEL_FULL ClientPlugin::ENABLE_LEVEL_LOAD ClientPlugin::ENABLE_LEVEL_PROCESS ClientPlugin::ENABLE_LEVEL_SERVERCALL | ### Inherited Variables #### Class: ClientPlugin ClientPlugin::$cartoclient ClientPlugin::$config ClientPlugin::$enabledLevel #### Class: PluginBase PluginBase::$basePath PluginBase::$name PluginBase::$overriddenRequest | ### Inherited Methods #### Class: ClientPlugin ClientPlugin::__construct() Constructor ClientPlugin::checkBool() Checks if variable $variable has a boolean (0 or 1) value $value. ClientPlugin::checkInt() Checks if variable $variable has an integer positive or zero value $value. ClientPlugin::checkNumeric() Checks if variable $variable has a numeric value $value. ClientPlugin::disable() Sets the enable level to ClientPlugin::ENABLE_LEVEL_SERVERCALL. ClientPlugin::enable() Sets the enable level to ClientPlugin::ENABLE_LEVEL_FULL. ClientPlugin::getCartoclient() ClientPlugin::getConfig() ClientPlugin::getEnabledLevel() Returns the enable level. ClientPlugin::getHttpValue() Returns the user-submitted $key data if it is set. ClientPlugin::initializeConfig() Initializes plugin configuration ClientPlugin::isEnabledAtLevel() Sets the enable level to ClientPlugin::ENABLE_LEVEL_FULL. ClientPlugin::setEnableLevel() Sets the enable level (to be used with the AJAX mode). #### Class: PluginBase PluginBase::__construct() Constructor PluginBase::account() Records an accounting message for plugins PluginBase::getBasePath() PluginBase::getExtendedName() PluginBase::getName() PluginBase::getRequest() Get plugin's request or result out of MapRequest or MapResult PluginBase::initialize() Plugin initialization (can be extended in custom plugins) PluginBase::initializeConfig() Initializes plugin PluginBase::preInitialize() Plugin pre initialization. In most cases, plugins should use PluginBase::replacePlugin() Returns name of parent plugin in case of plugin extension PluginBase::setBasePath() PluginBase::setExtendedName() PluginBase::setName()
### Class Details [line 202] Handles layers selection interface [ Top ] ### Class Variables #### $childrenCache = array() [line 299] #### Tags:
access: | protected
Type: | array
[ Top ] #### $currentScale = [line 304] #### Tags:
access: | protected
Type: | float
[ Top ] #### $frozenLayers = array() [line 269] #### Tags:
access: | protected
Type: | array
[ Top ] #### $frozenSelectedLayers = [line 244] #### Tags:
access: | protected
Type: | array
[ Top ] #### $frozenUnselectedLayers = [line 249] #### Tags:
access: | protected
Type: | array
[ Top ] #### $hiddenLayers = array() [line 264] #### Tags:
access: | protected
Type: | array
[ Top ] #### $hiddenSelectedLayers = [line 234] #### Tags:
access: | protected
Type: | array
[ Top ] #### $hiddenUnselectedLayers = [line 239] #### Tags:
access: | protected
Type: | array
[ Top ] #### $layerIds = array() [line 294] #### Tags:
access: | protected
Type: | array
[ Top ] #### $layers = [line 254] #### Tags:
access: | protected
Type: | array
[ Top ] #### $layersData = [line 229] List of LayerState objects. See LayerState. #### Tags:
access: | protected
Type: | array
[ Top ] #### $layersInit = [line 218] #### Tags:
access: | protected
Type: | LayersInit
[ Top ] #### $layersState = [line 223] #### Tags:
access: | protected
Type: | LayersState
[ Top ] #### $log = [line 208] #### Tags:
access: | private
Type: | Logger
Overrides: | Array
[ Top ] #### $mapId = [line 309] #### Tags:
access: | protected
Type: | string
[ Top ] #### $nodeId = array() [line 284] #### Tags:
access: | protected
Type: | array
[ Top ] #### $nodesIds = array() [line 289] #### Tags:
access: | protected
Type: | array
[ Top ] #### $notAvailableIcon = [line 314] Availability information icons #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $notAvailableMinusIcon = [line 316] #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $notAvailablePlusIcon = [line 315] #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $overrideSwitch = false [line 327] True if switch was overrided by another plugin #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $selectedLayers = array() [line 259] #### Tags:
access: | protected
Type: | array
[ Top ] #### $smarty = [line 213] #### Tags:
access: | protected
Type: | Smarty_Plugin
[ Top ] #### $unfoldedIds = array() [line 279] #### Tags:
access: | protected
Type: | array
[ Top ] #### $unfoldedLayerGroups = array() [line 274] #### Tags:
access: | protected
Type: | array
[ Top ] #### $useNewSwitch = false [line 321] #### Tags:
access: | protected
Type: | boolean
[ Top ] ### Class Methods ### constructor __construct [line 336]
`ClientLayers __construct( )`
Constructor #### Tags:
access: | public
Overrides ClientPlugin::__construct() (Constructor) [ Top ] ### method adjustExportMapRequest [line 1626]
`void adjustExportMapRequest( ExportConfiguration $configuration, MapRequest $mapRequest)`
#### Tags:
access: | public
see: | Exportable::adjustExportMapRequest()
[ Top ] ### method ajaxGetPluginResponse [line 1443]
`void ajaxGetPluginResponse( AjaxPluginResponse $ajaxPluginResponse)`
#### Tags:
access: | public
see: | Ajaxable::ajaxGetPluginResponse()
[ Top ] ### method ajaxHandleAction [line 1454]
`void ajaxHandleAction( mixed $actionName, PluginEnabler $pluginEnabler)`
#### Tags:
access: | public
see: | Ajaxable::ajaxHandleAction()
[ Top ] ### method buildRequest [line 950]
`void buildRequest( )`
#### Tags:
access: | public
see: | ServerCaller::buildRequest()
[ Top ] ### method createSession [line 404]
`void createSession( MapInfo $mapInfo, InitialMapState $initialMapState)`
Initializes layers session data and initially populates some properties. #### Tags:
access: | public
see: | Sessionable::CreateSession()
[ Top ] ### method drawLayersList [line 1377]
`string drawLayersList( )`
Initializes layers selector interface. #### Tags:
return: | result of a Smarty fetch
access: | protected
[ Top ] ### method drawSwitches [line 1403]
`string drawSwitches( )`
Draws switches dropdown #### Tags:
return: | result of a smarty fetch
access: | protected
[ Top ] ### method fetchChildrenFromLayerGroup [line 871]
`array fetchChildrenFromLayerGroup( array $layersList, [boolean $listLayerGroups = false])`
Determines activated layers by recursively browsing LayerGroups. Only keeps Layer objects that are not detected as {hidden AND not selected}. #### Tags:
return: | list of children, grand-children... of given layers
access: | public
#### Parameters:
array | $layersList | list of layers names
boolean | $listLayerGroups | if true, layerGroups will be listed as well (default: false)
[ Top ] ### method fetchFrozenSelectedLayers [line 804]
`array fetchFrozenSelectedLayers( string $layerId, [boolean $forceFrozen = false], [boolean $forceSelected = false])`
Recursively retrieves selected frozen layers. #### Tags:
access: | protected
see: | ClientLayers::fetchHiddenSelectedLayers()
#### Parameters:
string | $layerId | layer name
boolean | $forceFrozen | (default: false) if true, transmits 'frozen' status to children layers
boolean | $forceSelected | (default: false) if true, transmits 'selected' status to children layers
[ Top ] ### method fetchHiddenSelectedLayers [line 784]
`array fetchHiddenSelectedLayers( string $layerId, [boolean $forceHidden = false], [boolean $forceSelected = false])`
Recursively retrieves selected hidden layers (not transmitted by the browser). Since "hidden" property is inheritated by layers from their declared-as-hidden parents, those layers selection statuses are retrieved as well. #### Tags:
access: | protected
#### Parameters:
string | $layerId | layer name
boolean | $forceHidden | (default: false) if true, transmits 'hidden' status to children layers
boolean | $forceSelected | (default: false) if true, transmits 'selected' status to children layers
[ Top ] ### method fetchLayer [line 1216]
`array fetchLayer( LayerBase $layer, [boolean $forceSelection = false], [boolean $forceFrozen = false], [string $layerRendering = self::RENDERING_TREE], [int $parentId = 0])`
Deals with every single layer and recursively calls itself to build sublayers. #### Tags:
return: | array of layer children and grand-children... data
access: | protected
#### Parameters:
LayerBase | $layer |
boolean | $forceSelection | (default: false) if true transmits 'selected' status to children
boolean | $forceFrozen | (default: false) if true transmits 'frozen' status to children
string | $layerRendering | (default: 'tree') rendering of layers
int | $parentId | (default: 0) id of parent layer in displayed interface
[ Top ] ### method fetchLayerIcon [line 1140]
`string fetchLayerIcon( LayerBase $layer, [array &$children = array()])`
Returns layer icon filename if any. #### Tags:
access: | protected
#### Parameters:
LayerBase | $layer |
array | &$children | list of layer children names (default: empty array)
[ Top ] ### method fetchRecursively [line 828]
`array fetchRecursively( LayerBase $layer, string $type, boolean $forceFixed, boolean $forceSelected)`
Performs common recursive job for fetchHiddenSelectedLayers() and fetchFrozenSelectedLayers(). #### Tags:
access: | protected
see: | ClientLayers::fetchFrozenSelectedLayers()
see: | ClientLayers::fetchHiddenSelectedLayers()
#### Parameters:
LayerBase | $layer |
string | $type | type of layers detection: 'hidden' or 'frozen'
boolean | $forceFixed | inherited status (see above type)
boolean | $forceSelected | inherited selection status
[ Top ] ### method getClassChildren [line 1087]
`array getClassChildren( LayerBase $layer)`
Recursively retrieves the list of Mapserver Classes bound to the layer or its sublayers. #### Tags:
return: | array of layers names
access: | protected
#### Parameters:
LayerBase | $layer |
[ Top ] ### method getCurrentScale [line 1108]
`float getCurrentScale( )`
Retrieves current scale from location plugin #### Tags:
access: | protected
[ Top ] ### method getFrozenLayers [line 768]
`array getFrozenLayers( )`
Returns the list of explicitely frozen layers. #### Tags:
access: | protected
[ Top ] ### method getHiddenLayers [line 760]
`array getHiddenLayers( )`
Returns the list of explicitely hidden layers. #### Tags:
access: | protected
[ Top ] ### method getLayerByName [line 547]
`LayerBase getLayerByName( string $layername, [boolean $strict = true])`
Returns the Layer|LayerGroup|LayerClass object whose name is passed. #### Tags:
return: | layer object of type Layer|LayerGroup|LayerClass
access: | public
#### Parameters:
string | $layername | name of layer
boolean | $strict | if true (default), throws exception if invalid layername
[ Top ] ### method getLayerChildren [line 562]
`array getLayerChildren( LayerBase $layer)`
Returns a list of current layer children, taking into account some criteria such as aggregation, LayerClass name validity. #### Tags:
return: | array of layers names
access: | protected
#### Parameters:
LayerBase | $layer | layer object of type Layer|LayerGroup|LayerClass
[ Top ] ### method getLayerIds [line 522]
`array getLayerIds( )`
#### Tags:
return: | layerIds, list of server-asked layers
access: | public
[ Top ] ### method getLayerNode [line 483]
`LayerNode getLayerNode( )`
Construct a new tree of layerNodes by getting the layers from the mapInfo. #### Tags:
return: | The root node of the hierarchy of layerNodes.
access: | protected
[ Top ] ### method getLayers [line 532]
`array getLayers( [boolean $forceRefresh = false])`
Returns the list of Layer|LayerGroup|LayerClass objects available in MapInfo. #### Tags:
access: | public
#### Parameters:
boolean | $forceRefresh | if true, force refresh list (default: false)
[ Top ] ### method getLayersInit [line 1619]
`array getLayersInit( )`
#### Tags:
return: | layersInit
access: | public
[ Top ] ### method getLayersMask [line 914]
`array getLayersMask( [string $layerId = 'root'], [bool $resetCache = false])`
Recursively determines layers that can be selected in layers selector. #### Tags:
return: | layers list
access: | protected
#### Parameters:
string | $layerId | layer id
bool | $resetCache | if true, children cache is ignored (default: false)
[ Top ] ### method getLayersSecurityFiltered [line 504]
`array getLayersSecurityFiltered( )`
Filters the layers which are not allowed to be viewed by the current user. It returns a flat map of (layerId => Layer object). #### Tags:
return: | An array of LayerBase object.
access: | protected
[ Top ] ### method getMatchingLayers [line 723]
`array getMatchingLayers( string $stateProperty, string $storageName, [boolean $refresh = false])`
Returns a list of layers that match passed condition. Is in fact a code factorizer for get*Layers() methods. #### Tags:
access: | protected
#### Parameters:
string | $stateProperty | name of some LayerBase property. See LayerBase.
string | $storageName | name of ClientLayers property that contains data
boolean | $refresh | if true, refreshes storage content (default to false)
[ Top ] ### method getNewSessionObject [line 396]
`LayersState getNewSessionObject( )`
Gets a new instance of layers-plugin session-storage class. Usefull in extended ClientLayers class when using extended session storage class. #### Tags:
access: | protected
[ Top ] ### method getPrintedIconPath [line 1473]
`string getPrintedIconPath( string $icon)`
Returns icon full path. #### Tags:
return: | full path
access: | protected
#### Parameters:
string | $icon | icon filename
[ Top ] ### method getPrintedLayerData [line 1486]
`array getPrintedLayerData( string $layerId, mixed $resolution)`
Returns given layer printing data (icon, label, children...). #### Tags:
access: | protected
#### Parameters:
string | $layerId | layer id
[ Top ] ### method getPrintedLayers [line 1589]
`array getPrintedLayers( array $selectedLayers, float $scale, [mixed $resolution = 0])`
Returns the list of layers actually printed on mainmap as well as their classes and parent LayerGroups if any (mainly used for PDF printing). #### Tags:
return: | complete list of printed layers, layergroups, layerclasses
access: | public
#### Parameters:
array | $selectedLayers | list of layers explicitely asked to CartoServer
float | $scale | scale value
[ Top ] ### method getPrintedParents [line 1546]
`void getPrintedParents( string $layerId, array &$selectedLayers, array &$printedNodes)`
Recursively detects selected layers parent nodes and substitutes them if parents are aggregated. #### Tags:
access: | protected
#### Parameters:
string | $layerId | current layer id
array | &$selectedLayers | selected layers list
array | &$printedNodes | structure containing data of layers to print
[ Top ] ### method getSelectedLayers [line 743]
`array getSelectedLayers( [boolean $refresh = false])`
Returns the list of activated layers. #### Tags:
access: | public
#### Parameters:
boolean | $refresh | optional (default: false), if true, forces result refresh
[ Top ] ### method getUnfoldedLayerGroups [line 752]
`array getUnfoldedLayerGroups( )`
Returns the list of LayerGroups that must be rendered unfolded. #### Tags:
access: | protected
[ Top ] ### method handleHttpGetRequest [line 688]
`void handleHttpGetRequest( mixed $request)`
Handles data from GET request. #### Tags:
access: | public
see: | GuiProvider::handleHttpGetRequest()
[ Top ] ### method handleHttpPostRequest [line 632]
`void handleHttpPostRequest( mixed $request)`
Handles layers-related POST'ed data and updates layers statuses. #### Tags:
access: | public
see: | GuiProvider::handleHttpPostRequest()
[ Top ] ### method handleInit [line 344]
`void handleInit( mixed $layersInit)`
#### Tags:
access: | public
see: | InitUser::handleInit()
[ Top ] ### method handleResult [line 1079]
`void handleResult( mixed $layersResult)`
#### Tags:
access: | public
see: | ServerCaller::handleResult()
[ Top ] ### method handleSwitches [line 598]
`void handleSwitches( array $request)`
Handles switches form #### Tags:
access: | protected
#### Parameters:
array | $request |
[ Top ] ### method initializeResult [line 968]
`void initializeResult( mixed $layersResult)`
#### Tags:
access: | public
see: | ServerCaller::initializeResult()
[ Top ] ### method isLayerVisibleAtCurrentScale [line 1523]
`boolean isLayerVisibleAtCurrentScale( string $layerId)`
Tells if given layer is visible at current scale Checks for classes scale visibility #### Tags:
access: | public
#### Parameters:
string | $layerId | layer id
[ Top ] ### method isOutOfRangeIcon [line 1128]
`boolean isOutOfRangeIcon( string $icon)`
#### Tags:
return: | True if this icon is an out of range icon (below or above scale).
access: | protected
#### Parameters:
string | $icon | icon filename
[ Top ] ### method loadSession [line 356]
`void loadSession( mixed $sessionObject)`
Retrieves session-saved layers data. #### Tags:
access: | public
see: | Sessionable::loadSession()
[ Top ] ### method nodesFilterSecurity [line 465]
`boolean nodesFilterSecurity( LayerNode $node)`
Callback used to remove nodes which are not visible by the current user. If it returns true, the node will be ignored in the tree. #### Tags:
return: | True of this node is not accepted (meaning access denied)
access: | public
#### Parameters:
LayerNode | $node | The node on which to check access
[ Top ] ### method renderForm [line 1433]
`void renderForm( Smarty $template)`
Assigns the layers interface output in the general Cartoclient template. #### Tags:
access: | public
see: | GuiProvider::renderForm()
[ Top ] ### method saveSession [line 1609]
`void saveSession( )`
Saves layers data in session. #### Tags:
access: | public
see: | Sessionable::saveSession()
[ Top ] ### method setOutofScaleIcon [line 1186]
`boolean setOutofScaleIcon( LayerBase $layer)`
Substitutes out-of-scale icons if current scale is out of the layer range of scales. #### Tags:
access: | protected
#### Parameters:
LayerBase | $layer |
[ Top ] ### method setSwitch [line 611]
`void setSwitch( string $newSwitch)`
Changes switch from another plugin #### Tags:
access: | public
#### Parameters:
string | $newSwitch |
[ Top ] ### Class Constants #### RENDERING_DROPDOWN = 'dropdown' [line 331] [ Top ] #### RENDERING_RADIO = 'radio' [line 330] [ Top ] #### RENDERING_TREE = 'tree' [line 329] [ Top ] Documentation generated on Fri, 21 Sep 2007 13:30:38 +0200 by phpDocumentor 1.3.0RC3