Esempio n. 1
0
$fixture = new Fixture();
if (isset($_GET['team']) && is_numeric($_GET['team'])) {
    $teamId = escape($_GET['team']);
    $fixtures = $fixture->getAllMatches($teamId);
    if (!$fixtures->count()) {
        $teamName = "";
        $errorMessage = "No fixtures to display, <a href='add-fixture.php'>Click here to add a fixture</a>";
    } else {
        $teamName = " - " . $fixtures->first()->Name;
        $fixtures = $fixtures->results();
    }
} else {
    if (isset($_GET['delete']) && $_GET['delete'] == true && isset($_GET['matchid']) && is_numeric($_GET['matchid'])) {
        try {
            $matchId = escape($_GET['matchid']);
            $fixture->delete($matchId);
            Session::flash('deleted', 'Fixture Deleted Successfully');
            Redirect::to('fixtures.php');
        } catch (Exception $e) {
            die($e->getMessage());
        }
    } else {
        $fixtures = $fixture->getAllMatches()->results();
        $teamName = "";
    }
}
?>
<!DOCTYPE html>
<html>
	<?php 
include_once 'includes/htmlhead.php';