$dbq->execute($drop_sql); $html .= "Cache table dropped."; } } if ($_POST['build_battles']) { if (config::get('fleet_battles_mod_cache')) { if (function_exists("set_time_limit")) { @set_time_limit(0); } $dbq = DBFactory::getDBQuery(); $system_sql = "select count(*) as cnt, kll_system_id from kb3_kills\n\t\t\t group by kll_system_id\n\t\t\t having cnt > " . config::get('fleet_battles_mod_minkills') . " order by cnt"; $dbq->execute($system_sql); while ($system = $dbq->getRow()) { $battlelist = new BattleList((int) $system['kll_system_id']); $battlelist->execQuery(); $table = new BattleListTable($battlelist); $table->getTableStats(); unset($battlelist); unset($table); } $html .= "Built battle cache.<br/>"; } else { $html .= "Caching must be enabled to build the battle cache."; } } // ------------------------------------------------------------------------ // side assignment table actions // ------------------------------------------------------------------------ if ($_POST['side_assignment_empty_table']) { $dbq = DBFactory::getDBQuery(); $empty_sql = 'TRUNCATE TABLE kb3_side_assignment;';
} $sql = "SELECT COUNT( bop.battle_id ) AS cnt, bop.plt_id\n FROM kb3_battles_owner_pilots bop\n INNER JOIN kb3_pilots plt ON ( plt.plt_id = bop.plt_id ) \n INNER JOIN kb3_battles_cache bc ON bc.battle_id = bop.battle_id\n INNER JOIN kb3_systems sys ON sys.sys_name = bc.system\n INNER JOIN kb3_constellations con ON con.con_id = sys.sys_con_id\n INNER JOIN kb3_regions reg ON reg.reg_id = con.con_reg_id\n {$whereSql}\n GROUP BY bop.plt_id ORDER BY 1 DESC LIMIT 15"; $query = DBFactory::getDBQuery(); $query->execute($sql); $tkbox = new AwardBoxLong($query, "Top Fleet Attendees", "Fleet attendances", "fleets", "eagle", $query->recordCount()); return $html = $tkbox->generate(); } // add filter toggling script $jsDir = config::get("cfg_kbhost") . '/mods/' . basename(dirname(__FILE__)) . '/js/'; $page->addHeader("<script type=\"text/javascript\" src=\"" . $jsDir . "toggleFilter.js\"></script>"); switch ($_GET['view']) { case '': echo "<!-- MOD VERSION -->\n"; $battlelist = new BattleList(); $page->setTitle('Fleet Battles'); $table = new BattleListTable($battlelist); // pagination only available for cached battles and non-filtered results if (config::get('fleet_battles_mod_cache') && !isset($_POST["filter"])) { $table->setPageSplit(config::get('killcount') * 2); $pagesplitter = new PageSplitter($table->getCount(), config::get('killcount') * 2); $pagesplit = $pagesplitter->generate(); $html .= $pagesplit . $table->generate() . $pagesplit . $table->getStatsHtml(); } else { $html .= $table->generate() . $table->getStatsHtml(); } break; } $menubox = new box('Menu'); $menubox->setIcon('menu-item.gif'); $menubox->addOption('link', 'Fleet Battles', edkURI::page('battles')); $page->addContext($menubox->generate());