<?php
/****************************************************************************
* Copyright (C) 2000 Bryan Brunton
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/
page_open(array("sess" => "ME_Session_Uncached", "auth" => "ME_Auth", "user" => "ME_User"));
$sess->register("player_id");
$sess->register("player_dead");
include("./lib/player.php");
include("./lib/ship.php");
include("./lib/relations.php");
include("./merchantempiresdefines.php");
include("./lib/player_redirect.php");
?>
<html><head><title>Merchant Empires: Manage Relations</title>
<link rel=stylesheet href="./merchantempires.css" type=text/css>
</head><body text=white background="./images/createbg.gif"><?php
include("./templates/header.html");
?>
<table width=100%><tr>
<td width=100 vAlign=top><?php
$player = new ME_Player;
$player->get_player($player_id);
$player_dead = $player->f("dead");
$game_id = $player->f("game_id");
$ship = new ME_Ship;
$ship->get_ship($player_id);
$ship->add_parameter("time", date ("Y H:i:s"));
$ship->add_parameter("current_screen", "merchant");
echo $ship->get_transform("./xslt/mainmenu.xslt", $ship->get_xml());
?>
</td>
<td vAlign=top align=left width=0> </td>
<td vAlign=top width=500><?php
$db = new ME_DB_Xml;
$db->add_parameter("current_screen", "merchant_relations");
echo $db->get_transform("./xslt/menu_top_merchant.xslt", "");
$relations = new ME_Relations;
$relations->initialize($game_id, $player->f("race_number"));
$db_g = new ME_DB;
$db_g->query("select * from games where game_id = '$game_id'");
$db_g->next_record();
?>
<table border=0 cellPadding=0 cellSpacing=0>
<tr>
<td bgColor=#003399>
<table border=0 cellPadding=5 cellSpacing=1 width=500>
<tr>
<td width=500 bgColor=#000000 align=left valign=middle>
<table cols=2 width=100% border=0>
<tr>
<td valign=top width=250>
<font color=#3333FF face=arial,helvetica,swiss size=3>
<b>Personal Relations</b></font><br><?php
$db_g = new ME_DB;
$db_g->query("select * from games where game_id = '$game_id'");
$db_g->next_record();
echo "<table BORDER=0 cellpadding=0 cellspacing=0>";
$active_races = array();
$active_races = explode(",", $db_g->f("active_races"));
for ($i = 0; $i <= count($active_races) - 1; $i++) {
echo "<tr>";
echo "<td> <FONT color=#cccccc face=arial,helvetica,swiss size=2>" . $db_g->f("namerace_" . $active_races[$i]) . " </font></td><td><FONT face=arial,helvetica,swiss size=2> " . $player->f("relationrace_" . $active_races[$i]) . "</font></td>";
echo "</tr>";
}
echo "</table><br>";
?>
</td>
<td valign=top width=250>
<font color=#3333FF face=arial,helvetica,swiss size=3>
<b>Global Relations</b></font><br><?php
$db_g = new ME_DB;
$db_g->query("select * from games where game_id = '$game_id'");
$db_g->next_record();
echo "<table BORDER=0 cellpadding=0 cellspacing=0>";
echo "<tr>";
$active_races = array();
$active_races = explode(",", $db_g->f("active_races"));
for ($i = 0; $i <= count($active_races) - 1; $i++) {
if ( $player->f("race_number") <> $active_races[$i] ) {
echo "<tr>";
echo "<td> <FONT color=#cccccc face=arial,helvetica,swiss size=2>" . $db_g->f("namerace_" . $active_races[$i]) . " </font></td><td><FONT face=arial,helvetica,swiss size=2> ";
switch ($active_races[$i]) {
case 1:
echo $relations->get_relations_1();
break;
case 2:
echo $relations->get_relations_2();
break;
case 3:
echo $relations->get_relations_3();
break;
case 4:
echo $relations->get_relations_4();
break;
case 5:
echo $relations->get_relations_5();
break;
case 6:
echo $relations->get_relations_6();
break;
case 7:
echo $relations->get_relations_7();
break;
}
echo "</font></td>";
echo "</tr>";
}
}
echo "</table><br>";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign=top align=right width=100%><?php
include("./messages_display.php");
echo $player->get_transform("./xslt/player.xslt", $player->get_xml());
include("./ship_display.php");
?>
</td></tr></table>
</body></html><?php
page_close();
?>