Exemplo n.º 1
0
 //assign overview to smarty
 if ($mosaic->type_or_user > 0) {
     $overview->type_or_user = $mosaic->type_or_user;
     $profile = new GeographUser($mosaic->type_or_user);
     $smarty->assign('realname', $profile->realname);
     $smarty->assign('user_id', $mosaic->type_or_user);
 }
 if ($mosaic->pixels_per_km >= 40) {
     //largeoverview
     $overview->setScale(1);
     list($x, $y) = $mosaic->getCentre();
     $overview->setCentre($x, $y);
     //does call setAlignedOrigin
 }
 $overview->assignToSmarty($smarty, 'overview');
 $smarty->assign('marker', $overview->getBoundingBox($mosaic));
 //assign main map to smarty
 $mosaic->assignToSmarty($smarty, 'mosaic');
 //assign all the other useful stuff
 $gridref = $mosaic->getGridRef(-1, -1);
 $smarty->assign('gridref', $gridref);
 $smarty->assign('mapwidth', round($mosaic->image_w / $mosaic->pixels_per_km));
 preg_match("/([A-Z]+\\d)5(\\d)5\$/", $gridref, $matches);
 $smarty->assign('gridref2', $matches[1] . $matches[2]);
 if ($mosaic->pixels_per_km >= 40) {
     $left = $mosaic->map_x;
     $bottom = $mosaic->map_y;
     $right = $left + floor($mosaic->image_w / $mosaic->pixels_per_km) - 1;
     $top = $bottom + floor($mosaic->image_h / $mosaic->pixels_per_km) - 1;
     $rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'";
     $sql = "SELECT user_id,credit_realname,realname,\nCOUNT(*) AS count,\nDATE_FORMAT(MAX(submitted),'%D %b %Y') as last_date,\ncount(distinct imagetaken) as days,\ncount(distinct imageclass) as categories\nFROM \n\tgridimage_search\nWHERE \n\tCONTAINS(GeomFromText({$rectangle}),point_xy) AND\n\tmoderation_status = 'geograph' AND\n\tftf = 1\nGROUP BY user_id,realname\nORDER BY count DESC,last_date DESC\n";