static function advSrch($object)
 {
     /* init variables */
     global $smarty;
     $html = "";
     // process $_REQUEST data, escape string, decode html entities
     $req = array();
     foreach ($_REQUEST as $name => $val) {
         $req[$name] = DBBaseQuery::escape(htmlspecialchars_decode(trim($val)));
     }
     if ($req['act'] == "go" and (isset($req['killperpage']) or isset($_SESSION['killperpage']))) {
         /* do the search */
         // create advanced kill list with filter options
         $list = new AdvKillList();
         // check if being paged
         if (isset($req['killperpage'])) {
             // populate filter options
             $killperpage = $req['killperpage'];
             $list->setDestrShpClass($req['destroyedshipclass']);
             $list->setInvShpClass($req['invshipclass']);
             $list->setSysRange($req['sysrange']);
             if (strlen($req['victimname']) > 0) {
                 $list->setVictimName($req['victimname']);
             }
             if (strlen($req['victimcorp']) > 0) {
                 $list->setVictimCorp($req['victimcorp']);
             }
             if (strlen($req['victimally']) > 0) {
                 $list->setVictimAlly($req['victimally']);
             }
             if (strlen($req['destroyedship']) > 0) {
                 $list->setDestroyedShip($req['destroyedship']);
             }
             if (strlen($req['system']) > 0) {
                 $list->setSystem($req['system']);
             }
             if (strlen($req['const']) > 0) {
                 $list->setConstellation($req['const']);
             }
             if (strlen($req['region']) > 0) {
                 $list->setRegion($req['region']);
             }
             if (strlen($req['invship']) > 0) {
                 $list->setInvShip($req['invship']);
             }
             if (strlen($req['invpilot']) > 0) {
                 $list->setInvPilot($req['invpilot']);
             }
             if (strlen($req['invcorp']) > 0) {
                 $list->setInvCorp($req['invcorp']);
             }
             if (strlen($req['invally']) > 0) {
                 $list->setInvAlly($req['invally']);
             }
             if (strlen($req['invweapon']) > 0) {
                 $list->setInvWeapon($req['invweapon']);
             }
             if (strlen($req['invcount']) > 0) {
                 $list->setInvCount($req['invcount']);
             }
             if (strlen($req['itemdropped']) > 0) {
                 $list->setItemDropped($req['itemdropped']);
             }
             if (strlen($req['itemdestroyed']) > 0) {
                 $list->setItemDestroyed($req['itemdestroyed']);
             }
             if (strlen($req['commcnt']) > 0) {
                 $list->setCommentCount($req['commcnt']);
             }
             if (strlen($req['daterange']) > 0) {
                 $list->setDateRange($req['daterange']);
             }
             // save session data
             $shareUrl = "?a=search&p=adv_search&act=go";
             $shareUrlPieces = array();
             foreach ($req as $name => $val) {
                 switch (strtolower($name)) {
                     case "a":
                         break;
                     case "p":
                         break;
                     case "act":
                         break;
                     case "submit":
                         break;
                     case "phpsessid":
                         break;
                     case "page":
                         break;
                     default:
                         if (preg_match("/^edk/i", $name) == 0) {
                             $_SESSION[$name] = $val;
                             if (strlen($val) > 0) {
                                 $shareUrlPieces[] = strtolower($name) . "=" . urlencode($val);
                             }
                         }
                 }
             }
             if (count($shareUrlPieces) > 0) {
                 $shareUrl .= "&" . implode("&", $shareUrlPieces);
             }
         } else {
             // populate filter options from saved session
             $killperpage = $_SESSION['killperpage'];
             $list->setDestrShpClass($_SESSION['destroyedshipclass']);
             $list->setInvShpClass($_SESSION['invshipclass']);
             $list->setSysRange($_SESSION['sysrange']);
             if (strlen($_SESSION['victimname']) > 0) {
                 $list->setVictimName($_SESSION['victimname']);
             }
             if (strlen($_SESSION['victimcorp']) > 0) {
                 $list->setVictimCorp($_SESSION['victimcorp']);
             }
             if (strlen($_SESSION['victimally']) > 0) {
                 $list->setVictimAlly($_SESSION['victimally']);
             }
             if (strlen($_SESSION['destroyedship']) > 0) {
                 $list->setDestroyedShip($_SESSION['destroyedship']);
             }
             if (strlen($_SESSION['system']) > 0) {
                 $list->setSystem($_SESSION['system']);
             }
             if (strlen($_SESSION['const']) > 0) {
                 $list->setConstellation($_SESSION['const']);
             }
             if (strlen($_SESSION['region']) > 0) {
                 $list->setRegion($_SESSION['region']);
             }
             if (strlen($_SESSION['invship']) > 0) {
                 $list->setInvShip($_SESSION['invship']);
             }
             if (strlen($_SESSION['invpilot']) > 0) {
                 $list->setInvPilot($_SESSION['invpilot']);
             }
             if (strlen($_SESSION['invcorp']) > 0) {
                 $list->setInvCorp($_SESSION['invcorp']);
             }
             if (strlen($_SESSION['invally']) > 0) {
                 $list->setInvAlly($_SESSION['invally']);
             }
             if (strlen($_SESSION['invweapon']) > 0) {
                 $list->setInvWeapon($_SESSION['invweapon']);
             }
             if (strlen($_SESSION['invcount']) > 0) {
                 $list->setInvCount($_SESSION['invcount']);
             }
             if (strlen($_SESSION['itemdropped']) > 0) {
                 $list->setItemDropped($_SESSION['itemdropped']);
             }
             if (strlen($_SESSION['itemdestroyed']) > 0) {
                 $list->setItemDestroyed($_SESSION['itemdestroyed']);
             }
             if (strlen($_SESSION['commcnt']) > 0) {
                 $list->setCommentCount($_SESSION['commcnt']);
             }
             if (strlen($_SESSION['daterange']) > 0) {
                 $list->setDateRange($_SESSION['daterange']);
             }
         }
         $combined = config::get('adv_search_show_combined') or "default";
         $error_handling = config::get('adv_search_error_handling') or "continue";
         if ($combined == "always" or config::get('show_comb_home') and $combined == "default") {
             if (ALLIANCE_ID > 0) {
                 $list->addCombinedAlliance(ALLIANCE_ID);
             }
             if (CORP_ID > 0) {
                 $list->addCombinedCorp(CORP_ID);
             }
             if (PILOT_ID > 0) {
                 $list->addCombinedPilot(PILOT_ID);
             }
         }
         // add page splitter
         $pagesplitter = new PageSplitter($list->getCount(), $killperpage);
         $list->setPageSplitter($pagesplitter);
         // prepare list table
         $table = new KillListTable($list);
         $table->setDayBreak(false);
         if (method_exists($table, "setCombined") and ($combined == "always" or config::get('show_comb_home') and $combined == "default")) {
             $table->setCombined(true);
         }
         $errors = $list->getErrors();
         /* error handling */
         if (count($errors) and $error_handling == "halt") {
             // header
             $html .= "<div class=\"kb-date-header\">There was one or more errors</div>\n";
             // list errors
             $html .= "<ul>\n";
             foreach ($errors as $error) {
                 $html .= "<li>" . $error . ";</li>\n";
             }
             $html .= "</ul>\n";
         } else {
             if (count($errors) and $error_handling == "continue") {
                 // header
                 $html .= "<div class=\"kb-date-header\">There was one or more errors</div>\n";
                 // list errors
                 $html .= "<ul>\n";
                 foreach ($errors as $error) {
                     $html .= "<li>" . $error . ";</li>\n";
                 }
                 $html .= "</ul>\n";
             }
             // header
             $html .= "<div class=kb-kills-header>Search results";
             // share url
             if ($shareUrl) {
                 $html .= " (<a href=\"" . $shareUrl . "\">share</a>)";
             }
             $html .= "</div>\n";
             // generate html
             $html .= $table->generate();
             $html .= $pagesplitter->generate();
         }
     } else {
         /* get ship classes */
         $kbShipClasses = array();
         $qry = new DBQuery();
         $qry->execute("SELECT * FROM `kb3_ship_classes` WHERE `scl_class` NOT LIKE 'POS%' AND `scl_class` NOT LIKE 'Drone' ORDER BY `scl_class`");
         while ($sql_row = $qry->getRow()) {
             $kbShipClasses[$sql_row['scl_id']] = $sql_row['scl_class'];
         }
         $smarty->assignByRef('kbShipClasses', $kbShipClasses);
         // generate from tpl
         $html .= $smarty->fetch(getcwd() . '/mods/advanced_search/adv_search.tpl');
     }
     // generate page
     $html .= "<hr><p class=\"kb-subtable\" align=\"right\"><i>Advanced Search by Sonya Rayner<br>" . ADV_SRCH_VERSION . "</i></p>";
     /* return the generated content */
     return $html;
 }
