function generate() { global $smarty; $this->toplist->generate(); $i = 1; $rows = array(); while ($row = $this->toplist->getRow()) { $pilot = Pilot::getByID($row['plt_id']); $uri = edkURI::build(array('a', 'kill_detail', true), array('kll_id', $row['kll_id'], true)); if ($row['plt_externalid']) { $img = imageURL::getURL('Pilot', $row['plt_externalid'], 32); } else { $img = $pilot->getPortraitURL(32); } $ship = Ship::getByID($row['ship']); $shipUri = edkURI::build(array('a', 'invtype', true), array('id', $row['ship'], true)); if ((int) number_format($row["isk"], 0, "", "") > 1000000000) { $isk = number_format($row["isk"] / 1000000000, 2, ".", "") . " b"; } elseif ((int) number_format($row["isk"], 0, "", "") > 1000000) { $isk = number_format($row["isk"] / 1000000, 2, ".", "") . " M"; } else { $isk = number_format($row["isk"], 0, ".", ","); } $rows[] = array('rank' => $i, 'name' => $pilot->getName(), 'uri' => $uri, 'portrait' => $img, 'shipImage' => $ship->getImage(32), 'shipName' => $ship->getName(), 'shipId' => $row['ship'], 'shipURI' => $shipUri, 'isk' => $isk); $i++; } $smarty->assign('tl_name', 'Pilot'); $smarty->assign('tl_type', $this->entity_); $smarty->assignByRef('tl_rows', $rows); return $smarty->fetch(getcwd() . '/mods/most_expensive_toplist/templates/toplisttable_expensive.tpl'); }
function generate() { global $smarty; $this->toplist->generate(); $i = 1; while ($row = $this->toplist->getRow()) { /* @var $corp Corporation */ $corp = Cacheable::factory('Corporation', $row['crp_id']); if ($corp->getExternalID()) { $uri = KB_HOST . "/?a=corp_detail&crp_ext_id=" . $corp->getExternalID(); } else { $uri = KB_HOST . "/?a=corp_detail&crp_id=" . $row['crp_id']; } $rows[] = array('rank' => $i, 'name' => $corp->getName(), 'uri' => $uri, 'portrait' => imageURL::getURL('Corporation', $corp->getExternalID(false), 32), 'count' => $row['cnt']); $i++; } $smarty->assign('tl_name', 'Corporation'); $smarty->assign('tl_type', $this->entity_); $smarty->assignByRef('tl_rows', $rows); return $smarty->fetch(get_tpl('toplisttable')); }
function generate() { global $smarty; $this->toplist->generate(); $i = 1; $rows = array(); while ($row = $this->toplist->getRow()) { $pilot = Pilot::getByID($row['plt_id']); if ($row['plt_externalid']) { $uri = edkURI::build(array('a', 'pilot_detail', true), array('plt_ext_id', $row['plt_externalid'], true)); $img = imageURL::getURL('Pilot', $row['plt_externalid'], 32); } else { $uri = edkURI::build(array('a', 'pilot_detail', true), array('plt_id', $row['plt_id'], true)); $img = $pilot->getPortraitURL(32); } $rows[] = array('rank' => $i, 'name' => $pilot->getName(), 'uri' => $uri, 'portrait' => $img, 'count' => $row['cnt']); $i++; } $smarty->assign('tl_name', 'Pilot'); $smarty->assign('tl_type', $this->entity_); $smarty->assignByRef('tl_rows', $rows); return $smarty->fetch(get_tpl('toplisttable')); }
/** * Return the URL for the alliance's portrait. If the alliance has a * portrait in the board's img/alliances directory, that portrait will be * used * * @param integer $size The desired portrait size. * @return string URL for a portrait. */ function getPortraitURL($size = 128) { if (isset($this->imgurl[$size])) { return $this->imgurl[$size]; } if (file_exists("img/alliances/" . $this->getUnique() . ".png")) { if ($size == 128) { $this->imgurl[$size] = IMG_HOST . "/img/alliances/" . $this->getUnique() . ".png"; } else { if (CacheHandler::exists($this->getUnique() . "_{$size}.png", 'img')) { $this->imgurl[$size] = KB_HOST . "/" . CacheHandler::getExternal($this->getUnique() . "_{$size}.png", 'img'); } else { $this->imgurl[$size] = KB_HOST . '/?a=thumb&type=alliance&id=' . $this->getUnique() . '&size=' . $size; } } $this->putCache(); } else { if ($this->getExternalID()) { $this->imgurl[$size] = imageURL::getURL('Alliance', $this->getExternalID(), $size); $this->putCache(); } else { $this->imgurl[$size] = imageURL::getURL('Alliance', 1, $size); } } return $this->imgurl[$size]; }
/** * Return an image for the victim's ship. * @param integer $size * @return string */ function getVictimShipImage($size) { return imageURL::getURL('Ship', $this->victimshipid, $size); }
/** * * @global array $destroyed * @global <type> $pilots * @global array $pods * @param Kill $kill * @param <type> $side * @return <type> */ function handle_destroyed($kill, $side, &$destroyed, &$pilots, $sideAssignmentMap = array(), $completeInformation = FALSE) { // ------------------------------------------------------------------------- // FIX BATTLE REPORT a little by Evoke. Salvoxia // BEGIN // ------------------------------------------------------------------------- // we don't want losses of our own corp/ally as losses on the enemy's side if ($side == 'e') { if (config::get('cfg_corpid')) { $corpId = config::get('cfg_corpid'); $corpId = $corpId[0]; if ($kill->getVictimCorpID() == $corpId) { return; } } elseif (config::get('cfg_allianceid')) { $allianceId = config::get('cfg_allianceid'); $allianceId = $allianceId[0]; if ($kill->getVictimAllianceID() == $allianceId) { return; } } } // ------------------------------------------------------------------------- // FIX BATTLE REPORT a little by Evoke. Salvoxia // END // ------------------------------------------------------------------------- if ($completeInformation && !is_null($destroyed) && is_array($destroyed)) { $destroyed[$kill->getID()] = $kill->getVictimID(); } if (config::get('fleet_battles_mod_sideassign')) { // determine whether the pilot is member of an alliance if ($kill->getVictimAllianceName() == "None") { $entityType = "corp"; $entityId = $kill->getVictimCorpID(); } else { $entityType = "alliance"; $entityId = $kill->getVictimAllianceID(); } if (isset($sideAssignmentMap[$entityType][$entityId])) { $pilotSide = $sideAssignmentMap[$entityType][$entityId]; } else { $pilotSide = $side; } } else { $pilotSide = $side; } $ship = Ship::lookup($kill->getVictimShipName()); $shipc = $ship->getClass(); $ts = strtotime($kill->getTimeStamp()); // mark the pilot as podded if ($shipc->getID() == 18 || $shipc->getID() == 2) { // increase the timestamp of a podkill by 1 so its after the shipkill $ts++; } // search for ships with the same id if (isset($pilots[$pilotSide][$kill->getVictimId()]) && is_array($pilots[$pilotSide][$kill->getVictimId()])) { foreach ($pilots[$pilotSide][$kill->getVictimId()] as $id => $_ship) { if ($ship->getID() == $_ship['sid']) { $pilots[$pilotSide][$kill->getVictimId()][$id]['destroyed'] = true; if (!isset($pilots[$pilotSide][$kill->getVictimId()][$id]['kll_id'])) { $pilots[$pilotSide][$kill->getVictimId()][$id]['kll_id'] = $kill->getID(); $pilots[$pilotSide][$kill->getVictimId()][$id]['kll_url'] = edkURI::page('kill_detail', $kill->getID(), "kll_id"); } //$pilots[$side][$kill->getVictimId()][0]["times"] +=1; return; } } } if ($completeInformation) { $pilots[$pilotSide][$kill->getVictimId()][] = array('name' => $kill->getVictimName(), 'plt_url' => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), 'kll_id' => $kill->getID(), 'kll_url' => edkURI::page('kill_detail', $kill->getID(), "kll_id"), 'spic' => imageURL::getURL('Ship', $ship->getID(), 32), 'scl' => $shipc->getPoints(), 'destroyed' => true, 'corp' => $kill->getVictimCorpName(), 'alliance' => $kill->getVictimAllianceName(), 'aid' => $kill->getVictimAllianceID(), 'alliance_url' => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), 'ship' => $kill->getVictimShipname(), 'shipClass' => $shipc->getName(), 'shipClassObject' => $shipc, 'sid' => $ship->getID(), 'cid' => $kill->getVictimCorpID(), 'crp_url' => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), 'ts' => $ts, 'times' => 0, 'color' => getColorClassByClass($shipc)); } else { $pilots[$pilotSide][$kill->getVictimId()] = 1; } }
/** * Return the URL for the pilot's portrait. * * @param integer $size The desired portrait size. * @return string URL for a portrait. */ public function getPortraitURL($size = 64) { if (!$this->externalid) { $this->execQuery(); } if (!$this->externalid) { return KB_HOST . "/thumb.php?type=pilot&id=" . $this->id . "&size={$size}&int=1"; } else { return imageURL::getURL('Pilot', $this->externalid, $size); } }
/** * Return the URL for an icon for this item. * @param integer $size * @param boolean $full Whether to return a full image tag. * @return string */ public function getIcon($size, $full = true) { $this->execQuery(); global $smarty; $img = imageURL::getURL('InventoryType', $this->id, $size); if (!$full) { return $img; } if ($size == 24) { $show_style = '_' . config::get('fp_ammostyle'); $t_s = config::get('fp_ttag'); $f_s = config::get('fp_ftag'); $d_s = 0; $o_s = 0; } elseif ($size == 48 || ($size = 32)) { $show_style = '_' . config::get('fp_highstyle'); $t_s = config::get('fp_ttag'); $f_s = config::get('fp_ftag'); $d_s = config::get('fp_dtag'); $o_s = config::get('fp_otag'); } else { $show_style = ""; $t_s = 1; $f_s = config::get('kd_ftag'); $d_s = config::get('kd_dtag'); $o_s = config::get('kd_otag'); } if ($show_style == "_none" || $show_style == "_") { $show_style = ""; } if ($show_style == "_tag" || $show_style == "") { return "<img src='{$img}' title=\"" . $this->getName() . "\" alt=\"" . $this->getName() . "\" style='width:{$size}px; height:{$size}px; border:0px' />"; } $it_name = $this->getName(); if ($this->row_['itm_techlevel'] == 5 && $show_style) { // is a T2? $icon .= config::get('cfg_img') . '/items/' . $size . '_' . $size . '/t2' . $show_style . '.png'; } elseif ($this->row_['itm_techlevel'] > 5 && $this->row_['itm_techlevel'] < 10 && $show_style) { // is a faction item? $icon .= config::get('cfg_img') . '/items/' . $size . '_' . $size . '/f' . $show_style . '.png'; } elseif ($this->row_['itm_techlevel'] > 10 && strstr($it_name, "Modified") && $show_style) { // or it's an officer? $icon .= config::get('cfg_img') . '/items/' . $size . '_' . $size . '/o' . $show_style . '.png'; } elseif ($this->row_['itm_techlevel'] > 10 && strstr($it_name, "-Type") && $show_style) { // or it's just a deadspace item. $icon .= config::get('cfg_img') . '/items/' . $size . '_' . $size . '/d' . $show_style . '.png'; } elseif ((strstr($it_name, "Blood ") || strstr($it_name, "Sansha") || strstr($it_name, "Arch") || strstr($it_name, "Domination") || strstr($it_name, "Republic") || strstr($it_name, "Navy") || strstr($it_name, "Guardian") || strstr($it_name, "Guristas") || strstr($it_name, "Shadow")) && $show_style) { // finally if it's a faction it should have its prefix $icon = config::get('cfg_img') . '/items/' . $size . '_' . $size . '/f' . $show_style . '.png'; } else { // but maybe it was only a T1 item :P return "<img src='{$img}' title=\"" . $this->getName() . "\" alt=\"" . $this->getName() . "\" style='width:{$size}px; height:{$size}px; border:0px' />"; } if (($size == 32 || $size == 48 || true) && $show_style == '_backglowing') { $temp = $img; $img = $icon; $icon = $temp; } $smarty->assign('img', $img); $smarty->assign('icon', $icon); $smarty->assign('name', $it_name); return $smarty->fetch(get_tpl('icon' . $size)); }
/** * Return the URL for a portrait of this Ship. * * @param integer $size the size of the image to return. * @return string containing valid URL for a portrait of this Ship. */ function getImage($size) { if (is_null($this->id)) { $this->execQuery(); } return imageURL::getURL('Ship', $this->id, $size); }
/** * Return a URL for the icon of this corporation. * * If a cached image exists then return the direct url. Otherwise return * a link to the thumbnail page. * * @param integer $size The size in pixels of the image needed. * @return string The URL for this corporation's logo. */ function getPortraitURL($size = 64) { if (!$this->externalid) { $this->getExternalID(); } // NPC alliances can be recorded as corps on killmails. if ($this->externalid > 500000 && $this->externalid < 500021) { return imageURL::getURL('Alliance', $this->externalid, $size); } return imageURL::getURL('Corporation', $this->externalid, $size); }
function thumbInt($int_id, $size, $type) { $this->size = $size; switch ($this->type) { case 'pilot': case '': $pilot = new Pilot($int_id); $this->id = $pilot->getExternalID(); if ($this->id) { $url = imageURL::getURL('Pilot', $this->id, $size); header(html_entity_decode("Location: {$url}")); die; } $this->type = 'pilot'; $this->encoding = 'jpeg'; $this->validate(); break; case 'corp': case 'npc': $this->type = 'corp'; $corp = new Corporation($int_id); if (!$corp->getExternalID()) { $this->id = 0; } $this->id = $corp->getExternalID(); if ($this->id) { $url = imageURL::getURL('Corporation', $this->id, $size); header("Location: {$url}"); die; } $this->encoding = 'png'; if ($this->type == 'npc') { $this->type = 'npc'; //$this->encoding = 'png'; } $this->validate(); break; default: $this->id = $str_id; $this->type = $type; $this->encoding = 'jpeg'; $this->validate(); } }
/** * @param KillWrapper $kill * @param string $side a,e for ally, enemy */ private function handle_involved($kill, $side) { // we need to get all involved pilots, killlists dont supply them $qry = DBFactory::getDBQuery(); $sql = "select ind_plt_id, ind_crp_id, ind_all_id, ind_sec_status, ind_shp_id, ind_wep_id,\n\t\t\t\twtype.typeName, plt_name, crp_name, all_name, stype.typeName AS shp_name, scl_points, scl_id\n\t\t\t\tfrom kb3_inv_detail\n\t\t\t\tleft join kb3_invtypes wtype on ind_wep_id=wtype.typeID\n\t\t\t\tleft join kb3_invtypes stype on ind_shp_id=stype.typeID\n\t\t\t\tleft join kb3_pilots on ind_plt_id=plt_id\n\t\t\t\tleft join kb3_corps on ind_crp_id=crp_id\n\t\t\t\tleft join kb3_alliances on ind_all_id=all_id\n\t\t\t\tleft join kb3_ships on ind_shp_id=shp_id\n\t\t\t\tleft join kb3_ship_classes on shp_class=scl_id\n\t\t\t\twhere ind_kll_id = " . $kill->getID() . "\n\t\t\t\torder by ind_order"; $qry->execute($sql); while ($row = $qry->getRow()) { // check for npc names (copied from pilot class) $pos = strpos($row['plt_name'], "#"); if ($pos !== false) { $name = explode("#", $row['plt_name']); $item = Item::getByID($name[2]); $row['plt_name'] = $item->getName(); } // dont set pods as ships for pilots we already have if (isset($this->pilots[$side][$row['ind_plt_id']])) { if ($row['scl_id'] == 18 || $row['scl_id'] == 2) { continue; } } // search for ships with the same id if (isset($this->pilots[$side][$row['ind_plt_id']])) { foreach ($this->pilots[$side][$row['ind_plt_id']] as $id => $_ship) { if ($row['ind_shp_id'] == $_ship['sid']) { // we already got that pilot in this ship, continue continue 2; } } } $this->pilots[$side][$row['ind_plt_id']][] = array('name' => $row['plt_name'], 'plt_url' => edkURI::page('pilot_detail', $row['ind_plt_id']), 'corp' => $row['crp_name'], 'cid' => $row['ind_crp_id'], 'crp_url' => edkURI::page('corp_detail', $row['ind_crp_id']), 'alliance' => $row['all_name'], 'aid' => $row['ind_all_id'], 'all_url' => edkURI::page('alliance_detail', $row['ind_all_id']), 'ts' => strtotime($kill->getTimeStamp()), 'weapon' => $row['itm_name'], 'sid' => $row['ind_shp_id'], 'spic' => imageURL::getURL('Ship', $row['ind_shp_id'], 32), 'ship' => $row['ind_shp_id'] ? $row['shp_name'] : Language::get("Unknown"), 'scl' => $row['scl_points'], 'shpclass' => $row['scl_id']); } }
/** * Returns HTML for the map where this kill took place * * @return string HTML for the map where this kill took place */ function map() { //Admin is able to see classsified systems if (!$this->kill->isClassified() || $this->page->isAdmin()) { $mapbox = new Box("Map"); if (IS_IGB) { $mapbox->addOption("img", imageURL::getURL('map', $this->kill->getSystem()->getID(), 145), "javascript:CCPEVE.showInfo(3, " . $this->kill->getSystem()->getRegionID() . ")"); $mapbox->addOption("img", imageURL::getURL('region', $this->kill->getSystem()->getID(), 145), "javascript:CCPEVE.showInfo(4, " . $this->kill->getSystem()->getConstellationID() . ")"); $mapbox->addOption("img", imageURL::getURL('cons', $this->kill->getSystem()->getID(), 145), "javascript:CCPEVE.showInfo(5, " . $this->kill->getSystem()->getExternalID() . ")"); } else { $mapbox->addOption("img", imageURL::getURL('map', $this->kill->getSystem()->getID(), 145)); $mapbox->addOption("img", imageURL::getURL('region', $this->kill->getSystem()->getID(), 145)); $mapbox->addOption("img", imageURL::getURL('cons', $this->kill->getSystem()->getID(), 145)); } return $mapbox->generate(); } return ''; }
/** * adds meta tags for Twitter Summary Card and OpenGraph tags * to the HTML header */ function metaTags() { $referenceSystem = SolarSystem::getByID(reset($this->systems)); // meta tag: title $metaTagTitle = $referenceSystem->getName() . " | " . $referenceSystem->getRegionName() . " | Battle Report"; $this->page->addHeader('<meta name="og:title" content="' . $metaTagTitle . '">'); $this->page->addHeader('<meta name="twitter:title" content="' . $metaTagTitle . '">'); // build description $date = gmdate("Y-m-d", strtotime($this->firstts)); $startTime = gmdate("H:i", strtotime($this->firstts)); $endTime = gmdate("H:i", strtotime($this->lastts)); $totalIskDestroyedM = round(($this->summaryTable->getTotalKillISK() + $this->summaryTable->getTotalLossISK()) / 1000000, 2); $metaTagDescription = "Battle Report for " . $referenceSystem->getName() . " (" . $referenceSystem->getRegionName() . ") from " . $date . " (" . $startTime . " - " . $endTime . "): "; $metaTagDescription .= "Involved Pilots: " . (count($this->pilots['a']) + count($this->pilots['e'])) . ", Total ISK destroyed: " . $totalIskDestroyedM . "M ISK"; $this->page->addHeader('<meta name="description" content="' . $metaTagDescription . '">'); $this->page->addHeader('<meta name="og:description" content="' . $metaTagDescription . '">'); // meta tag: image $this->page->addHeader('<meta name="og:image" content="' . imageURL::getURL('Type', 3802, 64) . '">'); $this->page->addHeader('<meta name="twitter:image" content="' . imageURL::getURL('Type', 3802, 64) . '">'); $this->page->addHeader('<meta name="og:site_name" content="EDK - ' . config::get('cfg_kbtitle') . '">'); // meta tag: URL $this->page->addHeader('<meta name="og:url" content="' . edkURI::build(array('kll_id', $this->kll_id, true)) . '">'); // meta tag: Twitter summary $this->page->addHeader('<meta name="twitter:card" content="summary">'); }