[Cartoweb-users] sessionable plugin

Alexandre Saunier alexandre.saunier at camptocamp.com
Tue Mar 28 11:09:16 EST 2006


Hello,

your plugin seems quite correct.

giuseppe.derossi at email.it wrote:
> for some data and display them in a box. The results are a set of
> coordinates and are displayed as clickble links, now if I click on one of
> them I get the map to be recentered and some info to be displayed, but at
> this point I miss the previous
> results and the folder is changed to the default, so I should to click on my
> folder plugin and reinsert the input string. 

> // my data structure to be stored
> class ResultFromDataBase {    
>     public $CoordinatesFromDataBase = array();
> }
> 
> // my plugin main class
> class ClientRicercaPar extends ClientPlugin implements Sessionable,
> GuiProvider, FilterProvider {
> 
>     protected $ResultFromDataBase;    
> 
> // implementation of sessionable interface
> public function createSession(MapInfo $mapInfo, 
>                                   InitialMapState $initialMapState) {
>          
>         $this->ResultFromDataBase = new ResultFromDataBase();
>         $this->clearSession();       
>         return;
>     }

clearSession() and "return" are useless here.

> public function saveSession() {
>     
>         if (!$this->getConfig()->persistentQueries) {
>         
>             // Do not store selections
>             $this->ResultFromDataBase->CoordinatesFromDataBase = array(); 
>         }
> 
>         return $this->ResultFromDataBase;
>     }  

Do you actually have a "persistentQueries" parameter set to "true" in 
your config (in ricercaPar.ini, not in query.ini)?
If not, your results list is emptied on every page. That might be the 
reason of your troubles?!

Alexandre


More information about the Cartoweb-users mailing list