Example #1
0
    $app->render('admin/index.php', array('class' => $class, 'subject' => $subject));
})->name('indexAdmin');
$app->post('/indexAdmin', function () use($app) {
    Task::addTaskTeacher($_POST['subjectId'], $_POST['classId'], $_POST['dateStart'], $_POST['dateEnd'], $_POST['name']);
    $app->redirect($app->urlFor('indexAdmin'));
});
// GET /
$app->get('/profil/:user_id', function ($user_id) use($app) {
    $profil = User::getUserById($_SESSION['userid']);
    $class = StudentClass::getClassById($profil['user']['classId']);
    $tache = Task::getTaskByClassId($profil['user']['classId']);
    var_dump($class);
    $app->render('profil/index.php', array('profil' => $profil, 'class' => $class, 'tache' => $tache));
})->name('profil');
$app->get('/deconnexion', function () use($app) {
    User::deconnexion();
    $app->redirect($app->urlFor('index'));
})->name('deconnexion');
// GET /
$app->get('/profil', function () use($app) {
    // $profil = User::getUser($_SESSION['userId']);
    $profil = User::getUserById($_SESSION['userid']);
    $class = StudentClass::getClassById($profil['user']['classId']);
    $app->render('profil/index.php');
})->name('toutprofil');
$app->get('/getAllClass', function () use($app) {
    $app->render('profil/index.php');
})->name('getAllClass');
$app->get('/indexTeacher', function () use($app) {
    $subject = Subject::getAllSubjectTeacherAndTaskAndClass($_SESSION['teacherId']);
    $app->render('teacher/index.php', array('subject' => $subject));