if ($_GET['debug']) { print $sql; } $topusers = $db->GetAssoc($sql); } //assign an ordinal $i = 1; $lastgeographs = '?'; #$geographs = 0; $pending = 0; #$points = 0; foreach ($topusers as $user_id => $entry) { if ($lastgeographs == $entry['geographs']) { $topusers[$user_id]['ordinal'] = '" '; } else { $topusers[$user_id]['ordinal'] = smarty_function_ordinal($i); $lastgeographs = $entry['geographs']; } $i++; #$geographs += $entry['geographs']; $pending += $entry['pending']; #$points += $entry['points']; if (empty($entry['points'])) { $topusers[$user_id]['points'] = ''; } } $geographs = $sum['geographs']; $points = $sum['points']; $smarty->assign('geographs', $geographs); $smarty->assign('pending', $pending); $smarty->assign('points', $points);
$most[$id]['ordinal'] = smarty_function_ordinal($i); $lastgeographs = $most[$id]['percentage']; } $i++; //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->assign_by_ref("most", $mostarray); if ($myriad) { $onekm = array(); $smarty->assign("myriad", $myriad); } else { $onekm = $db->GetAll("select grid_reference,imagecount from gridsquare where imagecount>1 order by imagecount desc,grid_reference limit 50"); $i = 1; $lastgeographs = -1; foreach ($onekm as $id => $entry) { if ($lastgeographs == $onekm[$id]['imagecount']) { $onekm[$id]['ordinal'] = '" '; } else { $onekm[$id]['ordinal'] = smarty_function_ordinal($i); $lastgeographs = $onekm[$id]['imagecount']; } $i++; } } $smarty->assign_by_ref("onekm", $onekm); } $smarty->display($template, $cacheid);
if (isset($topusers[$entry['user_id']])) { $topusers[$entry['user_id']]['imgcount']++; } else { $topusers[$entry['user_id']] = $entry; $topusers[$entry['user_id']]['imgcount'] = 1; } } function cmp($a, $b) { if ($a['imgcount'] == $b['imgcount']) { return 0; } return $a['imgcount'] > $b['imgcount'] ? -1 : 1; } uasort($topusers, "cmp"); $i = 1; $lastimgcount = '?'; foreach ($topusers as $idx => $entry) { if ($lastimgcount == $topusers[$idx]['imgcount']) { $topusers[$idx]['ordinal'] = ' "'; } else { $topusers[$idx]['ordinal'] = smarty_function_ordinal($i); $lastimgcount = $topusers[$idx]['imgcount']; } $i++; } $smarty->assign_by_ref('topusers', $topusers); //lets find some recent photos new RecentImageList($smarty); } $smarty->display($template, $cacheid);
die('Database connection failed'); } #$db->debug = true; $mosaic = new GeographMapMosaic(); $mosaic->setScale(4); $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\tsubstring(grid_reference,1,{$letterlength}) as hunk_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 hunk_square \n\t\thaving geograph_count > 0 \n\t\torder by percentage desc,land_count desc,hunk_square"); $i = 1; $lastgeographs = -1; foreach ($most as $id => $entry) { $most[$id]['x'] = intval(($most[$id]['x'] - $CONF['origins'][$ri][0]) / 100) * 100 + $CONF['origins'][$ri][0]; $most[$id]['y'] = intval(($most[$id]['y'] - $CONF['origins'][$ri][1]) / 100) * 100 + $CONF['origins'][$ri][1]; if ($lastgeographs == $most[$id]['percentage']) { $most[$id]['ordinal'] = '" '; } else { $most[$id]['ordinal'] = smarty_function_ordinal($i); $lastgeographs = $most[$id]['percentage']; } $i++; //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->assign_by_ref("most", $mostarray); } $smarty->display($template, $cacheid);