R: [Cartoweb-users] list in cartoweb HELP!!!!!!!!!!

Fabio D'Ovidio fabiodovidio at gmail.com
Thu Jun 12 04:53:57 EDT 2008


Hi Giovanni!
May be you must consider Sessionable Interface in you 
ClientYourNamePlugin.php ($comune will be tour variable):


// my data structure to be stored
class ResultFromDataBase {   
    public  $comune = array();

}

// Sessionable interface

    public function createSession(MapInfo $mapInfo,
                                  InitialMapState $initialMapState) {
        
        $this->ResultFromDataBase = new ResultFromDataBase();
        $this->clearSession();      
        return;
    }
 

   public function saveSession() {
   
        return $this->ResultFromDataBase;
    } 
   
    public function loadSession($sessionObject) {
   
        $this->ResultFromDataBase = $sessionObject;
    }
   
    protected function clearSession() {
    $this->ResultFromDataBase->comune = '';
   
   
    }




Giovanni Virdis ha scritto:
>
> Hi Fabio,
>
>  
>
> I have made what you have said to me. I get the value from db with the 
> function query_sql() that return a resultset but when I get the smarty 
> variable 'first_query' this is empty but in the resultset there are 
> the value . Why? Where I wrong?
>
> This is the function that return a fill load resulset.
>
> Please help if you can
>
> Thanks
>
>  
>
>  
>
>  
>
> ------------------------------------------------------------------------
>
> *Da:* Fabio D'Ovidio [mailto:fabiodovidio at gmail.com]
> *Inviato:* mercoledì 11 giugno 2008 8.16
> *A:* Giovanni Virdis
> *Cc:* cartoweb-users at lists.maptools.org
> *Oggetto:* Re: [Cartoweb-users] list in cartoweb HELP!!!!!!!!!!
>
>  
>
> Giovanni,
> IMHO you must modify your PHP source code in order to do what you want.
>
> In the ClientYourPluginName.php file you could modify as following:
>
> public function renderForm(Smarty $template) {
>     
> ......   
>    
>      $template->assign('first_query', $this->query_sql());
>     
> ...
> ...    
>     
> }
>
> where query_sql() is the function that queries your database and 
> return resultset (you can look at here: 
> http://www.cartoweb.org/cwiki/HowToDisplayOnTheMapAPointFromADatabaseQuery). 
> Remeber Cartoweb uses PEAR extension to connect and query DB...
> After you can call the variable "first_query" from your application 
> cartoclient.tpl file (so you must modify it. Remeber to make a --clean 
> after deploying cartoweb). All values can be put in the 
> YourPluginName.tpl file where a  <select></select> section is just 
> prepared or you can create YourPluginName.tpl file dinamically 
> inserting you values..
>
> In order to select a second value coming from the choise of the first 
> one, you have to create an "onchage" event on the first select item in 
> order to fetch the value and make the second query...
>
> Fabio D'Ovidio
>
> 2008/6/10 Giovanni Virdis <g.virdis at riteco.it 
> <mailto:g.virdis at riteco.it>>:
>
> Can someonehelp me . I post  my answer many times but nobody help me. 
> Please I'm new and I need help
>
>  
>
> Hi,
>
> if is possibile i want populate the select item from db. I have modify 
> the dhtmlEdit.js file to show a select item with a fix value
>
>  
>
> var authorisedOptionsList = new Array(1, 2, 3);
>
> var authorisedOptionsListLabel = new Array('Strutture pubbliche', 
> 'Strutture per il commercio', 'Strutture militari');
>
>  
>
> How i can populate this item  by db select?
>
>  Is possible chanche the value of second select item when I change the 
> value of first select item ?
>
> Example
>
>  
>
> 1° Select value:
>
>  
>
> 1, 'America'
> 2, 'Europa'
>
> 3, 'Asia'
>
> 4, 'Oceania'
>
> 5, 'Africa'
>
>  
>
> 2° Select value:
>
>  
>
> 1, 'Giappone'
> 2, 'Cina'
> 3, 'Mongolia'
> 4, 'Stati Uniti'
> 5, 'Canada'
> 6, 'Messico'
> 7, 'Italia'
> 8, 'Spagna'
>
>  
>
>  
>
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org 
> <mailto:Cartoweb-users at lists.maptools.org>
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>
>  
>

-- 
Ing. Fabio D'Ovidio

INOVA Open Solutions s.r.l.
Web : http://www.inovaos.it
Tel.: 081 197 57 600
mail: fabiodovidio at gmail.com



More information about the Cartoweb-users mailing list