This commit is contained in:
kali
2024-03-20 18:31:49 +03:00
parent fd39285e41
commit 5ecf87df75
15 changed files with 207 additions and 76 deletions

View File

@ -1,55 +1,19 @@
<?php
use itguild\forms\Form;
use \itguild\forms\inputs\TextInput;
use \itguild\forms\inputs\RadioButton;
use \itguild\forms\inputs\Select;
use \itguild\forms\ActiveForm;
ini_set("display_errors", true);
ini_set("display_errors", 1);
error_reporting(-1);
require_once "vendor/autoload.php";
$formData = [];
use Phroute\Phroute\RouteCollector;
$form = new Form();
$form->beginForm("checkPOST.php");
$form->textInput("phone", ['placeholder' => 'Введите телефон', 'class' => 'form-group']);
$form->textInput("email", ['placeholder' => 'Введите email']);
$form->textInput("name", ['type' => 'number']);
$form->textInput("lastname");
$form->checkBox("Button", "1", ["class" => 'sdsa', "id" => "b1"]);
$form->checkBox("Button", "2", ["class" => 'sdsa', "id" => "b1"]);
$form->checkBox("Button", "3", ["class" => 'sdsa', "id" => "b1"]);
$form->label("RadioButton", ["for" => "r2"]);
$form->radio("radio1", ["id" => "r2"]);
$form->label("RadioButton", ["for" => "r3"]);
$form->radio("radio1", ["id" => "r3"]);
$form->textarea("textarea", "dsadasads", ["id" => "t1"]);
$form->select("select", ["class1" => "option", "class2" => "b2", "class3" => "b4"], 'class2', ["id" => "s1"]);
$router = new RouteCollector();
$router->get('/', [\itguild\forms\app\controllers\Main::class, 'indexAction']);
$router->get('/example', [\itguild\forms\app\controllers\Main::class, 'exampleAction']);
$activeForm = new ActiveForm();
$activeForm->field(class: TextInput::class, name: 'one', params: ["style" => "color:RED;display:flex"])
->render();
$dispatcher = new Phroute\Phroute\Dispatcher($router->getData());
$activeForm->field(class: TextInput::class, name: 'two', params: [])
->render();
$activeForm->field(class: RadioButton::class, name: 'radio2',params: ["style" => "color:RED;display:flex"])
->setOptions(['1' => 'bbb1', '2' => 'vvv3', 3 => 'ggg3', 4 => 'fgfgfgfg4'])
->setTemplate("<div class='form-group'>{label}{input}</div>")
->setLabel("bbb222bbb")
->render();
$activeForm->field(class: RadioButton::class, name: 'radio2',params: ["style" => "color:RED;display:flex"])
->setLabel("bbbbbb")
->render();
$activeForm->field(Select::class, 'select2', ['value' => 2])
->setOptions(['1' => 'bbb1', '2' => 'vvv3', 3 => 'ggg3', 4 => 'fgfgfgfg4'])
->render();
$form->button('button', "Кнопка", ["id" => "button"]);
$form->endForm();
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
// Print out the value returned from the dispatched function
echo $response;