Beispiel #1
0
    exit;
}
?>
<h2>Administra&ccedil;&atilde;o de turmas</h2>
<?php 
if (isset($_REQUEST['delete'])) {
    $turma = new Turma($_REQUEST['delete']);
    if ($turma->remove()) {
        echo "<p>Turma removida</p>";
    } else {
        echo "<p>Erro ao remover turma! Verifique se a turma tem 0 alunos</p>";
    }
}
if (isset($_REQUEST['submit'])) {
    $turma = new Turma();
    if ($turma->create($_REQUEST['nome'])) {
        echo "<p>Turma criada</p>";
    } else {
        echo "<p>Erro ao criar turma!</p>";
    }
}
?>
<p>Turmas cadastradas:</p>
<table><tr><th colspan=2>Nome</th><th>Alunos</th><th>Exerc&iacute;cios</th></tr>
<?php 
foreach (ListTurmas() as $turma) {
    echo "<tr><td><a href='?delete=" . $turma->getId() . "'><img src='img/x.png'></a></td><td>" . $turma->getNome() . "</td><td>" . $turma->getAlunos() . "</td><td>" . $turma->getNEx() . "</td></tr>";
}
?>
</table>