Exemplo n.º 1
0
        $newLoan->set($_GET['id'], $contractTeam->id, $_POST['toteam'], strtotime($_POST['loanFrom']), strtotime($_POST['loanTo']));
        $newLoan->save();
    }
    if (isset($_POST['insTo'])) {
        $newIns = new Insurance();
        $newIns->set($_GET['id'], strtotime($_POST['insTo']));
        $newIns->save();
    }
    if (isset($_POST['visaTo'])) {
        $newVisa = new Visa();
        $newVisa->set($_GET['id'], strtotime($_POST['visaTo']));
        $newVisa->save();
    }
    if (isset($_POST['transFrom'])) {
        $newTrans = new Transfer();
        $newTrans->set($_GET['id'], $_POST['assoc'], strtotime($_POST['transFrom']));
        $newTrans->save();
    }
    $teams = Team::find_all();
    $assocs = Assoc::find_all();
    if ($player->category == 1) {
        $contracts = Contract::find_by_sql("SELECT * FROM contracts WHERE player={$player->id} ORDER BY date_of_reg ASC");
        $insurances = Insurance::find_by_sql("SELECT * FROM insurances WHERE player={$player->id} ORDER BY added_on ASC");
        $visas = Visa::find_by_sql("SELECT * FROM visas WHERE player={$player->id} ORDER BY added_on ASC");
        $loans = Loan::find_by_sql("SELECT * FROM loans WHERE player={$player->id} ORDER BY start ASC");
        $transfers = Transfer::find_by_sql("SELECT * FROM transfers WHERE player={$player->id} ORDER BY start ASC");
        $contractTeam = $player->find_contract_team();
        $currentTeam = $player->find_current_team();
        $transTo = Assoc::find_by_sql("SELECT * FROM assocs WHERE id = (SELECT assoc FROM transfers WHERE player = {$_GET['id']} AND returned = 0)");
    }
}