コード例 #1
0
         return;
     }
     if (UrlVar('task') == 'unit_test') {
         if (Core::Client()->isAdmin()) {
             // TODO: make a phpunit.xml and better unit tests
             // then phpunit --configuration phpunit.xml
             print_r(htmlspecialchars(shell_exec('/usr/local/bin/phpunit ' . escapeshellarg(__DIR__ . DS . 'lib' . DS . 'UtilTest') . ' 2>&1')));
         }
         return;
     }
     /*
      * 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));
         }