Ejemplo n.º 1
0
 /**
  * Build a new summary table for a pilot.
  *
  * @param integer $plt_id
  * @return boolean Returns false on error.
  */
 private static function buildSummary($plt_id)
 {
     $plt_id = (int) $plt_id;
     if (!$plt_id) {
         return false;
     }
     $qry = DBFactory::getDBQuery();
     $qry->autocommit(false);
     $klist = new KillList();
     $klist->addInvolvedPilot($plt_id);
     $klist->getAllKills();
     $kpoints = $klist->getPoints();
     unset($klist);
     $llist = new KillList();
     $llist->addVictimPilot($plt_id);
     $llist->getAllKills();
     $lpoints = $llist->getPoints();
     unset($llist);
     $qry->execute("UPDATE kb3_pilots SET plt_kpoints = {$kpoints},\n\t\t\t plt_lpoints = {$lpoints} WHERE plt_id = {$plt_id}");
     $qry->autocommit(true);
     return;
 }
Ejemplo n.º 2
0
 /**
  * Return the html for the known members of this corp.
  * @param pCorpDetail $home 
  * @return string 
  */
 public static function view($home)
 {
     if (config::get('mod_knownmembers_own')) {
         if (array_search($home->alliance->getID(), config::get('cfg_allianceid')) !== false) {
             $can_view = 1;
         } else {
             if (array_search($home->crp_id, config::get('cfg_corpid')) !== false) {
                 $can_view = 1;
             }
         }
     }
     if ($can_view == 1) {
         $html .= "Cannot View this corps Member List";
     } else {
         $query = "SELECT * FROM `kb3_pilots`  WHERE plt_crp_id =" . $home->crp_id . " ORDER BY `plt_name` ASC";
         $qry = DBFactory::getDBQuery();
         $qry->execute($query);
         $cnt = $qry->recordCount();
         $html .= "<div class=block-header2>Known Pilots (" . $cnt . ")</div>";
         $html .= "<table class=kb-table align=center>";
         $html .= '<tr class=kb-table-header>';
         if (config::get('mod_knownmembers_img')) {
             $html .= '<td class=kb-table-header align="center"></td>';
         }
         $html .= '<td class=kb-table-header align="center">Pilot</td>';
         if (config::get('mod_knownmembers_kllpnts')) {
             $html .= '<td class=kb-table-header align="center">Kill Points</td>';
         }
         if (config::get('mod_knownmembers_dmgdn')) {
             $html .= '<td class=kb-table-header align="center">Dmg Done (isk)</td>';
         }
         if (config::get('mod_knownmembers_dmgrcv')) {
             $html .= '<td class=kb-table-header align="center">Dmg Received (isk)</td>';
         }
         if (config::get('mod_knownmembers_eff')) {
             $html .= '<td class=kb-table-header align="center">Efficiency</td>';
         }
         if ($home->page->isAdmin()) {
             $html .= '<td class=kb-table-header align="center">Admin - Move</td>';
         }
         $html .= '</tr>';
         while ($data = $qry->getRow()) {
             $pilot = new Pilot($data['plt_id']);
             $plist = new KillList();
             $plist->addInvolvedPilot($pilot);
             $plist->getAllKills();
             $points = $plist->getPoints();
             $pllist = new KillList();
             $pllist->addVictimPilot($pilot);
             $pllist->getAllKills();
             $plistisk = $plist->getISK();
             $pllistisk = $pllist->getISK();
             if ($plistisk == 0) {
                 $plistisk = 1;
                 //Remove divide by 0
             }
             if ($pllistisk == 0) {
                 $pllistisk = 1;
                 //Remove divide by 0
             }
             $efficiency = round($plistisk / ($plistisk + $pllistisk) * 100, 2);
             if (!$odd) {
                 $odd = true;
                 $class = 'kb-table-row-odd';
             } else {
                 $odd = false;
                 $class = 'kb-table-row-even';
             }
             $html .= "<tr class=" . $class . " style=\"height: 32px;\">";
             if (config::get('mod_knownmembers_img')) {
                 $html .= '<td width="64" align="center"><img src=' . $pilot->getPortraitURL(32) . '></td>';
             }
             $html .= '<td align="center"><a href=?a=pilot_detail&plt_id=' . $pilot->getID() . '>' . $pilot->getName() . '</a></td>';
             if (config::get('mod_knownmembers_kllpnts')) {
                 $html .= '<td align="center">' . $points . '</td>';
             }
             if (config::get('mod_knownmembers_dmgdn')) {
                 $html .= '<td align="center">' . round($plist->getISK(), 2) / 1000000 . 'M</td>';
             }
             if (config::get('mod_knownmembers_dmgrcv')) {
                 $html .= '<td align="center">' . round($pllist->getISK(), 2) / 1000000 . 'M</td>';
             }
             if (config::get('mod_knownmembers_eff')) {
                 $html .= '<td align="center">' . $efficiency . '%</td>';
             }
             if ($home->page->isAdmin()) {
                 $html .= "<td align=center><a href=\"javascript:openWindow('?a=admin_move_pilot&plt_id=" . $data['plt_id'] . "', null, 500, 500, '' )\">Move</a></td>";
             }
             $html .= '</tr>';
         }
         $html .= '</table>';
     }
     return $html;
 }
