发信人: bb_rain(小雨)
整理人: tang(2001-01-31 09:00:37), 站内信件
|
<?
/******************************************************************************
Html Module for PHP3 & PHP4 ( v 3.00 )
Copyright (C) 2000 heyin.com, All Rights Reserved.
http://www.heyin.com
RAIN ( Email: [email protected] Oicq: 1235686 )
lib_html.php, 2001/01/01
*******************************************************************************/
class CHtml {
var $text = array();
var $value = array();
var $retvar;
var $in;
var $count;
var $style;
function CHtml($Text, $Retvar='', $Value='', $In='', $Count='', $Style='') {
$count=sizeof($Text);
for ($i=0; $i<$count; $i++) {
list($k, $v) = each($Text);
$this->text[$i] = $v;
$this->value[$i] = (isarray($Value)) ? $Value[$i] : $k;
}
$this->retvar = $Retvar;
$this->in = $In;
$this->count = $Count;
$this->style = $Style;
}
function GroupText() {
$count=sizeof($this->in);
$s = "\n ";
for ($i=0; $i<$count; $i++) {
$temp[$i] = $this->text[$this->in[$i]];
}
$s .= implode(',', $temp);
$s .= "\n";
return $s;
}
function GroupCheck() {
$count=sizeof($this->text);
$s = "\n";
for ($i=0; $i<$count; $i++) {
if (!empty($this->text[$i])) {
$s .= " <INPUT NAME=\"".$this->retvar."[]\" TYPE=\"checkbox\" VALUE=\"".$this->value[$i]."\"";
$s .= preg_match("/".$i."/", $this->in) ? " CHECKED" : "";
$s .= ">".$this->text[$i];
$s .= "\n";
}
}
return $s;
}
function GroupRadio() {
$count=sizeof($this->text);
$s = "\n";
for ($i=0;$i<$count;$i++) {
if (!empty($this->text[$i])) {
$s .= " <INPUT NAME=\"".$this->retvar."\" TYPE=\"radio\" VALUE=\"".$this->value[$i]."\"";
$s .= ($i==$this->in) ? " CHECKED" : "";
$s .= ">".$this->text[$i];
$s .= "\n";
}
}
return $s;
}
function SelectText() {
$s .= "\n <SELECT NAME=\"".$this->retvar."\"";
$s .= (!empty($this->style)) ? " CLASS=\"".$this->style."\"" : "";
$s .= ">\n";
$count=sizeof($this->text);
for ($i=0;$i<$count;$i++) {
$s .= " <OPTION VALUE=\"".$this->value[$i]."\"";
$s .= ($i==$this->in) ? " SELECTED" : "";
$s .= ">".$this->text[$i]."</OPTION>\n";
}
$s .= " </SELECT>\n";
return $s;
}
function SelectNum() {
$s .= "\n <SELECT NAME=\"".$this->retvar."\"";
$s .= (!empty($this->style)) ? " CLASS=\"".$this->style."\"" : "";
$s .= ">\n";
$s .= ($this->text[0]==0) ? " <OPTION VALUE=\"0\"></OPTION>\n" : "";
for ($i=$this->text[1]; $i<=$this->text[2]; $i++) {
$s .= " <OPTION VALUE=\"".$this->value[$i]."\"";
$s .= ($i==$this->in) ? " SELECTED" : "";
$s .= ">".$i."</OPTION>\n";
}
$s .= " </SELECT>\n";
return $s;
}
}
?>
---- HEYIN 软件 http://www.heyin.com
|
|