Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
Yii Bootstrap 3
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Common
Yii Bootstrap 3
Commits
129738f2
Commit
129738f2
authored
Dec 23, 2011
by
niskac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the BootNav widget.
parent
f44dd281
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
3 deletions
+64
-3
BootMenu.php
widgets/BootMenu.php
+2
-3
BootNav.php
widgets/BootNav.php
+62
-0
No files found.
widgets/BootMenu.php
View file @
129738f2
...
...
@@ -16,14 +16,12 @@ class BootMenu extends CMenu
{
/**
* @var string the type of menu to display.
* Following types are supported: 'tabs' and 'pills'.
* Following types are supported: '
', '
tabs' and 'pills'.
*/
public
$type
=
'tabs'
;
/**
* Initializes the menu widget.
* This method mainly normalizes the {@link items} property.
* If this method is overridden, make sure the parent implementation is invoked.
*/
public
function
init
()
{
...
...
@@ -88,6 +86,7 @@ class BootMenu extends CMenu
/**
* Recursively renders the menu items.
* @param array $items the menu items to be rendered recursively
* @param integer $depth the menu depth. Defaults to zero.
*/
protected
function
renderMenuRecursive
(
$items
,
$depth
=
0
)
{
...
...
widgets/BootNav.php
0 → 100644
View file @
129738f2
<?php
class
BootNav
extends
BootWidget
{
/**
* @var array the menu items
*/
public
$items
=
array
();
/**
* @var string the URL for the brand link
*/
public
$brandUrl
;
/**
* @var string the text for the brand link
*/
public
$brandText
;
/**
* @var array the HTML attributes for the brand link
*/
public
$brandOptions
=
array
();
/**
* @var array the HTML attributes for the menu
*/
public
$navOptions
=
array
();
/**
* Runs the widget.
*/
public
function
run
()
{
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' topbar'
;
else
$this
->
htmlOptions
[
'class'
]
=
'topbar'
;
if
(
isset
(
$this
->
brandOptions
[
'class'
]))
$this
->
brandOptions
[
'class'
]
.=
' brand'
;
else
$this
->
brandOptions
[
'class'
]
=
'brand'
;
if
(
isset
(
$this
->
brandUrl
))
$this
->
brandOptions
[
'href'
]
=
$this
->
brandUrl
;
if
(
isset
(
$this
->
navOptions
[
'class'
]))
$this
->
navOptions
[
'class'
]
.=
' nav'
;
else
$this
->
navOptions
[
'class'
]
=
'nav'
;
echo
CHtml
::
openTag
(
'div'
,
$this
->
htmlOptions
);
echo
'<div class="topbar-inner"><div class="container">'
;
echo
CHtml
::
openTag
(
'a'
,
$this
->
brandOptions
);
echo
$this
->
brandText
;
echo
'</a>'
;
$this
->
controller
->
widget
(
'bootstrap.widgets.BootMenu'
,
array
(
'type'
=>
''
,
'items'
=>
$this
->
items
,
'htmlOptions'
=>
$this
->
navOptions
,
));
echo
'</div></div></div>'
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment