-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCls_Formulario.php
More file actions
105 lines (79 loc) · 2.67 KB
/
Cls_Formulario.php
File metadata and controls
105 lines (79 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
class Formulario{
private $campos;
private $classDiv;
private $classForm;
private $idForm;
static $estados;
public function __Construct($link,$classForm,$idForm)
{
$this->link = $link;
$this->campos = array("");
$this->classDiv = "formulario";
$this->classForm = $classForm;
$this->idForm = $idForm;
$this::$estados = array("AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO");
}
public function GerarFormulario()
{
$Html = "<div class='".$this->classDiv."'>" . PHP_EOL .
"<form action='". $this->link ."' method='post' id='".$this->idForm."' class='".$this->classForm."'>". PHP_EOL.
"<table>". PHP_EOL
;
for($i = 0; $i< count($this->campos);$i++)
{
$Html .= $this->campos[$i];
}
$Html .=
"</table>" . PHP_EOL .
"<div class='bt_cadastrar'><input type='submit' value='Cadastrar'></div>" . PHP_EOL .
"</form>" . PHP_EOL .
"<div class='clear'></div>" . PHP_EOL .
"</div>" . PHP_EOL
;
return $Html;
}
public function AddCampoTexto(string $preDescricao, string $name, string $id){
$Html = "<tr>". PHP_EOL .
"<td>".$preDescricao."</td>" . PHP_EOL.
"<td><input type='text' name='". $name ."' id='".$id."'></td>
</tr>";
$this->campos[] = $Html;
}
public function AddCampoRadio(string $preDescricao, string $name, string $id, string $value, string $posDescricao){
$Html = "<tr>". PHP_EOL .
"<td>".$preDescricao."</td>" . PHP_EOL.
"<td><input type='radio' name='". $name ."' id='".$id."' value='".$value."'>". $posDescricao ."</td>
</tr>";
$this->campos[] = $Html;
}
public function AddCampoData(string $preDescricao, string $name, string $id, string $value){
$Html = "<tr>". PHP_EOL .
"<td>".$preDescricao."</td>" . PHP_EOL.
"<td><input type='date' name='". $name ."' id='".$id."' value='".$value."'></td>
</tr>";
$this->campos[] = $Html;
}
public function AddCampoSelect(string $preDescricao, string $id, $value){
$Html = "<tr>". PHP_EOL .
"<td>".$preDescricao."</td>" . PHP_EOL.
"<td> <select name='$id'>";
for($i=0;$i<count($value);$i++){
$Html .= " <option value='".$value[$i]."'>".$value[$i]."</option>";
}
$Html .= "</select>
</td>
</tr>";
$this->campos[] = $Html;
}
public function AddCampoHTML(string $preDescricao,string $Html){
$this->campos[] = $Html;
}
public function AddTopico(string $titulo){
$Html = "<tr>
<td colspan='2' class='topico'>".$titulo."</td>
</tr>";
$this->campos[] = $Html;
}
}
?>