function showOrganizationsInfo($getPage_connection2) { $nationInfo = getNationInfo($getPage_connection2, $_SESSION["nation_id"]); $authorityReport = getAuthorityReport($nationInfo["authority"]); $economyReport = getEconomyReport($nationInfo["economy"]); echo " <div class=\"spacing-from-menu well well-lg standard-text\">\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Top 5 Organizations, according to the previous turn's statistics.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Top Organizations <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseTop\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseTop\" class=\"panel-body collapse in\">\n"; for ($a = 1; $a < 6; $a++) { $found = false; $organization = array("id" => 0, "name" => "", "members" => 0, "managers" => 0, "pending" => 0, "ranking" => 0); if ($stmt = $getPage_connection2->prepare("SELECT id,name,members,managers,ranking,pending FROM organizations WHERE ranking=? ORDER BY ranking DESC LIMIT 1")) { $stmt->bind_param("i", $a); $stmt->execute(); $stmt->bind_result($r_id, $r_name, $r_members, $r_managers, $r_pending, $r_ranking); $stmt->fetch(); $organization["id"] = $r_id; $organization["name"] = $r_name; if (stripos($r_members, ",")) { $organization["members"] = explode(",", $r_members); } else { $organization["members"] = array(0 => $r_members); } // else if (stripos($r_managers, ",")) { $organization["managers"] = explode(",", $r_managers); } else { $organization["managers"] = array(0 => $r_managers); } // else if (stripos($r_pending, ",")) { $organization["pending"] = explode(",", $r_pending); } else { $organization["pending"] = array(0 => $r_pending); } // else $organization["ranking"] = $r_ranking; if ($organization["id"] >= 1) { $found = true; } // if $stmt->close(); } else { break; } // else if ($found === true) { if (count($organization["members"]) >= 2) { echo " " . $a . ". " . $organization["name"] . " - " . count($organization["members"]) . " members\n"; } else { echo " " . $a . ". " . $organization["name"] . " - " . count($organization["members"]) . " member\n"; } // else echo " <br />\n"; } // if } // for echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Create a new organization.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Create New <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseCreate\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseCreate\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <form action=\"index.php?page=organizations\" method=\"post\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"organizations\" />\n"; echo " <div class=\"form-group form-group-sm\">\n"; echo " <label class=\"control-label\" for=\"orgname\">Name:</label>\n"; echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify name of organization.\" name=\"orgname\" type=\"text\" class=\"form-control input-md\" id=\"orgname\" placeholder=\"Name of New Organization\" />\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Submit new organization.\" value=\"create\" name=\"action\" id=\"org_create\" type=\"submit\" class=\"btn btn-md btn-primary\">Create</button>\n"; echo " </div>\n"; echo " </form>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; for ($z = 0; $z < count($nationInfo["invites"]); $z++) { if ($nationInfo["invites"][$z] > 0) { $organizationInfo1 = getOrganizationInfo($getPage_connection2, $nationInfo["invites"][$z]); echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Organization controls: invite.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">" . $organizationInfo1["name"] . " <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseOrg" . $z . "\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseOrg" . $z . "\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <form action=\"index.php?page=organizations\" method=\"post\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"organizations\" />\n"; echo " <input type=\"hidden\" name=\"org\" value=\"" . $organizationInfo1["id"] . "\" />\n"; echo " \t\t\t\t\t You have been invited to this organization. Do you wish to join it?\n"; echo " <div class=\"form-group form-group-sm\">\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Accept invitation to organization.\" value=\"join\" name=\"action\" id=\"join_org\" type=\"submit\" class=\"btn btn-md btn-success info_button\">Join Org</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Decline invitation to organization.\" value=\"decline\" name=\"action\" id=\"decline_org\" type=\"submit\" class=\"btn btn-md btn-danger info_button\">Decline Org</button>\n"; echo " </div>\n"; echo " </form>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; } // if } // for for ($z = 0; $z < count($nationInfo["organizations"]); $z++) { if ($nationInfo["organizations"][$z] > 0) { $organizationInfo1 = getOrganizationInfo($getPage_connection2, $nationInfo["organizations"][$z]); echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Organization controls.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">" . $organizationInfo1["name"] . " <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseOrg" . $z . "\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseOrg" . $z . "\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <form action=\"index.php?page=organizations\" method=\"post\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"organizations\" />\n"; echo " <input type=\"hidden\" name=\"org\" value=\"" . $organizationInfo1["id"] . "\" />\n"; echo " Current managers:\n"; echo " <br />\n"; for ($b = 0; $b < count($organizationInfo1["managers"]); $b++) { $nationInfoManager = getNationInfo($getPage_connection2, $organizationInfo1["managers"][$b]); if ($b > 0) { echo ", \n"; } // if echo " " . $nationInfoManager["name"] . "\n"; } // for echo " <br />\n"; echo " Current members:\n"; echo " <br />\n"; for ($b = 0; $b < count($organizationInfo1["members"]); $b++) { $nationInfoMember = getNationInfo($getPage_connection2, $organizationInfo1["members"][$b]); if ($b > 0) { echo ", \n"; } // if echo " " . $nationInfoMember["name"] . "\n"; } // for echo " <br />\n"; echo " <div class=\"form-group form-group-sm\">\n"; for ($a = 0; $a < count($organizationInfo1["managers"]); $a++) { if ($organizationInfo1["managers"][$a] == $_SESSION["nation_id"]) { echo " <input name=\"orgnation\" type=\"text\" class=\"form-control input-md\" id=\"orgnation\" placeholder=\"Name of Target Nation\" />\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Invite nation to the organization.\" value=\"invite\" name=\"action\" id=\"org_invite\" type=\"submit\" class=\"btn btn-md btn-success\">Invite Nation</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Kick nation from the organization.\" value=\"kick\" name=\"action\" id=\"org_kick\" type=\"submit\" class=\"btn btn-md btn-warning\">Kick Nation</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Appoint nation to be a manager of the organization.\" value=\"appoint\" name=\"action\" id=\"org_appoint\" type=\"submit\" class=\"btn btn-md btn-success\">Appoint Manager</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Dismiss nation from being a manager of the organization.\" value=\"dismiss\" name=\"action\" id=\"org_dismiss\" type=\"submit\" class=\"btn btn-md btn-warning\">Dismiss Manager</button>\n"; break; } // if } // for echo " <br />\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Leave organization membership.\" value=\"leave\" name=\"action\" id=\"org_leave\" type=\"submit\" class=\"btn btn-md btn-danger info_button\">Leave Org</button>\n"; echo " </div>\n"; echo " </form>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; } // if } // for echo " </div>\n"; echo " </div>\n"; }
function showInfoInfo($getPage_connection2) { echo " <div class=\"spacing-from-menu well well-lg standard-text\">\n"; if ($_SESSION["section"] == "nations") { $nationInfo = getNationInfo($getPage_connection2, $_SESSION["info_id"]); $continentInfo = getContinentInfo($getPage_connection2, $nationInfo["home"]); $authorityReport = getAuthorityReport($nationInfo["authority"]); $economyReport = getEconomyReport($nationInfo["economy"]); $rankingInfo = getRankingInfo($getPage_connection2, $_SESSION["info_id"]); echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View basic govermental policies.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Government <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseGovernment\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseGovernment\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <h3>" . $nationInfo["formal"] . "</h3>\n"; echo " <br />\n"; if (strlen($nationInfo["flag"]) >= 1) { echo " <img class=\"info_flag\" src=\"" . $nationInfo["flag"] . "\" alt=\"Flag of " . $nationInfo["name"] . "\" />\n"; } else { echo " <img class=\"info_flag\" src=\"images/blank.png\" alt=\"Flag of " . $nationInfo["name"] . "\" />\n"; } // else echo " <br />\n"; echo " <br />\n"; echo " <br />\n"; echo " Home Continent: " . $continentInfo["name"] . " (" . $nationInfo["home"] . ") \n"; echo " <br />\n"; echo " Authority: " . $nationInfo["authority"] . "/10\n"; echo " <br />\n"; echo " " . $authorityReport . "\n"; echo " <br />\n"; echo " Economy: " . $nationInfo["economy"] . "/10\n"; echo " <br />\n"; echo " " . $economyReport . "\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View general information about nation.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">General <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseGeneral\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseGeneral\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " Production: " . $nationInfo["production"] . ", #" . $rankingInfo["production"] . " in world\n"; echo " <br />\n"; echo " Money: " . $nationInfo["money"] . ", #" . $rankingInfo["money"] . " in world\n"; echo " <br />\n"; echo " Debt: " . $nationInfo["debt"] . "\n"; echo " <br />\n"; if ($nationInfo["happiness"] >= 4) { echo " Happiness: <img src=\"images/happiness/4.png\" alt=\"Very Happy\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } else { if ($nationInfo["happiness"] >= 3) { echo " Happiness: <img src=\"images/happiness/3.png\" alt=\"Happy\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } else { if ($nationInfo["happiness"] >= 2) { echo " Happiness: <img src=\"images/happiness/2.png\" alt=\"Neutral\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } else { echo " Happiness: <img src=\"images/happiness/1.png\" alt=\"Unhappy\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } } } // else echo " <br />\n"; echo " Food: " . round($nationInfo["food"], 2, PHP_ROUND_HALF_UP) . ", #" . $rankingInfo["food"] . " in world\n"; echo " <br />\n"; echo " Population: " . $nationInfo["population"] . ", #" . $rankingInfo["population"] . " in world\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View organizations that nation is currently a member of.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Organizations <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseOrganizations\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseOrganizations\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " "; $belongstoOrgs = false; for ($z = 0; $z < count($nationInfo["organizations"]); $z++) { if ($z >= 1 && $nationInfo["organizations"][0] > 0) { echo ", "; } // if if ($nationInfo["organizations"][$z] >= 1) { $organizationInfo1 = getOrganizationInfo($getPage_connection2, $nationInfo["organizations"][$z]); echo "<a href=\"index.php?page=info&section=orgs&info_id=" . $organizationInfo1["id"] . "\">" . $organizationInfo1["name"] . "</a>"; if (strlen($organizationInfo1["name"]) >= 1) { $belongsToOrgs = true; } // if } // if } // for echo " \n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; } else { $organizationInfo = getOrganizationInfo($getPage_connection2, $_SESSION["info_id"]); echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View general information about organization.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">General <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseGeneral\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseGeneral\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <h3>" . $organizationInfo["name"] . "</h3>\n"; echo " <br />\n"; echo " Ranking: " . $organizationInfo["ranking"] . " \n"; echo " <br />\n"; echo " <br />\n"; echo " Managers: " . count($organizationInfo["managers"]) . "\n"; echo " <br />\n"; for ($z = 0; $z < count($organizationInfo["managers"]); $z++) { if ($z >= 1) { echo ", "; } // if if ($organizationInfo["managers"][$z] >= 1) { $nationInfo1 = getNationInfo($getPage_connection2, $organizationInfo["managers"][$z]); echo "<a href=\"index.php?page=info&section=nations&info_id=" . $nationInfo1["id"] . "\">" . $nationInfo1["name"] . "</a>"; } // if } // for echo " <br />\n"; echo " Members: " . count($organizationInfo["members"]) . "\n"; echo " <br />\n"; for ($za = 0; $z < count($organizationInfo["members"]); $za++) { if ($za >= 1) { echo ", "; } // if if ($organizationInfo["members"][$za] >= 1) { $nationInfo1 = getNationInfo($getPage_connection2, $organizationInfo["members"][$za]); echo "<a href=\"index.php?page=info&section=nations&info_id=" . $nationInfo1["id"] . "\">" . $nationInfo1["name"] . "</a>"; } // if } // for echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; } // else echo " </div>\n"; }
function showPoliciesInfo($getPage_connection2) { $nationInfo = getNationInfo($getPage_connection2, $_SESSION["nation_id"]); $continentInfo = getContinentInfo($getPage_connection2, $nationInfo["home"]); $productionInfo = getProductionInfo($getPage_connection2, $_SESSION["nation_id"]); $authorityReport = getAuthorityReport($nationInfo["authority"]); $economyReport = getEconomyReport($nationInfo["economy"]); $rankingInfo = getRankingInfo($getPage_connection2, $_SESSION["nation_id"]); echo " <div class=\"spacing-from-menu well well-lg standard-text\">\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View basic govermental policies.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Government <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseGovernment\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseGovernment\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <h3>" . $nationInfo["formal"] . "</h3>\n"; echo " <br />\n"; if (strlen($nationInfo["flag"]) >= 1) { echo " <img class=\"info_flag\" src=\"" . $nationInfo["flag"] . "\" alt=\"Flag of " . $nationInfo["name"] . "\" />\n"; } else { echo " <img class=\"info_flag\" src=\"images/blank.png\" alt=\"Flag of " . $nationInfo["name"] . "\" />\n"; } // else echo " <br />\n"; echo " <br />\n"; echo " <br />\n"; echo " Home Continent: " . $continentInfo["name"] . " (" . $nationInfo["home"] . ") \n"; echo " <br />\n"; echo " Authority: " . $nationInfo["authority"] . "/10\n"; echo " <br />\n"; echo " " . $authorityReport . "\n"; echo " <br />\n"; echo " Economy: " . $nationInfo["economy"] . "/10\n"; echo " <br />\n"; echo " " . $economyReport . "\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Change basic govermental policies.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Change Policies <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseChange\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseChange\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <label class=\"control-label\">Reform Government:</label> \n"; echo " <form action=\"index.php?page=policies\" method=\"post\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"policies\" />\n"; if ($nationInfo["authorityChanged"] == 0) { echo " <div class=\"form-group form-group-sm\">\n"; if ($nationInfo["authority"] > 0) { echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Decrease authority. This will mean less state control of society.\" value=\"aminus\" name=\"action\" id=\"authority_decrease\" type=\"submit\" class=\"btn btn-md btn-primary\"><span class=\"glyphicon glyphicon-minus\"></span></button>\n"; } // if echo " Authority\n"; if ($nationInfo["authority"] < 10) { echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Increase authority. This will mean more state control of society.\" value=\"aplus\" name=\"action\" id=\"authority_increase\" type=\"submit\" class=\"btn btn-md btn-primary\"><span class=\"glyphicon glyphicon-plus\"></span></button>\n"; } // if echo " </div>\n"; } else { echo " Authority has already been reformed this turn. <br />\n"; } // else if ($nationInfo["economyChanged"] == 0) { echo " <div class=\"form-group form-group-sm\">\n"; if ($nationInfo["economy"] > 0) { echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Decrease economic control. This will mean less state intervention in the economy.\" value=\"eminus\" name=\"action\" id=\"economy_decrease\" type=\"submit\" class=\"btn btn-md btn-primary\"><span class=\"glyphicon glyphicon-minus\"></span></button>\n"; } // if echo " Economy\n"; if ($nationInfo["economy"] < 10) { echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Increase economic control. This will mean more state intervention in the economy.\" value=\"eplus\" name=\"action\" id=\"economy_increase\" type=\"submit\" class=\"btn btn-md btn-primary\"><span class=\"glyphicon glyphicon-plus\"></span></button>\n"; } // if echo " </div>\n"; } else { echo " Economy has already been reformed this turn. <br />\n"; } // else echo " <div class=\"form-group form-group-sm\">\n"; echo " <label class=\"control-label\" for=\"formal\">Formal Name:</label>\n"; echo " <input name=\"formalname\" type=\"text\" class=\"form-control input-md\" id=\"formal\" placeholder=\"New Formal Name of Nation\" />\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Change long formal name of nation. This will not affect the regular short name of your nation!\" value=\"formal\" name=\"action\" id=\"formal_change\" type=\"submit\" class=\"btn btn-md btn-primary\">Change Formal Name</button>\n"; echo " </div>\n"; echo " </form>\n"; echo " <form action=\"index.php?page=policies&action=flag\" method=\"post\" enctype=\"multipart/form-data\">\n"; echo " <div class=\"form-group form-group-sm\">\n"; echo " <label class=\"control-label\" for=\"fileToUpload\">Upload New Flag:</label>\n"; echo " <br />\n"; echo " <span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Select an image file from your computer to be your new flag.\" class=\"btn btn-med btn-default btn-file\">\n"; echo " Browse <input type=\"file\" name=\"fileToUpload\" id=\"fileToUpload\" />\n"; echo " </span>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Upload your new flag.\" value=\"flag\" name=\"action\" type=\"submit\" class=\"btn btn-md btn-primary\">Change Flag</button>\n"; echo " </div>\n"; echo " </form>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Change production expenditure and prioritization.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Production <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseProduction\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseProduction\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <form action=\"index.php?page=policies\" method=\"post\">\n"; echo " <div class=\"form-group form-group-sm\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"policies\" />\n"; echo " <label class=\"control-label\" for=\"slider1\">Production Spending Percentage:</label>\n"; echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Change the amount of production you spend for this turn. Remember that production does not transfer over to the next turn!\" name=\"prod-percent\" id=\"slider1\" type=\"range\" min=\"0\" max=\"100\" step=\"5\" value=\"" . $productionInfo["spending"] . "\" class=\"\" />\n"; echo " <br />\n"; $productionInfo1 = getProductionInfo($getPage_connection2, $_SESSION["nation_id"]); if ($productionInfo1["id"] >= 1) { for ($k = 0; $k < count($productionInfo1["goods"]) + 1; $k++) { $new_index = $k + 1; $goodsInfo2 = getGoodsInfo($getPage_connection2, $new_index); if ($goodsInfo2["id"] >= 1) { echo " <label class=\"control-label\" for=\"slider_prod-" . $goodsInfo2["name"] . "\">Emphasize " . $goodsInfo2["name"] . ":</label>\n"; echo " " . round($goodsInfo2["productionRequired"], 2, PHP_ROUND_HALF_UP) . " Production, " . round($goodsInfo2["foodRequired"], 2, PHP_ROUND_HALF_UP) . " Food"; for ($t = 0; $t < count($goodsInfo2["resourceTypesRequired"]); $t++) { if ($goodsInfo2["resourceTypesRequired"][$t] >= 1) { echo ", "; $resourceTypeInfo1 = getResourceTypeInfo($getPage_connection2, $goodsInfo2["resourceTypesRequired"][$t]); echo $goodsInfo2["resourceQuantitiesRequired"][$t] . " " . $resourceTypeInfo1["name"]; } // if } // for echo "\n"; $productionType = $goodsInfo2["id"]; if (strlen($productionType) >= 1) { echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Change prioritization of producing this good.\" name=\"prod[" . $k . "]\" id=\"slider_prod-" . $productionType . "\" type=\"range\" min=\"0\" max=\"3\" step=\"1\" value=\"" . $productionInfo1["goods"][$k] . "\" />\n"; } else { echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Change prioritization of producing this good.\" name=\"prod[" . $k . "]\" id=\"slider_prod-" . $productionType . "\" type=\"range\" min=\"0\" max=\"3\" step=\"1\" value=\"0\" />\n"; } // else } // if } // for } // if echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Submit changes to production expenditure and prioritization.\" value=\"prod\" name=\"action\" id=\"prod_change\" type=\"submit\" class=\"btn btn-md btn-primary\">Set Production</button>\n"; echo " </div>\n"; echo " </form>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View general information about nation.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">General <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseGeneral\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseGeneral\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " Production: " . $nationInfo["production"] . ", #" . $rankingInfo["production"] . " in world\n"; echo " <br />\n"; echo " Money: " . $nationInfo["money"] . ", #" . $rankingInfo["money"] . " in world\n"; echo " <br />\n"; echo " Debt: " . $nationInfo["debt"] . "\n"; echo " <br />\n"; if ($nationInfo["happiness"] >= 4) { echo " Happiness: <img src=\"images/happiness/4.png\" alt=\"Very Happy\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } else { if ($nationInfo["happiness"] >= 3) { echo " Happiness: <img src=\"images/happiness/3.png\" alt=\"Happy\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } else { if ($nationInfo["happiness"] >= 2) { echo " Happiness: <img src=\"images/happiness/2.png\" alt=\"Neutral\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } else { echo " Happiness: <img src=\"images/happiness/1.png\" alt=\"Unhappy\" />" . $nationInfo["happiness"] . ", #" . $rankingInfo["happiness"] . " in world\n"; } } } // else echo " <br />\n"; echo " Food: " . round($nationInfo["food"], 2, PHP_ROUND_HALF_UP) . ", #" . $rankingInfo["food"] . " in world\n"; echo " <br />\n"; echo " Population: " . $nationInfo["population"] . ", #" . $rankingInfo["population"] . " in world\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View goods inventory statistics of nation.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Goods <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseGoods\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseGoods\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; for ($zz = 0; $zz < count($nationInfo["goods"]); $zz++) { $goodsInfoK = getGoodsInfo($getPage_connection2, $zz + 1); echo " " . $goodsInfoK["name"] . ": " . $nationInfo["goods"][$zz] . "\n"; echo " <br />\n"; } // for echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View resources inventory statistics of nation.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Resources <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseResources\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseResources\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; for ($zz = 0; $zz < count($nationInfo["resources"]); $zz++) { $resourceTypeInfoK = getResourceTypeInfo($getPage_connection2, $zz + 1); echo " " . $resourceTypeInfoK["name"] . ": " . $nationInfo["resources"][$zz] . "\n"; echo " <br />\n"; } // for echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View organizations that nation is currently a member of.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Organizations <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseOrganizations\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseOrganizations\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " "; $belongstoOrgs = false; for ($z = 0; $z < count($nationInfo["organizations"]); $z++) { if ($z >= 1 && $nationInfo["organizations"][0] > 0) { echo ", "; } // if if ($nationInfo["organizations"][$z] >= 1) { $organizationInfo1 = getOrganizationInfo($getPage_connection2, $nationInfo["organizations"][$z]); echo "<a href=\"index.php?page=info&section=orgs&info_id=" . $organizationInfo1["id"] . "\">" . $organizationInfo1["name"] . "</a>"; if (strlen($organizationInfo1["name"]) >= 1) { $belongsToOrgs = true; } // if } // if } // for echo " \n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; }
function showTradeInfo($getPage_connection2) { $nationInfo = getNationInfo($getPage_connection2, $_SESSION["nation_id"]); $tradeInfo = getTradeInfo($getPage_connection2, $_SESSION["nation_id"]); $authorityReport = getAuthorityReport($nationInfo["authority"]); $economyReport = getEconomyReport($nationInfo["economy"]); echo " <div class=\"spacing-from-menu well well-lg standard-text\">\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View and reply to pending trade agreements.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Pending Agreements <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapsePendingAgreements\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapsePendingAgreements\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; $agreementsExist = false; if ($stmt = $getPage_connection2->prepare("SELECT id FROM agreements ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_agreements = $r_result; $agreementInfo1 = getAgreementInfo($getPage_connection2, $next_agreements); if (($agreementInfo1["toNation"] == $_SESSION["nation_id"] || $agreementInfo1["fromNation"] == $_SESSION["nation_id"]) && $agreementInfo1["status"] == 0) { $agreementsExist = true; $toNationInfo = getNationInfo($getPage_connection2, $agreementInfo1["toNation"]); $fromNationInfo = getNationInfo($getPage_connection2, $agreementInfo1["fromNation"]); echo " To: <a href=\"index.php?page=info&section=nations&info_id=" . $toNationInfo["id"] . "\">" . $toNationInfo["name"] . "</a>, From: <a href=\"index.php?page=info&section=nations&info_id=" . $fromNationInfo["id"] . "\">" . $fromNationInfo["name"] . "</a>\n <br />\n"; echo " Agreement Policy: " . $agreementInfo1["policy"] . "\n <br />\n"; echo " " . $agreementInfo1["turns"] . " turns \n"; echo " <br />\n"; echo " <form action=\"index.php?page=trade#collapsePendingAgreements\" method=\"post\">\n"; echo " <div class=\"form-group form-group-xs\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"trade\" />\n"; echo " <input type=\"hidden\" name=\"actionid\" value=\"" . $agreementInfo1["id"] . "\" />\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Accept trade agreement proposal.\" name=\"action\" value=\"accept_agreement\" id=\"accept_agreement-" . $agreementInfo1["id"] . "\" type=\"submit\" class=\"btn btn-sm btn-success\">Accept</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Decline trade agreement proposal.\" name=\"action\" value=\"decline_agreement\" id=\"decline_agreement-" . $agreementInfo1["id"] . "\" type=\"submit\" class=\"btn btn-sm btn-danger\">Decline</button>\n"; echo " </div>\n"; echo " </form\">\n"; echo " ----\n <br />\n"; } // if } // while $stmt->close(); } else { } // else if ($agreementsExist === false) { echo " No agreements established.\n"; } // if echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View and reply to pending offers.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Pending Offers <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapsePendingOffers\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapsePendingOffers\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; $offersExist = false; if ($stmt = $getPage_connection2->prepare("SELECT id FROM offers ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_offers = $r_result; $offerInfo1 = getOfferInfo($getPage_connection2, $next_offers); if ($offerInfo1["toNation"] == $_SESSION["nation_id"] && $offerInfo1["status"] == 0) { if ($offerInfo1["givingItems"][0] > 0 || $offerInfo1["receivingItems"][0] > 0) { $offersExist = true; $toNationInfo = getNationInfo($getPage_connection2, $offerInfo1["toNation"]); $fromNationInfo = getNationInfo($getPage_connection2, $offerInfo1["fromNation"]); echo " To: <a href=\"index.php?page=info&section=nations&info_id=" . $toNationInfo["id"] . "\">" . $toNationInfo["name"] . "</a>, From: <a href=\"index.php?page=info&section=nations&info_id=" . $fromNationInfo["id"] . "\">" . $fromNationInfo["name"] . "</a>\n <br />\n"; if ($offerInfo1["givingItems"][0] > 0) { echo " Giving:\n <br />\n"; for ($z = 0; $z < count($offerInfo1["givingItems"]); $z++) { if ($offerInfo1["givingQuantities"][$z] > 0) { if ($offerInfo1["givingTypes"][$z] == "goods") { $itemInfo1 = getGoodsInfo($getPage_connection2, $offerInfo1["givingItems"][$z]); $name1 = $itemInfo1["name"]; } else { if ($offerInfo1["givingTypes"][$z] == "resources") { $itemInfo1 = getResourceTypeInfo($getPage_connection2, $offerInfo1["givingItems"][$z]); $name1 = $itemInfo1["name"]; } else { $name1 = "money"; } } // else echo " " . $offerInfo1["givingQuantities"][$z] . " " . $name1 . "\n <br />\n"; } // if } // for } else { echo " Giving:\n <br />\n Nothing.\n"; } // else if ($offerInfo1["receivingItems"][0] > 0) { echo " Receiving:\n <br />\n"; for ($z = 0; $z < count($offerInfo1["receivingItems"]); $z++) { if ($offerInfo1["receivingQuantities"][$z] > 0) { if ($offerInfo1["receivingTypes"][$z] == "goods") { $itemInfo1 = getGoodsInfo($getPage_connection2, $offerInfo1["receivingItems"][$z]); $name1 = $itemInfo1["name"]; } else { if ($offerInfo1["receivingTypes"][$z] == "resources") { $itemInfo1 = getResourceTypeInfo($getPage_connection2, $offerInfo1["receivingItems"][$z]); $name1 = $itemInfo1["name"]; } else { $name1 = "money"; } } // else echo " " . $offerInfo1["receivingQuantities"][$z] . " " . $name1 . "\n <br />\n"; } // if } // for } else { echo " Receiving:\n <br />\n Nothing.\n <br />\n"; } // else echo " " . $offerInfo1["turns"] . " turns \n"; echo " <br />\n"; echo " <form action=\"index.php?page=trade#collapsePendingOffers\" method=\"post\">\n"; echo " <div class=\"form-group form-group-xs\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"trade\" />\n"; echo " <input type=\"hidden\" name=\"actionid\" value=\"" . $offerInfo1["id"] . "\" />\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Accept offer.\" name=\"action\" value=\"accept_offer\" id=\"accept_offer-" . $offerInfo1["id"] . "\" type=\"submit\" class=\"btn btn-sm btn-success\">Accept</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Decline offer.\" name=\"action\" value=\"decline_offer\" id=\"decline_offer-" . $offerInfo1["id"] . "\" type=\"submit\" class=\"btn btn-sm btn-danger\">Decline</button>\n"; echo " </div>\n"; echo " </form\">\n"; echo " ----\n <br />\n"; } // if } // if } // while $stmt->close(); } else { } // else if ($offersExist === false) { echo " No offers established.\n"; } // if echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Create new trade agreement proposal.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Make Trade Agreement <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseMakeAgreement\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseMakeAgreement\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; if ($tradeInfo["limit"] > count($tradeInfo["routes"])) { echo " <form action=\"index.php?page=trade#collapseMakeAgreement\" method=\"post\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"trade\" />\n"; echo " <div class=\"form-group form-group-sm\">\n"; echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify target nation.\" name=\"send_nation\" type=\"text\" class=\"form-control input-md\" id=\"send_nation\" placeholder=\"Name of Target Nation\" />\n"; echo " <br />\n"; echo " <label class=\"control-label\" for=\"slider-agreement\">Trade Policy:</label>\n"; echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify trade agreement free trade policy arrangement. A lower number means less state intervention, and a higher number means more.\" name=\"agreement\" id=\"slider-agreement\" type=\"range\" min=\"1\" max=\"10\" step=\"1\" value=\"1\" />\n"; echo " <br />\n"; echo " <label class=\"control-label\" for=\"set_turns_agreement\">Turns:</label>\n"; echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify the duration of the deal.\" type=\"text\" name=\"turns\" id=\"set_turns_agreement\" class=\"form-control input-sm\" value=\"1\" placeholder=\"e.g. 1\" />\n"; echo " <br />\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Send deal to nation for consideration.\" value=\"send_agreement\" name=\"action\" id=\"send_agreement\" type=\"submit\" class=\"btn btn-md btn-success info_button\">Send</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Reset deal's contents to none.\" value=\"reset_agreement\" name=\"action\" id=\"reset_agreement\" type=\"submit\" class=\"btn btn-md btn-danger info_button\">Reset</button>\n"; echo " </div>\n"; echo " </form>\n"; } else { echo " You have no trade routes available.\n"; } // else echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Create new offer.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Make Offer <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseMakeOffer\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseMakeOffer\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; echo " <form action=\"index.php?page=trade#collapseMakeOffer\" method=\"post\">\n"; echo " <input type=\"hidden\" name=\"page\" value=\"trade\" />\n"; echo " <div class=\"form-group form-group-sm\">\n"; echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify target nation.\" name=\"send_nation\" type=\"text\" class=\"form-control input-md\" id=\"send_nation\" placeholder=\"Name of Target Nation\" />\n"; echo " <div class=\"col-md-6\">\n"; echo " <label for=\"add_offer\">Add Offer</label>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Add another offer (something the player's nation contributes).\" value=\"add_offer\" name=\"action\" id=\"add_offer\" type=\"submit\" class=\"btn btn-md btn-success\">Add</button>\n"; echo " <br />\n"; echo " <div id=\"offers\">\n"; for ($ff = 0; $ff <= count($_SESSION["offers"]); $ff++) { if ($ff < count($_SESSION["offers"])) { echo " <input type=\"hidden\" name=\"offers[" . $ff . "]\" value=\"1\" />\n"; echo " Offer <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify quantity of item.\" type=\"text\" name=\"offersQuantities[" . $ff . "]\" class=\"form-control input-sm\" placeholder=\"Quantity\" value=\"" . $_SESSION["offersQuantities"][$ff] . "\" />\n"; echo " <select data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify item.\" name=\"offersItems[" . $ff . "]\" class=\"form-control input-sm\">\n"; if ($stmt = $getPage_connection2->prepare("SELECT id FROM resources ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_resources = $r_result; $resourceTypeInfo1 = getResourceTypeInfo($getPage_connection2, $next_resources); if ($_SESSION["offersItems"][$ff] == $resourceTypeInfo1["id"] && $_SESSION["offersTypes"][$ff] == "resources") { echo " <option selected value=\"resources." . strtolower($resourceTypeInfo1["name"]) . "\">" . $resourceTypeInfo1["name"] . "</option>\n"; } else { echo " <option value=\"resources." . strtolower($resourceTypeInfo1["name"]) . "\">" . $resourceTypeInfo1["name"] . "</option>\n"; } // else } // while $stmt->close(); } else { } // else if ($stmt = $getPage_connection2->prepare("SELECT id FROM goods ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_goods = $r_result; $goodsInfo1 = getGoodsInfo($getPage_connection2, $next_goods); if ($_SESSION["offersItems"][$ff] == $goodsInfo1["id"] && $_SESSION["offersTypes"][$ff] == "goods") { echo " <option selected value=\"goods." . strtolower($goodsInfo1["name"]) . "\">" . $goodsInfo1["name"] . "</option>\n"; } else { echo " <option value=\"goods." . strtolower($goodsInfo1["name"]) . "\">" . $goodsInfo1["name"] . "</option>\n"; } // else } // while $stmt->close(); } else { } // else if ($_SESSION["offersTypes"][$ff] == "money") { echo " <option selected value=\"money.money\">Money</option>\n"; } else { echo " <option value=\"money.money\">Money</option>\n"; } // else if ($_SESSION["offersTypes"][$ff] == "food") { echo " <option selected value=\"food.food\">Food</option>\n"; } else { echo " <option value=\"food.food\">Food</option>\n"; } // else echo " </select>\n"; echo " <br />\n"; } else { echo " <input type=\"hidden\" name=\"offers[" . $ff . "]\" value=\"1\" />\n"; echo " Offer <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify quantity of item.\" type=\"text\" name=\"offersQuantities[" . $ff . "]\" class=\"form-control input-sm\" placeholder=\"Quantity\" value=\"0\" />\n"; echo " <select data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify item.\" name=\"offersItems[" . $ff . "]\" class=\"form-control input-sm\">\n"; if ($stmt = $getPage_connection2->prepare("SELECT id FROM resources ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_resources = $r_result; $resourceTypeInfo1 = getResourceTypeInfo($getPage_connection2, $next_resources); echo " <option value=\"resources." . strtolower($resourceTypeInfo1["name"]) . "\">" . $resourceTypeInfo1["name"] . "</option>\n"; } // while $stmt->close(); } else { } // else if ($stmt = $getPage_connection2->prepare("SELECT id FROM goods ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_goods = $r_result; $goodsInfo1 = getGoodsInfo($getPage_connection2, $next_goods); echo " <option value=\"goods." . strtolower($goodsInfo1["name"]) . "\">" . $goodsInfo1["name"] . "</option>\n"; } // while $stmt->close(); } else { } // else echo " <option value=\"money.money\">Money</option>\n"; echo " <option value=\"food.food\">Food</option>\n"; echo " </select>\n"; echo " <br />\n"; } // else } // for echo " </div>\n"; echo " </div>\n"; echo " <div class=\"col-md-6\">\n"; echo " <label for=\"add_demand\">Add Demand</label>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Add another demand (something the target nation contributes).\" value=\"add_demand\" name=\"action\" id=\"add_demand\" type=\"submit\" class=\"btn btn-md btn-success\">Add</button>\n"; echo " <br />\n"; echo " <div id=\"demands\">\n"; for ($ff = 0; $ff <= count($_SESSION["demands"]); $ff++) { if ($ff < count($_SESSION["demands"])) { echo " <input type=\"hidden\" name=\"demands[" . $ff . "]\" value=\"1\" />\n"; echo " Demand <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify quantity of item.\" type=\"text\" name=\"demandsQuantities[" . $ff . "]\" class=\"form-control input-sm\" placeholder=\"Quantity\" value=\"" . $_SESSION["demandsQuantities"][$ff] . "\" />\n"; echo " <select data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify item.\" name=\"demandsItems[" . $ff . "]\" class=\"form-control input-sm\">\n"; if ($stmt = $getPage_connection2->prepare("SELECT id FROM resources ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_resources = $r_result; $resourceTypeInfo1 = getResourceTypeInfo($getPage_connection2, $next_resources); if ($_SESSION["demandsItems"][$ff] == $resourceTypeInfo1["id"] && $_SESSION["demandsTypes"][$ff] == "resources") { echo " <option selected value=\"resources." . strtolower($resourceTypeInfo1["name"]) . "\">" . $resourceTypeInfo1["name"] . "</option>\n"; } else { echo " <option value=\"resources." . strtolower($resourceTypeInfo1["name"]) . "\">" . $resourceTypeInfo1["name"] . "</option>\n"; } // else } // while $stmt->close(); } else { } // else if ($stmt = $getPage_connection2->prepare("SELECT id FROM goods ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_goods = $r_result; $goodsInfo1 = getGoodsInfo($getPage_connection2, $next_goods); if ($_SESSION["demandsItems"][$ff] == $goodsInfo1["id"] && $_SESSION["demandsTypes"][$ff] == "goods") { echo " <option selected value=\"goods." . strtolower($goodsInfo1["name"]) . "\">" . $goodsInfo1["name"] . "</option>\n"; } else { echo " <option value=\"goods." . strtolower($goodsInfo1["name"]) . "\">" . $goodsInfo1["name"] . "</option>\n"; } // else } // while $stmt->close(); } else { } // else if ($_SESSION["demandsTypes"][$ff] == "money") { echo " <option selected value=\"money.money\">Money</option>\n"; } else { echo " <option value=\"money.money\">Money</option>\n"; } // else if ($_SESSION["demandsTypes"][$ff] == "food") { echo " <option selected value=\"food.food\">Food</option>\n"; } else { echo " <option value=\"food.food\">Food</option>\n"; } // else echo " </select>\n"; echo " <br />\n"; } else { echo " <input type=\"hidden\" name=\"demands[" . $ff . "]\" value=\"1\" />\n"; echo " Demand <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify quantity of item.\" type=\"text\" name=\"demandsQuantities[" . $ff . "]\" class=\"form-control input-sm\" placeholder=\"Quantity\" value=\"0\" />\n"; echo " <select data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify item.\" name=\"demandsItems[" . $ff . "]\" class=\"form-control input-sm\">\n"; if ($stmt = $getPage_connection2->prepare("SELECT id FROM resources ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_resources = $r_result; $resourceTypeInfo1 = getResourceTypeInfo($getPage_connection2, $next_resources); echo " <option value=\"resources." . strtolower($resourceTypeInfo1["name"]) . "\">" . $resourceTypeInfo1["name"] . "</option>\n"; } // while $stmt->close(); } else { } // else if ($stmt = $getPage_connection2->prepare("SELECT id FROM goods ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_goods = $r_result; $goodsInfo1 = getGoodsInfo($getPage_connection2, $next_goods); echo " <option value=\"goods." . strtolower($goodsInfo1["name"]) . "\">" . $goodsInfo1["name"] . "</option>\n"; } // while $stmt->close(); } else { } // else echo " <option value=\"money.money\">Money</option>\n"; echo " <option value=\"food.food\">Food</option>\n"; echo " </select>\n"; echo " <br />\n"; } // else } // for echo " </div>\n"; echo " </div>\n"; echo " <br />\n"; echo " <div class=\"col-md-12\">\n"; echo " <label class=\"control-label\" for=\"set_turns\">Turns:</label>\n"; echo " <input data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Specify the duration of the deal.\" type=\"text\" name=\"turns\" id=\"set_turns\" class=\"form-control input-sm\" value=\"1\" placeholder=\"e.g. 1\" />\n"; echo " </div>\n"; echo " <br />\n"; echo " <div class=\"col-md-12\">\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Send deal to nation for consideration.\" value=\"send_offer\" name=\"action\" id=\"send_offer\" type=\"submit\" class=\"btn btn-md btn-success info_button\">Send</button>\n"; echo " <button onclick=\"loadButton(this)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Reset deal's contents to none.\" value=\"reset_offer\" name=\"action\" id=\"reset_offer\" type=\"submit\" class=\"btn btn-md btn-danger info_button\">Reset</button>\n"; echo " </div>\n"; echo " </div>\n"; echo " </form>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View current market rates.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Current Market <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseMarket\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseMarket\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; if ($stmt = $getPage_connection2->prepare("SELECT id FROM market ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_market = $r_result; $marketInfo1 = getMarketInfo($getPage_connection2, $next_market); echo " " . $marketInfo1["name"] . ": " . $marketInfo1["rate"] . "% value\n <br />\n"; } // while $stmt->close(); } else { } // else echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View previously accepted trade agreements.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Accepted Agreements <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseAcceptedAgreements\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseAcceptedAgreements\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; $agreementsExist = false; if ($stmt = $getPage_connection2->prepare("SELECT id FROM agreements ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_agreements = $r_result; $agreementInfo1 = getAgreementInfo($getPage_connection2, $next_agreements); if (($agreementInfo1["toNation"] == $_SESSION["nation_id"] || $agreementInfo1["fromNation"] == $_SESSION["nation_id"]) && $agreementInfo1["status"] == 1) { $agreementsExist = true; $toNationInfo = getNationInfo($getPage_connection2, $agreementInfo1["toNation"]); $fromNationInfo = getNationInfo($getPage_connection2, $agreementInfo1["fromNation"]); echo " To: <a href=\"index.php?page=info&section=nations&info_id=" . $toNationInfo["id"] . "\">" . $toNationInfo["name"] . "</a>, From: <a href=\"index.php?page=info&section=nations&info_id=" . $fromNationInfo["id"] . "\">" . $fromNationInfo["name"] . "</a>\n <br />\n"; echo " Agreement Policy: " . $agreementInfo1["policy"] . "\n <br />\n"; echo " " . $agreementInfo1["counter"] . " / " . $agreementInfo1["turns"] . " turns \n"; echo " <br />\n"; echo " ----\n <br />\n"; } // if } // while $stmt->close(); } else { } // else if ($agreementsExist === false) { echo " No agreements established.\n"; } // if echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View previously accepted offers.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Accepted Offers <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseAcceptedOffers\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseAcceptedOffers\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; $offersExist = false; if ($stmt = $getPage_connection2->prepare("SELECT id FROM offers ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_offers = $r_result; $offerInfo1 = getOfferInfo($getPage_connection2, $next_offers); if (($offerInfo1["toNation"] == $_SESSION["nation_id"] || $offerInfo1["fromNation"] == $_SESSION["nation_id"]) && $offerInfo1["status"] == 1) { if ($offerInfo1["givingItems"][0] > 0 || $offerInfo1["receivingItems"][0] > 0) { $offersExist = true; $toNationInfo = getNationInfo($getPage_connection2, $offerInfo1["toNation"]); $fromNationInfo = getNationInfo($getPage_connection2, $offerInfo1["fromNation"]); echo " To: <a href=\"index.php?page=info&section=nations&info_id=" . $toNationInfo["id"] . "\">" . $toNationInfo["name"] . "</a>, From: <a href=\"index.php?page=info&section=nations&info_id=" . $fromNationInfo["id"] . "\">" . $fromNationInfo["name"] . "</a>\n <br />\n"; if ($offerInfo1["givingItems"][0] > 0) { echo " Giving:\n <br />\n"; for ($z = 0; $z < count($offerInfo1["givingItems"]); $z++) { if ($offerInfo1["givingQuantities"][$z] > 0) { if ($offerInfo1["givingTypes"][$z] == "goods") { $itemInfo1 = getGoodsInfo($getPage_connection2, $offerInfo1["givingItems"][$z]); $name1 = $itemInfo1["name"]; } else { if ($offerInfo1["givingTypes"][$z] == "resources") { $itemInfo1 = getResourceTypeInfo($getPage_connection2, $offerInfo1["givingItems"][$z]); $name1 = $itemInfo1["name"]; } else { $name1 = "money"; } } // else echo " " . $offerInfo1["givingQuantities"][$z] . " " . $name1 . "\n <br />\n"; } // if } // for } else { echo " Giving:\n <br />\n Nothing.\n"; } // else if ($offerInfo1["receivingItems"][0] > 0) { echo " Receiving:\n <br />\n"; for ($z = 0; $z < count($offerInfo1["receivingItems"]); $z++) { if ($offerInfo1["receivingQuantities"][$z] > 0) { if ($offerInfo1["receivingTypes"][$z] == "goods") { $itemInfo1 = getGoodsInfo($getPage_connection2, $offerInfo1["receivingItems"][$z]); $name1 = $itemInfo1["name"]; } else { if ($offerInfo1["receivingTypes"][$z] == "resources") { $itemInfo1 = getResourceTypeInfo($getPage_connection2, $offerInfo1["receivingItems"][$z]); $name1 = $itemInfo1["name"]; } else { $name1 = "money"; } } // else echo " " . $offerInfo1["receivingQuantities"][$z] . " " . $name1 . "\n <br />\n"; } // if } // for } else { echo " Receiving:\n <br />\n Nothing.\n"; } // else echo " <br />\n"; echo " " . $offerInfo1["counter"] . " / " . $offerInfo1["turns"] . " turns \n"; echo " <br />\n"; echo " ----\n <br />\n"; } // if } // if } // while $stmt->close(); } else { } // else if ($offersExist === false) { echo " No offers established.\n"; } // if echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View previously declined trade agreements.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Declined Agreements <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseDeclinedAgreements\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseDeclinedAgreements\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; $agreementsExist = false; if ($stmt = $getPage_connection2->prepare("SELECT id FROM agreements ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_agreements = $r_result; $agreementInfo1 = getAgreementInfo($getPage_connection2, $next_agreements); if (($agreementInfo1["toNation"] == $_SESSION["nation_id"] || $agreementInfo1["fromNation"] == $_SESSION["nation_id"]) && $agreementInfo1["status"] == 2) { $agreementsExist = true; $toNationInfo = getNationInfo($getPage_connection2, $agreementInfo1["toNation"]); $fromNationInfo = getNationInfo($getPage_connection2, $agreementInfo1["fromNation"]); echo " To: <a href=\"index.php?page=info&section=nations&info_id=" . $toNationInfo["id"] . "\">" . $toNationInfo["name"] . "</a>, From: <a href=\"index.php?page=info&section=nations&info_id=" . $fromNationInfo["id"] . "\">" . $fromNationInfo["name"] . "</a>\n <br />\n"; echo " Agreement Policy: " . $agreementInfo1["policy"] . "\n <br />\n"; echo " <br />\n"; echo " " . $agreementInfo1["counter"] . " / " . $agreementInfo1["turns"] . " turns \n"; echo " <br />\n"; echo " ----\n <br />\n"; } // if } // while $stmt->close(); } else { } // else if ($agreementsExist === false) { echo " No declined agreements exist so far.\n"; } // if echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <div class=\"panel panel-info\">\n"; echo " <div data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"View previously declined offers.\" class=\"panel-heading\">\n"; echo " <h3 class=\"panel-title\">Declined Offers <button type=\"button\" class=\"btn btn-default btn-md collapsed\" data-toggle=\"collapse\" data-target=\"#collapseDeclinedOffers\"><span class=\"glyphicon glyphicon-plus\"></span>/<span class=\"glyphicon glyphicon-minus\"></span></button></h3>\n"; echo " </div>\n"; echo " <div id=\"collapseDeclinedOffers\" class=\"panel-body collapse in\">\n"; echo " <div class=\"col-md-8 col-center\">\n"; $offersExist = false; if ($stmt = $getPage_connection2->prepare("SELECT id FROM offers ORDER BY id ASC")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($r_result); while ($stmt->fetch()) { $next_offers = $r_result; $offerInfo1 = getOfferInfo($getPage_connection2, $next_offers); if (($offerInfo1["toNation"] == $_SESSION["nation_id"] || $offerInfo1["fromNation"] == $_SESSION["nation_id"]) && $offerInfo1["status"] == 2) { if ($offerInfo1["givingItems"][0] > 0 || $offerInfo1["receivingItems"][0] > 0) { $offersExist = true; $toNationInfo = getNationInfo($getPage_connection2, $offerInfo1["toNation"]); $fromNationInfo = getNationInfo($getPage_connection2, $offerInfo1["fromNation"]); echo " To: <a href=\"index.php?page=info&section=nations&info_id=" . $toNationInfo["id"] . "\">" . $toNationInfo["name"] . "</a>, From: <a href=\"index.php?page=info&section=nations&info_id=" . $fromNationInfo["id"] . "\">" . $fromNationInfo["name"] . "</a>\n <br />\n"; if ($offerInfo1["givingItems"][0] > 0) { echo " Giving:\n <br />\n"; for ($z = 0; $z < count($offerInfo1["givingItems"]); $z++) { if ($offerInfo1["givingQuantities"][$z] > 0) { if ($offerInfo1["givingTypes"][$z] == "goods") { $itemInfo1 = getGoodsInfo($getPage_connection2, $offerInfo1["givingItems"][$z]); $name1 = $itemInfo1["name"]; } else { if ($offerInfo1["givingTypes"][$z] == "resources") { $itemInfo1 = getResourceTypeInfo($getPage_connection2, $offerInfo1["givingItems"][$z]); $name1 = $itemInfo1["name"]; } else { $name1 = "money"; } } // else echo " " . $offerInfo1["givingQuantities"][$z] . " " . $name1 . "\n <br />\n"; } // if } // for } else { echo " Giving:\n <br />\n Nothing.\n"; } // else if ($offerInfo1["receivingItems"][0] > 0) { echo " Receiving:\n <br />\n"; for ($z = 0; $z < count($offerInfo1["receivingItems"]); $z++) { if ($offerInfo1["receivingQuantities"][$z] > 0) { if ($offerInfo1["receivingTypes"][$z] == "goods") { $itemInfo1 = getGoodsInfo($getPage_connection2, $offerInfo1["receivingItems"][$z]); $name1 = $itemInfo1["name"]; } else { if ($offerInfo1["receivingTypes"][$z] == "resources") { $itemInfo1 = getResourceTypeInfo($getPage_connection2, $offerInfo1["receivingItems"][$z]); $name1 = $itemInfo1["name"]; } else { $name1 = "money"; } } // else echo " " . $offerInfo1["receivingQuantities"][$z] . " " . $name1 . "\n <br />\n"; } // if } // for } else { echo " Receiving:\n <br />\n Nothing.\n"; } // else echo " <br />\n"; echo " " . $offerInfo1["counter"] . " / " . $offerInfo1["turns"] . " turns \n"; echo " <br />\n"; echo " ----\n <br />\n"; } // if } // if } // while $stmt->close(); } else { } // else if ($offersExist === false) { echo " No declined offers exist so far.\n"; } // if echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; }