Source for file MapFishLayerTreeWidget.php
Documentation is available at MapFishLayerTreeWidget.php
* Widget de type mapfishlayertree
* @copyright 2009, Boreal - Information Strategies
* @license http://www.geoprisma.org/license BSD License
* @link http://www.geoprisma.org
* Widget de type mapfishlayertree
private $m_objDomDocumentOptions =
null;
* Construit un instance de org_geoprisma_widget_MapWidget
* @param array &$pobjArray Config node
* @return org_geoprisma_widget_MapWidget
if (isset
($pobjArray['id']))
$strName = (string)
$pobjArray['id'];
$strName = (string)
$pobjArray['name'];
* Given an array of nodes, remove each ones that are leaves and that have
* non-authorized or inexistant resources. Nodes that are not leaves
* (that contain other nodes) should have its childs dealt with also.
* @param array $pobjArrayNodes Array of nodes
private function removeNodesWithNoRight($pobjArrayNodes)
foreach ($pobjArrayNodes as $strNodeKey =>
$objArrayNode)
// if current node has children
if (isset
($objArrayNode['nodes']))
$pobjArrayNodes[$strNodeKey]['nodes']
=
$this->removeNodesWithNoRight($objArrayNode['nodes']);
// if current node had all its children removed, remove it
if (count($pobjArrayNodes[$strNodeKey]['nodes']) ==
0)
unset
($pobjArrayNodes[$strNodeKey]);
// if current node is a leaf
if (isset
($objArrayNode['resourcename']))
$strResource =
$objArrayNode['resourcename'];
unset
($pobjArrayNodes[$strNodeKey]);
unset
($pobjArrayNodes[$strNodeKey]);
* Remove a specific leaf using its resourcename and servicetype values from
* given nodes. If the parent node becomes empty, it's removed as well.
* @param array &$pobjArrayNodes Array of nodes
* @param string $pstrResourceName The name of the resourcename of the node
* @param string $pstrServiceType The servicetype of the node to remove
&$pobjArrayNodes, $pstrResourceName, $pstrServiceType
foreach ($pobjArrayNodes as $strNodeKey =>
&$objArrayNode)
// if current node has children
if (isset
($objArrayNode['nodes']))
// if current node had all its children removed, remove it
if (count($pobjArrayNodes[$strNodeKey]['nodes']) ==
0)
unset
($pobjArrayNodes[$strNodeKey]);
// if current node is a leaf
if (isset
($objArrayNode['resourcename'])
&&
$objArrayNode['resourcename'] ==
$pstrResourceName
&& isset
($objArrayNode['servicetype'])
&&
$objArrayNode['servicetype'] ==
$pstrServiceType
unset
($pobjArrayNodes[$strNodeKey]);
* Retourne le type du widget
return self::MAP_FISH_LAYER_TREE_WIDGET;
* Ajout le widget courant (this) dans le xml
* @param DOMElement &$pobjDomElementWidgets Noeud xml ou le widget doit ĂȘtre ajouter
* @param DOMDocument &$pobjDomDocument Document XMl ou le noeud xml datastore est ajouter, utiliser pour construire les noeuds
public function insertIntoXML(DOMElement &$pobjDomElementWidgets, DOMDocument &$pobjDomDocument)
$objDomElementWidget =
$pobjDomDocument->createElement('widget');
$pobjDomElementWidgets->appendChild($objDomElementWidget);
$objDomElementType =
$pobjDomDocument->createElement('type', $this->getType());
$objDomElementName =
$pobjDomDocument->createElement('name', $this->getName());
$objDomElementWidget->appendChild($objDomElementType);
$objDomElementWidget->appendChild($objDomElementName);
$objDomElementWidget->appendChild($objDomNodeParams);
return $objDomElementWidget;
* Retourne une liste de nom de ressource utiliser par ce widget
* @return ArrayObject of string
$objArrayResource =
new ArrayObject();
foreach ($objArrayResourceNames as $strResourceName)
$objArrayResource->append($strResourceName);
return $objArrayResource;
* Retourne une liste d'information sur les datastores utilisé
* @return ArrayObject of array('resourcename' => ?, 'datastorename' => ?, 'servicename' => ? )
return self::getDatastoresFromResources($this->getResources());
* Return an array of resource name unique values from given "nodes" array.
* @param array $pobjArrayNodes Array of node.
$objArrayResourceNames =
array();
foreach ($pobjArrayNodes as $objArrayNode)
if (isset
($objArrayNode['resourcename']))
$objArrayResourceNames, $objArrayNode['resourcename']
else if (isset
($objArrayNode['nodes']))
* Prepare and call to the 'addLayerNodeFromPathArray' method to set the
* options 'nodes' property with the new layer node added.
* @param string &$pstrPath The path in which
* @param org_geoprisma_resource_Resource &$pobjResource Resource object
* @param string &$pstrServiceType Service type
* @param array &$pobjOptions Array of layer
$objArrayNodesToAdd =
explode(self::PATH_DELIMITER, $pstrPath);
* Add a new layer node to the 'nodes' array OR browse nodes using the
* 'paths' array in order to add it to the according tree position. If
* a 'path' node doesn't exists, it creates it at the same time.
* @param array &$pobjArrayPaths Array of nodes
* @param array &$pobjArrayNodes Array of nodes in
* @param org_geoprisma_resource_Resource &$pobjResource Resource object
* @param string &$pstrServiceType Service type
* @param array &$pobjOptions Array of layer
* @return array Nodes containing the new ones added.
// if there are no more paths, that means we are in the leaf container,
// so create and push the new leaf
if (count($pobjArrayPaths) ==
0)
'servicetype' =>
$pstrServiceType,
'resourcename' =>
$pobjResource->getName(),
'textkey' =>
$pobjResource->getTitle()
// see if the path has an existing node. If if does, move in it, else
// create a new one then move in it.
// check if path contains domain:key
self::DOMAIN_KEY_LOOKUP_PATTERN,
if (count($objArrayMatchs) ==
3)
$objArrayTextKey =
array(
"domain" =>
$objArrayMatchs[1],
"key" =>
$objArrayMatchs[2]
$objArrayTextKey =
$strPath;
if ($iIndex != -
1 && isset
($pobjArrayNodes[$iIndex]['nodes']))
$pobjArrayNodes[$iIndex]['nodes'],
// if node doesn't exists
"textkey" =>
$objArrayTextKey,
"checked" =>
"undefined",
* Check if a node exists in an array of nodes using the 'textkey' property.
* It may sometimes be defined as a 'domain' & 'key' array, so it takes
* If it does, returns the key of the node, else returns -1.
* @param array &$pobjArrayNodes Array of nodes
* @param string $pstrTextKey TextKey value. Can also be an array with
* 'domain' and 'key' keys.
foreach ($pobjArrayNodes as $iKey =>
$objNode)
if (getType($objNode['textkey']) ==
'array')
&& isset
($objNode['textkey']['domain'])
&& isset
($objNode['textkey']['key'])
&&
$objNode['textkey']['domain'] ===
$pstrTextKey['domain']
&&
$objNode['textkey']['key'] ===
$pstrTextKey['key']
foreach ($pobjArrayNodes as $iKey =>
$objNode)
if ($objNode['textkey'] ===
$pstrTextKey)
* Returns a reference to the root nodes of the layertree inside the options.
Documentation generated on Thu, 19 Jan 2012 00:08:38 +0400 by phpDocumentor 1.4.1