Ejemplo n.º 3
0
}
$html .= "<form><textarea class=killmail id=killmail name=killmail cols=\"55\" rows=\"35\" readonly=readonly>";
// Setup the lists
$klist = new KillList();
$klist->setOrdered(true);
$klist->addInvolvedPilot($pilot);
$klist->rewind();
while ($kll_id = $klist->getKill()) {
    $kill = new Kill($kll_id->getID());
    $html .= "\"";
    $html .= $kill->getRawMail();
    $html .= "\",\n\n";
}
// Losses
$llist = new KillList();
$llist->setOrdered(true);
// $list->setPodsNoobships( true ); // Not working!!
$llist->addVictimPilot($pilot);
$llist->rewind();
while ($lss_id = $llist->getKill()) {
    $html .= "\"";
    $loss = new Kill($lss_id->getID());
    $html .= $loss->getRawMail();
    $html .= "\",\n\n";
}
$html .= "</textarea><br>";
$html .= "<input type=\"button\" value=\"Select All\" onClick=\"this.form.killmail.select();this.form.killmail.focus(); document.execCommand('Copy')\"></form><br>";
$html .= "Copy content of textbox to another location (eg. a textfile)";
$page->setContent($html);
$page->addContext($menubox->generate());
$page->generate();
Ejemplo n.º 4
0
 $tmp = explode(',', $string);
 foreach ($tmp as $item) {
     if (!$item) {
         continue;
     }
     $typ = substr($item, 0, 1);
     $id = substr($item, 1);
     if ($typ == 'a') {
         $klist->addInvolvedAlliance(new Alliance($id));
         $llist->addVictimAlliance(new Alliance($id));
     } elseif ($typ == 'c') {
         $klist->addInvolvedCorp(new Corporation($id));
         $llist->addVictimCorp(new Corporation($id));
     } elseif ($typ == 'p') {
         $klist->addInvolvedPilot(new Pilot($id));
         $llist->addVictimPilot(new Pilot($id));
     }
 }
 $kills = array();
 while ($kill = $klist->getKill()) {
     $kills[$kill->getID()] = $kill->getTimestamp();
 }
 while ($kill = $llist->getKill()) {
     $kills[$kill->getID()] = $kill->getTimestamp();
 }
 asort($kills);
 $cnt = 0;
 foreach ($kills as $id => $timestamp) {
     $kill = new Kill($id);
     $cnt++;
     $file = $_SESSION['admin_kill_export']['dir'] . $cnt . $_SESSION['admin_kill_export']['ext'];
Ejemplo n.º 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;
 }