Example #2
0
 /**
  *  Build the killlists that are needed for the options selected.
  */
 function killList()
 {
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     global $smarty;
     $html = '';
     $smarty->assign('view', $this->view);
     switch ($this->view) {
         case "":
             $targets = array();
             $curtarget = array();
             while ($target =& $this->contract->getContractTarget()) {
                 $kl =& $target->getKillList();
                 $ll =& $target->getLossList();
                 $summary = new KillSummaryTable($kl, $ll);
                 $summary->setVerbose(true);
                 $summary->setView('combined');
                 $curtargets['type'] = $target->getType();
                 $curtargets['id'] = $target->getID();
                 $curtargets['name'] = $target->getName();
                 $curtargets['summary'] = $summary->generate();
                 if ($summary->getTotalKillISK()) {
                     $curtargets['efficiency'] = round($summary->getTotalKillISK() / ($summary->getTotalKillISK() + $summary->getTotalLossISK()) * 100, 2);
                 } else {
                     $curtargets['efficiency'] = 0;
                 }
                 $curtargets['total_kills'] = $summary->getTotalKills();
                 $curtargets['total_losses'] = $summary->getTotalLosses();
                 $curtargets['total_kill_isk'] = round($summary->getTotalKillISK() / 1000000000, 2);
                 $curtargets['total_loss_isk'] = round($summary->getTotalLossISK() / 1000000000, 2);
                 $bar = new BarGraph($curtargets['efficiency'], 100, 120);
                 $curtargets['bar'] = $bar->generate();
                 $targets[] = $curtargets;
             }
             $smarty->assignByRef('targets', $targets);
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
         case "recent_activity":
             $this->contract = new Contract($this->ctr_id);
             $klist = $this->contract->getKillList();
             $klist->setOrdered(true);
             if ($scl_id) {
                 $klist->addVictimShipClass($scl_id);
             } else {
                 $klist->setPodsNoobShips(config::get('podnoobs'));
             }
             $table = new KillListTable($klist);
             $table->setLimit(10);
             $smarty->assign('killtable', $table->generate());
             $llist = $this->contract->getLossList();
             $llist->setOrdered(true);
             if ($scl_id) {
                 $llist->addVictimShipClass($scl_id);
             } else {
                 $llist->setPodsNoobShips(config::get('podnoobs'));
             }
             $table = new KillListTable($llist);
             $table->setLimit(10);
             $smarty->assign('losstable', $table->generate());
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
         case "kills":
             $this->contract = new Contract($this->ctr_id);
             $list = $this->contract->getKillList();
             $list->setOrdered(true);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('killtable', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
         case "losses":
             $this->contract = new Contract($this->ctr_id);
             $llist = $this->contract->getLossList();
             $llist->setOrdered(true);
             if ($scl_id) {
                 $llist->addVictimShipClass($scl_id);
             } else {
                 $llist->setPodsNoobShips(config::get('podnoobs'));
             }
             $llist->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($llist->getCount(), config::get('killcount'));
             $table = new KillListTable($llist);
             $smarty->assign('losstable', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
             $html .= $smarty->fetch(get_tpl('cc_detail_lists'));
             break;
     }
     return $html;
 }
 function killList()
 {
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     global $smarty;
     $klist = new KillList();
     $klist->setOrdered(true);
     // We'll be needing comment counts so set the killlist to retrieve them
     if (config::get('comments_count')) {
         $klist->setCountComments(true);
     }
     // We'll be needing involved counts so set the killlist to retrieve them
     if (config::get('killlist_involved')) {
         $klist->setCountInvolved(true);
     }
     // Set time limit to 1 day.
     $klist->setStartDate($this->period . " 00:00");
     $klist->setEndDate($this->period . " 23:59");
     // Select between kills, losses or both.
     if ($this->view == 'combined' || $this->view == '' && $this->showcombined) {
         involved::load($klist, 'combined');
     } elseif ($this->view == 'losses') {
         involved::load($klist, 'loss');
     } else {
         involved::load($klist, 'kill');
     }
     if ($this->scl_id) {
         $klist->addVictimShipClass($this->scl_id);
     } else {
         $klist->setPodsNoobShips(config::get('podnoobs'));
     }
     $table = new KillListTable($klist);
     if ($this->showcombined) {
         $table->setCombined(true);
     }
     $html = $table->generate();
     return $html;
 }
Example #4
0
 /**
  *  Build the killlists that are needed for the options selected.
  */
 function killList()
 {
     global $smarty;
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     $klist = new KillList();
     $klist->setOrdered(true);
     if ($this->view == 'losses') {
         involved::load($klist, 'loss');
     } else {
         involved::load($klist, 'kill');
     }
     $klist->addSystem($this->system);
     if (config::get('kill_classified')) {
         $klist->setEndDate(gmdate('Y-m-d H:i', strtotime('now - ' . config::get('kill_classified') . ' hours')));
     }
     if ($scl_id) {
         $klist->addVictimShipClass(intval($scl_id));
     } else {
         $klist->setPodsNoobShips(config::get('podnoobs'));
     }
     if ($this->view == 'recent' || !$this->view) {
         $klist->setLimit(20);
         $smarty->assign('klheader', config::get('killcount') . ' most recent kills');
     } else {
         if ($this->view == 'losses') {
             $smarty->assign('klheader', 'All losses');
         } else {
             $smarty->assign('klheader', 'All kills');
         }
     }
     $klist->setPageSplit(config::get('killcount'));
     $pagesplitter = new PageSplitter($klist->getCount(), config::get('killcount'));
     $table = new KillListTable($klist);
     $smarty->assign('klsplit', $pagesplitter->generate());
     $smarty->assign('kltable', $table->generate());
     $html = $smarty->fetch(get_tpl('system_detail'));
     return $html;
 }
Example #5
0
 /**
  *  Build the killlists that are needed for the options selected.
  */
 function killList()
 {
     global $smarty;
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     switch ($this->view) {
         case "kills":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addInvolvedPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('kills', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_kills'));
             break;
         case "losses":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addVictimPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobships(config::get('podnoobs'));
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('losses', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_losses'));
             break;
         case "ships_weapons":
             $shiplist = new TopList_Ship();
             $shiplist->addInvolvedPilot($this->pilot);
             $shiplisttable = new TopTable_Ship($shiplist);
             $smarty->assign('ships', $shiplisttable->generate());
             $weaponlist = new TopList_Weapon();
             $weaponlist->addInvolvedPilot($this->pilot);
             $weaponlisttable = new TopTable_Weapon($weaponlist);
             $smarty->assign('weapons', $weaponlisttable->generate());
             return $smarty->fetch(get_tpl('detail_kl_ships_weapons'));
             break;
         case 'history':
             $pltsum = new pilotSummary($this->plt_id);
             $smarty->assign('title', Language::get('history'));
             $smarty->assign('summary', $pltsum->getMonthlySummary());
             return $smarty->fetch(get_tpl('detail_history'));
             break;
         default:
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addInvolvedPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobships(config::get('podnoobs'));
             }
             $table = new KillListTable($list);
             $smarty->assign('kills', $table->generate());
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addVictimPilot($this->pilot);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobships(config::get('podnoobs'));
             }
             $table = new KillListTable($list);
             $smarty->assign('losses', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_default'));
             break;
     }
     return $html;
 }
Example #6
0
 /**
  * Return the main killlists
  * @global Smarty $smarty
  * @return string HTML string for killlist tables
  */
 function killList()
 {
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     global $smarty;
     $klist = new KillList();
     $klist->setOrdered(true);
     // We'll be needing comment counts so set the killlist to retrieve them
     if (config::get('comments_count')) {
         $klist->setCountComments(true);
     }
     // We'll be needing involved counts so set the killlist to retrieve them
     if (config::get('killlist_involved')) {
         $klist->setCountInvolved(true);
     }
     // Select between kills, losses or both.
     if ($this->view == 'combined' || $this->view == '' && $this->showcombined) {
         involved::load($klist, 'combined');
     } else {
         if ($this->view == 'losses') {
             involved::load($klist, 'loss');
         } else {
             involved::load($klist, 'kill');
         }
     }
     if ($this->scl_id) {
         $klist->addVictimShipClass($this->scl_id);
     } else {
         $klist->setPodsNoobShips(config::get('podnoobs'));
     }
     // If no week is set then show the most recent kills. Otherwise
     // show all kills for the week using the page splitter.
     if (config::get("cfg_fillhome") && !$this->dateSet) {
         $klist->setLimit(config::get('killcount'));
         $table = new KillListTable($klist);
         if ($this->showcombined) {
             $table->setCombined(true);
         }
         $table->setLimit(config::get('killcount'));
         $html = $table->generate();
     } else {
         $this->loadTime($klist);
         //$klist->setWeek($this->week);
         //$klist->setYear($this->year);
         $klist->setPageSplit(config::get('killcount'));
         //$pagesplitter = new PageSplitter($klist->getCount(), config::get('killcount'));
         $table = new KillListTable($klist);
         if ($this->showcombined) {
             $table->setCombined(true);
         }
         //$pagesplit = $pagesplitter->generate();
         //$html = $pagesplit.$table->generate().$pagesplit;
         $html = $table->generate();
     }
     return $html;
 }
Example #7
0
 /**
  *
  * @return string HTML string for the list of kills and losses.
  */
 public function killList()
 {
     $html = '<div class="kb-kills-header">Related kills</div>';
     $ktable = new KillListTable($this->klist);
     $html .= $ktable->generate();
     $html .= '<div class="kb-losses-header">Related losses</div>';
     $ltable = new KillListTable($this->llist);
     $html .= $ltable->generate();
     return $html;
 }
Example #8
0
 /**
  *  Build the killlists that are needed for the options selected.
  *
  * @global Smarty $smarty
  * @return string
  */
 function killList()
 {
     global $smarty;
     if ($this->view == '') {
         $smarty->assign('view', Language::get('recent'));
     } else {
         $smarty->assign('view', $this->view);
     }
     $args = array(array('a', 'alliance_detail', true), array('all_id', $this->all_id, true));
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $scl_id = (int) edkURI::getArg('scl_id');
     switch ($this->view) {
         default:
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addInvolvedAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $ktab = new KillListTable($list);
             $ktab->setLimit(10);
             $smarty->assign('kills', $ktab->generate());
             $list = new KillList();
             $list->setOrdered(true);
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $list->setLimit(10);
             $list->addVictimAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $ltab = new KillListTable($list);
             $ltab->setLimit(10);
             $smarty->assign('losses', $ltab->generate());
             return $smarty->fetch(get_tpl('detail_kl_default'));
             break;
         case "kills":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addInvolvedAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('kills', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             return $smarty->fetch(get_tpl('detail_kl_kills'));
             break;
         case "losses":
             $list = new KillList();
             $list->setOrdered(true);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->addVictimAlliance($this->alliance);
             if ($scl_id) {
                 $list->addVictimShipClass($scl_id);
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('losses', $table->generate());
             $smarty->assign('splitter', $pagesplitter->generate());
             return $smarty->fetch(get_tpl('detail_kl_losses'));
             break;
         case "corp_kills":
             $smarty->assign('title', Language::get('topkillers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'corp_kills', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'corp_kills', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_CorpKills();
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Corp($list, Language::get('kills'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_CorpKills();
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Corp($list, Language::get('kills'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "corp_kills_class":
             $smarty->assign('title', Language::get('topdestroyedships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             $newrow = true;
             $ships = array();
             foreach ($shipclass as $shp) {
                 $list = new TopList_CorpKills();
                 $list->addInvolvedAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Corp($list, Language::get('kills'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "kills_class":
             $smarty->assign('title', Language::get('topdestroyedships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             foreach ($shipclass as $shp) {
                 $list = new TopList_Kills();
                 $list->addInvolvedAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Pilot($list, Language::get('kills'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "corp_losses_class":
             $smarty->assign('title', Language::get('toplostships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             foreach ($shipclass as $shp) {
                 $list = new TopList_CorpLosses();
                 $list->addVictimAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Corp($list, Language::get('losses'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "losses_class":
             $smarty->assign('title', Language::get('toplostships'));
             // Get all ShipClasses
             $sql = "select scl_id, scl_class from kb3_ship_classes\n\t\t\t\t\twhere scl_class not in ('Drone','Unknown') order by scl_class";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             while ($row = $qry->getRow()) {
                 $shipclass[] = new Shipclass($row['scl_id']);
             }
             foreach ($shipclass as $shp) {
                 $list = new TopList_Losses();
                 $list->addVictimAlliance($this->alliance);
                 $list->addVictimShipClass($shp);
                 $table = new TopTable_Pilot($list, Language::get('losses'));
                 $content = $table->generate();
                 $ships[] = array('name' => $shp->getName(), 'table' => $content);
             }
             $smarty->assignByRef('ships', $ships);
             return $smarty->fetch(get_tpl('detail_kl_ships'));
             break;
         case "corp_losses":
             $smarty->assign('title', Language::get('toplosers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'corp_losses', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'corp_losses', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_CorpLosses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Corp($list, Language::get('losses'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_CorpLosses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Corp($list, Language::get('losses'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_kills":
             $smarty->assign('title', Language::get('topkillers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_kills', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_kills', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, Language::get('kills'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, Language::get('kills'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_scores":
             $smarty->assign('title', Language::get('topscorers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_scores', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_scores', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_Score();
             $list->addInvolvedAlliance($this->alliance);
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, Language::get('top_points'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Score();
             $list->addInvolvedAlliance($this->alliance);
             $table = new TopTable_Pilot($list, Language::get('top_points'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_losses":
             $smarty->assign('title', Language::get('toplosers'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_losses', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_losses', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $list = new TopList_Losses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, Language::get('losses'));
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Losses();
             $list->addVictimAlliance($this->alliance);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, Language::get('losses'));
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "ships_weapons":
             $view = "ships_weapons";
             $shiplist = new TopList_Ship();
             $shiplist->addInvolvedAlliance($this->alliance);
             $shiplisttable = new TopTable_Ship($shiplist);
             $smarty->assign('ships', $shiplisttable->generate());
             $weaponlist = new TopList_Weapon();
             $weaponlist->addInvolvedAlliance($this->alliance);
             $weaponlisttable = new TopTable_Weapon($weaponlist);
             $smarty->assign('title', Language::get('ships_weapons'));
             $smarty->assign('weapons', $weaponlisttable->generate());
             return $smarty->fetch(get_tpl('detail_kl_ships_weapons'));
             break;
         case 'violent_systems':
             $smarty->assign('title', Language::get('topmostviolentsys'));
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('all_id', $this->all_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'violent_systems', true), array('y', $this->pyear, true), array('m', $this->pmonth, true)));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'violent_systems', true), array('y', $this->nyear, true), array('m', $this->nmonth, true)));
             $startdate = gmdate('Y-m-d H:i', makeStartDate(0, $this->year, $this->month));
             $enddate = gmdate('Y-m-d H:i', makeEndDate(0, $this->year, $this->month));
             $sql = "select sys.sys_name, sys.sys_sec, sys.sys_id, count(kll.kll_id) as kills\n\t\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_all ina\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand ina.ina_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand ina.ina_all_id = " . $this->all_id;
             $sql .= "   and kll.kll_timestamp > '{$startdate}'\n\t\t\t\t\t\t\tand kll.kll_timestamp < '{$enddate}'\n\t\t\t\t\t\t\tand ina.ina_timestamp > '{$startdate}'\n\t\t\t\t\t\t\tand ina.ina_timestamp < '{$enddate}'\n\t\t\t\t\t\t\tgroup by sys.sys_id\n\t\t\t\t\t\t\torder by kills desc, sys.sys_name asc\n\t\t\t\t\t\t\tlimit 25";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             $odd = false;
             $counter = 1;
             $syslist = array();
             while ($row = $qry->getRow()) {
                 if (!$odd) {
                     $odd = true;
                     $rowclass = 'kb-table-row-odd';
                 } else {
                     $odd = false;
                     $rowclass = 'kb-table-row-even';
                 }
                 $syslist[] = array("counter" => $counter, "url" => "?a=system_detail&amp;sys_id=" . $row['sys_id'], "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => (int) $row['kills']);
                 $counter++;
             }
             $smarty->assignByRef('syslist', $syslist);
             $smarty->assign('monthly_stats', $smarty->fetch(get_tpl(violent_systems)));
             $sql = "select sys.sys_name, sys.sys_id, sys.sys_sec, count(kll.kll_id) as kills\n\t\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_all ina\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand ina.ina_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand ina.ina_all_id = " . $this->all_id;
             $sql .= " group by sys.sys_id\n\t\t\t\t\t\t\torder by kills desc, sys.sys_name asc\n\t\t\t\t\t\t\tlimit 25";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             $odd = false;
             $counter = 1;
             $syslist = array();
             while ($row = $qry->getRow()) {
                 if (!$odd) {
                     $odd = true;
                     $rowclass = 'kb-table-row-odd';
                 } else {
                     $odd = false;
                     $rowclass = 'kb-table-row-even';
                 }
                 $syslist[] = array("counter" => $counter, "url" => "?a=system_detail&amp;sys_id=" . $row['sys_id'], "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => (int) $row['kills']);
                 $counter++;
             }
             $smarty->assignByRef('syslist', $syslist);
             $smarty->assign('total_stats', $smarty->fetch(get_tpl(violent_systems)));
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case 'corp_list':
             return $this->corpList();
             break;
         case 'history':
             $allsum = new allianceSummary($this->alliance);
             $smarty->assign('title', Language::get('history'));
             $smarty->assign('summary', $allsum->getMonthlySummary());
             return $smarty->fetch(get_tpl('detail_history'));
             break;
     }
     return '';
 }
Example #9
0
 /**
  *  Build the killlists that are needed for the options selected.
  */
 function killList()
 {
     global $smarty;
     if (isset($this->viewList[$this->view])) {
         return call_user_func_array($this->viewList[$this->view], array(&$this));
     }
     $args = array();
     if ($this->crp_external_id) {
         $args[] = array('crp_ext_id', $this->crp_external_id, true);
     } else {
         $args[] = array('crp_id', $this->crp_id, true);
     }
     $pyear = array('y', $this->pyear, true);
     $nyear = array('y', $this->nyear, true);
     $pmonth = array('m', $this->pmonth, true);
     $nmonth = array('m', $this->nmonth, true);
     switch ($this->view) {
         case "":
             $list = new KillList();
             $list->setOrdered(true);
             $list->setLimit(10);
             $list->addInvolvedCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $ktab = new KillListTable($list);
             $ktab->setLimit(10);
             $smarty->assign('kills', $ktab->generate());
             $list = new KillList();
             $list->setOrdered(true);
             $list->setLimit(10);
             $list->addVictimCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             if (config::get('comments_count')) {
                 $list->setCountComments(true);
             }
             if (config::get('killlist_involved')) {
                 $list->setCountInvolved(true);
             }
             $ltab = new KillListTable($list);
             $ltab->setLimit(10);
             $smarty->assign('losses', $ltab->generate());
             return $smarty->fetch(get_tpl('detail_kl_default'));
             break;
         case "kills":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addInvolvedCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('kills', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_kills'));
             break;
         case "losses":
             $list = new KillList();
             $list->setOrdered(true);
             $list->addVictimCorp($this->crp_id);
             if ($this->scl_id) {
                 $list->addVictimShipClass($this->scl_id);
             } else {
                 $list->setPodsNoobShips(config::get('podnoobs'));
             }
             $list->setPageSplit(config::get('killcount'));
             $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount'));
             $table = new KillListTable($list);
             $smarty->assign('splitter', $pagesplitter->generate());
             $smarty->assign('losses', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_losses'));
             break;
         case "pilot_kills":
             $smarty->assign('title', 'Top Killers');
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_kills', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_kills', true), $nyear, $nmonth));
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Kills();
             $list->setLimit(30);
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_scores":
             $smarty->assign('title', 'Top Scorers');
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_scores', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_scores', true), $nyear, $nmonth));
             $list = new TopList_Score();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Points");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Score();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Points");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_solo":
             $smarty->assign('title', 'Top Solokillers');
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_solo', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_solo', true), $nyear, $nmonth));
             $list = new TopList_SoloKiller();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Solokills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_SoloKiller();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Solokills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_damage":
             $smarty->assign('title', 'Top Damagedealers');
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_damage', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_damage', true), $nyear, $nmonth));
             $list = new TopList_DamageDealer();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_DamageDealer();
             $list->addInvolvedCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_griefer":
             $smarty->assign('title', 'Top Griefers');
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_griefer', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_griefer', true), $nyear, $nmonth));
             $list = new TopList_Kills();
             $list->addVictimShipClass(20);
             // freighter
             $list->addVictimShipClass(22);
             // exhumer
             $list->addVictimShipClass(7);
             // industrial
             $list->addVictimShipClass(12);
             // barge
             $list->addVictimShipClass(14);
             // transport
             $list->addInvolvedCorp($this->crp_id);
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Kills();
             $list->addVictimShipClass(20);
             // freighter
             $list->addVictimShipClass(22);
             // exhumer
             $list->addVictimShipClass(7);
             // industrial
             $list->addVictimShipClass(12);
             // barge
             $list->addVictimShipClass(14);
             // transport
             $list->addInvolvedCorp($this->crp_id);
             $table = new TopTable_Pilot($list, "Kills");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "pilot_losses":
             $smarty->assign('title', 'Top Losers');
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'pilot_losses', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'pilot_losses', true), $nyear, $nmonth));
             $list = new TopList_Losses();
             $list->addVictimCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $list->setMonth($this->month);
             $list->setYear($this->year);
             $table = new TopTable_Pilot($list, "Losses");
             $smarty->assign('monthly_stats', $table->generate());
             $list = new TopList_Losses();
             $list->addVictimCorp($this->crp_id);
             $list->setPodsNoobShips(config::get('podnoobs'));
             $table = new TopTable_Pilot($list, "Losses");
             $smarty->assign('total_stats', $table->generate());
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
         case "ships_weapons":
             $shiplist = new TopList_Ship();
             $shiplist->addInvolvedCorp($this->crp_id);
             $shiplisttable = new TopTable_Ship($shiplist);
             $smarty->assign('ships', $shiplisttable->generate());
             $weaponlist = new TopList_Weapon();
             $weaponlist->addInvolvedCorp($this->crp_id);
             $weaponlisttable = new TopTable_Weapon($weaponlist);
             $smarty->assign('weapons', $weaponlisttable->generate());
             return $smarty->fetch(get_tpl('detail_kl_ships_weapons'));
             break;
         case 'history':
             $crpsum = new corpSummary($this->crp_id);
             $smarty->assign('title', Language::get('history'));
             $smarty->assign('summary', $crpsum->getMonthlySummary());
             return $smarty->fetch(get_tpl('detail_history'));
             break;
         case 'violent_systems':
             $smarty->assign('title', 'Most violent systems');
             $smarty->assign('month', $this->monthname);
             $smarty->assign('year', $this->year);
             $smarty->assign('pmonth', $this->pmonth);
             $smarty->assign('pyear', $this->pyear);
             $smarty->assign('nmonth', $this->nmonth);
             $smarty->assign('nyear', $this->nyear);
             $smarty->assign('crp_id', $this->crp_id);
             $smarty->assign('url_previous', edkURI::build($args, array('view', 'violent_systems', true), $pyear, $pmonth));
             $smarty->assign('url_next', edkURI::build($args, array('view', 'violent_systems', true), $nyear, $nmonth));
             $startdate = gmdate('Y-m-d H:i', makeStartDate(0, $this->year, $this->month));
             $enddate = gmdate('Y-m-d H:i', makeEndDate(0, $this->year, $this->month));
             $sql = "select sys.sys_name, sys.sys_sec, sys.sys_id, count(kll.kll_id) as kills\n\t\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_crp inc\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand inc.inc_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand inc.inc_crp_id = " . $this->crp_id;
             $sql .= "   and kll.kll_timestamp > '{$startdate}'\n\t\t\t\t\t\t\tand kll.kll_timestamp < '{$enddate}'\n\t\t\t\t\t\t\tand inc.inc_timestamp > '{$startdate}'\n\t\t\t\t\t\t\tand inc.inc_timestamp < '{$enddate}'\n\t\t\t\t\t\t\tgroup by sys.sys_id\n\t\t\t\t\t\t\torder by kills desc, sys.sys_name asc\n\t\t\t\t\t\t\tlimit 25";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             $odd = false;
             $counter = 1;
             $syslist = array();
             while ($row = $qry->getRow()) {
                 if (!$odd) {
                     $odd = true;
                     $rowclass = 'kb-table-row-odd';
                 } else {
                     $odd = false;
                     $rowclass = 'kb-table-row-even';
                 }
                 $syslist[] = array("counter" => $counter, "url" => edkURI::build(array(array('a', 'system_detail', true), array('sys_id', $row['sys_id'], true))), "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => $row['kills']);
                 $counter++;
             }
             $smarty->assignByRef('syslist', $syslist);
             $smarty->assign('monthly_stats', $smarty->fetch(get_tpl('violent_systems')));
             $sql = "select sys.sys_name, sys.sys_id, sys.sys_sec, count(kll.kll_id) as kills\n\t\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_crp inc\n\t\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\t\tand inc.inc_kll_id = kll.kll_id\n\t\t\t\t\t\t\tand inc.inc_crp_id = " . $this->crp_id;
             $sql .= " group by sys.sys_id\n\t\t\t\t\t\t\torder by kills desc, sys.sys_name asc\n\t\t\t\t\t\t\tlimit 25";
             $qry = DBFactory::getDBQuery();
             $qry->execute($sql);
             $odd = false;
             $counter = 1;
             $syslist = array();
             while ($row = $qry->getRow()) {
                 if (!$odd) {
                     $odd = true;
                     $rowclass = 'kb-table-row-odd';
                 } else {
                     $odd = false;
                     $rowclass = 'kb-table-row-even';
                 }
                 $syslist[] = array("counter" => $counter, "url" => edkURI::build(array(array('a', 'system_detail', true), array('sys_id', $row['sys_id'], true))), "name" => $row['sys_name'], "sec" => roundsec($row['sys_sec']), "kills" => $row['kills']);
                 $counter++;
             }
             $smarty->assignByRef('syslist', $syslist);
             $smarty->assign('total_stats', $smarty->fetch(get_tpl('violent_systems')));
             return $smarty->fetch(get_tpl('detail_kl_monthly'));
             break;
     }
     return $html;
 }