formName = 'name="'.$name.'"'; } if ($id != "") { $this->formId = 'id="'.$id.'"'; } if ($method != "") { $this->method = 'method="'.$method.'"'; } if ($action != "") { $this->$action = 'action="'.$action.'"'; } } /** * [addInput description] * @param String $type Type of input element (text, number, color,checkbox, button, date, datetime, submit) * @param String $name name of element * @param String $id id of element * @param String $label label of element * @param String $value value of element * @param boolean $require require selector toggle * @param boolean $enabled enable selector toggle */ function addInput(String $type, String $name, String $id, String $label, String $value, Bool $require = false, Bool $enabled = true){ $this->formContent .= '
'; if ($label != "") { $this->formContent .= '
'.$label.'
'; } $this->formContent .= ''; $this->formContent .= '
'; } //TODO: add Group support /** * [addSelect description] * @param String $name name of element * @param String $id id of element * @param String $label label of element * @param Array $data array of options [value => valueName] * @param boolean $multiple multiple selector toggle * @param boolean $enabled enable selector toggle */ function addSelect(String $name, String $id, String $label, Array $data, Bool $multiple = false, Bool $require = false, Bool $enabled = true){ $this->formContent .= '
'; if ($label != "") { $this->formContent .= '
'.$label.'
'; } $this->formContent .= ''; $this->formContent .= '
'; } /** * [addTextarea description] * @param String $name name of element * @param String $id id of element * @param String $label label of element * @param String $value value of element * @param boolean $enabled enable selector toggle */ function addTextarea(String $name, String $id, String $label, Array $value, Bool $require = false, Bool $enabled = true){ $this->formContent .= '
'; if ($label != "") { $this->formContent .= '
'.$label.'
'; } $this->formContent .= ''; $this->formContent .= '
'; } /** * [render function whitch dysplay generated form] */ function render(){ self::addInput(InputTypes::SUBMIT, 'formSubmit', '', '', 'Submit'); $form = '
formName.$this->formId.$this->method.$this->action.'">'; $form .= $this->formContent; $form .= '
'; echo $form; } }