2024-03-15 14:17:25 +03:00
|
|
|
<?php
|
2024-03-20 18:31:49 +03:00
|
|
|
ini_set("display_errors", 1);
|
2024-03-15 14:17:25 +03:00
|
|
|
error_reporting(-1);
|
|
|
|
|
2024-03-25 18:07:54 +03:00
|
|
|
const ROOT_PATH = __DIR__;
|
|
|
|
const VIEW_PATH = __DIR__ . "/views";
|
|
|
|
const VIEW_CACHE_PATH = __DIR__ . "/compilation_cache";
|
|
|
|
|
2024-03-15 16:56:03 +03:00
|
|
|
require_once "vendor/autoload.php";
|
2024-03-15 14:17:25 +03:00
|
|
|
|
2024-03-25 18:07:54 +03:00
|
|
|
require_once "bootstrap/db.php";
|
|
|
|
|
2024-03-20 18:31:49 +03:00
|
|
|
use Phroute\Phroute\RouteCollector;
|
2024-03-15 16:56:03 +03:00
|
|
|
|
2024-03-20 18:31:49 +03:00
|
|
|
$router = new RouteCollector();
|
2024-03-15 16:56:03 +03:00
|
|
|
|
2024-03-25 18:07:54 +03:00
|
|
|
$router->get('/', [\itguild\forms\app\controllers\MainController::class, 'indexAction']);
|
|
|
|
$router->get('/example', [\itguild\forms\app\controllers\MainController::class, 'exampleAction']);
|
|
|
|
$router->get('/create-user', [\itguild\forms\app\controllers\UserController::class, 'createUserAction']);
|
|
|
|
$router->get('/get-user/{id}', [\itguild\forms\app\controllers\UserController::class, 'getUserAction']);
|
2024-03-29 17:47:46 +03:00
|
|
|
$router->get("/form/{id}", [\itguild\forms\app\controllers\FormController::class, "indexAction"]);
|
|
|
|
$router->get("/form-input/{id}", [\itguild\forms\app\controllers\FormInputController::class, "indexAction"]);
|
|
|
|
$router->get("/form-res/{id}", [\itguild\forms\app\controllers\FormResController::class, "indexAction"]);
|
|
|
|
$router->get("/input-type/{id}", [\itguild\forms\app\controllers\InputTypeController::class, "indexAction"]);
|
|
|
|
$router->get("/input-value/{id}", [\itguild\forms\app\controllers\InputValueController::class, "indexAction"]);
|
2024-04-01 17:56:37 +03:00
|
|
|
$router->post("/form-save/{id}", [\itguild\forms\app\controllers\FormController::class, "saveAction"]);
|
2024-04-02 18:00:13 +03:00
|
|
|
$router->get("/form-load/{id}", [\itguild\forms\app\controllers\FormController::class, "result"]);
|
2024-04-03 18:25:38 +03:00
|
|
|
$router->get("/form-load/{id}/{page}", [\itguild\forms\app\controllers\FormController::class, "result"]);
|
2024-04-04 17:47:39 +03:00
|
|
|
$router->get("/form-item/{id}", [\itguild\forms\app\controllers\FormController::class, "getResultItem"]);
|
|
|
|
|
2024-03-20 18:31:49 +03:00
|
|
|
$dispatcher = new Phroute\Phroute\Dispatcher($router->getData());
|
2024-03-15 17:54:06 +03:00
|
|
|
|
2024-03-20 18:31:49 +03:00
|
|
|
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
|
2024-03-18 17:52:16 +03:00
|
|
|
|
2024-03-25 18:07:54 +03:00
|
|
|
|
2024-03-20 18:31:49 +03:00
|
|
|
// Print out the value returned from the dispatched function
|
|
|
|
echo $response;
|