$results = array(); $maxct = 0; $v = array('week' => this_week(), 'month' => this_month(), 'year' => this_year(), 'ever' => 0); foreach (array_keys($v) as $when) { $data = $ft->dbh->_select_rows_as_objects("SELECT var1, {$by} AS 'val' FROM tbl:stats WHERE type = ? AND dtype = ? AND var2 = ? " . "AND {$by} > 0 ORDER BY {$by} DESC LIMIT 25", array($which, $when, $v[$when])); if ($data) { # now convert the data to something useful $out = array(); $ct = 0; foreach ($data as $row) { $ct++; if ($which == 'pilot') { array_push($out, array(get_pilot_link($row->var1), $row->val)); } elseif ($which == 'system') { $sys = new EVESystem($row->var1); array_push($out, array($sys->getLink() . ' (<span style="color: ' . security_color($sys->getSecurity()) . ';">' . security($sys->getSecurity()) . '</span>)', $row->val)); } elseif ($which == 'corp') { array_push($out, array(get_corp_link($row->var1), $row->val)); } elseif ($which == 'alliance') { array_push($out, array(get_alliance_link($row->var1), $row->val)); } elseif ($which == 'region') { array_push($out, array(EVERegion::getLink($row->var1), $row->val)); } elseif ($which == 'group') { array_push($out, array(get_group_link($row->var1), $row->val)); } elseif ($which == 'ship') { array_push($out, array(get_ship_link($row->var1), $row->val)); } elseif ($which == 'weapon') { array_push($out, array(get_item_link($row->var1), $row->val)); } } if ($maxct < $ct) {
if (!isset($okwhen[$when])) { return $ft->errorpage('Invalid ranking criteria.'); } # now do the select $v = array('week' => this_week(), 'month' => this_month(), 'year' => this_year(), 'ever' => 0); $data = $ft->dbh->_select_rows_as_objects("SELECT var1, {$by} AS 'val' FROM tbl:stats WHERE type = ? AND dtype = ? AND var2 = ? " . "AND {$by} > 0 ORDER BY {$by} DESC LIMIT 25", array($which, $when, $v[$when])); if (!$data) { $data = array(); } # now convert the data to something useful $out = array(); foreach ($data as $row) { if ($which == 'pilot') { array_push($out, array(get_pilot_link($row->var1), $row->val)); } elseif ($which == 'system') { array_push($out, array(EVESystem::getLink($row->var1), $row->val)); } elseif ($which == 'corp') { array_push($out, array(get_corp_link($row->var1), $row->val)); } elseif ($which == 'alliance') { array_push($out, array(get_alliance_link($row->var1), $row->val)); } elseif ($which == 'region') { array_push($out, array(EVERegion::getLink($row->var1), $row->val)); } elseif ($which == 'group') { array_push($out, array(get_group_link($row->var1), $row->val)); } elseif ($which == 'ship') { array_push($out, array(get_ship_link($row->var1), $row->val)); } elseif ($which == 'weapon') { array_push($out, array(get_item_link($row->var1), $row->val)); } } # now prepare the page