} /* * could implement other ajax commands ie: * list number of results actively while user changes selection */ echo 'Ajax Command List: [export]'; } elseif (GeoliveHelper::ScriptWasIncludedFromJoomla()) { // display a dynamic form containing regions, and area selection. // TODO add layer selection. if (!file_exists(__DIR__ . DS . 'regions.json')) { include_once 'lib/PaddlingArea.php'; include_once 'lib/Region.php'; $regionObjArray = array(); foreach (GeoliveHelper::DefinedRegionsList() as $region) { $regionObj = new Region($region); foreach (GeoliveHelper::DistinctPaddlineAreas($region) as $pdArea) { $paddleObj = new PaddlingArea($pdArea); $regionObj->areas[] = $paddleObj; } $regionObjArray[] = $regionObj; file_put_contents(__DIR__ . DS . 'regions.json', json_encode($regionObjArray, JSON_PRETTY_PRINT)); } } else { $regionObjArray = json_decode(file_get_contents(__DIR__ . DS . 'regions.json')); } if (empty($regionObjArray)) { throw new Exception('There were no regions'); } // HtmlBock is used to seperate templates from code // look in scaffolds/html.form.select.php HtmlBlock('form.select', array('regions' => $regionObjArray, 'layers' => array_map(function ($layer) {