[Cartoweb-users] Get layers icon in LayerReorder plugin

Simon ORTET simon.ortet at silogic.fr
Mon Aug 27 02:49:05 EDT 2007


Hello

It was to check the values i got.
But finally i found a way :
In getCwLayerIds and my new function getCwLayerIcons i make a
foreach ($plugin->getLayers() as $layer) {
instead of
foreach ($plugin->getLayersInit()->layers as $layer)
so i can get $layer->icon

Seems to work fine, i just hope i didn't create a mess by modifing 
getCwLayerIds function...


Simon Ortet
Silogic


Oliver Christen a écrit :
> hi
>
> whats the output of the print_r($element); you added?
>
> regards
> Oliver
>
>
>
>> Hi,
>>
>> I'm trying to add the layer icon just before the radio button in 
>> LayerReorder form. So here's what i did :
>> - in ClientLayerReorder.php, I created a getCwLayerIcons() function 
>> just like getCwLayerIds() wich looks like this
>>
>>    /    public function getCwLayerIcons() {
>>
>>            $cwLayerIcons = array();
>>            $plugin =
>>    $this->cartoclient->getPluginManager()->getPlugin('layers');
>>
>>            foreach ($plugin->getLayersInit()->layers as $layer) {
>>                if ($layer instanceof Layer) {
>>                     $cwLayerIcons[$layer->id] =
>>    $plugin->getLayerIcon($layer);
>>                }
>>            }
>>            return $cwLayerIcons;
>>        }/
>>
>> - The getLayerIcon() function in ClientLayers.php looks like this
>>
>>    /public function getLayerIcon($layer) {
>>            $element = $this->fetchLayer($layer);
>>            /*$children = $this->getLayerChildren($layer);
>>            $this->fetchLayerIcon($layer,$children);
>>            if (empty($element['layerIcon'])) {
>>                $iconUrl = '';
>>            } else {
>>                $resourceHandler =
>>    $this->getCartoclient()->getResourceHandler();
>>                $iconUrl =
>>    $resourceHandler->getFinalUrl($element['layerIcon'], false);
>>            }*/
>>
>>            echo($layer->id.": ");
>>            print_r($element);
>>            echo "<br><br>\n";
>>            return $element['layerIcon'];
>>        }/
>>
>>
>> My problem is that i can't get the icon filename of my layers. I 
>> always get an empty string.
>> Where am I doing something wrong?
>>
>> Thanks
>>
>> Simon Ortet
>>
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
>


More information about the Cartoweb-users mailing list