¡¾php¿ªÔ´´úÂëÀ¸Ä¿ÌáÐÑ¡¿£º±¾ÎÄÖ÷ҪΪÍøѧ»áÔ±Ìṩclass.ui.php£¬Ï£Íû¶ÔÐèÒªclass.ui.phpÍøÓÑÓÐËù°ïÖú£¬Ñ§Ï°Ò»ÏÂ!
<?php
class ui_class
{
var $name;
var $search;
var $header;
var $data;
var $opt;
var $submitbtn;
var $url;
var $hidden;
var $btn;
function ui_class( )
{
$this->name = " ";
$this->search = array( );
$this->header = array( );
$this->data = array( );
$this->opt = array( );
$this->hidden = array( );
$this->btn = array( );
$this->submitbtn = true;
$this->url = "";
}
}
class ui_list_class extends ui_class
{
var $addbtn;
function ui_list_class( )
{
$this->ui_class( );
$this->addbtn = false;
}
function show( )
{
$multipage= $GLOBALS['multipage'];
echo LF."<form action=\"".$this->url."\" method=\"post\" onsubmit=\"return submitcheck(this);\">";
showtype( $this->name, "top", 99, 1, "showlist" );
echo "<tr class=\"category\">";
foreach ( $this->header as $key => $head )
{
if ( strtolower( $head['key'] ) == "key" )
{
$primarykey = $key;
}
else if ( $head['key'] )
{
$size = "size=".$head['key'];
}
if ( $head['type'] == M_CHECKBOX && strtolower( $head['key'] ) == "key" )
{
$listarr[$key] = "<td width=".$head['width']."><input class=checkedbox name=delitems[] type=checkbox value= \$row[".$key."] ></td> ";
}
else if ( $head['type'] == M_CHECKBOX )
{
$listarr[$key] = "<td width=".$head['width']."><input class=checkedbox name=items[\$row[\$primarykey]][".$key."] type=checkbox value=1 \$row[".$key."_checked]></td> ";
}
else if ( $head['type'] == M_TEXT )
{
$listarr[$key] = "<td width=".$head['width']."><input name=items[\$row[\$primarykey]][".$key."] value= \$row[".$key."] ></td>";
}
else if ( $head['type'] == M_TTEXT )
{
$listarr[$key] = "<td width=".$head['width']."> \$row[".$key."] </td>";
}
else if ( $head['type'] == M_COLORSEL )
{
$listarr[$key] = "<td width=".$head['width']."><input id=items[\$row[\$primarykey]][".$key."] name=items[\$row[\$primarykey]][".$key."] ".$size." onchange=\\\"./js/admincp/getcolor.htm?items[\$row[\$primarykey]][".$key."];showMenu(\\\"items[\$row[\$primarykey]][".$key."]\\\");\\\" value= \$row[".$key."] ></td>";
}
else if ( $head['type'] == M_TCALENDAR )
{
$listarr[$key] = "<td width=".$head['width']."><input id=items[\$row[\$primarykey]][".$key."] name=items[\$row[\$primarykey]][".$key."] onclick=\\\"showcalendar(event, this)\\\" value=\\\" \$row[".$key."]\\\" ></td>";
}
else
{
$listarr[$key] = "<td width=".$head['width']."> \$row[".$key."] </td>";
}
if ( strtolower( $head['key'] ) != "key" )
{
echo "<td width=\"".$head['width']."\">".$head['tag']."</td>";
}
else if ( $head['type'] == M_CHECKBOX )
{
echo "<td width=\"".$head['width']."\"><input name=\"chkall\" class=\"checkedbox\" onclick=\"checkall(this.form, 'delitems')\" type=\"checkbox\">全�/td>";
}
else
{
echo "<td width=\"".$head['width']."\">ID</td>";
}
}
$liststr = "";
foreach ( $listarr as $listtemp )
{
$liststr .= $listtemp;
}
echo "</tr>";
if ( is_array( $this->data ) )
{
foreach ( $this->data as $row )
{
eval( "\$liststrnew = \"{$liststr}\";" );
echo "<tr>".$liststrnew."</tr>";
}
}
if ( $this->addbtn )
{
echo "<script>\r\n\t\t\tvar allcount = showtotal = \$(\"showlist\").rows.length;\r\n\t\t\tvar addlines = 0;\r\n\t\t\tfunction addline(){\r\n\t\t\taddlines++;\r\n\t\t\tshowsubmit(true);\r\n\t\t\trownum = \$(\"showlist\").rows.length-1;\r\n\t\t\tnewline = \$(\"showlist\").insertRow(rownum);\r\n\t\t\tnewline.ln=allcount;\r\n\t\t\tnewline.id=allcount;\r\n\t\t\tif(browser.name == \"ie\"){\r\n\t\t\t";
$jsstr = "";
foreach ( $listarr as $key => $jslist )
{
if ( $primarykey && $key == $primarykey )
{
$addline = "<a href=javascript:delline(\"+allcount+\")>åˆ é™¤</a>";
}
else
{
$size = "";
if ( $this->header[$key]['key'] )
{
$size = "size=".$this->header[$key]['key'];
}
if ( $this->header[$key]['type'] == M_TEXT || $this->header[$key]['type'] == M_TTEXT )
{
$addline = "<input name=newitems[\"+allcount+\"][".$key."] ".$size.">";
}
else if ( $this->header[$key]['type'] == M_TCALENDAR )
{
$addline = "<input id=newitems[\"+allcount+\"][".$key."] name=newitems[\"+allcount+\"][".$key."] ".$size." value=30>�;
}
else
{
$addline = "";
}
}
$jsstr .= "<td width=".$this->header[$key]['width'].">".$addline."</td>";
echo "newline.insertCell().innerHTML = \"".$addline."\";";
}
echo "\r\n\t\t\t}else{\r\n\r\n\t\t\t newline.inner
HTML = \"".$js