/** * get a url that will zoom us out one level from this gridsquare * @access public */ function getGridSquareToken($gridsquare) { if (is_numeric($gridsquare)) { $id = $gridsquare; $gridsquare = new GridSquare(); $gridsquare->loadFromId($id); } $out = new GeographMapMosaic(); //start with same params $out->setScale(40); $out->setMosaicFactor(2); $out->setCentre($gridsquare->x, $gridsquare->y, true); //true to align to 10x10 map return $out->getToken(); }
$smarty->cache_lifetime = 3600 * 24; //24hr cache } if (isset($_GET['refresh']) && $USER->hasPerm('admin')) { $smarty->clear_cache($template, $cacheid); } $smarty->assign_by_ref('references_real', $CONF['references']); if (!$smarty->is_cached($template, $cacheid)) { $db = NewADOConnection($GLOBALS['DSN']); if (!$db) { die('Database connection failed'); } #$db->debug = true; $mosaic = new GeographMapMosaic(); $mosaic->setScale(40); $mosaic->setMosaicFactor(2); $mostarray = array(); foreach ($CONF['references'] as $ri => $rname) { $letterlength = $CONF['gridpreflen'][$ri]; $most = $db->GetAll("select \n\t\tgrid_reference,x,y,\n\t\tconcat(substring(grid_reference,1," . ($letterlength + 1) . "),substring(grid_reference," . ($letterlength + 3) . ",1)) as tenk_square,\n\t\tsum(has_geographs) as geograph_count,\n\t\tsum(percent_land >0) as land_count\n\t\tfrom gridsquare \n\t\twhere reference_index = {$ri} \n\t\tgroup by tenk_square \n\t\thaving geograph_count = 0 and land_count > 0\n\t\torder by tenk_square"); $i = 1; $lastgeographs = -1; foreach ($most as $id => $entry) { $most[$id]['x'] = intval(($most[$id]['x'] - $CONF['origins'][$ri][0]) / 10) * 10 + $CONF['origins'][$ri][0]; $most[$id]['y'] = intval(($most[$id]['y'] - $CONF['origins'][$ri][1]) / 10) * 10 + $CONF['origins'][$ri][1]; //get a token to show a suroudding geograph map $mosaic->setOrigin($most[$id]['x'], $most[$id]['y']); $most[$id]['map_token'] = $mosaic->getToken(); } $mostarray += array($ri => $most); }
$smarty->cache_lifetime = 3600 * 6; //6hr cache } $smarty->assign_by_ref('references_real', $CONF['references']); if (!$smarty->is_cached($template, $cacheid)) { $db = NewADOConnection($GLOBALS['DSN']); if (!$db) { die('Database connection failed'); } #$db->debug = true; $mosaic = new GeographMapMosaic(); $mosaic->setScale(40); $mosaic->setMosaicFactor(2); $largemosaic = new GeographMapMosaic(); $largemosaic->setScale(80); $largemosaic->setMosaicFactor(2); $largemosaic->setMosaicSize(800, 800); $censquare = new GridSquare(); function cmp($a, $b) { if ($a['sort'] == $b['dateraw']) { return 0; } return $a['dateraw'] > $b['dateraw'] ? -1 : 1; } $db->Execute("TRUNCATE hectad_complete"); $mostarray = array(); foreach ($CONF['references'] as $ri => $rname) { $letterlength = $CONF['gridpreflen'][$ri]; $prev_fetch_mode = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;