Exemplo n.º 1
0
                $smarty->assign('map_token', $mosaic->getGridSquareToken($square));
            }
        }
    }
} else {
    //no square specifed - populate with remembered values
    $smarty->assign('gridsquare', $_SESSION['gridsquare']);
    $smarty->assign('eastings', $_SESSION['eastings']);
    $smarty->assign('northings', $_SESSION['northings']);
}
if (!isset($_GET['inner'])) {
    #//lets find some recent photos
    #new RecentImageList($smarty);
    //lets add an overview map too
    if ($grid_ok) {
        $overview = new GeographMapMosaic('largeoverview');
        $overview->setCentre($square->x, $square->y);
        //does call setAlignedOrigin
        $smarty->assign('marker', $overview->getSquarePoint($square));
        //TODO if centisquare is specified use that to plot a circle!
        //lets add an rastermap too
        $rastermap = new RasterMap($square, false, $square->natspecified);
        $rastermap->addLatLong($lat, $long);
        $smarty->assign_by_ref('rastermap', $rastermap);
    } else {
        $overview = new GeographMapMosaic('overview');
    }
    $overview->assignToSmarty($smarty, 'overview');
}
#}
$smarty->display($template, $cacheid);
Exemplo n.º 2
0
 }
 foreach ($CONF['references'] as $ri => $rname) {
     $letterlength = $CONF['gridpreflen'][$ri];
     $newstats = $db->CacheGetRow(3 * 3600, "select \n\t\t\tcount(*) as squares_total,\n\t\t\tsum(imagecount) as images_total,\n\t\t\tsum(imagecount > 0) as squares_submitted,\n\t\t\tcount(distinct concat(substring(grid_reference,1," . ($letterlength + 1) . "),substring(grid_reference," . ($letterlength + 3) . ",1))) as tenk_total\n\t\tfrom gridsquare \n\t\twhere reference_index = {$ri} and percent_land > 0");
     $stats[$ri] = array_merge($stats[$ri], $newstats);
     $newstats = $db->CacheGetRow(3 * 3600, "select \n\t\t\tcount(*) as geographs_submitted,\n\t\t\tcount(distinct substring(grid_reference,1,{$letterlength})) as grid_submitted,\n\t\t\tcount(distinct concat(substring(grid_reference,1," . ($letterlength + 1) . "),substring(grid_reference," . ($letterlength + 3) . ",1))) as tenk_submitted,\n\t\t\tavg( x ) as x,\n\t\t\tavg( y ) as y\n\t\tfrom gridsquare \n\t\twhere reference_index = {$ri} and percent_land > 0 and has_geographs > 0");
     $stats[$ri] = array_merge($stats[$ri], $newstats);
     $stats[$ri] += array('images_thisweek' => $db->CacheGetOne(3 * 3600, "select count(*) from gridimage_search where reference_index = {$ri} and (unix_timestamp(now())-unix_timestamp(submitted))<604800"));
     $stats[$ri] += array("grid_total" => $db->CacheGetOne(24 * 3600, "select count(*) from gridprefix where reference_index = {$ri} and landcount > 0"));
     $censquare = new GridSquare();
     $ok = $censquare->loadFromPosition(intval($stats[$ri]['x']), intval($stats[$ri]['y']));
     if ($ok) {
         $stats[$ri] += array("centergr" => $censquare->grid_reference);
         //find a possible place within 35km
         $stats[$ri] += array("place" => $censquare->findNearestPlace(35000));
         $stats[$ri] += array("marker" => $overview->getSquarePoint($censquare));
     } else {
         $stats[$ri] += array("centergr" => 'unknown');
     }
 }
 foreach (array('images_total', 'images_thisweek', 'squares_total', 'squares_submitted', 'tenk_total', 'tenk_submitted', 'geographs_submitted', 'grid_submitted', 'grid_total') as $name) {
     $sum = 0;
     foreach ($CONF['references'] as $ri => $rname) {
         $sum += $stats[$ri][$name];
     }
     $stats[0] += array($name => $sum);
 }
 foreach ($CONF['references_all'] as $ri => $rname) {
     $sqtotal = $stats[$ri]['squares_total'];
     $percentage = $sqtotal == 0 ? 0.0 : $stats[$ri]['squares_submitted'] / $sqtotal * 100;
     $stats[$ri] += array('percent' => $percentage);
Exemplo n.º 3
0
     $overview->assignToSmarty($smarty, 'overview2');
 } else {
     $overview->assignToSmarty($smarty, 'overview');
 }
 require_once 'geograph/pictureoftheday.class.php';
 $potd = new PictureOfTheDay();
 if (isset($_GET['potd'])) {
     $potd->assignToSmarty($smarty, intval($_GET['potd']));
 } else {
     $potd->assignToSmarty($smarty);
 }
 //lets find some recent photos
 if ($CONF['template'] == 'ireland') {
     new RecentImageList($smarty, 2);
 } else {
     $smarty->assign('marker', $overview->getSquarePoint($potd->image->grid_square));
     new RecentImageList($smarty);
 }
 $db = NewADOConnection($GLOBALS['DSN']);
 if ($CONF['forums']) {
     //let's find recent posts in the announcements forum made by
     //administrators
     $sql = "select u.user_id,u.realname,t.topic_title,p.post_text,t.topic_id,t.topic_time, posts_count - 1 as comments \n\t\t\tfrom geobb_topics as t\n\t\t\tinner join geobb_posts as p on(t.topic_id=p.topic_id)\n\t\t\tinner join user as u on (p.poster_id=u.user_id)\n\t\t\twhere find_in_set('admin',u.rights)>0 and\n\t\t\tabs(unix_timestamp(t.topic_time) - unix_timestamp(p.post_time) ) < 10 and\n\t\t\tt.forum_id={$CONF['forum_announce']}\n\t\t\torder by t.topic_time desc limit 3";
     $news = $db->GetAll($sql);
     if ($news) {
         foreach ($news as $idx => $item) {
             $news[$idx]['post_text'] = str_replace('<br>', '<br/>', GeographLinks($news[$idx]['post_text'], true));
         }
     }
     $smarty->assign_by_ref('news', $news);
 }
