campo;
}
}
/*
* Gera saídas para botões no form
*
* Parametros: botões e css
*
* @Ex:
* $array=(
* 'submit'=>array('sb'=>'Pesquisar','js'=>'JavaScript'),
* 'reset'=>array('rs'=>'Resetar','js'=>'JavaScript'),
* 'button'=>array('bt'=>'Novo botao','js'=>'JavaScript')
* );
*
* ***********************************************************
* Apenas as chaves:
* submit, reset, button e js devem estar setadas com estes
* respectivos nomes. Único detalhe é que a chave js pode ser
* nulla, caso o botao nao necessite de JavaScript
* 'js'=>NULL
* ***********************************************************
*
* $obj->Add(new Button($array,''));
*/
class Button extends Form
{
function Button($arraybt,$css="",$colspan=2)
{
$button .= "
\n";
/*
* Obtem valores da(s) primeira(s) chave(s)
* $vltype = array()
*/
foreach((array)$arraybt as $type => $vltype)
{
/*
* Obtem valores da(s) chave(s) do segundo array
*/
foreach((array)$vltype as $nome_bt => $value_bt)
{
/*
* Nega valores de javascript
* Mostra apenas input´s válidos
* de:
* submit
* reset
* button
*/
if(!($nome_bt=='js'))
$button .= "
campo = $button;
}
}
/*
* Classe para campo text
* titulo
* name
* value
* size
* maxsize
* css
* js
*/
class Text extends Form
{
function Text($titulo="",$name="",$value="",$size,$maxsize,$css="",$js="",$break=NULL)
{
$text = "
$titulo
\n
\n
";
switch($break)
{
case NULL:
$text .= "\n
\n";
break;
case end:
$text .= "
\n";
break;
}
return $this->campo = $text;
}
}
/*
* Classe para campo password
* titulo
* name
* value
* size
* maxsize
* css
* js
*/
class Password extends Form
{
function Password($titulo="",$name="",$value="",$size,$maxsize,$css="",$js="",$break=NULL)
{
$text = "
$titulo
\n
\n
";
switch($break)
{
case NULL:
$text .= "\n
\n";
break;
case end:
$text .= "
\n";
break;
}
return $this->campo = $text;
}
}
/*
* Classe para campo file
* titulo
* name
* value
* size
* maxsize
* css
* js
*/
class File extends Form
{
function File($titulo="",$name="",$value="",$size,$maxsize,$css="",$js="",$break=NULL)
{
$text = "
$titulo
\n
\n
";
switch($break)
{
case NULL:
$text .= "\n
\n";
break;
case end:
$text .= "
\n";
break;
}
return $this->campo = $text;
}
}
/*
* Classe para campo textarea
* titulo
* name
* cols
* rows
* value
* css
* js
*/
class TextArea extends Form
{
function TextArea($titulo="",$name="",$cols,$rows,$value="",$css="",$js="",$break=NULL)
{
$text = "
$titulo
\n
\n
";
switch($break)
{
case NULL:
$text .= "\n
\n";
break;
case end:
$text .= "
\n";
break;
}
return $this->campo = $text;
}
}
/*
* Classe para campo hidden
* titulo
* name
* value
* layout -> para campos com TÃtulo
*/
class Hidden extends Form
{
function Hidden($titulo="",$name="",$value="",$layout,$break=NULL)
{
if($layout)
{
$hidden = "
$titulo
\n
\n
";
switch($break)
{
case NULL:
$hidden .= "\n
\n";
break;
case end:
$hidden .= "
\n";
break;
}
}
else
$hidden = "\n";
return $this->campo = $hidden;
}
}
/*
* Classe para campo select
* titulo
* name
* arrayValue -> valores para option
* value_checked -> qdo recuperado
* css
* js
*/
class Select extends Form
{
function Select($titulo,$name="",$arrayValue,$value_checked,$css="",$js="",$break=NULL)
{
$sel = "
$titulo
\n
\n
\n
\n
";
switch($break)
{
case NULL:
$sel .= "\n
\n";
break;
case end:
$sel .= "
\n";
break;
}
return $this->campo = $sel;
}
}
/*
* Classe para campo checkbox
* titulo
* field_tit -> título do campo
* name
* value
* css
* js
* checked
*/
class CheckBox extends Form
{
function CheckBox($label_title="",$titulo="",$name="",$value="",$css="",$js="",$checked="",$break=NULL,$colspan=NULL)
{
$atributos = ($checked) ? "checked=\"checked\"" : "" ;
/*
* Para checkboxes lado a lado
*/
if($break=='ld_start')
$chk = "
\n
";
/*
* Para fim de formulário
*/
if($break=='end')
$chk = "
$titulo \n
\n
\n
";
return $this->campo = $chk;
}
}
/*
* Classe para campo radio
* titulo
* field_tit -> tÃtulo do campo
* name
* value
* css
* js
* checked
*/
class Radio extends Form
{
function Radio($label_title="",$titulo="",$name="",$value="",$css="",$js="",$checked="",$break=NULL,$colspan=NULL)
{
$atributos = ($checked) ? "checked=\"checked\"" : "" ;
/*
* Para checkboxes lado a lado
*/
if($break=='ld_start')
$radio = "