示例#1
0
文件: Db.php 项目: uwitec/outbuying
    /**
     * 说明
     *
     * 返回数据列表
     */
    private function html_data()
    {
        /*/$html_data	=	'<table border=1 width=100%>';*/
        // +--------------------------锁定表格--------------------------+
        if ($this->lock_table != 'OFF') {
            $html_data = '<SCRIPT language=JavaScript >
			var DataFields=new Array()
			';
            if (is_array($this->pure_data)) {
                $js_key = 0;
                foreach ($this->pure_data as $key => $var) {
                    $html_data .= "\n\t\t\t\t\t\tDataFields[" . $js_key . "] =new Array(";
                    foreach ($var as $key => $value) {
                        //$value	=	htmlspecialchars($value);
                        $value = addslashes($value);
                        $value = str_replace("\n", "\\", $value);
                        $html_data .= "\"" . $value . "\",";
                    }
                    $html_data = rtrim($html_data, ",");
                    $html_data .= ")\n\t\t\t\t\t\t\t\t   ";
                    $js_key++;
                }
            }
            $html_data .= '</SCRIPT>';
            $html_data .= $this->lock_js();
            $html_data .= '<TR>
			<TD  colspan=50><TABLE cellSpacing=0 cellPadding=0 border=0>
  <TBODY>
  <TR>
    <TD ><DIV id=TonyDataTable></DIV></TD></TR></TBODY></TABLE></TD></TR>';
            return $html_data;
        }
        // +--------------------------end锁定表格--------------------------+
        // +-------------------------------js-鼠标单击的颜色------------------------------------+
        $html_data .= '<script>
		function R_changeBG(RocID)
		{
			if(document.all)
			{
				var Roc = document.getElementById(RocID)
				var BackGround = Roc.style.background.toUpperCase();
				if (BackGround.match("#FFFADF"))
				{
					Roc.style.background = "#EEF0F6";
				}
				else
				{
					Roc.style.background = "#FFFADF";
				}
			}
		}
						</script>';
        // +-------------------+
        if (is_array($this->pure_data)) {
            foreach ($this->pure_data as $keyz => $var) {
                $html_data .= "<tr  id=\"Roc" . $i . "\" " . $this->html_style[data] . "  onclick=\"R_changeBG('Roc" . $i . "');\" onMouseOver=\"this.className ='bg';\" onMouseOut=\"this.className='source'\">";
                //修改成样式了 Victor 20070613
                foreach ($var as $key => $value) {
                    $html_data .= "<td>" . $value . "</td>";
                }
                $html_data .= "</tr>";
                $i++;
            }
            //小计
            if ($this->xs_xiaoji) {
                $html_data .= "<tr  id=\"Roc" . $i . "\" " . $this->html_style[data] . "  onclick=\"R_changeBG('Roc" . $i . "');\" onMouseOver=\"this.style.backgroundColor ='#FFFFFF';\" onMouseOut=\"this.style.backgroundColor ='#EEF0F6';\">";
                $j = 0;
                foreach ($this->m_tot_arr as $key => $value) {
                    if ($j) {
                        if ($this->format) {
                            if (is_float($value)) {
                                $html_data .= "<td><b>" . ($value ? Pft_Config::sechof($value) : '') . "</b></td>";
                            } else {
                                $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                            }
                        } else {
                            $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                        }
                    } else {
                        $html_data .= "<td><b>" . $this->z_language['小计'] . "</b></td>";
                    }
                    $j++;
                }
                $html_data .= "</tr>";
            }
            //合计
            if ($this->xs_heji) {
                $html_data .= "<tr  id=\"Roc" . $i . "\" " . $this->html_style[data] . "  onclick=\"R_changeBG('Roc" . $i . "');\" onMouseOver=\"this.style.backgroundColor ='#FFFFFF';\" onMouseOut=\"this.style.backgroundColor ='#EEF0F6';\">";
                $j = 0;
                foreach ($this->tot_arr as $key => $value) {
                    if ($j) {
                        if ($this->format) {
                            if (is_float($value)) {
                                $html_data .= "<td><b>" . ($value ? Pft_Config::sechof($value) : '') . "</b></td>";
                            } else {
                                $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                            }
                        } else {
                            $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                        }
                    } else {
                        $html_data .= "<td><b>" . $this->z_language['合计'] . "</b></td>";
                    }
                    $j++;
                }
                $html_data .= "</tr>";
            }
        }
        //$html_data	.=	'</table>';
        return $html_data;
    }