From 878f29b671eeeedbf4c32b0b8d30603c34a6bc6f Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 16 Feb 2017 10:50:05 +0800 Subject: [PATCH] =?UTF-8?q?UITables=E5=A2=9E=E5=8A=A0=E5=A4=8D=E6=9D=82?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E6=94=AF=E6=8C=81=EF=BC=8C=E5=8F=AF=E4=B8=BA?= =?UTF-8?q?=E5=88=97=E6=A0=87=E9=A2=98=E5=A2=9E=E5=8A=A0=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=88=96=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui_table.php | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/ui_table.php b/ui_table.php index 2148535..33afd09 100644 --- a/ui_table.php +++ b/ui_table.php @@ -2,12 +2,27 @@ require_once "tools_sql.php"; + class TableCol + { + public $text; //显示文本 + public $icon; //图标 + public $link; //如果点击列将跳转的页面 + + public function __construct() + { + $this->text=func_get_arg(0); + + if(func_num_args()>1)$this->icon=func_get_arg(1);else $this->icon=null; + if(func_num_args()>2)$this->link=func_get_arg(2);else $this->link=null; + } + }; + class UITable { + protected $title_cols=null; private $heading=null; private $heading_style="default"; private $body=null; - protected $title_col=null; private $table_style="striped"; public function set_heading($h) @@ -25,9 +40,15 @@ $this->body=$bt; } + public function set_title_col_text($f) + { + foreach($f as $tt) + $this->title_cols[]=new TableCol($tt); + } + public function set_title_col($f) { - $this->title_col=$f; + $this->title_cols[]=f; } public function set_table_style($ts) @@ -50,11 +71,26 @@ else echo ''; - if($this->title_col!=null) + if($this->title_cols!=null) { echo ''; - foreach($this->title_col as $field) - echo ''; + foreach($this->title_cols as $field) + { + echo ''; + } echo ''; } }
'.$field.''; + + if($field->link) + echo ''; + + echo $field->text; + + if($field->icon) + echo_icon($field->icon); + + if($field->link) + echo ''; + + echo '