function __construct($id)
 {
     $this->slot = GameSlot::load(array('slot_id' => $id));
     if (!$this->slot) {
         error_exit("That gameslot does not exist");
     }
 }
Exemple #2
0
 function generateConfirm($edit)
 {
     global $dbh;
     $dataInvalid = $this->isDataInvalid($edit['games']);
     if ($dataInvalid) {
         error_exit($dataInvalid . "<br>Please use your back button to return to the form, fix these errors, and try again");
     }
     $gameslots = $this->league->get_gameslots($this->day_id);
     if (count($gameslots) <= 1) {
         error_exit("There are no fields assigned to this league!");
     }
     $output = para("Confirm that the changes below are correct, and click 'Submit' to proceed.");
     if ($edit['published'] == 'yes') {
         $output .= para("Games will be made available for player viewing.") . form_hidden('edit[published]', 'yes');
     } else {
         $output .= para("Games will be hidden from player view until you choose to publish them.") . form_hidden('edit[published]', 'no');
     }
     $output .= form_hidden('edit[step]', 'perform');
     $header = array("Game ID", "Round", "Game Slot", "Home", "Away");
     $rows = array();
     while (list($game_id, $game_info) = each($edit['games'])) {
         reset($game_info);
         $slot = GameSlot::load(array('slot_id' => $game_info['slot_id']));
         $team_sth = $dbh->prepare('SELECT name FROM team WHERE team_id = ?');
         $team_sth->execute(array($game_info['home_id']));
         $home_name = $team_sth->fetchColumn();
         $team_sth->execute(array($game_info['away_id']));
         $away_name = $team_sth->fetchColumn();
         $rows[] = array(form_hidden("edit[games][{$game_id}][game_id]", $game_id) . $game_id, form_hidden("edit[games][{$game_id}][round]", $game_info['round']) . $game_info['round'], form_hidden("edit[games][{$game_id}][slot_id]", $game_info['slot_id']) . $gameslots[$game_info['slot_id']], form_hidden("edit[games][{$game_id}][home_id]", $game_info['home_id']) . $home_name, form_hidden("edit[games][{$game_id}][away_id]", $game_info['away_id']) . $away_name);
     }
     $output .= "<div class='listtable'>" . table($header, $rows) . "</div>";
     $output .= para(form_submit('submit'));
     return form($output);
 }