public function GetOutput($Db)
 {
     $Mail = new eveApiMails($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Mail->fetch(CHAR_ID, USER_ID, API_KEY)) {
         $this->Output = $Mail->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Mail);
     $this->Title = "Mail for " . CHAR_NAME;
     if (count($Mail->Messages) > 0) {
         $idsToResolve = array();
         foreach ($Mail->Messages as $message) {
             // get a list of all ids referenced
             foreach (explode(",", $message["toCorpOrAllianceID"] . "," . $message["toCharacterIDs"] . "," . $message["senderID"]) as $str) {
                 if ($str != "" && !in_array($str, $idsToResolve)) {
                     $idsToResolve[] = $str;
                 }
             }
         }
         $ids = idlookup($Db->link, $idsToResolve);
         if (isset($_GET['mail'])) {
             $ret = $Mail->fetchMailBody(CHAR_ID, USER_ID, API_KEY, $_GET['mail']);
             if (!$ret) {
                 $this->Output = "Error fetching mail {$_GET['mail']}: " . $Mail->Error;
                 return false;
             }
             if (isset($_GET['ajax'])) {
                 die(json_encode(["result" => "success", "body" => (string) $ret]));
             }
             foreach ($Mail->Messages as $message) {
                 if ($message["messageID"] != $_GET['mail']) {
                     continue;
                 } else {
                     $this->Output .= "<h3>{$message['title']}</h3><h5 style=\"display: inline;\">Sent by " . $ids[(int) $message["senderID"]] . " on {$message['sentDate']}</h5><br><br>";
                     break;
                 }
             }
             $this->Output .= parse_ccptml($ret) . "<br><br>";
             $this->Output .= "<a href=\"{$full_url}&view=mail\">[back]</a><br><br>";
         } else {
             $this->Output .= "<span style=\"font-size:80%; font-weight: bold;\">";
             /*if ($Mail->unread > 0)
               $this->Output .= $Mail->unread." unread message".($Mail->unread ==1?", ":"s, ");*/
             $this->Output .= count($Mail->Messages) . " messages total<br>";
             if (isset($_SESSION) && isset($_SESSION['mailFormatted']) && $_SESSION['mailFormatted'] == true) {
                 $this->Output .= "Message Formatting: <input type=\"button\" value=\"Formatted\" id=\"changeMessageFormatting\">";
             } else {
                 $this->Output .= "Message Formatting: <input type=\"button\" value=\"Unformatted\" id=\"changeMessageFormatting\">";
             }
             if ($Mail->Message != "") {
                 $this->Output .= $Mail->Message . "<br>";
             }
             $this->Output .= "</span>";
             $this->Output .= "<br><table class=\"fancy Mail\" style=\"font-size:83%;\" border=1>";
             $this->Output .= "<tr><th>date</th><th>sender</th><th>title</th><th>recipients</th></tr>";
             $alt = " class=\"main\"";
             $ids1 = array();
             foreach ($Mail->Messages as $message) {
                 $ids1[] = (string) $message['senderID'];
                 $kindaID = explode(",", (string) $message['toCharacterIDs']);
                 $kindaID2 = explode(",", (string) $message['toCorpOrAllianceID']);
                 $ids1 = array_merge($ids1, $kindaID, $kindaID2);
             }
             $ids1 = array_unique($ids1);
             $redIDS = GetRedIDS($ids1, $Db);
             if (isset($redIDS[0]) && $redIDS[0] == 0) {
                 $redIDS = array();
             }
             foreach ($Mail->Messages as $message) {
                 $sentTo = explode(",", (string) $message['toCharacterIDs']);
                 $sentToGroup = explode(",", (string) $message['toCorpOrAllianceID']);
                 $intersect = array_intersect($redIDS, $sentTo);
                 $intersect2 = array_intersect($redIDS, $sentToGroup);
                 if (in_array((string) $message['senderID'], $redIDS) || !empty($intersect) || !empty($intersect2)) {
                     if (strpos(strtolower($alt), 'main') !== false) {
                         $alt = " class=\"redAlt messageRow\"";
                     } else {
                         $alt = " class=\"redMain messageRow\"";
                     }
                 } else {
                     if (strpos(strtolower($alt), 'main') !== false) {
                         $alt = " class=\"alt messageRow\"";
                     } else {
                         $alt = " class=\"main messageRow\"";
                     }
                 }
                 if ((int) $message["toListID"] == 0 || (string) $message["toListID"] == "") {
                     $to = array();
                     if ($message["toCorpOrAllianceID"] != "") {
                         $to += explode(",", $message["toCorpOrAllianceID"]);
                     }
                     if ($message["toCharacterIDs"] != "") {
                         $to += explode(",", $message["toCharacterIDs"]);
                     }
                     $recp = "";
                     foreach ($to as $rec) {
                         $recp .= $ids[(int) $rec] . ", ";
                     }
                     $recp = rtrim($recp, ", ");
                 } else {
                     $recp = "(mailing list)";
                 }
                 $this->Output .= "<tr{$alt} style=\"cursor: pointer;\" href=\"{$full_url}&view=mail&mail=" . $message["messageID"] . "\">";
                 //$this->Output .= "<td>".($message["read"]!=1?"<b>#</b>":"")."</td>";
                 $this->Output .= "<td>" . $message["sentDate"] . "</td>";
                 $this->Output .= "<td>" . $ids[(int) $message["senderID"]] . "</td>";
                 $this->Output .= "<td>" . $message["title"] . "</td>";
                 $this->Output .= "<td>" . $recp . "</td>\n";
                 $this->Output .= "</tr>";
             }
             $this->Output .= "</table>";
         }
     } else {
         $this->Output .= "<br>Character has no recent mails.<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) {
         $ids = array();
         foreach ($Journal->entries as $entry) {
             $ids[] = (string) $entry['ownerID1'];
             $ids[] = (string) $entry['ownerID2'];
         }
         $ids = array_unique($ids);
         $redIDS = GetRedIDS($ids, $Db);
         if (isset($redIDS[0]) && $redIDS[0] == 0) {
             $redIDS = array();
         }
         $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\"";
         $alt_b = false;
         foreach ($entries as $entry) {
             $alt_b = !$alt_b;
             $this->Output .= "<tr";
             if (in_array($entry['ownerID1'], $redIDS) || in_array($entry['ownerID2'], $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 .= ">";
             $this->Output .= "<th scope=\"row\">" . str_replace(" ", "&nbsp;", $entry["date"]) . "&nbsp;</th>";
             $this->Output .= "<td>" . str_replace(" ", "&nbsp;", $entry["typeNice"]) . "</td>";
             $this->Output .= "<td align=right style=\"color: " . ($entry["amount"] > -1 ? "#007700" : "#BB0000") . ";\">&nbsp;" . number_format($entry["amount"], 2) . "&nbsp;ISK</td>";
             $this->Output .= "<td align=right>&nbsp;" . number_format($entry["balance"], 2) . "&nbsp;ISK&nbsp;&nbsp;</td>";
             $this->Output .= "<td>" . $entry["description"] . "</td>";
             $this->Output .= "<td nowrap=\"nowrap\" width=\"400\">" . $entry["reason"] . "&nbsp;</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
     $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(" ", "&nbsp;", $entry["date"]) . "&nbsp;</th>";
             $this->Output .= "<td>" . str_replace(" ", "&nbsp;", $entry["type"]) . "</td>";
             $this->Output .= "<td align=right >" . number_format($entry["price"], 2) . "&nbsp;ISK</td>";
             $this->Output .= "<td align=center> " . $entry["quantity"] . "</td>";
             $this->Output .= "<td align=right style=\"color: " . ($entry["total"] > -1 ? "#007700" : "#BB0000") . ";\">&nbsp;" . number_format($entry["total"], 2) . "&nbsp;ISK</td>";
             $this->Output .= "<td>&nbsp;" . $entry["client"] . "&nbsp;&nbsp;</td>";
             $this->Output .= "<td width=\"*\">" . $entry["station"] . "&nbsp;</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
        $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>&lt;assignee&gt;</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>&nbsp;</td>";
                            }
                        }
                    }
                }
                $this->Output .= "<td>" . $entry["issuer"] . "</td>";
                if ((string) $entry["availability"] == "Private" && $entry["acceptor"] == "") {
                    $this->Output .= "<td>&lt;" . $entry["assignee"] . "&gt;</td>";
                } else {
                    if ($entry["acceptor"] == "") {
                        if (isset($entry["bidder"])) {
                            if ($entry["bidder"] == "") {
                                $this->Output .= "<td style=\"color:grey;\">&lt;no bids&gt;</td>";
                            } else {
                                $this->Output .= "<td style=\"color:grey;\">&lt;bid {$entry['bidder']}&gt;</td>";
                            }
                        } else {
                            $this->Output .= "<td style=\"color:grey;\">&lt;public&gt;</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 .= "&nbsp;</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 .= "&lt;" . $entry["assignee"] . "&gt;";
                } else {
                    if ($entry["acceptor"] == "") {
                        if (isset($entry["bidder"])) {
                            if ($entry["bidder"] == "") {
                                $this->Output .= "<span style=\"color:grey;\">&lt;no bids&gt;</span>";
                            } else {
                                $this->Output .= "<span style=\"color:grey;\">&lt;bid {$entry['bidder']}&gt;</span>";
                            }
                        } else {
                            $this->Output .= "<span style=\"color:grey;\">&lt;public&gt;</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;
    }