Create a New Widget to allow visible and invisible mapguide layer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Create a New Widget to allow visible and invisible mapguide layer

annis
This post has NOT been accepted by the mailing list yet.
Hi all,


I want to create a new widget . The new Widget allow to invisible a "selected" layer by click the new widget .




my widget/VisibleOFF.js

// VisibleOff layer @ 24April14
// Fusion <Widget>
   
   
    Fusion.Widget.LayerPoints = OpenLayers.Class(Fusion.Widget, {
    uiClass: Jx.Button,
   
    initializeWidget: function (widgetTag){
        var json = widgetTag.extension;
        this.sBaseUrl = Fusion.getFusionURL() + 'widgets/LayerPoints/LayerPointsOFF.php';
                                     

    }
    }
    );

   
   

-------------------------------------------------------------------------------------------

<?php

/*
     Invisible/OFF Layer @ 24 April 14
*/


    $fusionMGpath = '../../layers/MapGuide/php/';
    require_once $fusionMGpath . 'Common.php';
    require_once $fusionMGpath . 'Utilities.php';
    require_once $fusionMGpath . 'JSON.php';

    include 'setting.php';

    $args = ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST : $_GET;

        $site = new MgSiteConnection();
        $site->Open(new MgUserInformation($args['SESSION']));
       
        $map = new MgMap($site);
        $resourceService = $site->CreateService(MgServiceType::ResourceService);

        $map->Open($resourceService, $args['MAPNAME']);
        $layers=  $map->GetLayers();

    $layerLP = $layers->GetItem($Layer_LicencePoints);
        $layerLP->SetVisible(false);   // set false (invisible)
               
        $layerLP->ForceRefresh();
        $map->Save($resourceService);
       


 
?>


After i tested my function, no run at all . Is it my .js code wrongly?  Pls Advice ! tq