function __construct() { $this->DBconnect = DBconnect::getInstance(); $this->personal['surname'] = $_SESSION['surname']; $this->personal['name'] = $_SESSION['name']; $this->personal['id'] = $_SESSION['id']; $this->terminyVypsane = StudentDAO::getVypsaneTerminy($this->personal['id']); $this->terminyZapsane = StudentDAO::getZapsaneTerminy($this->personal['id']); }
<?php session_start(); include_once $_SERVER['DOCUMENT_ROOT'] . '/projects/XWYDA_KU3/Controler/DBconnect.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/projects/XWYDA_KU3/Database/StudentDAO.php'; print StudentDAO::zapsat($_GET['idTermin'], $_SESSION['id']); print '<br>Budete presmerovani'; header('Refresh:3; url=/projects/XWYDA_KU3/index.php?page=student', true, 303);
<?php $studentDAO = new StudentDAO(); $app->get('/students/?', function () use($studentDAO) { header("Content-Type: application/json"); echo json_encode($studentDAO->selectAll(), JSON_NUMERIC_CHECK); exit; }); $app->get('/students/:id/?', function ($id) use($studentDAO) { header("Content-Type: application/json"); echo json_encode($studentDAO->selectById($id), JSON_NUMERIC_CHECK); exit; }); $app->post('/students/?', function () use($app, $studentDAO) { header("Content-Type: application/json"); $post = $app->request->post(); if (empty($post)) { $post = (array) json_decode($app->request()->getBody()); } echo json_encode($studentDAO->insert($post), JSON_NUMERIC_CHECK); exit; }); $app->delete('/students/:id/?', function ($id) use($studentDAO) { header("Content-Type: application/json"); echo json_encode($studentDAO->delete($id)); exit; }); $app->put('/students/:id/?', function ($id) use($app, $studentDAO) { header("Content-Type: application/json"); $post = $app->request->post(); if (empty($post)) {