From e27b45a361ce277c3a6ac177a4a88005927faeb8 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Tue, 30 Aug 2016 02:28:42 +0400 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=96=B0=E7=9A=84UINavBar?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E6=94=B9=E4=B8=BA=E4=BB=85=E4=BD=BF=E7=94=A8?= =?UTF-8?q?Bootstrap=EF=BC=8C=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8AlloyUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phptools.php | 1 + tools.php | 15 ++++- ui_navbar.php | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 ui_navbar.php diff --git a/phptools.php b/phptools.php index c28658f..d5bd913 100644 --- a/phptools.php +++ b/phptools.php @@ -10,3 +10,4 @@ require_once "ui_tab.php"; require_once 'ui_sidebar.php'; + require_once "ui_navbar.php"; diff --git a/tools.php b/tools.php index 75211da..160f14f 100644 --- a/tools.php +++ b/tools.php @@ -8,9 +8,18 @@ - - - + + + + + + + + + + + + '; } diff --git a/ui_navbar.php b/ui_navbar.php new file mode 100644 index 0000000..71a223a --- /dev/null +++ b/ui_navbar.php @@ -0,0 +1,154 @@ +sub_menu=$s; + } + + public function __construct2($t,$l) + { + $this->Set($t,$l); + } + + public function __construct3($t,$l,$s) + { + $this->Set($t,$l); + $this->sub_menu=$s; + } + + public function Set($t,$l) + { + $this->text=$t; + $this->link=$l; + } + + public function SetSubMenu($sm) + { + $this->sub_menu=$sm; + } + + public function GetText() + { + return $this->text; + } + + public function GetLink() + { + return $this->link; + } + + public function GetSubMenu() + { + return $this->sub_menu; + } + };//class MenuItem + + class UINavBar + { + private $style="navbar-default"; + private $fix_top=true; + private $brand=null; + private $brand_link=null; + private $menu=null; + private $active=null; + + public function __construct($m,$a) + { + $this->menu=$m; + $this->active=$a; + } + + public function set_style($s) + { + if($s==null||strlen($s)<=0) + $this->style=""; + else + $this->style="navbar-".$s; + } + + /** + * @b 标题文本 + * @l 标题链接 + */ + public function set_brand($b,$l) + { + $this->brand=$b; + $this->brand_link=$l; + } + + private function echo_menu($m) + { + if($m==null)return; + + foreach($m as $mi) + { + $sub_menu=$mi->GetSubMenu(); + + if($sub_menu!=null) //子菜单 + { + echo ''; + } + else + { + if($this->active==$mi->GetLink()) + echo '
  • '; + else + echo '
  • '; + + echo ''.$mi->GetText().'
  • '; + } + } + } + + public function out_html() + { + echo ''; + } + };//class UINavBar