<?php

include "classes/league.class.php";
if (isset($_POST['save'])) {
    $oFixture = new fixture();
    $oFixture->datetime = $_POST['datetimepicker2'];
    $oFixture->gameweek = $_POST['gameweek'];
    $oFixture->league = $_POST['league'];
    $oFixture->hometeam = $_POST['hometeam'];
    $oFixture->awayteam = $_POST['awayteam'];
    $oFixture->oddhome = $_POST['oddhome'];
    $oFixture->odddraw = $_POST['odddraw'];
    $oFixture->oddaway = $_POST['oddaway'];
    switch ($oFixture->insert_fixture()) {
        case 'SUCCESS':
            $_SESSION['success_message'] = "Fixture Added Successfully!";
            echo "<script type=\"text/javascript\">window.location=\"home.php?page=fixture\"</script>";
            break;
        case 'ERROR':
            $_SESSION['error_message'] = "Error Occured. Please Try Again!";
            echo "<script type=\"text/javascript\">window.location=\"home.php?page=fixture\"</script>";
            break;
            // case 'FILL_THIS_FIELD':
            //     if ($oLogin->user=="")
            //         $oForm->setError('username','Please Fill the Username');
            //     elseif ($oLogin->pass=="")
            //         $oForm->setError('password','Please Fill the Password');
            //     break;
        // case 'FILL_THIS_FIELD':
        //     if ($oLogin->user=="")
        //         $oForm->setError('username','Please Fill the Username');
<div class="container-fluid">
	<div class="row">

<?php 
if (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    $action = "";
}
include "classes/fixture.class.php";
$oFixture = new fixture();
?>
	<div class="col-xs-12 title">Fixture</div>
	<div class="col-xs-12 submenu">
<?php 
if ($action == 'new' || $action == 'result') {
    ?>
		<div class="cancel pull-right"><a href="home.php?page=fixture&action=cancel">Cancel</a></div><!--end delete-->
<?php 
} else {
    ?>
		<div class="new pull-right"><a href="home.php?page=fixture&action=new">Add New Fixture</a></div><!--end new-->
<?php 
}
?>
		</div>
	</div>
</div>
<div class="content_desc">
<?php 
switch ($action) {
<div class="container-fluid">
	<div class="row">
		<div class="col-md-10">
	<?php 
include "classes/fixture.class.php";
$oFixture = new fixture();
// if (isset($_GET['leagueid'])!=""){
// 	$oFixture->leagueid = $_GET['leagueid'];
// 	// Get list of gameweek
// 	// $gameWeek=$oFixture->getGameWeekList();
// }
?>
		<!-- <div class="gameweek-filter pull-right">
		    <div class="form-group">
		      <label for="gameweek">GameWeek:</label>
		      <select class="form-control" name="gameweek" id="gameweek" >
		      	<?php 
// foreach($gameWeek as $x => $x_value)
// 	echo("<option value='".$x_value."'>".$x_value."</option>");
?>
		      </select>
		    </div>
		</div> -->
	<?php 
// echo "Current week range from $this_week_sd to $this_week_ed ";
// if (!empty($_POST)) {
// 	$data = @$_POST;
// 	$oFixture->gameweek = $data['gameweek'];
//     $oFixture->filterFixtureList();
// }
// else {