Ejemplo n.º 1
0
 /**
  *  Show the overall statistics for this corporation.
  */
 function stats()
 {
     global $smarty;
     // The summary table is also used by the stats. Whichever is called
     // first generates the table.
     $this->page->setTitle('Corporation details - ' . $this->corp->getName() . " [" . $this->corp->getShortName() . "]");
     $smarty->registerObject('Corp', $this->corp);
     $smarty->assign('portrait_url', $this->corp->getPortraitURL(128));
     if ($this->alliance->getName() == "None") {
         $smarty->assign('alliance_url', false);
     } else {
         if ($this->alliance->getExternalID()) {
             $smarty->assign('alliance_url', edkURI::build(array('a', 'alliance_detail', true), array('all_ext_id', $this->alliance->getExternalID(), true)));
         } else {
             $smarty->assign('alliance_url', edkURI::build(array('a', 'alliance_detail', true), array('all_id', $this->alliance->getID(), true)));
         }
     }
     $smarty->assign('alliance_name', $this->alliance->getName());
     $smarty->assign('kill_count', $this->kill_summary->getTotalKills());
     $smarty->assign('loss_count', $this->kill_summary->getTotalLosses());
     $smarty->assign('damage_done', number_format($this->kill_summary->getTotalKillISK() / 1000000000, 2));
     $smarty->assign('damage_received', number_format($this->kill_summary->getTotalLossISK() / 1000000000, 2));
     if ($this->kill_summary->getTotalKillISK()) {
         $smarty->assign('efficiency', number_format(100 * $this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()), 2));
     } else {
         $smarty->assign('efficiency', 0);
     }
     $smarty->assign('ceo_url', edkURI::build(array('a', 'pilot_detail', true), array('plt_ext_id', $this->corp->getCeoID(), true)));
     $pilot = new Pilot(0, $this->corp->getCeoID());
     $smarty->assign('ceo_name', $pilot->getName());
     return $smarty->fetch(get_tpl('corp_detail_stats'));
 }
Ejemplo n.º 2
0
 /**
  * updates battles with the same stats as the current related kills
  */
 protected function updateBattles()
 {
     if (!isset($this->battlesToUpdate) || empty($this->battlesToUpdate)) {
         return;
     }
     $killIsk = $this->summaryTable->getTotalKillISK();
     $lossIsk = $this->summaryTable->getTotalLossISK();
     $kills = $this->summaryTable->getTotalKills();
     $losses = $this->summaryTable->getTotalLosses();
     $involved = count($this->pilots["a"]) + count($this->pilots["e"]);
     foreach ($this->battlesToUpdate as $battleId) {
         Battle::updateCacheForBattle($battleId, $killIsk, $lossIsk, $kills, $losses, $involved, $this->firstts, $this->lastts, $this->numberOfInvolvedOwners, $this->involvedOwners);
     }
 }
Ejemplo n.º 3
0
 /**
  *  Show the overall statistics for this alliance.
  *
  * @global Smarty $smarty
  * @return string
  */
 function stats()
 {
     global $smarty;
     if ($this->alliance->isFaction()) {
         $this->page->setTitle(Language::get('page_faction_det') . ' - ' . $this->alliance->getName() . " [" . $this->alliance->getshortName() . "]");
     } else {
         $this->page->setTitle(Language::get('page_all_det') . ' - ' . $this->alliance->getName() . " [" . $this->alliance->getshortName() . "]");
     }
     $sql = "select crp_id from kb3_corps WHERE crp_all_id=" . $this->alliance->getID();
     $qry = DBFactory::getDBQuery();
     $qry->execute($sql);
     while ($row = $qry->getRow()) {
         $this->allianceCorps[] = Corporation::getByID((int) $row['crp_id']);
     }
     if (!isset($this->kill_summary)) {
         $this->kill_summary = new KillSummaryTable();
         $this->kill_summary->addInvolvedAlliance($this->alliance);
         $this->kill_summary->generate();
     }
     $execcrp = Corporation::lookupByExternalID($this->alliance->GetExecutorID());
     if ($execcrp !== false) {
         $smarty->assign('ExecutorName', $execcrp->getName());
     } else {
         $smarty->assign('ExecutorName', '');
     }
     $smarty->registerObject('Alliance', $this->alliance);
     $smarty->assign('memberCorpCount', count($this->allianceCorps));
     if ($this->kill_summary->getTotalKillISK()) {
         $efficiency = round($this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()) * 100, 2);
     } else {
         $efficiency = 0;
     }
     // The summary table is also used by the stats. Whichever is called
     // first generates the table.
     $smarty->assign('all_img', $this->alliance->getPortraitURL(128));
     $smarty->assign('totalkills', $this->kill_summary->getTotalKills());
     $smarty->assign('totallosses', $this->kill_summary->getTotalLosses());
     $smarty->assign('totalkisk', round($this->kill_summary->getTotalKillISK() / 1000000000, 2));
     $smarty->assign('totallisk', round($this->kill_summary->getTotalLossISK() / 1000000000, 2));
     if ($this->kill_summary->getTotalKillISK()) {
         $smarty->assign('efficiency', round($this->kill_summary->getTotalKillISK() / ($this->kill_summary->getTotalKillISK() + $this->kill_summary->getTotalLossISK()) * 100, 2));
     } else {
         $smarty->assign('efficiency', '0');
     }
     return $smarty->fetch(get_tpl('alliance_detail_stats'));
 }
Ejemplo n.º 4
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;
 }