コード例 #1
0
  * Actually render the kml or gpx file directly to client
  * this happens when they sumbit the form to a new tab - which directly accesses this file.
  * at this point joomla is gone which is great becuase I don't want to wait for all the eventhandlers
  * etc. (now relying on Geolive to provide database access)
  */
 $paArray = UrlVar('paddlingAreas', array());
 if (!empty($paArray)) {
     include_once 'lib/Util.php';
     $sitesArray = array();
     // I am working on another method called FilteredSiteListInAreas
     // which will work using Attribute filters - this will hopefully
     // be more robust and ignore minor spelling differences
     $siteList = json_decode(UrlVar('siteList', '[]'));
     if (is_array($siteList) && !empty($siteList)) {
         GeoliveHelper::QueriedSiteListInAreasInIdList($paArray, $siteList, function ($row) use(&$sitesArray) {
             $sitesArray[] = get_object_vars($row);
         });
     } else {
         GeoliveHelper::QueriedSiteListInAreas($paArray, function ($row) use(&$sitesArray) {
             $sitesArray[] = get_object_vars($row);
         });
     }
     // die(Core::GetDatasource()->getQuery());
     if (UrlVar('exportOutput') == 'kml') {
         // export kmz file, this requires writing
         // to a temprotary file, kmz is a zip file with
         // .kmz extensions
         $filename = tempnam(__DIR__, 'zip');
         include_once 'lib/KmlWriter.php';
         $kmlWriter = new KmlWriter();
         $zip = new ZipArchive();