firstPHP/views/admin/index.php

96 lines
2.7 KiB
PHP
Raw Normal View History

2024-04-15 17:46:33 +03:00
<?php
/**
2024-05-02 17:52:03 +03:00
* @var \itguild\forms\ActiveForm $form
* @var \itguild\forms\app\DTO\FormDTO $dto
2024-05-21 15:53:19 +03:00
* @var \itguild\forms\core\cg_view\CgView $cgView
2024-04-15 17:46:33 +03:00
*/
2024-05-21 15:53:19 +03:00
use itguild\forms\ActiveForm;
2024-04-15 17:46:33 +03:00
use itguild\forms\inputs\TextInput;
use itguild\forms\inputs\TextArea;
2024-05-03 18:11:43 +03:00
use itguild\forms\app\controllers\AdminController;
2024-04-15 17:46:33 +03:00
?>
2024-05-21 15:53:19 +03:00
2024-05-03 18:11:43 +03:00
<?php echo $form->beginForm("/admin/save-form/"); ?>
2024-04-15 17:46:33 +03:00
<?php $form->field(TextInput::class, name: "title", params: [
'class' => "form-control",
2024-05-02 17:52:03 +03:00
'placeholder' => 'Название формы',
'value' => $dto->get('title'),
2024-04-15 17:46:33 +03:00
])
->setLabel("Название формы")
->render();
2024-04-16 17:13:42 +03:00
2024-04-17 17:30:00 +03:00
$form->field(TextInput::class, name: "perPage", params: [
2024-04-16 17:54:37 +03:00
'class' => "form-control",
2024-05-02 17:52:03 +03:00
'placeholder' => 'Perpage',
'value' => $dto->get('perPage'),
2024-04-16 17:54:37 +03:00
])
->setLabel("Количество выводимых записей на страницу")
->render();
2024-04-22 11:31:44 +03:00
2024-05-02 17:52:03 +03:00
$form->field(\itguild\forms\inputs\Checkbox::class, name: "actionView", params: [
'value' => 'view',
'checked' => $dto->get('view')
])
->setLabel("Разрешить просмотр")
->render();
$form->field(\itguild\forms\inputs\Checkbox::class, name: "actionEdit", params: [
'value' => 'edit',
'checked' => $dto->get('edit')
])
->setLabel("Разрешить редактирование")
->render();
$form->field(\itguild\forms\inputs\Checkbox::class, name: "actionDelete", params: [
'value' => 'delete',
'checked' => $dto->get('delete')
])
->setLabel("Разрешить удаление")
->render();
2024-04-17 17:30:00 +03:00
$form->field(\itguild\forms\inputs\Select::class, name: "inputType", params: [
'class' => "form-control-sm",
'id' => "selectID",
'placeholder' => 'Параметры',
2024-05-02 17:52:03 +03:00
'options' => \itguild\forms\app\services\InputTypeService::getInputTypes()
2024-04-17 17:30:00 +03:00
])
->setLabel("Добавить поле")
->render();
2024-04-16 17:13:42 +03:00
2024-05-03 18:11:43 +03:00
$form->field(\itguild\forms\inputs\Hidden::class, name: "formId", params: [
"value" => $dto->get('id')
])->render();
2024-05-21 15:53:19 +03:00
if (isset($fields)){
$i = 0;
foreach ($fields as $field){
$viewName = \itguild\forms\app\models\InputTypeModel::getViewNameByTypeId($field['input_type_id']);
$cgView->render("/admin/field_type/$viewName.php", ['form' => new ActiveForm(), 'count' => $i]);
$i++;
}
}
2024-05-03 18:11:43 +03:00
$form->field(\itguild\forms\inputs\Button::class, name: "", params: [
"id" => 'buttonAdd',
"value" => 'Добавить поле',
'style' => "margin-top: 10px",
"class" => "btn btn-success",
"onclick" => "getValueSelect()",
"data-count" => "0"
])->render();
2024-04-16 17:13:42 +03:00
2024-04-15 17:46:33 +03:00
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
'class' => "btn btn-primary ",
'value' => 'Отправить',
'typeInput' => 'submit'
])
->render();
2024-04-16 17:13:42 +03:00
$form->endForm();
2024-05-21 15:53:19 +03:00
2024-04-15 17:46:33 +03:00
?>