include '../user.php'; $user = new User(); $action = $_GET['action']; switch ($action) { case 'updatestaus': $id = $_GET['id']; $user->active = $_GET['active']; $user->updateStatus($id); echo "user update succsess"; header('location:../controle.php#tabs-1'); # code... break; case 'updateadmin': $id = $_GET['id']; $user->admin = $_GET['admin']; $user->updateAdmin($id); echo "user update succsess"; header('location:../controle.php#tabs-1'); # code... break; case 'editname': $id = $_SESSION['user_id']; $name = $_GET['name']; $user->name = $name; $user->updateName($id); echo "user update succsess"; break; case 'editemail': $id = $_SESSION['user_id']; $email = $_GET['email']; $user->email = $email;
if ($_POST['type'] == 1) { $result = User::addUser($_POST['mail'], $_POST['password'], $_POST['class']); } else { if ($_POST['type'] == 2) { $result = User::addTeacher($_POST['mail'], $_POST['password']); } else { if ($_POST['type'] == 3) { $result = User::addAdmin($_POST['mail'], $_POST['password']); } } } $app->render('admin/addUser.php', array('allclass' => $allclass, 'result' => $result)); }); $app->post('/update', function () use($app) { if ($_POST['type'] == 1) { User::updateAdmin($_POST['id'], $_POST['password']); } else { if ($_POST['type'] == 2) { User::updateTeacher($_POST['id'], $_POST['password']); } else { if ($_POST['type'] == 3) { User::updateUser($_POST['id'], $_POST['password'], $_POST['class']); } } } $app->redirect($app->urlFor('gestionUser')); }); $app->get('/gestionUser', function () use($app) { $alladmin = User::listAdmin(); $allteacher = User::listTeacher(); $i = 0;