<body> <h3 align=center>WebReg -- Modify Rosters</h3> <?php // Page controller for modifying rosters include 'vendor/autoload.php'; include 'db_config.php'; include 'transaction_log.php'; include 'models/rosters.php'; // modify_roster.php // Used to modify existing rosters // Can be used to do the following: // 1. update player names and teams at the end of the season // 2. change status of players (Active, Inactive, UC) $pdo = new PDO('pgsql:host=localhost;dbname=ibl_stats;user=stats;password=st@ts=Fun'); $get_team = 0; $roster = new Roster($db); if (isset($_POST["get_team"])) { $get_team = $_POST["get_team"]; } // Now, if we don't have a team selected, just get a dropdown list // of teams to work with if ($get_team == 0) { include './templates/modify_roster/no_team.php'; } else { // Let's collect all the data we just grabbed via _POST if (isset($_POST["id"])) { $id = $_POST["id"]; } if (isset($_POST["tig_name"])) { $tig_name = $_POST["tig_name"]; }
<?php require_once 'templates/draft/header.php'; require_once 'db_config.php'; require_once 'transaction_log.php'; require_once 'models/rosters.php'; require_once 'models/franchises.php'; $task = "list"; $roster = new Roster($db); $franchise = new Franchise($db); define(YEAR, "16"); if (isset($_GET['task'])) { $task = $_GET['task']; } if (isset($_POST['task'])) { $task = $_POST['task']; } if ($task == "draft") { $id = 0; $round = array("1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th", "17th", "18th", "19th", "20th"); $team_list = $franchise->getAll(); if (isset($_GET['id'])) { $id = (int) $_GET['id']; } if ($id != 0) { $details = $roster->getById($id); $tig_name = $details['tig_name']; // Now, we can display the form to let them assign the player to a team require 'templates/draft/form.php'; } else { print "Invalid player ID<br>";
public function testAddPlayerAddsPlayerCorrectly() { // Create an array of player data $player_data = ['tig_name' => 'Testy McTesterton', 'ibl_team' => 'MAD', 'item_type' => 1, 'comments' => 'Test item']; // Create a mock insert object $insert = $this->getMockBuilder('stdClass')->setMethods(['into', 'cols'])->getMock(); $insert->expects($this->once())->method('cols')->will($this->returnValue($insert)); $insert->expects($this->once())->method('into')->will($this->returnValue($insert)); // Create a mock DB connection $db = $this->getMockBuilder('stdClass')->setMethods(['newInsert', 'query'])->getMock(); $db->expects($this->once())->method('newInsert')->will($this->returnValue($insert)); $db->expects($this->once())->method('query')->will($this->returnValue(true)); // Create a new roster object $roster = new Roster($db); // Assert that true was returned when adding a player $this->assertTrue($roster->addPlayer($player_data), 'addPlayer() did not correctly add a new player'); }
public function save_roster() { $roster = str_replace('\\"', '"', $_POST['roster']); $roster = json_decode($roster, true); $this->roster->save($roster); var_dump($this->roster); $this->audit->audit(); echo "success"; ob_flush(); wp_die(); }
<p> Choose from roster, and click Import to fill in their info</p> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'rasta-import', 'enableAjaxValidation' => false)); echo CHtml::listBox('rasta', null, CHtml::listData(Roster::model()->findAll(array('order' => 'last_name, first_name')), 'id', 'full_name'), array('size' => 20)); ?> <br /> <br /> <?php echo CHtml::button("Import", array('id' => 'importer')); $this->endWidget(); ?> <?php Yii::app()->clientScript->registerCoreScript("jquery"); ?> <script type="text/javascript"> jQuery(function($) { fieldmap = { 'last_name' : 'last_name', 'first_name' : 'first_name', 'grade' : 'grade', 'phone' : 'emergency_1', 'parent_1' : 'contact', 'cell_parent_1' : 'emergency_2',
<?php include 'DB.php'; include 'db_config.php'; $db = DB::connect(DSN); // Process the incoming data that we got from our trade page include './models/rosters.php'; $rosterModel = new Roster($db); // Grab the data that's been posted into here $team1 = filter_input(INPUT_POST, 'team1', FILTER_SANITIZE_ENCODED); $team2 = filter_input(INPUT_POST, 'team2', FILTER_SANITIZE_ENCODED); $data1 = filter_input(INPUT_POST, 'data1', FILTER_SANITIZE_ENCODED); $data2 = filter_input(INPUT_POST, 'data2', FILTER_SANITIZE_ENCODED); // Update roster entries with new updated teams foreach ($data1 as $playerInfo) { list($dataSet, $playerId) = explode('_', $playerInfo); $rosterModel->updatePlayerTeam($team1, $playerId); } foreach ($data2 as $playerInfo) { list($dataSet, $playerId) = explode('_', $playerInfo); $rosterModel->updatePlayerTeam($team2, $playerId); }
<?php // Controller for "Make a Trade" page include 'DB.php'; include 'db_config.php'; $db = DB::connect(DSN); // Grab all our models include './models/franchises.php'; include './models/rosters.php'; $franchiseModel = new Franchise($db); $rosterModel = new Roster($db); $franchises = $franchiseModel->getAll(); // We need to grab the data that's come in via $_POST and build our rosters $team1 = filter_input(INPUT_POST, 'team1', FILTER_SANITIZE_ENCODED); $team2 = filter_input(INPUT_POST, 'team2', FILTER_SANITIZE_ENCODED); $team1Roster = $rosterModel->getByNickname($team1); $team2Roster = $rosterModel->getByNickname($team2); include './templates/make_trade.php';
// File that handles the signing off a player from the free agent pile or the releasing // of a player to the free agent pile ?> <html> <head> <title>WebReg -- Manage Free Agents</title> </head> <body> <h3 align="Center">WebReg -- Manage Free Agents</h3> <?php require_once 'db_config.php'; $pdo = new PDO('pgsql:host=localhost;dbname=ibl_stats;user=stats;password=st@ts=Fun'); include_once 'transaction_log.php'; require 'models/rosters.php'; $roster = new Roster($db); $task = ""; if (isset($_POST["task"])) { $task = $_POST["task"]; } if (isset($_GET["task"])) { $task = $_GET["task"]; } if ($task == "do_signing") { // assign free agents to their new teams $id = $_POST["id"]; $ibl_team = $_POST["ibl_team"]; $tig_name = $_POST["tig_name"]; ?> <div align="center"> <?php
/** * Return a roster for a particular date * * @param $date * @return DataObject */ public static function getRosterForDate($date) { $roster = Roster::get()->filter(array('StartDate:LessThanOrEqual' => $date, 'EndDate:GreaterThanOrEqual' => $date)); return $roster->first(); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Roster::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }