This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-07-10 20:15:28 +08:00
parent a5bdb3cc7b
commit 90044c22ac
2 changed files with 18 additions and 32 deletions

View File

@ -20,26 +20,9 @@
class UITable
{
protected $title_cols=null;
private $heading=null;
private $heading_style="default";
private $body=null;
private $thead_style=null;
private $table_style="striped";
public function set_heading($h)
{
$this->heading=$h;
}
public function set_heading_style($hs)
{
$this->heading_style=$hs;
}
public function set_body_text($bt)
{
$this->body=$bt;
}
public function set_title_col_text($f)
{
foreach($f as $tt)
@ -51,6 +34,11 @@
$this->title_cols=$f;
}
public function set_title_thead_style($s)
{
$this->thead_style=$s;
}
public function set_table_style($ts)
{
$this->table_style=$ts;
@ -58,14 +46,6 @@
public function start()
{
echo '<div class="panel panel-'.$this->heading_style.'" style="margin-bottom: 0px;">';
if($this->heading!=null)
echo '<div class="panel-heading">'.$this->heading.'</div>';
if($this->body!=null)
echo '<div class="panel-body"><p style="margin-bottom: 0px;">'.$this->body.'</p></div>';
if($this->table_style)
echo '<table class="table table-responsive table-'.$this->table_style.'">';
else
@ -73,6 +53,9 @@
if($this->title_cols!=null)
{
if($this->thead_style!=null)
echo '<thead class="table-'.$this->thead_style.'">';
echo '<tr>';
foreach($this->title_cols as $field)
{
@ -92,6 +75,9 @@
echo '</th>';
}
echo '</tr>';
if($this->thead_style!=null)
echo '</thead>';
}
}
@ -101,6 +87,7 @@
public function start_col (){echo '<td>';}
public function end_col (){echo '</td>';}
public function skip_col (){echo '<td/>';}
public function echo_col ($text){echo '<td>'.$text.'</td>';}
public function echo_multi_col($text_list)
@ -121,8 +108,7 @@
public function end()
{
echo '</table>
</div>';
echo '</table>';
}
};//class UITable
@ -146,13 +132,13 @@
if($field_list==null)
{
$field_list=get_field_list($sql,$sql_table_name);
$field_list=sql_get_field_list($sql,$sql_table_name);
parent::set_title_col($field_list);
$this->sql_fields=$field_list;
$this->sql_result=select_table_to_array($sql,$sql_table_name,null,$where,$start,$count);
$this->sql_result=sql_select_table_to_array($sql,$sql_table_name,null,$where,$start,$count);
}
else
{
@ -160,7 +146,7 @@
$this->sql_fields=$field_list;
$this->sql_result=select_table_to_array($sql,$sql_table_name,$field_list,$where,$start,$count);
$this->sql_result=sql_select_table_to_array($sql,$sql_table_name,$field_list,$where,$start,$count);
}
}