<?php
/**
* Trade interface
*
* Displays {@link OFFL_Trade trades} and related interfaces. Users may act upon all trades they are involved in.
* Administrative rights allow for veto or approval of any trade.
*
* @author Stephen Rochelle <hide@address.com>
* @version OFFL v0.2
* @copyright Copyright (c) 2004 Stephen Rochelle. Some rights reserved.
* @package offl-ui
*/
// *****************************************
// Various work notes are scattered through file
//
// An admin mode must be implemented in the management area (allow vetoes / immediate approvals)
$pageTitle = "Trades";
if (empty($_REQUEST["action"]))
{ $_REQUEST["action"] = NULL; }
if (empty($_REQUEST["action"]))
{ $_REQUEST["action"] = $_REQUEST["action"]; }
if (isset($_REQUEST["mode"]))
{ $_REQUEST["mode"] = $_REQUEST["mode"]; }
if (isset($_REQUEST["trade_id"]))
{ $_REQUEST["trade_id"] = $_REQUEST["trade_id"]; }
if (isset($_REQUEST["trade_id"]))
{ $pageTitle = "Trade Detail"; }
if ($_REQUEST["action"] == "proposetrade")
{ $pageTitle = "Trade Proposal"; }
require_once("offlconfig.php");
require_once($DOC_ROOT . "/lib/header.php");
$isAdmin = FALSE;
if (($_REQUEST["mode"] == "admin") && $_SESSION["admin"])
{ $isAdmin = TRUE; }
$continue_with_page = TRUE;
if ($_REQUEST["action"] == "dropplayer")
{
$player = new OFFL_Player($_REQUEST["player_id"], $_SESSION["league_id"]);
if (($_SESSION["fflteam_id"] == $player->getFFLTeamID()) || $isAdmin)
{
if (!$player->getTradelock())
{
$player->setStarter(0);
$player->setFFLTeamID(0);
$player->setTradelock(0);
$player->setWaiverStatus(time());
$player->save();
echo "<h2 class=\"success\">" . $player->getName() . " has been dropped successfully.</h2>\n";
}
else
{
echo "<h2 class=\"error\">You cannot drop a player involved in a pending trade!</h2>\n";
}
}
else
{
echo "<h2 class=\"error\">You are not authorized to drop that player!</h2>\n";
}
}
if ($_REQUEST["action"] == "proposetrade")
{
if ($_REQUEST["step"] == "1")
{
$continue_with_page = FALSE;
echo "<script type=\"text/javascript\">\n"
?>
var teamplayerlist = new Array();
function populateList()
{
document.forms.teamplayerpick.elements[4].options.length = 0;
var teamSelected = document.forms.teamplayerpick.targetfflteam.options[document.forms.teamplayerpick.targetfflteam.selectedIndex].value;
var count = 1;
var name = "";
document.forms.teamplayerpick.elements[4].options[0] = new Option("No Player", "");
for (var i = 1; i < teamplayerlist.length; i++)
{
if (teamSelected == teamplayerlist[i][2])
{
document.forms.teamplayerpick.elements[4].options[count] = new Option(teamplayerlist[i][0], teamplayerlist[i][1]);
count++;
}
}
document.forms.teamplayerpick.elements[4].options[0].defaultSelected = true;
}
teamplayerlist[0] = ["No Player", 0, ""];
// name+pos+nfl player_id fflteam_id
<?php
$i = 1; // counter for teamplayerlist[]
$thisTeam = new OFFL_FFLTeam($_SESSION["fflteam_id"]);
$teams = $myleague->getAllFFLTeams();
foreach ($teams as $team)
{
if ($team->getFFLTeamID() == $_SESSION["fflteam_id"])
continue;
$roster = $team->getRoster();
foreach ($roster as $player)
{
echo " teamplayerlist[$i] = [\"" . $player->getName() . ", " . $player->getPositionAbbv() . " " . $player->getNFLTeamAbbv() . "\", " . $player->getPlayerID() . ", " . $player->getFFLTeamID() . "];\n";
$i++;
}
}
echo "</script>\n";
?> <form name="teamplayerpick" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="action" value="proposetrade" />
<input type="hidden" name="step" value="2" />
<table>
<tr>
<th>Players Offered</th>
<th>Trade With</th>
<th>Players Wanted</th>
</tr>
<tr>
<td valign="top">
<select multiple name="proposedplayers[]" size="10" style="width:250px">
<option value="">No Player</option>
<?php $thisRoster = $thisTeam->getRoster();
foreach($thisRoster as $player)
{
echo " <option value=\"" . $player->getPlayerID() . "\">" . $player->getName() . "," . $player->getPositionAbbv() . " " . $player->getNFLTeamAbbv() . "</option>\n";
}
?> </select>
</td>
<td valign="top">
<select name="targetfflteam" onchange="populateList()" size="10">
<?php
$firstTeamID = 0;
foreach ($teams as $team)
{
if ($team->getFFLTeamID() == $_SESSION["fflteam_id"])
continue;
if (!$firstTeamID)
$firstTeamID = $team->getFFLTeamID();
echo " <option value=\"" . $team->getFFLTeamID() . "\">" . $team->getFFLTeamCity() . " " . $team->getFFLTeamName() . "</option>\n";
}
?> </select>
</td>
<td valign="top">
<select multiple name="targetplayers[]" size="10" style="width:250px">
<?php
$thatTeam = new OFFL_FFLTeam($firstTeamID);
$thatRoster= $thatTeam->getRoster();
foreach($thatRoster as $player)
{
echo " <option value=\"" . $player->getPlayerID() . "\">" . $player->getName() . "," . $player->getPositionAbbv() . " " . $player->getNFLTeamAbbv() . "</option>\n";
}
?> </select>
</td>
</tr>
</table>
<input type="submit" value="Propose Trade" />
</form>
<?php
} // if step == 1
else if ($_REQUEST["step"] == 2)
{
$TradeOK = TRUE;
foreach ($_REQUEST["proposedplayers"] as $player_id)
{
if ($player_id != "")
{
$checkPlayer = new OFFL_Player($player_id, $myleague->getLeagueID());
if ($checkPlayer->getFFLTeamID() != $_SESSION["fflteam_id"])
{
$TradeOK = 0; // proposed player is not on proposing team!
}
}
}
foreach ($_REQUEST["targetplayers"] as $player_id)
{
if ($player_id != "")
{
$checkPlayer = new OFFL_Player($player_id, $myleague->getLeagueID());
if ($checkPlayer->getFFLTeamID() != $_REQUEST["targetfflteam"])
{
$TradeOK = 0; // proposed player is not on proposing team!
}
}
}
if ($TradeOK)
{
$trade = new OFFL_Trade();
$trade->setLeagueID($myleague->getLeagueID());
$trade->setProposedFFLTeamID($_SESSION["fflteam_id"]);
$trade->setTargetFFLTeamID($_REQUEST["targetfflteam"]);
$trade->setProposedPlayerIDArray($_REQUEST["proposedplayers"]);
$trade->setTargetPlayerIDArray($_REQUEST["targetplayers"]);
$trade->save();
echo "<h2 class=\"success\">Trade proposal submitted</h2>\n";
}
else
{
echo "<h2 class=\"error\">Trade proposal failed: player IDs did not match team IDs.</h2>\n";
}
}
} // if $_REQUEST["action"]
if ($_REQUEST["action"] == "accept")
// ******************************
// UI ON ALL OF THESE IS BAREBONES ONLY
// work on it!
{
$trade = new OFFL_Trade($_REQUEST["trade_id"]);
if ($_SESSION["fflteam_id"] == $trade->getTargetFFLTeamID())
{
$trade->setDeadline(time());
$trade->setStatus("accepted");
$trade->save();
echo "<h2 class=\"success\">Trade proposal accepted.</h2>\n";
}
else
{
echo "<h2 class=\"error\">You are not authorized to accept this trade proposal.</h2>\n";
}
}
if ($_REQUEST["action"] == "decline")
{
$trade = new OFFL_Trade($_REQUEST["trade_id"]);
if ($_SESSION["fflteam_id"] == $trade->getTargetFFLTeamID())
{
$trade->setDeadline(time());
$trade->setStatus("declined");
$trade->save();
echo "<h2 class=\"success\">Trade proposal declined.</h2>\n";
}
else
{
echo "<h2 class=\"error\">You are not authorized to decline this trade proposal.</h2>\n";
}
}
if ($_REQUEST["action"] == "cancel")
{
// VERIFICATION: SESSION FFLTEAMID == PROPOSEDFFLTEAMID
$trade = new OFFL_Trade($_REQUEST["trade_id"]);
if ($_SESSION["fflteam_id"] == $trade->getProposedFFLTeamID())
{
$trade->deleteTrade();
echo "<h2 class=\"success\">Trade proposal cancelled.</h2>\n";
unset($_REQUEST["trade_id"]);
}
else
{
echo "<h2 class=\"error\">You are not authorized to cancel this trade proposal.</h2>\n";
}
}
if ($_REQUEST["action"] == "protest")
{
// VERIFICATION: SESSION FFLTEAMID HAS NOT YET PROTESTED
// **********************
// RELATIVELY COMPLICATED VERIFICATION
$thisProtest = new OFFL_TradeProtest();
$thisProtest->setTradeID($_REQUEST["trade_id"]);
$protests = $thisProtest->getTradeProtests();
$protestEligible = TRUE;
foreach ($protests as $protest)
{
echo "protest: " . $protest->getFFLTeamID() . " session: " . $_SESSION["fflteam_id"] . "<br>";
if ($protest->getFFLTeamID() == $_SESSION["fflteam_id"])
{ $protestEligible = FALSE; }
}
if ($protestEligible)
{
$trade = new OFFL_Trade($_REQUEST["trade_id"]);
$thisProtest->setFFLTeamID($_SESSION["fflteam_id"]);
$thisProtest->save();
echo "<h2 class=\"success\">Trade protested.</h2>\n";
$protestCount = $trade->getProtestVotes(1); // parameter forces refresh
if ($protestCount >= $trade->getProtestVotesNeeded())
{
$trade->setStatus("protested");
$trade->save();
echo "<h2 class=\"success\">Trade overturned.</h2>\n";
}
}
else
{
echo "<h2 class=\"error\">You are not authorized to protest this trade.</h2>\n";
}
}
if ($_REQUEST["action"] == "veto")
{
// VERIFICATION: SESSION FFLTEAMID IS ADMIN
$trade = new OFFL_Trade($_REQUEST["trade_id"]);
if ($_SESSION["admin"])
{
$trade->setStatus("vetoed");
$trade->setDeadline(time());
echo "<h2 class=\"success\">Trade vetoed.</h2>\n";
}
else
{
echo "<h2 class=\"error\">You are not authorized to veto this trade.</h2>\n";
}
}
if ($_REQUEST["action"] == "process")
{
// *************************************
// It would be nice to move the roster checking into the Trade class
// investigate porting it once it works!
$trade = new OFFL_Trade($_REQUEST["trade_id"]);
if ($_SESSION["admin"])
{
// $trade->setStatus("vetoed");
// $trade->setDeadline(time());
// CHECK TRADELOCK (if in place, abort -- even commish doesn't override this w/o killing the trade)
if ($trade->checkTradelock() != 0)
{ // players are tradelocked
// don't delete here, though? leave for automatic removal.
echo "<h2 class=\"error\">Involved players are tradelocked. Trade not processed.</h2>\n";
}
else
{
// CHECK THE ROSTERS
$errors = $trade->checkTradeRosters();
if (sizeof($errors)) // IF BAD, SET STATUS TO "rosterviolation" AND SET TRADELOCK
{
$trade->setStatus("rosterviolation");
$trade->setTradelock(1);
$trade->setDeadline(time(), "rosterviolation");
$trade->save();
echo "<h2 class=\"success\">Trade processed, pending roster fixes by participants</h2>\n";
}
else
{
$errors = $trade->processTrade();
$trade->deleteTrade();
if (sizeof($errors))
echo "<h2 class=\"error\">Expected players not on teams! Trade cancelled.</h2>\n";
else
echo "<h2 class=\"success\">Trade processed!</h2>\n";
}
}
}
else
{
echo "<h2 class=\"error\">You are not authorized to process this trade.</h2>\n";
}
}
if ($continue_with_page)
{
if (!isset($_REQUEST["trade_id"])) // list all involved trades
{
if (isset($_SESSION["fflteam_id"]))
{ $fflteam_id = $_SESSION["fflteam_id"]; }
else
{ $fflteam_id = 0; }
$x = new OFFL_Trade();
$teamTrades = $x->getAllTeamTrades($fflteam_id);
foreach($teamTrades as $trade)
{
switch ($trade->getStatus())
{
case "rosterviolation":
if ($trade->getProposedFFLTeamID() == $fflteam_id)
$thatTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
else
$thatTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
echo "<p class=\"error\">Your trade with " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " cannot be completed until a roster inconsistency is resolved: ";
break;
case "proposed":
if ($trade->getProposedFFLTeamID() == $fflteam_id)
{
$thatTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
echo "<p>You have proposed a trade to " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . ":";
}
else
{
$thatTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
echo "<p>" . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has proposed a trade to you:";
}
break;
case "accepted":
if ($trade->getProposedFFLTeamID() == $fflteam_id)
{
$thatTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
echo "<p>" . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has accepted your trade, and it is pending:";
}
else
{
$thatTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
echo "<p>You have accepted a trade from " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . ", and it is pending:";
}
break;
case "vetoed":
if ($trade->getProposedFFLTeamID() == $fflteam_id)
{
$thatTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
echo "<p>Your trade with " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has been vetoed by the commissioner:";
}
else
{
$thatTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
echo "<p>" . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . "'s trade with you has been vetoed by the commissioner:";
}
break;
case "protested":
if ($trade->getProposedFFLTeamID() == $fflteam_id)
{
$thatTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
echo "<p>Your trade with " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has been overturned by league protest:";
}
else
{
$thatTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
echo "<p>" . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . "'s trade with you has been overturned by league protest:";
}
break;
case "declined":
if ($trade->getProposedFFLTeamID() == $fflteam_id)
{
$thatTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
echo "<p>" . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has declined your trade offer:";
}
else
{
$thatTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
echo "<p>You have declined the trade offer from " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . ":";
}
break;
}
echo " <a href=\"$WEB_ROOT/trades.php?trade_id=" . $trade->getTradeID();
if ($isAdmin)
{ echo "&mode=admin"; }
echo "\">[details]</a></p>\n";
}
$otherTrades = $x->getOtherViewableTrades($_SESSION["league_id"], $fflteam_id);
foreach ($otherTrades as $trade)
{
$thisTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
$thatTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
switch ($trade->getStatus())
{
case "accepted":
echo "<p>" . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has accepted a trade from " . $thisTeam->getFFLTeamCity() . " " . $thisTeam->getFFLTeamName() . ": <a href=\"$WEB_ROOT/trades.php?trade_id=" . $trade->getTradeID();
if ($isAdmin)
{ echo "&mode=admin"; }
echo "\">[details]</a></p>\n";
break;
case "vetoed":
echo "<p>The trade between " . $thisTeam->getFFLTeamCity() . " " . $thisTeam->getFFLTeamName() . " and " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has been vetoed by the commissioner: <a href=\"$WEB_ROOT/trades.php?trade_id=" . $trade->getTradeID();
if ($isAdmin)
{ echo "&mode=admin"; }
echo "\">[details]</a></p>\n";
break;
case "protested":
echo "<p>The trade between " . $thisTeam->getFFLTeamCity() . " " . $thisTeam->getFFLTeamName() . " and " . $thatTeam->getFFLTeamCity() . " " . $thatTeam->getFFLTeamName() . " has been overturned by league protest: <a href=\"$WEB_ROOT/trades.php?trade_id=" . $trade->getTradeID();
if ($isAdmin)
{ echo "&mode=admin"; }
echo "\">[details]</a></p>\n";
break;
}
}
}
else // display the specific trade
{
$trade = new OFFL_Trade($_REQUEST["trade_id"]);
$status = $trade->getStatus();
$proposer = 0;
$target = 0;
$viewer = 0;
if ($trade->getProposedFFLTeamID() == $_SESSION["fflteam_id"])
$proposer = 1;
elseif ($trade->getTargetFFLTeamID() == $_SESSION["fflteam_id"])
$target = 1;
else
$viewer = 1;
if ((($status == "proposed") || ($status == "rosterviolation")) && $viewer)
// should I put the admin check here? might be useful for roster violations.
// not for now.
echo "<h2 class=\"error\">You are not authorized to view the details of this trade.</h2>\n";
else
{
$proposingTeam = new OFFL_FFLTeam($trade->getProposedFFLTeamID());
$targetTeam = new OFFL_FFLTeam($trade->getTargetFFLTeamID());
$proposedPlayerIDs = $trade->getProposedPlayerIDArray();
$targetPlayerIDs = $trade->getTargetPlayerIDArray();
?>
<table>
<tr>
<th><?php echo "<a href=\"$WEB_ROOT/teams.php?fflteam_id=" . $proposingTeam->getFFLTeamID() . "\">" . $proposingTeam->getFFLTeamCity() . " " . $proposingTeam->getFFLTeamName() . "</a>"; ?></th>
<th><?php echo "<a href=\"$WEB_ROOT/teams.php?fflteam_id=" . $targetTeam->getFFLTeamID() . "\">" . $targetTeam->getFFLTeamCity() . " " . $targetTeam->getFFLTeamName() . "</a>"; ?></th>
</tr>
<tr>
<td valign="top"><?php
foreach ($proposedPlayerIDs as $player_id)
{
$player = new OFFL_Player($player_id, $myleague->getLeagueID());
echo "<a href=\"$WEB_ROOT/players.php?player_id=" . $player->getPlayerID() . "\">" . $player->getName() . "</a>, " . $player->getPositionAbbv() . " " . $player->getNFLTeamAbbv() . "<br>\n";
}
?> </td>
<td valign="top"><?php
foreach ($targetPlayerIDs as $player_id)
{
$player = new OFFL_Player($player_id, $myleague->getLeagueID());
echo "<a href=\"$WEB_ROOT/players.php?player_id=" . $player->getPlayerID() . "\">" . $player->getName() . "</a>, " . $player->getPositionAbbv() . " " . $player->getNFLTeamAbbv() . "<br>\n";
}
?> </td>
</tr>
</table>
<?php
// ********************************************
// All of these need admin options
if ($status == "rosterviolation")
/*
CHECK ROSTER ERRORS
IF FOUND
IF ON THIS TEAM
LIST ERRORS
LIST ROSTERS w/ DROP LINK
CONFIRM PAGE?
BACK TO TRADE DETAIL VIEW
ELSE
INFORM ERRORS ON OTHER TEAM
CANCEL TRADE DIALOG?
ELSE
NOTIFY TRADE GOOD
SET DEADLINE EARLY
*/
{
if ($isAdmin)
$errors = $trade->checkTradeRosters();
elseif ($_SESSION["fflteam_id"] == $trade->getProposedFFLTeamID())
$errors = $trade->checkTradeRosters("proposed");
elseif ($_SESSION["fflteam_id"] == $trade->getTargetFFLTeamID())
$errors = $trade->checkTradeRosters("target");
if (sizeof($errors))
{
if (!$isAdmin)
{
echo "<h2 class=\"error\">The trade cannot be completed at this time due to resulting roster violations</h2>\n";
echo "<h2 class=\"error\">The following situations must be addressed before the trade will be processed</h2>\n";
foreach ($errors as $error)
echo "<h3 class=\"error\">$error</h2>\n";
// NOW LIST ROSTER FOR DROP (EXCEPT TRADE PLAYERS)
// NO CANCEL OPTION, POTENTIAL FOR ABUSE WHERE ONE TEAM DROPS ITS PLAYERS AND THE OTHER DOES NOT
// CONFIRM PAGE?
// BACK TO TRADE DETAIL VIEW (HERE)
$thisTeam = new OFFL_FFLTeam($_SESSION["fflteam_id"]);
$roster = $thisTeam->getRoster();
echo "<h2>Drop players from roster to satisfy trade requirements (if needed)</h2>\n";
echo "<h3>Players in current trades may not be dropped to satisfy trade requirements</h3>\n";
echo " <table>\n";
foreach ($roster as $player)
{
if (!$player->getTradelock())
{
echo " <tr><td><a href=\"$WEB_ROOT/players.php?player_id=" . $player->getPlayerID() . "\">" . $player->getName() . ", " . $player->getPositionAbbv() . " " . $player->getNFLTeamAbbv() . "</a></td>";
echo "<td><a class=\"droplink\" href=\"$WEB_ROOT/trades.php?action=dropplayer&player_id=" . $player->getPlayerID() . "&trade_id=" . $trade->getTradeID() . "\">DROP</a></td></tr>\n";
}
}
}
else
{
echo "<h2 class=\"error\">The trade cannot be completed due to the resulting roster violations detailed below.</h2>\n";
foreach ($errors as $error)
echo "<h3 class=\"error\">$error</h3>\n";
}
}
else // trade OK to proceed, set "accepted," reset deadline
{
$trade->setStatus("accepted");
$trade->setDeadline(10); // Jan 1970 -- next available resolution run
$trade->save();
}
}
?>
<?php if ($status == "proposed")
{
if ($proposer)
{
?><form name="tradecancel" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="cancel" />
<input type="submit" value="Cancel Trade Offer" />
</form>
<?php }
if ($target)
{
?><form name="tradeaccept" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="accept" />
<input type="submit" value="Accept Trade Offer" />
</form>
<form name="tradedecline" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="decline" />
<input type="submit" value="Decline Trade Offer" />
</form>
<?php }
}
elseif ($status == "accepted")
{
if ($proposer || $target)
{
echo "<p>This trade will be eligible for processing at ";
$eligibleTime = $trade->getDeadline();
if ($eligibleTime < time())
echo "the next processing cycle.\n";
else
{
$eligibleTime = gmdate("g:i A, M j, Y", GMTOffsetTime($eligibleTime));
echo "$eligibleTime.\n";
}
if ($isAdmin)
{
?><form name="tradeveto" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="veto" />
<input type="submit" value="Veto Trade" />
</form>
<form name="tradeprocess" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="process" />
<input type="submit" value="Process Trade Immediately" />
</form>
<?php }
}
else
{
?><form name="tradeprotest" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="protest" />
<input type="submit" value="Protest Trade" />
</form>
<?php if ($isAdmin)
{
?><form name="tradeveto" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="veto" />
<input type="submit" value="Veto Trade" />
</form>
<form name="tradeprocess" method="post" action="<?php echo $WEB_ROOT; ?>/trades.php">
<input type="hidden" name="trade_id" value="<?php echo $_REQUEST["trade_id"]; ?>" />
<input type="hidden" name="action" value="process" />
<input type="submit" value="Process Trade Immediately" />
</form>
<?php }
}
}
elseif ($status == "vetoed")
{
echo "<p>Trade has been vetoed by the commissioner.\n";
}
elseif ($status == "protested")
{
echo "<p>Trade has been overturned by league protest.\n";
}
elseif ($status == "declined")
{
echo "<p>Trade proposal has been declined.\n";
}
} // authorized to view
} // else display specific trade
} // continue_with_page
require($DOC_ROOT . "/lib/footer.php"); ?>