Beispiel #1
0
 }
 // Now, if we're modifying a roster, let's update the records we've worked on
 $modify = 0;
 if (isset($_POST["modify"])) {
     $modify = $_POST["modify"];
 }
 if ($modify == 1) {
     $response = $roster->update($_POST);
     // Now, make an entry in the transaction log if neccessary
     if (count($response['activate_list']) > 0) {
         $log_entry = "Activates " . implode(", ", $response['activate_list']);
         transaction_log($ibl_team, $log_entry, $db);
     }
     if (count($response['deactivate_list']) > 0) {
         $log_entry = "Deactivates " . implode(", ", $response['deactivate_list']);
         transaction_log($ibl_team, $log_entry, $db);
     }
     // Display our template showing what was updated
     include 'templates/modify_roster/update.php';
 }
 // Check to see if we're adding a new player to this list
 $add = 0;
 if (isset($_POST["new_tig_name"]) && $_POST["new_tig_name"] != "") {
     $add = 1;
 }
 if ($add == 1) {
     $values = ['tig_name' => $_POST['new_tig_name'], 'ibl_team' => $_POST['ibl_team'], 'item_type' => $_POST['new_type'], 'status' => $_POST['new_status'], 'comments' => $_POST['new_comments']];
     $roster->addPlayer($values);
 }
 // We've picked a team, let's grab all the players on their roster
 $ibl_team = $_POST["ibl_team"];
Beispiel #2
0
            $sth->execute($update->getBindValues());
        }
    }
    $team1_trade_report = "";
    $team2_trade_report = "";
    if (isset($team1_trade_players)) {
        $team1_trade_report = implode(", ", $team1_trade_players);
    }
    if (isset($team2_trade_players)) {
        $team2_trade_report = implode(", ", $team2_trade_players);
    }
    $team1_transaction = "Trades {$team1_trade_report} to {$team2} for {$team2_trade_report}";
    $team2_transaction = "Trades {$team2_trade_report} to {$team1} for {$team1_trade_report}";
    require_once 'transaction_log.php';
    transaction_log($team1, $team1_transaction, $db);
    transaction_log($team2, $team2_transaction, $db);
    print "<div align=center><b>{$team1}</b> trades {$team1_trade_report} to <b>{$team2}</b> for {$team2_trade_report}<br></div>";
}
if ($task == "") {
    ?>
        <div align=center>Please select two teams for the trade</div>
<?php 
    $select = $db->newSelect();
    $select->cols(['nickname'])->from('franchises')->orderBy(['nickname']);
    $sth = $pdo->prepare($select->getStatement());
    $sth->execute();
    $results = $sth->fetchAll(PDO::FETCH_ASSOC);
    foreach ($results as $result) {
        $ibl_team[] = $result['nickname'];
    }
    $team_option = "";
Beispiel #3
0
        $round = $_POST["round"];
    }
    if (isset($_POST["tig_name"])) {
        $tig_name = $_POST["tig_name"];
    }
    // Sanity checks for the data
    if ($id == 0 || $ibl_team == 'FA' || $round == "Undrafted") {
        print "You must submit the correct data to draft someone!";
        $task == "list";
    } else {
        $comments = "{$round} Round (" . YEAR . ")";
        $result = $roster->updatePlayerTeam($ibl_team, $id, $comments);
        if ($result) {
            print "<div align='center'>Assigned {$tig_name} to <b>{$ibl_team}</b></div><br><br>";
            // Add an entry to the transaction log
            transaction_log($ibl_team, "Drafts {$tig_name} {$comments}", $db);
            $task = "list";
        } else {
            print "<div align='center'>Couldn't update record for {$tig_name}.  Please try again later</div><br><br>";
            $task = "list";
        }
    }
}
if ($task == "list") {
    // Show a list of free agents to draft
    $tig_name = array();
    $tig_name = $roster->getByNickname('FA');
    // Now, let's display the list of people to draft
    require 'templates/draft/list.php';
}
?>
Beispiel #4
0
    $tig_name = $_POST["tig_name"];
    ?>
    <div align="center">
<?php 
    $update = $db->newUpdate();
    $update->table('teams')->cols(['ibl_team', 'comments', 'status'])->where('id = :id');
    foreach ($id as $key => $sign_id) {
        $sign_team = $ibl_team[$key];
        if ($sign_team != 'FA') {
            $values = ['ibl_team' => $sign_team, 'comments' => "Free Agent " . date("m/y"), 'status' => 2, 'id' => $sign_id];
            $values['id'] = $sign_id;
            $update->bindValues($values);
            $sth = $pdo->prepare($update->getStatement());
            $sth->execute($update->getBindValues());
            $log_entry = "Signs " . $tig_name[$sign_id];
            transaction_log($sign_team, $log_entry, $db);
            print "<b>" . $tig_name[$sign_id] . "</b> signs with {$sign_team}<br>";
        }
    }
    ?>
    </div>
<?php 
}
if ($task == "sign") {
    // Present a list of all free agents
    // and then allow them to be assigned to a team
    $sql = "SELECT DISTINCT(ibl_team) FROM teams WHERE ibl_team!='FA' ORDER BY ibl_team";
    $select = $db->newSelect();
    $select->distinct()->cols(['ibl_team'])->from('teams')->where("ibl_team != 'FA'")->orderBy(['ibl_team']);
    $sth = $pdo->prepare($select->getStatement());
    $sth->execute($select->getBindValues());