[Chameleon] date filter
Danna Dowdy
Danna.Dowdy at noaa.gov
Fri Oct 28 09:10:22 EDT 2005
That is exactly what I was looking for. Thanks.
Jason Fournier wrote:
> Danna,
>
> If I understand correctly I think one way to approach this is to add
> custom code in index.phtml handle the layer selection process. In
> your index.phtml you have something like the following:
>
> class SampleApp extends Chameleon
> {
>
> function SampleApp()
> {
> parent::Chameleon();
> $this->moMapSession = new MapSession_RW;
> $this->moMapSession->setTempDir( getSessionSavePath());
> }
>
> function CWCProcessURL(&$oHTTPFormVars)
> {
> $bRes = parent::CWCProcessURL($oHTTPFormVars);
> // include any kind of execute processing here ...
> return $bRes;
> }
>
> }
>
> The function CWCProcessURL (which I don't think is there by default)
> is where you can execute PHP MapScript to affect the state of the
> current session mapfile (after $bRes is declared and before $bRes is
> returned). So, for instance, you can get the value of your dropdown,
> cycle through the mapfile layers, and perform whichever action you
> deem necessary on that layer (eg, visibility, expression, add classes,
> etc):
>
> $value = $_REQUEST['dropdown'];
> if( $value == 1990 )
> {
> $oMap = $oApp->moMapSession->oMap;
> $nMapLayers = $oMap->numlayers;
> for($i=0;$i<$nMapLayers;$i++)
> {
> $oLayer = $oMap->getLayer($i);
> //etc etc
> }
> }
>
> Replace or modify the above code with your own. You may want to keep
> an array of layers to turn on for a given dropdown value then write
> some generic code to handle it - would save you time in the long run.
>
> Is this what you were going after?
>
> Best Regards,
> Jason
>
>
>
>
> Danna Dowdy wrote:
>
>> I have found where I can use set FILTER in the map file dynamically
>> using a form or a url variable but am still not sure how to get those
>> variables passed from chameleon??
>>
>> Danna Dowdy wrote:
>>
>>> I am working on a basic mapping application that currently displays
>>> data from a spatial database based on variable groupings. I have
>>> individual views set up for each individual layer. I would like to
>>> add a drop down menu somewhere on the interface so that the user
>>> could select a year and plot whatever layers are chosen for that
>>> particular year. The date field is in the database. Could someone
>>> point me in the right direction of how to do this?
>>> _______________________________________________
>>> Chameleon mailing list
>>> Chameleon at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>>
>>
>> _______________________________________________
>> Chameleon mailing list
>> Chameleon at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/chameleon
>>
>
More information about the Chameleon
mailing list