label = $label;
$this->name = $name;
$this->value = $value;
}
function render($indent = "")
{
$str = $indent . "
\n";
return $str;
}
}
class FileUpload {
private $label, $name, $accept;
public function FileUpload($label, $name, $accept = "*")
{
$this->label = $label;
$this->name = $name;
$this->accept = $accept;
}
public function render($indent = "")
{
$str = $indent . "\n";
return $str;
}
}
class Button {
private $label;
public function Button($label)
{
$this->label = $label;
}
public function render($indent = "")
{
$str = $indent . "\n";
return $str;
}
}
class CheckBox {
private $label, $name, $value;
public function CheckBox($label, $name, $value = "")
{
$this->label = $label;
$this->name = $name;
$this->value = $value;
}
public function render($indent = "")
{
$str = $indent . "\n";
return $str;
}
}
class ComboBox {
private $label, $name, $value, $values;
public function ComboBox($label, $name, $value, $values)
{
$this->label = $label;
$this->name = $name;
$this->value = $value;
$this->values = $values;
}
public function render($indent = "")
{
$str = $indent . "\n";
return $str;
}
}
class Hidden {
private $values;
public function Hidden($values)
{
$this->values = $values;
}
public function render($indent = "")
{
$str = "";
foreach($this->values as $key => $value) {
$str .= $indent . "\n";
}
return $str;
}
}
class TextEdit {
private $label, $name, $value;
function TextEdit($label, $name, $value = "")
{
$this->label = $label;
$this->name = $name;
$this->value = $value;
}
function render($indent = "")
{
$str = $indent . "\n";
return $str;
}
}
class DateTimeEdit {
private $label, $name, $timestamp;
function DateTimeEdit($label, $name, $timestamp = 0)
{
$this->label = $label;
$this->name = $name;
$this->timestamp = $timestamp;
}
function render($indent = "")
{
if($this->timestamp == 0) $t = time();
else $t = $this->timestamp;
$second = date('s',$t);
$minute = date('i',$t);
$hour = date('G',$t);
$day = date('d',$t);
$month = date('m',$t);
$year = date('Y',$t);
$str = $indent . "\n";
return $str;
}
public function toTimestamp($t, $name)
{
$timestring = sprintf("%d", $t[$name."_year"]) ."/".
sprintf("%d", $t[$name."_month"]) ."/".
sprintf("%d", $t[$name."_day"]) ." ".
sprintf("%d", $t[$name."_hour"]) .":".
sprintf("%02d", $t[$name."_minute"]).":".
sprintf("%02d", $t[$name."_second"]);
return strtotime($timestring);
}
}
class ImageComboBox {
private $label, $name, $value, $values;
public function ImageComboBox($label, $name, $value, $values)
{
$this->label = $label;
$this->name = $name;
$this->value = $value;
$this->values = $values;
}
public function render($indent = "")
{
$str = $indent . "\n";
return $str;
}
}
class Form {
private $widgets = array();
private $action;
private $hasFileUpload = false;
public function addWidget($widget)
{
if(get_class($widget) == "FileUpload") $this->hasFileUpload = true;
array_push($this->widgets, $widget);
}
public function render($indent = "")
{
global $m, $s;
$str = $indent . "\n";
echo $str;
}
public function Form($action)
{
$this->action = $action;
}
}
?>