本文整理汇总了PHP中table::addRow方法的典型用法代码示例。如果您正苦于以下问题:PHP table::addRow方法的具体用法?PHP table::addRow怎么用?PHP table::addRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table
的用法示例。
在下文中一共展示了table::addRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeAddUserForm
function makeAddUserForm()
{
// Are we allowed to?
global $MySelf;
if (!$MySelf->canAddUser()) {
makeNotice("You are not authorized to do that!", "error", "Forbidden");
}
// Suggest a user password.
$suggestedPassword = crypt(base64_encode(rand(11111, 99999)), "8ewf7tg2k,leduj");
$table = new table(2, true);
$table->addHeader(">> Add a new user");
$table->addRow("#060622");
$table->addCol("You can manually add a new user with this form. But use this only " . "as a last resort, for example, if your server can not send eMails. " . "Always let the user request an account. This form was supposed to be " . "removed, but complains from the users kept it alive.", array("colspan" => 2));
$table->addRow();
$table->addCol("Username:");
$table->addCol("<input type=\"text\" name=\"username\" maxlength=\"20\">");
$table->addRow();
$table->addCol("eMail:");
$table->addCol("<input type=\"text\" name=\"email\">");
$table->addRow();
$table->addCol("Password:");
$table->addCol("<input type=\"password\" name=\"pass1\" value=\"{$suggestedPassword}\"> (Suggested: {$suggestedPassword})");
$table->addRow();
$table->addCol("Verify Password:");
$table->addCol("<input type=\"password\" name=\"pass2\" value=\"{$suggestedPassword}\">");
$table->addHeaderCentered("<input type=\"submit\" name=\"create\" value=\"Add user to database\">");
$page = "<h2>Add a new User</h2>";
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= $table->flush();
$page .= "<input type=\"hidden\" name=\"action\" value=\"newuser\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= "</form>";
return $page;
}
示例2: makeRequestAccountPage
function makeRequestAccountPage($failedFastLogin = false)
{
// We need global Variables.
global $VERSION;
global $SITENAME;
global $IGB;
global $IGB_VISUAL;
if ($IGB && $IGB_VISUAL) {
$table = new table(2, true);
} else {
$table = new table(2, true, "width=\"500\"", "align=\"center\"");
}
if ($_GET[admin] == true) {
$table->addHeader(">> Create initial Superadmin account");
} else {
$table->addHeader(">> Request an account");
}
// Trust, INC.
if ($failedFastLogin) {
// This happens when someone allowed fast logins(!) and the user does not exist.
global $EVE_Charname;
$table->addRow("#660000");
$table->addCol("Fast login failed; Username \"" . ucfirst($EVE_Charname) . "\" does not exist.", array("colspan" => 2, "align" => "center"));
}
$table->addRow("#060622");
if ($_GET[admin] == true) {
$table->addCol("Fill out the form below to create the initial superadmin account. " . "This account will have all priviledges - so keep the login credentials safe! " . "Your password will be randomly generated and revealed to you just once, " . "so write it down or copy it elsewhere. You will have the option to " . "change your password on your first login.", array("colspan" => 2));
} else {
$table->addCol("Fill out the form below to apply for a new account. After you requested " . "an account you will receive an email with an activation link. Finally, your " . "CEO has to approve of your account, after which you will receive your initial password.", array("colspan" => 2));
}
$table->addRow();
$table->addCol("Character Name:");
// Trust, INC.
global $EVE_Charname;
if ($EVE_Charname) {
$table->addCol("<input type=\"text\" name=\"username\" value=\"{$EVE_Charname}\" maxlength=\"30\">");
} else {
$table->addCol("<input type=\"text\" name=\"username\" maxlength=\"30\">");
}
$table->addRow();
$table->addCol("Your valid eMail:");
$table->addCol("<input type=\"text\" name=\"email\" maxlength=\"70\">");
if ($_GET[admin] == false) {
$table->addHeaderCentered("<input type=\"submit\" name=\"login\" value=\"request account\">");
$table->addRow("#060622");
$table->addCol("[<a href=\"index.php\">Cancel request</a>]", array("colspan" => 2));
} else {
$table->addHeaderCentered("<input type=\"submit\" name=\"login\" value=\"Create Superadmin\">");
}
$page = "<br><br>";
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"requestaccount\">";
$page .= $table->flush();
$page .= "</form><br><br>";
// Print it, and die (special case: login does not get beautified.)
$html = new html();
$html->addBody($page);
die($html->flush());
}
示例3: showHierarchy
function showHierarchy()
{
// Globals!
global $DB;
// Get all sorted ranks.
$Ranks = $DB->query("SELECT DISTINCT name, rankid, rankOrder FROM ranks ORDER by rankOrder ASC");
while ($rank = $Ranks->fetchRow()) {
// Get all the users in the current rank.
$peopleInRank = $DB->query("SELECT DISTINCT username, rank FROM users WHERE rank='{$rank['rankid']}' AND deleted='0' AND canLogin='1' ORDER BY username");
// Are there people in this rank?
if ($peopleInRank->numRows() > 0) {
// Create a temp. table.
$table = new table(1, true);
$table->addHeader(">> " . $rank[name]);
while ($peep = $peopleInRank->fetchRow()) {
$table->addRow();
$table->addCol("<a href=\"index.php?action=profile&id=" . usernameToID($peep[username]) . "\">" . ucfirst($peep[username]) . "</a>");
}
$html .= $table->flush() . "<br>";
unset($table);
}
}
$header = "<h2>" . getConfig("sitename") . " - Hierarchy</h2>";
return $header . $html;
}
示例4: lotto_editLottery
function lotto_editLottery()
{
// We need some globals
global $MySelf;
global $DB;
$formDisable = "";
if (lotto_getOpenDrawing()) {
$formDisable = "disabled";
}
// is Lotto enabled at all?
if (!getConfig("lotto")) {
makeNotice("Your CEO disabled the Lotto module, request denied.", "warning", "Lotto Module Offline");
}
// Deny access to non-lotto-officials.
if (!$MySelf->isLottoOfficial()) {
makeNotice("You are not allowed to do this!", "error", "Permission denied");
}
$table = new table(2, true);
$table->addHeader(">> Open new drawing");
$table->addRow();
$table->addCol("Number of tickets in draw:");
$table->addCol("<input type=\"text\" name=\"count\" " . $formDisable . " value=\"30\">");
// $newLotto = new table (2);
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" " . $formDisable . " value=\"open new drawing\">", array("bold" => true, "colspan" => 2));
$html = "<h2>Lotto Administration</h2>";
$html .= "<form action=\"index.php\" method=\"POST\">";
$html .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$html .= "<input type=\"hidden\" name=\"action\" value=\"createDrawing\">";
$html .= $table->flush();
$html .= "</form>";
if (lotto_getOpenDrawing()) {
$html .= "[<a href=\"index.php?action=drawLotto\">Draw Winner</a>]";
}
return $html;
}
示例5: confirm
function confirm($question = "Are you sure?")
{
// switch post or get.
if (isset($_POST[check])) {
// The user confirmed the box. Dont loop. Accept it already ;)
if ($_POST[confirmed] == true) {
return true;
}
$MODE = "POST";
$FORM = $_POST;
$keys = array_keys($_POST);
} else {
// The user confirmed the box. Dont loop. Accept it already ;)
if ($_GET[confirmed] == true) {
return true;
}
$MODE = "GET";
$FORM = $_GET;
$keys = array_keys($_GET);
}
// Assemble hidden values for the confirm form.
foreach ($keys as $key) {
$html .= "<input type=\"hidden\" name=\"" . $key . "\" value=\"" . $FORM[$key] . "\">";
}
// Cancel button
$cancel = "<form action=\"index.php\" method=\"POST\">";
$cancel .= "<input type=\"submit\" name=\"confirmed\" value=\"CANCEL\">";
$cancel .= "</form>";
// OK button
$ok = "<form action=\"index.php\" method=\"{$MODE}\">";
$ok .= $html;
$ok .= "<input type=\"submit\" name=\"confirmed\" value=\"OK\">";
$ok .= "</form>";
$table = new table("2", true, "width=\"50%\"", "align=\"center\"");
$table->addHeader("<img src=\"./images/warning.png\">");
$table->addRow("#060622");
$table->addCol(">> Confirmation needed", array("colspan" => "2"));
$table->addRow();
$table->addCol("<br>" . $question . "<br><br>", array("colspan" => "2"));
$table->addRow();
$table->addCol($cancel, array("align" => "left"));
$table->addCol($ok, array("align" => "right"));
$htmlobj = new html();
$htmlobj->addBody("<br><br><br><br>" . $table->flush() . "<br><br><br><br>");
die($htmlobj->flush());
}
示例6: makeLostPassForm
function makeLostPassForm()
{
// We need some global vars again.
global $IGB;
global $SITENAME;
global $IGB_VISUAL;
if ($IGB && $IGB_VISUAL) {
$table = new table(2, true);
} else {
$table = new table(2, true, "width=\"500\"", "align=\"center\"");
}
$table->addHeader(">> Request a new password");
$table->addRow("#060622");
$table->addCol("Fill out the form below to have a new password generated and sent to you registered eMail address.", array("colspan" => 2));
$table->addRow();
$table->addCol("Character Name:");
// Trust, INC.
global $EVE_Charname;
if ($EVE_Charname) {
$table->addCol("<input type=\"text\" name=\"username\" value=\"{$EVE_Charname}\" maxlength=\"30\">");
} else {
$table->addCol("<input type=\"text\" name=\"username\" maxlength=\"30\">");
}
$table->addRow();
$table->addCol("Your valid eMail:");
$table->addCol("<input type=\"text\" name=\"email\" maxlength=\"70\">");
$table->addHeaderCentered("<input type=\"submit\" name=\"change\" value=\"Get Password\">");
$table->addRow("#060622");
$table->addCol("[<a href=\"index.php\">Cancel request</a>]", array("colspan" => 2));
// $page = "<h2>Lost password</h2>";
$page = "<br><br>";
$page .= "<form action=\"index.php\" method=\"post\">";
$page .= "<input type=\"hidden\" name=\"action\" value=\"lostpass\">";
$page .= "<input type=\"hidden\" name=\"check\" value=\"check\">";
$page .= $table->flush();
$page .= "</form><br><br>";
// Print it, and die (special case: login does not get beautified.)
$html = new html();
$html->addBody($page);
die($html->flush());
}
示例7: editTemplate
function editTemplate()
{
global $DB;
global $MySelf;
// Are we allowed to?
if (!$MySelf->isAdmin()) {
makeNotice("Only an Administator can edit the sites templates.", "warning", "Access denied");
}
// No Identifier, no service
if ($_POST[check]) {
// We got the returning form, edit it.
numericCheck($_POST[id], 0);
$ID = $_POST[id];
// Fetch the current template, see that its there.
$test = $DB->query("SELECT identifier FROM templates WHERE id='{$ID}' LIMIT 1");
if ($test->numRows() == 1) {
// We got the template
$template = sanitize($_POST[template]);
$DB->query("UPDATE templates SET template='" . $template . "' WHERE id='{$ID}' LIMIT 1");
// Check for success
if ($DB->affectedRows() == 1) {
// Success!
header("Location: index.php?action=edittemplate&id={$ID}");
} else {
// Fail!
makeNotice("There was a problem updating the template in the database!", "error", "Internal Error", "index.php?action=edittemplate&id={$ID}", "Cancel");
}
} else {
// There is no such template
makeNotice("There is no such template in the database!", "error", "Invalid Template!", "index.php?action=edittemplate&id={$ID}", "Cancel");
}
} elseif (empty($_GET[id])) {
// No returning form, no identifier.
header("Location: index.php?action=configuration");
} else {
$ID = $_GET[id];
}
// numericheck!
numericCheck($ID, 0);
$temp = $DB->getCol("SELECT template FROM templates WHERE id='{$ID}' LIMIT 1");
$table = new table(1, true);
$table->addHeader(">> Edit template");
$table->addRow();
$table->addCol("<center><textarea name=\"template\" rows=\"30\" cols=\"60\">" . $temp[0] . "</textarea></center>");
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Edit Template\">");
$form1 = "<form action=\"index.php\" method=\"POST\">";
$form2 = "<input type=\"hidden\" name=\"check\" value=\"true\">";
$form2 .= "<input type=\"hidden\" name=\"action\" value=\"editTemplate\">";
$form2 .= "<input type=\"hidden\" name=\"id\" value=\"" . $ID . "\">";
$form2 .= "</form>";
$backlink = "<br><a href=\"index.php?action=configuration\">Back to configuration</a>";
return "<h2>Edit the template</h2>" . $form1 . $table->flush() . $form2 . $backlink;
}
示例8: makeNewOreRunPage
function makeNewOreRunPage()
{
// Load the globals.
global $VERSION;
global $SITENAME;
global $TIMEMARK;
global $ORENAMES;
global $DBORE;
global $DB;
global $MySelf;
$locationPDM = "";
// We need a list of all the previous run locations.
$locations = $DB->query("SELECT DISTINCT location FROM runs ORDER BY location");
if ($locations->numRows() > 0) {
while ($location = $locations->fetchRow()) {
$locationPDM .= "<option value=\"" . $location['location'] . "\">" . $location['location'] . "</option>";
}
$locationPDM = "<select name=\"locations\">" . $locationPDM . "</select>";
}
// Table
$table = new table(2, true);
$table->addHeader(">> Create a new operation");
$table->addRow();
// Field: Location.
$table->addCol("Location of Operation:");
if ($locationPDM) {
// We have at least one possible System we hauled before.
$table->addCol($locationPDM . " -or- <input type=\"text\" name=\"location\">");
} else {
// There are not target systems in the database.
if (getConfig("trustSetting") > 0) {
$table->addCol("<input type=\"text\" value=\"" . $_SERVER['HTTP_EVE_SOLARSYSTEMNAME'] . "\" name=\"location\">");
} else {
$table->addCol("<input type=\"text\" name=\"location\">");
}
}
$pdm = "";
// Field: Officer in Charge
if ($MySelf->isOfficial()) {
$SeniorUsers = $DB->getCol("SELECT DISTINCT username FROM users WHERE canCreateRun = 1 AND deleted='0' ORDER BY username");
foreach ($SeniorUsers as $senior) {
if ($MySelf->getUsername() == "{$senior}") {
$pdm .= "<option value=\"{$senior}\" selected>" . ucwords($senior) . "</option>";
} else {
$pdm .= "<option value=\"{$senior}\">" . ucwords($senior) . "</option>";
}
$seniorUsersPDM = "<select name=\"supervisor\">" . $pdm . "</select>";
}
} else {
// In case the user is not a senior member he can not change the officer in charge.
$seniorUsersPDM = ucfirst($MySelf->getUsername());
$seniorUsersPDM .= "<input type=\"hidden\" name=\"supervisor\" value=\"" . $MySelf->getUsername() . "\">";
}
// We have no senior member (aka: people who may start runs)
if (!$seniorUsersPDM) {
makeNotice("No one from your current users may create or lead a mining operation. Please give out appropiate permissions.", "warning", "Insufficient Rights");
} else {
$table->addRow();
$table->addCol("Executing Officer:");
$table->addCol($seniorUsersPDM);
}
$table->addRow();
$table->addCol("Op Type:");
$OPTYPE = isset($_REQUEST['optype']) ? $_REQUEST['optype'] : "";
$ops = $DB->getAll("select opName from opTypes;");
if ($DB->isError($ops)) {
die($ops->getMessage());
}
$opSelect = "<select name='optype' onChange='window.location = \"?action=newrun&optype=\"+this.value'>\n";
$opSelect .= "<option value=''>Standard</option>\n";
foreach ($ops as $op) {
$default = $op['opName'] == $OPTYPE ? "selected" : "";
$opSelect .= "<option {$default} value='" . $op['opName'] . "'>" . $op['opName'] . "</option>\n";
}
$opSelect .= "</select>";
$table->addCol($opSelect);
// Field: Corporation keeps.
$table->addRow();
$table->addCol("Corporation keeps:");
// Get the average amount.
if ($MySelf->isOfficial()) {
if (!getConfig("defaultTax")) {
// No default tax has been defined in the config file, generate our own.
$tax = $DB->getCol("SELECT AVG(corpKeeps) AS tax FROM runs;");
$tax = round($tax[0]);
// in case there are no taxes yet AND no default has been set.
if (!$tax) {
$tax = "15";
}
} else {
if ($OPTYPE == "Shopping") {
$tax = "0";
} else {
// Set the default tax, according to config.
$tax = getConfig("defaultTax");
}
}
$table->addCol("<input readonly=\"readonly\" type=\"text\" maxlength=\"3\" value=\"{$tax}\" size=\"4\" name=\"corpkeeps\">% of gross value.");
} else {
$table->addCol("As this is not an official Op, no tax is deducted.");
//.........这里部分代码省略.........
示例9: manageWallet
function manageWallet()
{
// Globals
global $MySelf;
global $DB;
$MyCredits = getCredits($MySelf->getID());
// Get (recent?) transactions
$html = getTransactions($MySelf->getID());
if ($MyCredits > 0) {
// Create the dropdown menu with all pilots.
$NamesDS = $DB->query("SELECT DISTINCT username, id FROM users WHERE deleted='0' ORDER BY username");
$ddm = "<select name=\"to\">";
while ($name = $NamesDS->fetchRow()) {
// Lets not allow transfers to self.
if ($name[id] != $MySelf->getID()) {
$ddm .= "<option value=\"" . $name[id] . "\">" . ucfirst($name[username]) . "</option>";
}
}
$ddm .= "</select>";
$tt = new table(2, true);
$tt->addHeader(">> Transfer ISK");
$tt->addRow("#060622");
$tt->addCol("You can transfer ISK into another Pilots wallet by using this form.", array("colspan" => 2));
$tt->addRow();
$tt->addCol("Transfer from:");
$tt->addCol(ucfirst($MySelf->getUsername()));
$tt->addRow();
$tt->addCol("Transfer to:");
$tt->addCol($ddm);
$tt->addRow();
$tt->addCol("Amount:");
$tt->addCol("<input type=\"text\" name=\"amount\">");
$tt->addRow();
$tt->addCol("Reason:");
$tt->addCol("<input type=\"text\" name=\"reason\">");
$tt->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"Transfer money\">");
// Create form stuff, and embed the table within.
$transfer = "<form action=\"index.php\" method=\"POST\">";
$transfer .= $tt->flush();
$transfer .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$transfer .= "<input type=\"hidden\" name=\"action\" value=\"transferMoney\">";
$transfer .= "</form>";
// Create the payout form.
$payout = new table(2, true);
$payout->addHeader(">> Request payout");
$payout->addRow("#060622");
$payout->addCol("Fill out this form to request payout of ISK. An accountant will honor your request soon.", array("colspan" => 2));
$payout->addRow();
$payout->addCol("Payout amount:");
$payout->addCol("<input type=\"text\" name=\"amount\" value=\"" . $MyCredits . "\"> ISK");
$payout->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"request payout\">");
// Create form stuff, and embed the table within.
$requestPayout = "<form action=\"index.php\" method=\"POST\">";
$requestPayout .= $payout->flush();
$requestPayout .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$requestPayout .= "<input type=\"hidden\" name=\"action\" value=\"requestPayout\">";
$requestPayout .= "</form>";
}
/*
* Show current requests
*/
$requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NULL AND applicant='" . $MySelf->getID() . "' ORDER BY time");
$table = new table(4, true);
$table->addHeader(">> Pending payout requests");
$table->addRow("#060622");
$table->addCol("request");
$table->addCol("time");
$table->addCol("amount");
$table->addCol("Cancel");
while ($request = $requests->fetchRow()) {
$table->addRow();
$table->addCol("#" . str_pad($request[request], "5", "0", STR_PAD_LEFT));
$table->addCol(date("d.m.y H:i:s", $request[time]));
$table->addCol(number_format($request[amount], 2) . " ISK");
$table->addCol("<input type=\"checkbox\" name=\"" . $request[request] . "\" value=\"true\">");
$haveRequest = true;
}
$table->addHeaderCentered("<input type=\"submit\" name=\"submit\" value=\"cancel marked requests\">");
$takeBack = "<form action=\"index.php\" method=\"POST\">";
$takeBack .= "<input type=\"hidden\" name=\"check\" value=\"true\">";
$takeBack .= "<input type=\"hidden\" name=\"action\" value=\"deleteRequest\">";
$takeBack .= $table->flush();
$rakeBack .= "</form>";
/*
* Show fulfilled requests
*/
$requests = $DB->query("SELECT * FROM payoutRequests WHERE payoutTime IS NOT NULL AND applicant='" . $MySelf->getID() . "' ORDER BY time");
$table_done = new table(5, true);
$table_done->addHeader(">> Fulfilled payout requests");
$table_done->addRow("#060622");
$table_done->addCol("request");
$table_done->addCol("time");
$table_done->addCol("amount");
$table_done->addCol("Payout time");
$table_done->addCol("Paid by");
while ($request = $requests->fetchRow()) {
$table_done->addRow();
$table_done->addCol("#" . str_pad($request[request], "5", "0", STR_PAD_LEFT));
$table_done->addCol(date("d.m.y H:i:s", $request[time]));
$table_done->addCol(number_format($request[amount], 2) . " ISK");
//.........这里部分代码省略.........
示例10: table
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
include './functions/runs/MineralCalculations.php';
//Table Information
$conversion_info = new table(8, true);
$conversion_info->addHeader(">> Refine Information (Values Based on Full Batches needed for Refine)");
$conversion_info->addRow("#080816");
$conversion_info->addCol("Minerals", array("bold" => true, "colspan" => 8, "align" => "center"));
$conversion_info->addRow("#080822");
$conversion_info->addCol("Mineral", array("bold" => true, "colspan" => 2));
$conversion_info->addCol("Quantity", array("bold" => true));
$conversion_info->addCol("Refined m3", array("bold" => true));
$conversion_info->addCol("Mineral", array("bold" => true, "colspan" => 2));
$conversion_info->addCol("Quantity", array("bold" => true));
$conversion_info->addCol("Refined m3", array("bold" => true));
$conversion_info->addRow();
$conversion_info->addCol("<img width=\"32\" height=\"32\" src=\"./images/mats/Tritanium.png\">", array("width" => "64"));
$conversion_info->addCol("Tritanium", array("bold" => true));
$conversion_info->addCol(number_format($Tritanium, 0));
$conversion_info->addCol(number_format($Tritanium * 0.01, 2) . " m3");
$conversion_info->addCol("<img width=\"32\" height=\"32\" src=\"./images/mats/Pyerite.png\">", array("width" => "64"));
$conversion_info->addCol("Pyerite", array("bold" => true));
示例11: makeCanPage
function makeCanPage()
{
// Defining some globals.
global $DB;
global $TIMEMARK;
global $MySelf;
global $PREFS;
$USERNAME = $MySelf->getUsername();
$USERID = $MySelf->getID();
$TTL = getConfig("canLifeTime") * 60;
// is the cargo module active?
if (!getConfig("cargocontainer")) {
makeNotice("The admin has deactivated the events module.", "warning", "Module not active");
}
// Get all current locations.
$locations = $DB->getCol("SELECT DISTINCT location FROM runs ORDER BY location");
// Get all current cans.
$cans = $DB->getAssoc("SELECT * from cans");
// Get last can-nr.
$canNaming = $PREFS->getPref("CanNaming");
// Query the database accordingly.
if ($canNaming == 1) {
$maxCan = $DB->getCol("SELECT MAX(name) as max FROM cans WHERE pilot = '{$USERID}'");
} else {
$maxCan = $DB->getCol("SELECT MAX(name) as max FROM cans");
}
// For can-naming: Increment the number.
if ($maxCan[0] == "") {
// No can jettisoned yet.
$canname = "001";
} else {
if (is_numeric($maxCan[0])) {
// Can ejected, and it is numeric, we can increase that number.
$canname = str_pad($maxCan[0] + 1, "3", "0", STR_PAD_LEFT);
} else {
// User entered some non-numerical stuff, can not increase.
unset($canname);
}
}
// Get the system the users mining operation takes place in, if any.
$myRun = userInRun($USERNAME);
if ($myRun != false) {
$myLocation = $DB->getCol("SELECT location FROM runs WHERE id='{$myRun}'");
$myLocation = $myLocation[0];
}
// Assemble the locations dropdown menu.
if (!empty($locations)) {
// Loop through all the locations.
foreach ($locations as $location) {
// And preselect the location the users miningrun takes place, if any.
if ("{$location}" == "{$myLocation}") {
$ddm .= "<option selected value=\"{$location}\">{$location}</option>";
} else {
$ddm .= "<option value=\"{$location}\">{$location}</option>";
}
}
}
// Select all current cans owned by the pilot.
$CansDS = $DB->query("SELECT location, droptime, name, id, isFull, miningrun FROM cans WHERE pilot = '{$USERID}' ORDER BY droptime ASC");
if ($CansDS->numRows() > 0) {
// We have at least one can out there, lets do this.
$myCans = new table(7, true);
$myCans->addHeader(">> My cargo containers in space");
$mode = array("bold" => true);
$myCans->addRow("#060622");
$myCans->addCol("Name", $mode);
$myCans->addCol("Location", $mode);
$myCans->addCol("Self or Run", $mode);
$myCans->addCol("Droptime", $mode);
$myCans->addCol("est. Poptime", $mode);
$myCans->addCol("Time Left", $mode);
$myCans->addCol("Can is full", $mode);
while ($can = $CansDS->fetchRow()) {
$candroptime = $can[droptime];
// Time of can drop.
$poptime = $candroptime + $TTL;
// Extimated pop time (droptime + 1h)
$timeleft = $candroptime + $TTL - $TIMEMARK;
// Time left (poptime - current time)
$minsleft = str_pad(number_format(($timeleft - 60) / 60, 0), "2", "0", STR_PAD_LEFT);
$secsleft = str_pad($timeleft % 60, "2", "0", STR_PAD_LEFT);
if ($secsleft < 1) {
// We want all negative amounts to read "00".
$secsleft = "00";
}
// Colorize the remaining time
if ($minsleft >= 30) {
// More or equal 30 mins: Green. We are cool.
$color = "#88ff88";
} elseif ($minsleft <= 29 && $minsleft >= 15) {
// Less or equal 29 mins: Yellow, keep an eye out.
$color = "#FFFF00";
} elseif ($minsleft < 15) {
// Less than 15 minutes: Ayee! RED! Refresh!s
$color = "#FF0000";
}
$myCans->addRow();
$myCans->addCol("<a href=\"index.php?action=popcan&id={$can['id']}\"><b>{$can['name']}</b></a>");
$system = new solarSystem($can[location]);
$myCans->addCol($system->makeFancyLink());
//.........这里部分代码省略.........
示例12: makeWelcome
function makeWelcome()
{
// Load the globals.
global $VERSION;
global $SITENAME;
global $IGB;
global $IGB_VISUAL;
global $MySelf;
global $DB;
global $ValidUntil;
/* HTML stuff */
$page = "<h2>Welcome to {$VERSION}!</h2>";
/* The welcome table */
$table = new table(2, true);
$table->addHeader(">> Welcome to {$VERSION}");
$table->addRow();
$table->addCol("Logged in as:", array("bold" => true, "align" => "right"));
$table->addCol(ucfirst($MySelf->getUsername()));
$table->addRow();
$table->addCol("Registered Rank:", array("bold" => true, "align" => "right"));
$table->addCol($MySelf->getRankName());
$table->addRow();
$table->addCol("Latest login:", array("bold" => true, "align" => "right"));
if ($MySelf->getLastlogin() < 1) {
$table->addCol("This is your very first login! Welcome!");
} else {
$table->addCol(date("r", $MySelf->getLastlogin()));
}
$table->addRow();
$table->addCol("Your account:", array("bold" => true, "align" => "right"));
$table->addCol(number_format(getCredits($MySelf->getID()), 2) . " ISK");
$table->addRow();
$table->addCol("Your profile:", array("bold" => true, "align" => "right"));
$table->addCol(makeProfileLink($MySelf->getID()));
global $BLESSED;
if ($BLESSED) {
$table->addRow("#330000");
$table->addCol("Installation Blessed!", array("bold" => true, "align" => "right"));
$table->addCol("It is not affected by expiration. It runs with the highest priority on the server and all limitations have been lifted.");
}
// Set the filename to the announce textfile.
$announceFile = "/path/to/your/announce/txt.file";
// Check its existance...
if (file_exists($announceFile)) {
// Then load it.
$globalAnnounce = file_get_contents($announceFile);
}
// Only display contents if more than X characters long.
if (strlen($globalAnnounce) > 10) {
// Create announcement table...
$announceTable = new table(1, true);
$announceTable->addHeader(">>> Important hosting information");
$announceTable->addRow();
$announceTable->addCol("{$globalAnnounce}");
// ... and add it to the page.
$page .= $announceTable->flush();
}
$page .= $table->flush();
/* Show failed Logins to admins. */
if ($MySelf->isAdmin()) {
$page .= showFailedLogins("15");
} else {
$page .= showFailedLogins("10", $MySelf->getUsername());
}
/* permissions table */
$permsTable = new table(1, true);
$permsTable->addHeader(">> Your permissions");
// Permissions matrix
$perms = array("canLogin" => "log in.", "canJoinRun" => "join mining operations.", "canCreateRun" => "create new mining operations.", "canCloseRun" => "close mining operations.", "canDeleteRun" => "delete mining operations.", "canAddHaul" => "haul to mining operations.", "canSeeEvents" => "view scheduled events.", "canEditEvents" => "add and delete scheduled events.", "canChangePwd" => "change your own password.", "canChangeEmail" => "change your own email.", "canChangeOre" => "manage ore prices and enable/disable them.", "canAddUser" => "add new accounts.", "canSeeUsers" => "see other accounts.", "canDeleteUser" => "delete other accounts.", "canEditRank" => "edit other peoples ranks.", "canManageUser" => "grant and take permissions.", "isAccountant" => "manage the corporation wallet and authorize payments.", "isOfficial" => "create official mining runs (with payout).");
$permDS = $DB->getAssoc("SELECT * FROM users WHERE id='" . $MySelf->getID() . "' AND deleted='0'");
$keys = array_keys($perms);
foreach ($keys as $key) {
if ($permDS[$MySelf->getID()][$key] == 1) {
$permsTable->addRow();
$permsTable->addCol("You are allowed to " . $perms[$key]);
}
}
$permsTable->addHeader("If you believe your permissions are faulty, consult your CEO immediatly.");
// Show the balance
$balance = getTransactions($MySelf->getID());
$logins = getLogins($MySelf->getID());
$page .= "<br>" . $balance . "<br>" . $permsTable->flush() . "<br>" . $logins;
// .. then return it.
return $page;
}
示例13: table
<div class="col-lg-8 col-md-7">
<div class="panel">
<div class="top">
<h3><?php
echo lang::get('server_info');
?>
</h3>
</div>
<div class="content">
<?php
$table = new table(['class' => ['horizontal']]);
$table->addCollsLayout('40%, *');
$table->addSection('tbody');
$table->addRow()->addCell(lang::get('distribution'), ['class' => 'first'])->addCell($host->distribution());
$table->addRow()->addCell(lang::get('firmware'), ['class' => 'first'])->addCell($host->firmware());
$table->addRow()->addCell(lang::get('hostname'), ['class' => 'first'])->addCell($host->hostname());
$table->addRow()->addCell(lang::get('kernel'), ['class' => 'first'])->addCell($host->kernel());
$ethernet = $host->ethernet();
$table->addRow()->addCell(lang::get('ethernet'), ['class' => 'first'])->addCell('Up: ' . byteToSize($ethernet['up']) . ' / Down: ' . byteToSize($ethernet['down']));
echo $table->show();
?>
</div>
</div>
</div>
<div class="col-lg-4 col-md-5">
<h2><?php
示例14: table
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Create a new table for the general info.
$general_info = new table(2, true);
// Header
$general_info->addHeader(">> General Information");
// Row: Mining Run ID
$general_info->addRow();
$general_info->addCol("Mining ID:", $common_mode);
$general_info->addCol(str_pad($row['id'], 5, "0", STR_PAD_LEFT));
// Row: Is official run?
$general_info->addRow();
$general_info->addCol("This run is official:", $common_mode);
$general_info->addCol(yesno($row['isOfficial'], true));
// Row: Op Type
$general_info->addRow();
$general_info->addCol("Op Type:", $common_mode);
$general_info->addCol($row['optype'] == "" ? "Standard" : $row['optype']);
// Row: Supervisor Name
$general_info->addRow();
$general_info->addCol("Supervisor:", $common_mode);
$general_info->addCol(makeProfileLink($row['supervisor']));
// Row: Taxes
示例15: showEvent
function showEvent()
{
// Lets import some globals, shall we?
global $MySelf;
global $DB;
global $TIMEMARK;
$ID = $MySelf->getID();
// is the events module active?
if (!getConfig("events")) {
makeNotice("The admin has deactivated the events module.", "warning", "Module not active");
}
// Are we allowed to be here?
if (!$MySelf->canSeeEvents()) {
makeNotice("You are not allowed to do this!", "error", "Forbidden");
}
// Is the ID safe?
if (!is_numeric($_GET[id]) || $_GET[id] < 0) {
makeNotice("Invalid ID given!", "error", "Invalid Data");
}
// Load the event.
$EVENTS = $DB->getRow("SELECT * FROM events WHERE id='{$_GET['id']}'");
$mission = new table(2, true);
$mission->addHeader(">> Mission information");
$mission->addRow();
$mission->addCol("Mission ID:");
$mission->addCol(str_pad("{$EVENTS['id']}", 5, "0", STR_RIGHT_PAD));
$mission->addRow();
$mission->addCol("Mission Type:");
$mission->addCol($EVENTS[type]);
$mission->addRow();
$mission->addCol("Executing Officer:");
// In case of a numeric value we have to translate that into plain english.
if (is_numeric($EVENTS[officer])) {
$officer = idToUsername($EVENTS[officer]);
} else {
$officer = $EVENTS[officer];
}
$mission->addCol(ucfirst($officer));
$mission->addRow();
$mission->addCol("System:");
$mission->addCol(ucfirst($EVENTS[system]));
$mission->addRow();
$mission->addCol("Security:");
$mission->addCol($EVENTS[security]);
// Has the event started yet?
$delta = $TIMEMARK - $EVENTS[starttime];
if ($delta > 0) {
// Yep!
$mission->addRow();
$mission->addCol("Mission underway for:");
$mission->addCol(numberToString($delta));
} else {
// Nope!
$delta = $delta * -1;
$mission->addRow();
$mission->addCol("Mission will start in:");
$mission->addCol(numberToString($delta));
}
$mission->addRow();
$mission->addCol("Est. Duration:");
$mission->addCol($EVENTS[duration]);
// How difficult is it?
$mission->addRow();
$mission->addCol("Difficulty:");
switch ($EVENTS[difficulty]) {
case 0:
$mission->addCol("No risk involved");
break;
case 1:
$mission->addCol("Inferior forces");
break;
case 2:
$mission->addCol("Adequate forces");
break;
case 3:
$mission->addCol("Major forces expected");
break;
case 4:
$mission->addCol("Superior forces expected");
break;
case 5:
$mission->addCol("Suicide Mission");
break;
}
$mission->addRow();
$mission->addCol("Payment:");
$mission->addCol($EVENTS[payment]);
$mission->addRow();
$mission->addCol("Collateral:");
$mission->addCol(number_format($EVENTS[collateral]));
$mission->addRow();
$mission->addCol("Notes:");
$mission->addCol(nl2br($EVENTS[notes]));
$shipsTable = new table(3, true);
$shipsTable->addHeader(">> Shiptypes and Joinups");
// Compute the wanted Ships.
$ships = unserialize($EVENTS[ships]);
$SHIPTYPES = array("shuttles", "frigates", "destroyers", "cruisers", "bcruiser", "scruiser", "bship", "dread", "carrier", "titan", "barges", "indies", "freighter", "jfreighter", "exhumer");
$TRANSLATE = array("shuttles" => "Shuttle", "frigates" => "Frigate", "destroyers" => "Destroyer", "cruisers" => "Cruiser", "bcruiser" => "Battlecruiser", "scruiser" => "Strategic Cruiser", "bship" => "Battleship", "dread" => "Dreadnought", "carrier" => "Carrier", "titan" => "Titan", "barges" => "Mining Barge", "indies" => "Industrial Ship", "freighter" => "Freighter", "jfreighter" => "Jump Freighter", "exhumer" => "Exhumer");
$shipsTable->addRow("#060622");
//.........这里部分代码省略.........