示例#1
0
$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));
})->name('indexTeacher');
$app->post('/formAddTaskTeacher', function () use($app) {
    $class = StudentClass::getAllClass();
    $subject = Subject::getAllSubjectTeacher($_SESSION['teacherId']);
    Task::addTaskTeacher($_POST['subjectId'], $_POST['classId'], $_POST['dateStart'], $_POST['dateEnd'], $_POST['name']);
    $app->render('teacher/formAddTaskTeacher.php', array('class' => $class, 'subject' => $subject));
});