Exemplo n.º 4
0
 function assignToSmarty($smarty)
 {
     global $CONF;
     $taken = $this->getFormattedTakenDate();
     //get the grid references
     $this->getSubjectGridref(true);
     $this->getPhotographerGridref(true);
     //remove grid reference from title
     $this->bigtitle = trim(preg_replace("/^{$this->grid_reference}/", '', $this->title));
     $this->bigtitle = preg_replace('/(?<![\\.])\\.$/', '', $this->bigtitle);
     $rid = $this->grid_square->reference_index;
     $gridrefpref = $CONF['gridrefname'][$rid];
     $smarty->assign('page_title', $this->bigtitle . ":: {$gridrefpref}{$this->grid_reference}");
     $smarty->assign('image_taken', $taken);
     $smarty->assign('ismoderator', $ismoderator);
     $smarty->assign_by_ref('image', $this);
     //get a token to show a suroudding geograph map
     $mosaic = new GeographMapMosaic();
     $smarty->assign('map_token', $mosaic->getGridSquareToken($this->grid_square));
     //find a possible place within 25km
     $place = $this->grid_square->findNearestPlace(75000);
     $smarty->assign_by_ref('place', $place);
     if (empty($this->comment)) {
         $smarty->assign('meta_description', "{$this->grid_reference} :: {$this->bigtitle}, " . strip_tags(smarty_function_place(array('place' => $place))));
     } else {
         $smarty->assign('meta_description', $this->comment);
     }
     if (!empty($CONF['forums'])) {
         //let's find posts in the gridref discussion forum
         $this->grid_square->assignDiscussionToSmarty($smarty);
     }
     //count the number of photos in this square
     $smarty->assign('square_count', $this->grid_square->imagecount);
     //lets add an overview map too
     $overview = new GeographMapMosaic('largeoverview');
     $overview->setCentre($this->grid_square->x, $this->grid_square->y);
     //does call setAlignedOrigin
     $overview->assignToSmarty($smarty, 'overview');
     $smarty->assign('marker', $overview->getSquarePoint($this->grid_square));
     require_once 'geograph/conversions.class.php';
     $conv = new Conversions();
     list($lat, $long) = $conv->gridsquare_to_wgs84($this->grid_square);
     $smarty->assign('lat', $lat);
     $smarty->assign('long', $long);
     list($latdm, $longdm) = $conv->wgs84_to_friendly($lat, $long);
     $smarty->assign('latdm', $latdm);
     $smarty->assign('longdm', $longdm);
     //lets add an rastermap too
     $rastermap = new RasterMap($this->grid_square, false);
     $rastermap->addLatLong($lat, $long);
     if (!empty($this->viewpoint_northings)) {
         $rastermap->addViewpoint($this->viewpoint_refindex, $this->viewpoint_eastings, $this->viewpoint_northings, $this->viewpoint_grlen, $this->view_direction);
     } elseif (isset($this->view_direction) && strlen($this->view_direction) && $this->view_direction != -1) {
         $rastermap->addViewDirection($this->view_direction);
     }
     $smarty->assign_by_ref('rastermap', $rastermap);
     $smarty->assign('x', $this->grid_square->x);
     $smarty->assign('y', $this->grid_square->y);
     if ($this->view_direction > -1) {
         $smarty->assign('view_direction', $this->view_direction % 90 == 0 ? strtoupper(heading_string($this->view_direction)) : ucwords(heading_string($this->view_direction)));
     }
     $level = $this->grid_square->imagecount > 1 ? 6 : 5;
     $smarty->assign('sitemap', getSitemapFilepath($level, $this->grid_square));
 }