public function GetOutput($Db) { global $sort, $ord, $cols; // req for sorting $Orders = new eveApiOrders($Db); $time_start = microtime_float(); if (!$Orders->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE)) { $this->Output = $Mail->Orders; return false; } $time_end = microtime_float(); $time_api = $time_end - $time_start; $this->Updated = APITime($Orders); $this->Title = "Orders for " . USER_NAME; ///////////////////////////////////////////////// $result = $Orders->entries; $cols = array("date", "state", "type", "minvol", "initvol", "remaining", "price", "station", "range"); if (CORP_MODE) { $cols[] = "owner"; $cols[] = "div"; } $ordercolors = array(0 => "FFFFFF", 1 => "FFFFFF", 2 => "007700", 3 => "BB0000", 4 => "FFFF00"); $ord = "DESC"; $sort = "date"; $this->Output .= sort_ctrl(true); if (count($result) > 0) { if ($sort != null && array_key_exists($sort, $result[0])) { usort($result, "globl_sortfunc"); } $sellorders = array(); $buyorders = array(); $exp_sellorders = array(); $exp_buyorders = array(); foreach ($result as $entry) { if (!$entry["bid"]) { if ($entry["active"]) { $sellorders[] = $entry; } else { $exp_sellorders[] = $entry; } } else { if ($entry["active"]) { $buyorders[] = $entry; } else { $exp_buyorders[] = $entry; } } } if (!isset($_GET['sort'])) { $sort = "type"; $ord = "ASC"; usort($sellorders, "globl_sortfunc"); usort($buyorders, "globl_sortfunc"); } $this->Output .= "<h3>Active Orders</h3>"; $this->Output .= "<a name=\"sa\"></a>"; $this->Output .= disp_orders($sellorders, "Sell Orders", array("minvol", "range", "state"), false, true); $this->Output .= "<a name=\"ba\"></a>"; $this->Output .= disp_orders($buyorders, "Buy Orders", array("state"), false, true); $this->Output .= "<br><h3>Expired Orders</h3>"; $this->Output .= "<a name=\"se\"></a>"; $this->Output .= disp_orders($exp_sellorders, "Sell Orders", array("minvol", "range"), true); $this->Output .= "<a name=\"be\"></a>"; $this->Output .= disp_orders($exp_buyorders, "Buy Orders", array()); } else { $this->Output .= (CORP_MODE ? "Corporation" : "Character") . " has no orders history.<br>"; } $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start); return true; }
public function GetOutput($Db) { global $sort, $ord, $cols; // req for sorting $Transactions = new eveApiTransactions($Db); $full_url = FULL_URL; // TODO $time_start = microtime_float(); $acct = isset($_GET['div']) ? $_GET['div'] + 999 : 1000; if (!$Transactions->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE, $acct)) { $this->Output = $Transactions->Error; return false; } $time_end = microtime_float(); $time_api = $time_end - $time_start; $this->Updated = APITime($Transactions); $this->Title = "Transactions for " . USER_NAME; ///////////////////////////////////////////////// $result = $Transactions->entries; $ord = "ASC"; $cols = array("date", "type", "price", "quantity", "total", "client", "station"); $sort = null; $this->Output .= sort_ctrl(); if (!$sort) { $sort = "date"; $ord = "DESC"; } $this->Output .= div_select($acct); if (count($result) > 0) { $this->Output .= "<br>" . count($result) . " entries<br>"; $this->Output .= "<table class=\"fancy trans\" style=\"font-size:83%;\" border=1>"; $this->Output .= "<tr>"; foreach ($cols as $col) { $this->Output .= "<th>"; if (!isset($nosorting)) { $this->Output .= "<a href=\"{$full_url}&view=transactions&sort={$col}&order=" . ($sort == $col && $ord == "ASC" ? "DESC" : "ASC") . "\">"; } $this->Output .= $col; if (!isset($nosorting)) { $this->Output .= "</a>"; } $this->Output .= "</th>"; } $ids = array(); foreach ($result as &$entry) { $ids[] = (string) $entry['clientID']; } $ids = array_unique($ids); $redIDS = GetRedIDS($ids, $Db); if (isset($redIDS[0]) && $redIDS[0] == 0) { $redIDS = array(); } $this->Output .= "</tr>"; //("date","type","price","total","client","station" if ($sort != null && array_key_exists($sort, $result[0])) { usort($result, "globl_sortfunc"); } $alt = " class=\"main\""; $alt_b = false; foreach ($result as $entry) { $alt_b = !$alt_b; $this->Output .= "<tr "; if (in_array($entry['clientID'], $redIDS)) { if ($alt_b) { $this->Output .= " class=\"redAlt"; } else { $this->Output .= " class=\"redMain"; } } else { if ($alt_b) { $this->Output .= " class=\"alt"; } else { $this->Output .= " class=\"main"; } } $this->Output .= ($entry["corp"] && !CORP_MODE ? " corp_entry_row" : "") . "\">"; $this->Output .= "<th scope=\"row\">" . str_replace(" ", " ", $entry["date"]) . " </th>"; $this->Output .= "<td>" . str_replace(" ", " ", $entry["type"]) . "</td>"; $this->Output .= "<td align=right >" . number_format($entry["price"], 2) . " ISK</td>"; $this->Output .= "<td align=center> " . $entry["quantity"] . "</td>"; $this->Output .= "<td align=right style=\"color: " . ($entry["total"] > -1 ? "#007700" : "#BB0000") . ";\"> " . number_format($entry["total"], 2) . " ISK</td>"; $this->Output .= "<td> " . $entry["client"] . " </td>"; $this->Output .= "<td width=\"*\">" . $entry["station"] . " </td>"; $this->Output .= "</tr>\n"; } $this->Output .= "</table>"; } else { $this->Output .= (CORP_MODE ? "Division" : "Character") . " has no recent transactions.<br><br>"; } $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start); return true; }
public function GetOutput($Db) { global $sort, $ord, $cols; // req for sorting $Journal = new eveApiJournal($Db); $full_url = FULL_URL; // TODO $time_start = microtime_float(); $acct = isset($_GET['div']) ? $_GET['div'] + 999 : 1000; if (!$Journal->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE, $acct)) { $this->Output = $Journal->Error; return false; } $time_end = microtime_float(); $time_api = $time_end - $time_start; $this->Updated = APITime($Journal); $this->Title = "Journal for " . USER_NAME; ///////////////////////////////////////////////// $ord = "ASC"; $cols = array("date", "type", "amount", "balance", "description", "reason"); $sort = null; $this->Output .= sort_ctrl(); if (!$sort) { $sort = "date"; $ord = "DESC"; } $this->Output .= div_select($acct); if (count($Journal->entries) > 0) { $this->Output .= number_format((int) $Journal->entries[0]["balance"], 2) . " ISK<br><br>"; $this->Output .= count($Journal->entries) . " entries<br>"; $this->Output .= "<table class=\"fancy journal\" style=\"font-size:83%;\" border=1>"; $this->Output .= "<tr>"; foreach ($cols as $col) { $this->Output .= "<th>"; if (!isset($nosorting)) { $this->Output .= "<a href=\"{$full_url}&view=journal&sort={$col}&order=" . ($sort == $col && $ord == "ASC" ? "DESC" : "ASC") . "\">"; } $this->Output .= $col; if (!isset($nosorting)) { $this->Output .= "</a>"; } $this->Output .= "</th>"; } $this->Output .= "</tr>"; $entries = $Journal->entries; if ($sort != null && array_key_exists($sort, $entries[0])) { usort($entries, "globl_sortfunc"); } $alt = " class=\"main\""; foreach ($entries as $entry) { if ($alt == " class=\"main\"") { $alt = " class=\"alt\""; } else { $alt = " class=\"main\""; } $this->Output .= "<tr{$alt}>"; $this->Output .= "<th scope=\"row\">" . str_replace(" ", " ", $entry["date"]) . " </th>"; $this->Output .= "<td>" . str_replace(" ", " ", $entry["typeNice"]) . "</td>"; $this->Output .= "<td align=right style=\"color: " . ($entry["amount"] > -1 ? "#007700" : "#BB0000") . ";\"> " . number_format($entry["amount"], 2) . " ISK</td>"; $this->Output .= "<td align=right> " . number_format($entry["balance"], 2) . " ISK </td>"; $this->Output .= "<td>" . $entry["description"] . "</td>"; $this->Output .= "<td nowrap=\"nowrap\" width=\"400\">" . $entry["reason"] . " </td>"; $this->Output .= "</tr>\n"; } $this->Output .= "</table>"; } else { $this->Output .= (CORP_MODE ? "Division" : "Character") . " has no Journal activity in the last 3 months.<br>"; } $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start); return true; }
public function GetOutput($Db) { global $sort, $ord, $cols; // req for sorting $Contracts = new eveApiContracts($Db); $full_url = FULL_URL; // TODO $time_start = microtime_float(); if (!$Contracts->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE)) { $this->Output = $Contracts->Error; return false; } $time_end = microtime_float(); $time_api = $time_end - $time_start; $Db->updateConqStations(); $this->Updated = APITime($Contracts); $this->Title = "Contracts for " . USER_NAME; if (isset($_GET['testing'])) { die("<pre>" . print_r($Contracts->entries, true) . "</pre>"); } $ord = "ASC"; $cols = array("Type", "status", "System", "dateIssued", "dateFinished", "issuer", "contractor", "Price", "volume", "desc"); $sort = null; $this->Output .= sort_ctrl(); //$this->Output .= "<h5 style=\"display: inline\">### PAGE UNDER CONSTRUCTION - WATCH FOR ANVILS ###</h5>"; if (count($Contracts->entries) > 0) { $this->Output .= <<<LEGENDEND <table border="1" style="font-size: 80%; border-style: solid;"> <tr><th colspan="2">LEGEND</th></tr> <tr><th>time format</th><td>[Month.Days.Years] Hours:Minutes</td></tr> <tr><th>blue row:</th><td>this contract is on behalf of your corporation</td></tr> <tr><th>orange volume:</th><td>volume is greater than 30,000 m3</td></tr> <tr><th>yellow time:</th><td>less than 24hrs left on auction</td></tr> <tr><th>red time:</th><td>less than 1 hour left on auction</td></tr> <tr><th>red price:</th><td>this is the price that was/will be paid <b style="color:red">by</b> the contract acceptor</td></tr> <tr><th>green price:</th><td>this is the price that was/will be paid <b style="color:#0f0">to</b> the contract acceptor</td></tr> <tr><th><assignee></th><td>contract is assigned to assignee but has not been accepted</td></tr> </table><br> LEGENDEND; $this->Output .= count($Contracts->entries) . " entries. <b>Click an entry to get contract details.</b><br><br>"; $this->Output .= "<table class=\"contracts_table\" style=\"font-size:83%;\" border=1>"; $this->Output .= "<tr>"; foreach ($cols as $col) { $this->Output .= "<th>"; if (!isset($nosorting)) { $this->Output .= "<a href=\"{$full_url}&view=contracts&sort={$col}&order=" . ($sort == $col && $ord == "ASC" ? "DESC" : "ASC") . "\">"; } $this->Output .= $col; if (!isset($nosorting)) { $this->Output .= "</a>"; } $this->Output .= "</th>"; } $this->Output .= "</tr>"; $entries = $Contracts->entries; $ids = array(); foreach ($entries as &$entry) { if ((string) $entry["availability"] == "Private" && $entry["acceptor"] == "") { $entry["contractor"] = $entry["assignee"]; } else { if ($entry["acceptor"] == "") { if (isset($entry["bidder"])) { if ($entry["bidder"] == "") { $entry["contractor"] = ""; } else { $entry["contractor"] = "{$entry['bidder']}"; } } else { $entry["contractor"] = ""; } } else { $entry["contractor"] = $entry["acceptor"]; } } $entry["Price"] = ($entry["reward"] > 0 || $entry["reward"] == $entry["price"] ? -1 : 1) * (double) ($entry["price"] + (double) $entry["reward"]); $ids[] = (string) $entry['issuerID']; $ids[] = (string) $entry['assigneeID']; } $ids = array_unique($ids); $redIDS = GetRedIDS($ids, $Db); if (isset($redIDS[0]) && $redIDS[0] == 0) { $redIDS = array(); } unset($entry); if ($sort != null && array_key_exists($sort, $entries[0])) { usort($entries, "globl_sortfunc"); } $alt_b = false; $rowclass = " class=\"nohover" . (isset($_GET['expandall']) ? "" : " contractbody") . "\""; foreach ($entries as $entry) { $alt_b = !$alt_b; $hasItems = isset($entry["buying"]) && ($entry["sellingItems"] != "" || $entry["buyingItems"] != ""); $this->Output .= "<tr onclick=\"toggle_row_visibility('contract" . $entry["contractID"] . "'); return false;\""; if (in_array($entry['issuerID'], $redIDS) || in_array($entry['assigneeID'], $redIDS)) { if ($alt_b) { $this->Output .= " class=\"redAlt"; } else { $this->Output .= " class=\"redMain"; } } else { if ($alt_b) { $this->Output .= " class=\"alt"; } else { $this->Output .= " class=\"main"; } } $this->Output .= ($entry["forCorp"] == 1 ? " corp_entry_row" : "") . " hover clickablerow\">"; //$this->Output .= "<th scope=\"row\">" . $entry["contractID"] . "</th>"; $this->Output .= "<th scope=\"row\">" . $entry["Type"] . "</th>"; if (CONTRACT_ACTIVE($entry["status"])) { $this->Output .= "<td class=\"pendingcontractstatus\">" . $entry["status"] . "</td>"; } else { if ($entry["status"] == "Failed") { $this->Output .= "<td class=\"failedcontractstatus\">FAILED</td>"; } else { if ($entry["status"] == "Rejected") { $this->Output .= "<td class=\"failedcontractstatus\">Rejected</td>"; } else { $this->Output .= "<td class=\"contractstatus\">" . $entry["status"] . "</td>"; } } } $this->Output .= "<td>" . $entry["System"] . "</td>"; $this->Output .= "<td>" . shortDateTime($entry["dateIssued"]) . "</td>"; if (CONTRACT_ACTIVE((string) $entry["status"])) { if ($entry["timeRemaining"] <= 3600 * 24) { $this->Output .= "<td style=\"color: " . timeToColor($entry["timeRemaining"]) . "\">"; } else { $this->Output .= "<td>"; } $this->Output .= niceTime($entry["timeRemaining"], 2) . " left</td>"; } else { if ((string) $entry["status"] == "Failed") { $this->Output .= "<td class=\"failedcontractstatus\">FAILED</td>"; } else { if ($entry["status"] == "Rejected") { $this->Output .= "<td class=\"failedcontractstatus\">Rejected</td>"; } else { if ($entry["dateFinished"] != "") { $this->Output .= "<td>" . shortDateTime($entry["dateFinished"]) . "</td>"; } else { $this->Output .= "<td> </td>"; } } } } $this->Output .= "<td>" . $entry["issuer"] . "</td>"; if ((string) $entry["availability"] == "Private" && $entry["acceptor"] == "") { $this->Output .= "<td><" . $entry["assignee"] . "></td>"; } else { if ($entry["acceptor"] == "") { if (isset($entry["bidder"])) { if ($entry["bidder"] == "") { $this->Output .= "<td style=\"color:grey;\"><no bids></td>"; } else { $this->Output .= "<td style=\"color:grey;\"><bid {$entry['bidder']}></td>"; } } else { $this->Output .= "<td style=\"color:grey;\"><public></td>"; } } else { $this->Output .= "<td>" . $entry["acceptor"] . "</td>"; } } $this->Output .= "<td align=right style=\"color: " . ($entry["reward"] > 0 || $entry["reward"] == $entry["price"] ? "#007700" : "#BB0000") . ";\">" . number_format((double) $entry["price"] + (double) $entry["reward"], 2) . " ISK</td>"; if ($entry["volume"] > 30000) { $this->Output .= "<td style=\"color: #FFA500\">" . shortVolume($entry["volume"]) . "</td>"; } else { $this->Output .= "<td>" . shortVolume($entry["volume"]) . "</td>"; } $this->Output .= "<td width=\"500\"" . ">" . $entry["desc"]; if ($hasItems) { if ($entry["desc"] != "") { $this->Output .= "<br>"; } $this->Output .= "<span class=\"contract_items\">"; if ($entry["sellingItems"] != "") { switch ($entry["Type"]) { case "Trade": $this->Output .= "<b>Offering:</b> "; break; case "Gift": $this->Output .= "<b>Giving:</b> "; break; default: $this->Output .= "<b>Selling:</b> "; break; } $this->Output .= "{$entry['sellingItems']}<br>"; } if ($entry["buyingItems"] != "") { $this->Output .= ($entry["Type"] != "Trade" ? "<b>Buying:</b> " : "<b>Looking for:</b> ") . "{$entry['buyingItems']}"; } $this->Output .= "</span>"; } $this->Output .= " </td>\n"; $this->Output .= "</tr>\n"; /// BEGIN CONTRACT DETAILS $this->Output .= "<tr{$rowclass} id=\"contract" . $entry["contractID"] . "\"><td colspan=\"" . count($cols) . "\">"; $this->Output .= "<a name=\"" . $entry["contractID"] . "\"></a><h3>"; if ($entry["title"] != "") { $this->Output .= "{$entry['title']} - "; } if ($entry["type"] == "ItemExchange") { $this->Output .= "Item Exchange [{$entry["Type"]}]"; } else { $this->Output .= "{$entry["Type"]}"; } $this->Output .= " - {$entry['status']}</h3>"; $this->Output .= "<b>Location</b>: {$entry["startStation"]}<br>"; if ($entry["type"] == "Courier") { $this->Output .= "<b>Destination</b>: {$entry["endStation"]}({$entry["endStationID"]})<br>"; } $this->Output .= "<b>Posted</b>: {$entry['dateIssued']}<br>"; if ((double) $entry["acceptorID"] != 0 && $entry["type"] == "Courier") { $this->Output .= "<b>Accepted</b>: {$entry['dateAccepted']}<br>"; } if ((string) $entry["status"] != "Completed" && (string) $entry["status"] != "Deleted" && (string) $entry["status"] != "Failed") { $this->Output .= "<b>Remaining</b>: <span"; if ($entry["timeRemaining"] <= 3600 * 24) { $this->Output .= " style=\"color: " . timeToColor($entry["timeRemaining"]) . "\">"; } else { $this->Output .= ">"; } $this->Output .= niceTime($entry["timeRemaining"], 3) . "</span><br>"; } else { $this->Output .= "<b>Finished</b>: {$entry['dateFinished']}<br>"; } $this->Output .= "<b>Contractor</b>: "; if ((string) $entry["availability"] == "Private" && $entry["acceptor"] == "") { $this->Output .= "<" . $entry["assignee"] . ">"; } else { if ($entry["acceptor"] == "") { if (isset($entry["bidder"])) { if ($entry["bidder"] == "") { $this->Output .= "<span style=\"color:grey;\"><no bids></span>"; } else { $this->Output .= "<span style=\"color:grey;\"><bid {$entry['bidder']}></span>"; } } else { $this->Output .= "<span style=\"color:grey;\"><public></span>"; } } else { $this->Output .= $entry["acceptor"]; } } $this->Output .= "<br>"; if ($entry["reward"] > 0 || $entry["reward"] == $entry["price"]) { $this->Output .= "<b>Reward</b>: <span style=\"color:007700\">"; } else { $this->Output .= "<b>Price</b>: <span style=\"color:BB0000\">"; } $this->Output .= number_format((double) $entry["price"] + (double) $entry["reward"], 2) . " ISK</span></br>"; if ((double) $entry["collateral"] != 0) { $this->Output .= "<b>Collateral</b>: <span style=\"color:#f00;\">" . number_format((double) $entry["collateral"], 2) . " ISK</span></br>"; } $this->Output .= "<b>Volume</b>: "; if ($entry["volume"] > 30000) { $this->Output .= "<span style=\"color: #FFA500\">" . number_format($entry["volume"], 2) . " m3</span>"; } else { $this->Output .= number_format($entry["volume"], 2) . " m3"; } $this->Output .= "<br>"; if ($hasItems) { $this->Output .= "<br><table class=\"contracts_wtt\"><tr>"; if ($entry["sellingItems"] != "") { $this->Output .= "<th> " . ($entry["Type"] != "Trade" ? $entry["Type"] == "Gift" ? "<b>Giving</b>:" : "<b>Selling</b> " : "<b>Offering:</b> ") . "</th>"; } if ($entry["buyingItems"] != "") { $this->Output .= "<th> " . ($entry["Type"] != "Trade" ? "<b>Buying</b> " : "<b>Looking for:</b> ") . "</th>"; } $this->Output .= "</tr><tr>"; if ($entry["sellingItems"] != "") { $this->Output .= "<td>" . str_replace("\n", "<br>", $entry["sellingItemsList"]) . "</td>"; } if ($entry["buyingItems"] != "") { $this->Output .= "<td>" . str_replace("\n", "<br>", $entry["buyingItemsList"]) . "</td>"; } $this->Output .= "</tr></table>"; } $this->Output .= ""; $this->Output .= "<br><h3 style=\"font-size: 150%; border-bottom: 0px;\"><a href=\"#\" onclick=\"toggle_row_visibility('contract" . $entry["contractID"] . "'); return false;\">[Hide]</a></h3>"; $this->Output .= ""; $this->Output .= ""; $this->Output .= "</td></tr>\n"; } $this->Output .= "</table>"; if (isset($_GET['contract'])) { $this->Output .= "<script>toggle_row_visibility('contract{$_GET['contract']}'); location.hash='{$_GET['contract']}';</script>"; } } else { $this->Output .= (CORP_MODE ? "Corporation" : "Character") . " has no Contracts in the last 3 months.<br>"; } $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start); return true; }