111 lines
2.4 KiB
PHP
111 lines
2.4 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace itguild\forms\form;
|
||
|
|
||
|
use itguild\forms\form\inputs\Button;
|
||
|
use itguild\forms\form\inputs\Checkbox;
|
||
|
use itguild\forms\form\inputs\Label;
|
||
|
use itguild\forms\form\inputs\RadioButton;
|
||
|
use itguild\forms\form\inputs\Select;
|
||
|
use itguild\forms\form\inputs\TextArea;
|
||
|
use itguild\forms\form\inputs\TextInput;
|
||
|
|
||
|
class Form {
|
||
|
|
||
|
/**
|
||
|
* @param string $action
|
||
|
* @return void
|
||
|
*/
|
||
|
public function beginForm(string $action): void
|
||
|
{
|
||
|
echo "<form method='POST' action='$action'>";
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $name
|
||
|
* @param array $paramsArray
|
||
|
* @return void
|
||
|
*/
|
||
|
|
||
|
public function textInput(string $name, array $paramsArray = []): void
|
||
|
{
|
||
|
TextInput::build($name, $paramsArray);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $name
|
||
|
* @param string $value
|
||
|
* @param array $paramsArray
|
||
|
* @return void
|
||
|
*/
|
||
|
public function checkBox(string $name, string $value, array $paramsArray = []): void
|
||
|
{
|
||
|
Checkbox::build($name, $value, $paramsArray);
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $title
|
||
|
* @param array $paramsArray
|
||
|
* @return void
|
||
|
*/
|
||
|
public function label(string $title, array $paramsArray = []): void
|
||
|
{
|
||
|
Label::build($title, $paramsArray);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $name
|
||
|
* @param array $paramsArray
|
||
|
* @return void
|
||
|
*/
|
||
|
public function radio(string $name, array $paramsArray = []): void
|
||
|
{
|
||
|
RadioButton::build($name, $paramsArray);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $name
|
||
|
* @param string $value
|
||
|
* @param array $paramsArray
|
||
|
* @return void
|
||
|
*/
|
||
|
public function textarea(string $name, string $value = "", array $paramsArray = []): void
|
||
|
{
|
||
|
TextArea::build($name, $value, $paramsArray);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $name
|
||
|
* @param array $options
|
||
|
* @param $value
|
||
|
* @param array $paramsArray
|
||
|
* @return void
|
||
|
*/
|
||
|
public function select(string $name, array $options = [], $value = null, array $paramsArray = []): void
|
||
|
{
|
||
|
Select::build($name, $options, $value, $paramsArray);
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $name
|
||
|
* @param string $value
|
||
|
* @param array $paramsArray
|
||
|
* @return void
|
||
|
*/
|
||
|
public function button(string $name, string $value, array $paramsArray = []): void
|
||
|
{
|
||
|
Button::build($name, $value, $paramsArray);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return void
|
||
|
*/
|
||
|
public function endForm(): void
|
||
|
{
|
||
|
echo "</form>";
|
||
|
|
||
|
}
|
||
|
}
|