コード例 #1
0
 public static function CountSites()
 {
     $args = json_decode(UrlVar('json', '{}'));
     $sites = array();
     if (is_array($args->paddlingAreas)) {
         $count = GeoliveHelper::CountSitesInAreas($args->paddlingAreas);
     }
     echo json_encode(array('count' => $count, 'success' => true), JSON_PRETTY_PRINT);
 }
コード例 #2
0
 public function testSiteCount()
 {
     include_once dirname(__DIR__) . '/lib/GeoliveHelper.php';
     include_once dirname(__DIR__) . '/lib/AjaxRequest.php';
     $access = array('public', 'special', 'site-planning');
     $c = GeoliveHelper::CountSitesInAreas(array("Douglas Gardner"), $access);
     $this->assertEquals(22, $c);
     $count = 0;
     GeoliveHelper::QueriedSiteListInAreas(array("Douglas Gardner"), function ($i) use(&$count) {
         $count++;
     }, $access);
     $this->assertEquals(22, $count, GeoliveHelper::Database()->lastQuery());
 }