Пример #1
0
Due to the 12-hour rule, players are not available to manage here for the 12 hours immediately following the start time of a game in which their school is participating. For more information see <a href="./index.php/about/game-rules">Game Rules</a> under "Roster Moves."

<?php 
$document = JFactory::getDocument();
#$document->addScript('fch-lib.js');
require_once "fch-lib.js";
require_once "fch-lib.php";
$userID = getUserID();
$leagueID = leagueHandler($_POST, $userID);
debug("League is {$leagueID}");
$season = getSeason();
if ($_POST['action'] == "doAcquire") {
    echo displayResults(acquirePlayer($userID, $leagueID, $_POST['playerID'], $_POST['destination'], $_POST['position'], $_POST["transactionID"]));
}
$limit_f_a = getPositionLimit("F", "a", $leagueID);
$limit_f_b = getPositionLimit("F", "b", $leagueID);
$limit_d_a = getPositionLimit("D", "a", $leagueID);
$limit_d_b = getPositionLimit("D", "b", $leagueID);
$limit_g_a = getPositionLimit("G", "a", $leagueID);
$limit_g_b = getPositionLimit("G", "b", $leagueID);
$roster_f_a = selectCount("fch_rosters", " Where season = \"{$season}\" and leagueID = {$leagueID} and userID = {$userID} and releaseDate is  null and position = \"F\" and statusCode = \"act\"");
$roster_f_b = selectCount("fch_rosters", " Where season = \"{$season}\" and leagueID = {$leagueID} and userID = {$userID} and releaseDate is  null and position = \"F\" and statusCode = \"ben\"");
$roster_d_a = selectCount("fch_rosters", " Where season = \"{$season}\" and leagueID = {$leagueID} and userID = {$userID} and releaseDate is  null and position = \"D\" and statusCode = \"act\"");
$roster_d_b = selectCount("fch_rosters", " Where season = \"{$season}\" and leagueID = {$leagueID} and userID = {$userID} and releaseDate is  null and position = \"D\" and statusCode = \"ben\"");
$roster_g_a = selectCount("fch_rosters", " Where season = \"{$season}\" and leagueID = {$leagueID} and userID = {$userID} and releaseDate is  null and position = \"G\" and statusCode = \"act\"");
$roster_g_b = selectCount("fch_rosters", " Where season = \"{$season}\" and leagueID = {$leagueID} and userID = {$userID} and releaseDate is  null and position = \"G\" and statusCode = \"ben\"");
?>

<p/>
<h3>Your Roster Slots (used/allowed)</h3>
<style>
Пример #2
0
function closeDraft($leagueID)
{
    debug("Entering CloseDraft.");
    $season = getSeason();
    executeGenericSQL("DELETE FROM fch_rosters WHERE leagueID = {$leagueID} and season = \"{$season}\"");
    $positionLimits = getAllPositionLimits($leagueID);
    $sql = "SELECT userID, playerID, position FROM fch_draft WHERE leagueID = {$leagueID} and status <> \"W\" and status <> \"C\" and status <> \"P\"  ORDER BY overallPick DESC ";
    debug("CloseDraft: {$sql}");
    // acquirePlayer($userID,$leagueID,$playerID,$activeOrBench, $position,$transactionID)
    $con = initializeDB();
    $result = $con->query($sql);
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            $userID = $row["userID"];
            $x = selectCount("fch_rosters", " WHERE userID = {$userID} and leagueID = {$leagueID} and season = \"{$season}\" and position  = \"" . $row["position"] . "\"");
            debug("<B>x=" . $x . " Limit " . $positionLimits["f_a"] . "</b>");
            if ($row["position"] == "F") {
                if ($x < $positionLimits["f_a"]) {
                    $dest = "act";
                } else {
                    $dest = "ben";
                }
                debug($row["playerID"] . " F, Dest = {$dest} ");
            }
            if ($row["position"] == "D") {
                if ($x < $positionLimits["d_a"]) {
                    $dest = "act";
                } else {
                    $dest = "ben";
                }
                debug($row["playerID"] . " D, Dest = {$dest} ");
            }
            if ($row["position"] == "G") {
                if ($x < $positionLimits["g_a"]) {
                    $dest = "act";
                } else {
                    $dest = "ben";
                }
                debug($row["playerID"] . " G, Dest = {$dest} ");
            }
            debug("CloseDraft: acquire: " . $row["userID"] . $leagueID . " " . $row["playerID"] . " " . $dest . " " . $row["position"]);
            acquirePlayer($row["userID"], $leagueID, $row["playerID"], $dest, $row["position"], getNextTransactionID($userID, $leagueID));
        }
    }
    closeDB($con);
}