Esempio n. 1
0
if (isset($_GET['matchId']) && is_numeric($_GET['matchId'])) {
    $fixtures = $fixture->getMatch(escape($_GET['matchId']));
    if ($fixtures->count()) {
        $results = $fixture->getMatch(escape($_GET['matchId']))->results();
    } else {
        die("Match not found");
    }
}
if (Input::exists()) {
    if (Token::check(Input::get('token'))) {
        $validate = new Validation();
        $validation = $validate->check($_POST, array('homeScore' => array('name' => 'Home Score', 'required' => true), 'awayScore' => array('name' => 'Away Score', 'required' => true), 'result' => array('name' => 'Result', 'required' => true)));
        if ($validation->passed()) {
            $score = Input::get('homeScore') . " - " . Input::get('awayScore');
            try {
                $fixture->update(array('Score' => $score, 'Result' => Input::get('result')), Input::get('matchId'));
                Session::flash('fixtureUpdated', 'Fixture Updated Successfully');
                Redirect::to('fixtures.php');
            } catch (Exception $e) {
                die($e->getMessage());
            }
            $displayErrors = "none";
        } else {
            $errorDisplay = "";
            $displayErrors = "block";
            foreach ($validation->errors() as $error) {
                $errorDisplay = $errorDisplay . $error . "<br>";
            }
        }
    }
}