Chameleon    Home  |  Docs  |  Support  |  Bugs  |  CVS  |  Downloads 

MapTools.org

Hidden Variables

There were two main problems with this solution:

First, how to record the expanded/collapsed state after updating the map, and second, how to record the group checkbox state after updating.

I have solved it by using hidden variables. So in gethtmlhiddenvariables() function, in legendtemplate.widget.php, I added this:

$oMap = $this->moMapObject->oMap;
$aAllGroups = $oMap->getAllGroupNames();
foreach ($aAllGroups as $group)
{
 $szVariable = $group."_status";
 if ($this->isVarSet($szVariable))
   $status = $this->getVar($szVariable);
 else
   $status = "closed";
 $szValue = " <INPUT TYPE=\"HIDDEN\" NAME=\"$szVariable\" 
              VALUE=\"$status\">\n";
 $aReturn$szVariable = $szValue;
 $szVariable = $group."_allLayersChecked";
 if ($this->isVarSet($szVariable))
 {
   $allLayersChecked = $this->getVar($szVariable);
 } else
 {
   $allLayersInGroup = $oMap->getLayersIndexByGroup($group);
   foreach($allLayersInGroup as $i)
   {
     $oLayer = $oMap->getLayer( $i );
     if ($oLayer->status == MS_OFF) 
     {
       $allLayersChecked = "FALSE";
       break;
     }
     $allLayersChecked = "TRUE";
   }
 }
 $szValue = " <INPUT TYPE=\"HIDDEN\" NAME=\"$szVariable\" 
            VALUE=\"$allLayersChecked\">\n";
 $aReturn$szVariable = $szValue;
}

Created by: dgambin last modification: Friday 17 of February, 2006 [10:26:15 UTC] by dgambin

Printer Friendly

 
 

Contact Information

Chameleon Users List