//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;
        $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\t(sum(has_geographs) * 100 / sum(percent_land >0)) as percentage\n\t\tfrom gridsquare \n\t\twhere reference_index = {$ri} \n\t\tgroup by tenk_square \n\t\thaving geograph_count > 0 and percentage >=100\n\t\torder by percentage desc,tenk_square");
 /**
  * get big token
  * @access public
  */
 function getBigToken()
 {
     $out = new GeographMapMosaic();
     //start with same params
     $out->setScale($this->pixels_per_km);
     $out->setMosaicFactor($this->mosaic_factor * 2);
     $out->setMosaicSize($this->image_w * 2, $this->image_h * 2);
     $out->type_or_user = $this->type_or_user;
     //figure out image size in km
     $mapw = $this->image_w / $this->pixels_per_km;
     $maph = $this->image_h / $this->pixels_per_km;
     //figure out how many pixels to pan by
     $panx = round($mapw / $this->mosaic_factor);
     $pany = round($maph / $this->mosaic_factor);
     $out->setAlignedOrigin($this->map_x - $panx, $this->map_y - $pany, true);
     return $out->getToken();
 }
示例#3
0
                }
            }
        }
        $smarty->assign_by_ref('data', $data);
        $smarty->assign_by_ref('searchdesc', $searchdesc);
        //geotag the page
        require_once 'geograph/conversions.class.php';
        $conv = new Conversions();
        list($lat, $long) = $conv->gridsquare_to_wgs84($square);
        $smarty->assign('lat', $lat);
        $smarty->assign('long', $long);
        $smarty->assign_by_ref('square', $square);
        //get a token to show a suroudding geograph map
        $mosaic = new GeographMapMosaic();
        $smarty->assign('map_token', $mosaic->getGridSquareToken($square));
        //lets add an overview map too
        $overview = new GeographMapMosaic('largeoverview');
        $overview->setCentre($square->x, $square->y);
        //does call setAlignedOrigin
        #$smarty->assign('marker', $overview->getSquarePoint($square));
        //actully lets make it the approximate size!
        $mosaic = new GeographMapMosaic('overview');
        $mosaic->setMosaicSize($d * 2, $d * 2);
        $mosaic->setScale($overview->pixels_per_km);
        #$mosaic->setCentre($square->x,$square->y); //does call setAlignedOrigin which we dont want!
        $mosaic->setOrigin($square->x - $d, $square->y - $d);
        $smarty->assign('marker', $overview->getBoundingBox($mosaic));
        $overview->assignToSmarty($smarty, 'overview');
    }
}
$smarty->display($template, $cacheid);