oMap; $bHasClasses = false; $bSaveResult = true; for ($i=0; $i<$oMap->numlayers; $i++) { $oLayer = $oMap->getlayer( $i ); if ($oLayer->numclasses) { $bHasClasses = true; break; } } if (isset($http_form_vars['bDownload']) && $bHasClasses) { $szFileName = tempnam($_SESSION['gszTmpImgPath'], "SLD").".xml"; // Set OWS_SCHEMAS_LOCATION before saving // if (isset($_SESSION['gszSchemasLocation'])) // { // $oMapSession->oMap->setMetadata("ows_schemas_location", // $_SESSION['gszSchemasLocation']); // } // // Set SLD version before saving // if (isset($http_form_vars['szVersion'])) // { // $oMapSession->oMap->setMetadata("wms_SLD_version", // $http_form_vars['szVersion']); // } /** * generate sld and then write to the temp filename for * processing by download.phtml. */ $szSLDContents = null; if (isset($http_form_vars['nlayerindex'])) { $poLayer = $oMapSession->oMap->getlayer($http_form_vars['nlayerindex']); $szSLDContents = $poLayer->generateSLD(); } else { $szSLDContents = $oMapSession->oMap->generateSLD(); } if (strlen($szSLDContents)) { $fp = @fopen( $szFileName, "w+" ); if($fp === false) { $bSaveResult = false; } else { fwrite( $fp, $szSLDContents ); fclose( $fp ); } } else { $bSaveResult = false; } $_SESSION['DOWNLOADFILE'] = $_SESSION['gszTmpWebPath']."/".basename($szFileName); $_SESSION['DOWNLOADFILE_SAVEAS'] = 'sld.xml'; if (stristr($_SESSION['DOWNLOADFILE'], 'http://') == false ) $_SESSION['DOWNLOADFILE'] = 'http://'.$_SERVER['HTTP_HOST'].'/'.$_SESSION['DOWNLOADFILE']; session_write_close(); header("Location: ".$_SESSION['gszCoreWebPath']."widgets/download.phtml?".SID); } ?> <?php echo trim($oMLT->get("0", "Save SLD")); ?>
 get("1", "Save SLD")); ?>

get("2", "Click the button below to begin saving the layer(s) to an SLD file.")); ?>

get("6", "There are no layers or classes to export.")); ?> ">
get("Close", "Close")), trim($oCommonMLT->get("CancelTip", "Close Dialog")), array( 'width' => 75) ); ?>
alert('The generated SLD file was empty or couldn't be created.');" ?>