<?
// Const --------------------------------------------------------------------------------------------
define('auto_bg_color','#FFFFFF');
define('auto_text_color','#000000');
define('auto_border_color','#000000');
define('auto_size','100%');
define('auto_table_style','border-collapse: collapse');
define('auto_font_name','verdana');
define('auto_font_size','1');
define('auto_font_style','');
//border styles
define('border_dotted','border-collapse: collapse; border-style: dotted');
define('border_dashed','border-collapse: collapse; border-style: dashed');
define('border_double','border-collapse: collapse; border-style: double');
define('border_groove','border-collapse: collapse; border-style: groove');
define('border_outset','border-collapse: collapse; border-style: outset');
define('border_ridge','border-collapse: collapse; border-style: ridge');
define('border_inset','border-collapse: collapse; border-style: inset');
//alignment styles
define('align_l','left');
define('align_r','right');
define('align_c','center');
define('align_j','justify');
define('align_t','top');
define('align_bl','baseline');
define('align_tt','texttop');
define('align_m','middle');
define('align_am','absmiddle');
define('align_b','bottom');
define('align_ab','absbottom');
//hyperlink styles
define('link_withow_underline','text-decoration: none');
// Class --------------------------------------------------------------------------------------------
class table
{
var $tr;
var $td;
var $width = auto_size;
var $height;
var $border_color = auto_border_color;
var $border_width = 1;
var $cell_padding = 0;
var $cell_spacing = 0;
var $style = auto_table_style;
var $bg_color = auto_bg_color;
var $bg_picture;
var $cell_bg_color;
var $obj;
var $id;
var $td_width;
var $tr_height;
//---------------------------------------------------------------------------------------------------
function table($t_tr,$t_td)
{
$this->tr = $t_tr;
$this->td = $t_td;
}
//---------------------------------------------------------------------------------------------------
function creat()
{
$out_value = 100 % $this->td;
$td_width = (100-$out_value)/$this->td;
//table heading
?><table width="<? echo $this->width; ?>"<? if (isset($this->height)) echo ' height="'.$this->height.'"'; ?> border="<? echo $this->border_width; ?>" cellpadding="<? echo $this->cell_padding; ?>" cellspacing="<? echo $this->cell_spacing; ?>" style="<? echo $this->style.'; border-width: '.$this->border_width ?>" bordercolor="<? echo $this->border_color; ?>" bgcolor="<? echo $this->bg_color; ?>"<? if (isset($this->bg_picture)) echo ' background="'.$this->bg_picture.'"'; if (isset($this->id)) echo ' id="'.$this->id.'"'?>><?
echo "\n";
for ($i = 1; $i<=$this->tr; $i++)
{
?><tr><?
echo "\n";
for ($j = 1; $j<=$this->td; $j++)
{
//td heading
?><td width="<? if (isset($this->td_width[$j])){echo $this->td_width[$j];} else {if ($j == $this->tr) {echo '*';} else {echo $td_width.'%';};}; ?>"<? if (isset($this->tr_height[$i])) echo ' height="'.$this->tr_height[$i].'"';?> style="<? echo $this->style.'; border-width: '.$this->border_width ?>" bordercolor="<? echo $this->border_color; ?>"<? if (isset($this->cell_bg_color[$i][$j])) echo ' bgcolor="'.$this->cell_bg_color[$i][$j].'"'; ?>><?
echo "\n";
//creat objects
if (isset($this->obj[$i][$j])) $this->obj[$i][$j]->creat();
?></td><?
echo "\n";
}
?></tr><?
echo "\n";
};
?></table><?
echo "\n";
}
}
//---------------------------------------------------------------------------------------------------
class text
{
var $value;
var $font;
var $size;
var $color;
var $align = align_l;
var $style = auto_font_style;
//---------------------------------------------------------------------------------------------------
function text($value,$color=auto_text_color,$font=auto_font_name,$size=auto_font_size,$style=auto_font_style)
{
$this->value = $value;
$this->font = $font;
$this->size = $size;
$this->style = $style;
$this->color = $color;
}
//---------------------------------------------------------------------------------------------------
function creat()
{
$style = str_replace('B','b',$this->style);
$style = str_replace('I','i',$style);
$style = str_replace('U','u',$style);
$style = str_replace('b','<b>',$style);
$style = str_replace('i','<i>',$style);
$style = str_replace('u','<u>',$style);
echo $style;
?><p align="<? echo $this->align; ?>"><font face="<? echo $this->font; ?>" size="<? echo $this->size; ?>" color="<? echo $this->color; ?>"><?
echo $this->value;
?></font><?
$style = str_replace('<','</',$style);
echo $style;
echo "\n";
}
function get()
{
$style = str_replace('B','b',$this->style);
$style = str_replace('I','i',$style);
$style = str_replace('U','u',$style);
$style = str_replace('b','<b>',$style);
$style = str_replace('i','<i>',$style);
$style = str_replace('u','<u>',$style);
$buf = $style;
$buf .= '<p align="'.$this->align.'"><font face="'.$this->font.'" size="'.$this->size.'" color="'.$this->color.'">'.$this->value.'</font>';
$style = str_replace('<','</',$style);
$buf .= $style;
return $buf;
}
}
//---------------------------------------------------------------------------------------------------
class picture
{
var $src;
var $border = 0;
var $height;
var $width;
var $align = align_l;
//---------------------------------------------------------------------------------------------------
function picture($src)
{
$this->src = $src;
}
//---------------------------------------------------------------------------------------------------
function creat()
{
?><p align="<? echo $this->align; ?>"><img border="<? echo $this->border; ?>" src="<? echo $this->src; ?>"<? if (isset($this->width)) echo ' width="'.$this->width.'"'; if (isset($this->height)) echo ' height="'.$this->height.'"'; ?>><?
echo "\n";
}
}
//---------------------------------------------------------------------------------------------------
class hyperlink
{
var $href;
var $label;
var $style;
var $name;
var $target;
//---------------------------------------------------------------------------------------------------
function hyperlink($href,$label)
{
$this->href = $href;
$this->label = $label;
}
//---------------------------------------------------------------------------------------------------
function creat()
{
?><a href="<? echo $this->href; ?>"<? if (isset($this->name)) echo ' name="'.$this->name.'"'; if (isset($this->target)) echo ' target="'.$this->target.'"'; if (isset($this->style)) echo ' style="'.$this->style.'"'; ?>><? echo $this->label; ?></a><?
echo "\n";
}
}
//---------------------------------------------------------------------------------------------------
class menu
{
var $width = auto_size;
var $sub_height;
var $sub;
var $count = 0;
var $sub_font = auto_font_name;
var $sub_size = auto_font_size;
var $sub_style = '';
var $sub_bg_color;
//---------------------------------------------------------------------------------------------------
function add($sub,$bg_color = auto_bg_color)
{
$this->count++;
$this->sub[$this->count][1] = $sub;
$this->sub_bg_color[$this->count][1] = $bg_color;
}
//---------------------------------------------------------------------------------------------------
function creat()
{
$table = new table($this->count,1);
$table->obj = $this->sub;
$table->width = $this->width;
$table->cell_bg_color = $this->sub_bg_color;
$table->tr_height = @$this->sub_height;
$table->creat();
}
}
//---------------------------------------------------------------------------------------------------
class button
{
var $label;
var $face;
var $hyper_link_url;
var $hyper_link_style;
//--------------------------------------------------------------------------------------------------
function button($label,$url)
{
$this->label = new text($label);
$this->hyper_link_url = $url;
$this->face = new table(1,1);
}
//--------------------------------------------------------------------------------------------------
function creat()
{
$this->face->obj[1][1] = new hyperlink($this->hyper_link_url,$this->label->get());
if (isset($this->hyper_link_style)) $this->face->obj[1][1]->style = $this->hyper_link_style;
$this->face->creat();
}
}
//--------------------------------------------------------------------------------------------------
?>