CMPHP/ui_tab.php

49 lines
945 B
PHP
Raw Normal View History

2017-02-23 15:21:34 +08:00
<?php
2016-08-21 23:06:17 +04:00
class UITabView
{
private $id=null;
private $active=null;
private $tab_array=null;
2016-08-21 23:06:17 +04:00
public function __construct($i,$a)
2016-08-21 23:06:17 +04:00
{
$this->id=$i;
$this->active=$a;
2016-08-21 23:06:17 +04:00
}
public function set_tab($ta)
{
$this->tab_array=$ta;
}
2016-08-21 23:06:17 +04:00
public function out_html()
{
echo '<div id="'.$this->id.'">
<ul class="nav nav-tabs">';
2016-08-21 23:06:17 +04:00
foreach($this->tab_array as $label=>$text)
{
echo '<li';
2016-08-21 23:06:17 +04:00
if($label==$this->active)
echo ' class="active"';
2016-08-21 23:06:17 +04:00
echo '><a href="'.$label.'">'.$text.'</a></li>';
}
2016-08-21 23:06:17 +04:00
echo '</ul>
</div>';
}
};//class UITabView
2016-08-21 23:06:17 +04:00
function create_tab_view($id,$active,$tab_array)
{
$tab=new UITabView($id,$active);
2016-08-21 23:06:17 +04:00
$tab->set_tab($tab_array);
2016-08-21 23:06:17 +04:00
$tab->out_html();
}
2016-08-21 23:06:17 +04:00
?>