Modify the forms system

This commit is contained in:
Antonio de la Rosa 2015-08-25 18:10:49 +02:00
parent faa1d76350
commit 1cc3c8cf34
5 changed files with 106 additions and 77 deletions

44
src/Forms/BaseForm.php Normal file
View file

@ -0,0 +1,44 @@
<?php
namespace PhangoApp\PhaModels\Forms;
/**
* Basic class for create forms
*/
class BaseForm {
/**
* @param string $name The name of form
* @param string $name The default value of the form
* @param string $name Field class instance used for check files
*/
public function __construct($name, $value, $field)
{
$this->label=name;
$this->name=name;
$this->default_value=value;
$this->css='';
$this->type='text';
$this->required=0;
}
public function form()
{
return '<input type="'.$this->type.'" class="'.$this->css.'" name="'.$this->setform($this->default_value).'">';
}
#Method for escape value for html input
public function setform(value)
{
return value.replace('"', '&quot;')
}
}
?>