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
84381e8c
Commit
84381e8c
authored
Jul 29, 2012
by
Crisu83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor widget improvements
parent
fe59a455
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
183 additions
and
113 deletions
+183
-113
TbBadge.php
widgets/TbBadge.php
+13
-9
TbBaseMenu.php
widgets/TbBaseMenu.php
+9
-6
TbButton.php
widgets/TbButton.php
+10
-9
TbButtonGroup.php
widgets/TbButtonGroup.php
+12
-7
TbCarousel.php
widgets/TbCarousel.php
+8
-6
TbDetailView.php
widgets/TbDetailView.php
+23
-13
TbGridView.php
widgets/TbGridView.php
+27
-13
TbHeroUnit.php
widgets/TbHeroUnit.php
+2
-3
TbLabel.php
widgets/TbLabel.php
+13
-9
TbMenu.php
widgets/TbMenu.php
+12
-8
TbModal.php
widgets/TbModal.php
+18
-6
TbNavbar.php
widgets/TbNavbar.php
+10
-7
TbPager.php
widgets/TbPager.php
+4
-3
TbProgress.php
widgets/TbProgress.php
+13
-10
TbTabbable.php
widgets/TbTabbable.php
+9
-4
No files found.
widgets/TbBadge.php
View file @
84381e8c
...
...
@@ -13,7 +13,6 @@
class
TbBadge
extends
CWidget
{
// Badge types.
const
TYPE_DEFAULT
=
''
;
const
TYPE_SUCCESS
=
'success'
;
const
TYPE_WARNING
=
'warning'
;
const
TYPE_IMPORTANT
=
'important'
;
...
...
@@ -22,9 +21,9 @@ class TbBadge extends CWidget
/**
* @var string the badge type (defaults to '').
* Valid types are '
', '
success', 'warning', 'important', 'info' and 'inverse'.
* Valid types are 'success', 'warning', 'important', 'info' and 'inverse'.
*/
public
$type
=
self
::
TYPE_DEFAULT
;
public
$type
;
/**
* @var string the badge text.
*/
...
...
@@ -45,14 +44,19 @@ class TbBadge extends CWidget
{
$classes
=
array
(
'badge'
);
if
(
in_array
(
$this
->
type
,
array
(
self
::
TYPE_SUCCESS
,
self
::
TYPE_WARNING
,
self
::
TYPE_IMPORTANT
,
self
::
TYPE_INFO
,
self
::
TYPE_INVERSE
)))
$validTypes
=
array
(
self
::
TYPE_SUCCESS
,
self
::
TYPE_WARNING
,
self
::
TYPE_IMPORTANT
,
self
::
TYPE_INFO
,
self
::
TYPE_INVERSE
);
if
(
isset
(
$this
->
type
)
&&
in_array
(
$this
->
type
,
$validTypes
))
$classes
[]
=
'badge-'
.
$this
->
type
;
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
if
(
$this
->
encodeLabel
===
true
)
$this
->
label
=
CHtml
::
encode
(
$this
->
label
);
...
...
widgets/TbBaseMenu.php
View file @
84381e8c
...
...
@@ -54,7 +54,7 @@ abstract class TbBaseMenu extends CMenu
if
(
$this
->
itemCssClass
!==
null
)
$classes
[]
=
$this
->
itemCssClass
;
if
(
$classes
!==
array
(
))
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
!
empty
(
$options
[
'class'
]))
...
...
@@ -162,11 +162,14 @@ abstract class TbBaseMenu extends CMenu
if
(
isset
(
$item
[
'items'
]))
$classes
[]
=
'dropdown'
;
$classes
=
implode
(
$classes
,
' '
);
if
(
isset
(
$item
[
'itemOptions'
][
'class'
]))
$item
[
'itemOptions'
][
'class'
]
.=
' '
.
$classes
;
else
$item
[
'itemOptions'
][
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
$classes
,
' '
);
if
(
isset
(
$item
[
'itemOptions'
][
'class'
]))
$item
[
'itemOptions'
][
'class'
]
.=
' '
.
$classes
;
else
$item
[
'itemOptions'
][
'class'
]
=
$classes
;
}
}
$items
[
$i
]
=
$item
;
...
...
widgets/TbButton.php
View file @
84381e8c
...
...
@@ -24,7 +24,6 @@ class TbButton extends CWidget
const
BUTTON_AJAXSUBMIT
=
'ajaxSubmit'
;
// Button types.
const
TYPE_NORMAL
=
''
;
const
TYPE_PRIMARY
=
'primary'
;
const
TYPE_INFO
=
'info'
;
const
TYPE_SUCCESS
=
'success'
;
...
...
@@ -45,9 +44,9 @@ class TbButton extends CWidget
public
$buttonType
=
self
::
BUTTON_LINK
;
/**
* @var string the button type.
* Valid values are '
', '
primary', 'info', 'success', 'warning', 'danger' and 'inverse'.
* Valid values are 'primary', 'info', 'success', 'warning', 'danger' and 'inverse'.
*/
public
$type
=
self
::
TYPE_NORMAL
;
public
$type
;
/**
* @var string the button size.
* Valid values are '', 'small' and 'large'.
...
...
@@ -137,12 +136,14 @@ class TbButton extends CWidget
$this
->
htmlOptions
[
'data-toggle'
]
=
'dropdown'
;
}
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
if
(
isset
(
$this
->
icon
))
{
...
...
widgets/TbButtonGroup.php
View file @
84381e8c
...
...
@@ -28,7 +28,7 @@ class TbButtonGroup extends CWidget
* @var string the button type.
* @see BootButton::type
*/
public
$type
=
TbButton
::
TYPE_NORMAL
;
public
$type
;
/**
* @var string the button size.
* @see BootButton::size
...
...
@@ -67,13 +67,18 @@ class TbButtonGroup extends CWidget
}
}
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
$validToggles
=
array
(
self
::
TOGGLE_CHECKBOX
,
self
::
TOGGLE_RADIO
);
if
(
isset
(
$this
->
toggle
)
&&
in_array
(
$this
->
toggle
,
array
(
self
::
TOGGLE_CHECKBOX
,
self
::
TOGGLE_RADIO
)
))
if
(
isset
(
$this
->
toggle
)
&&
in_array
(
$this
->
toggle
,
$validToggles
))
$this
->
htmlOptions
[
'data-toggle'
]
=
'buttons-'
.
$this
->
toggle
;
}
...
...
widgets/TbCarousel.php
View file @
84381e8c
...
...
@@ -59,12 +59,14 @@ class TbCarousel extends CWidget
if
(
$this
->
slide
===
true
)
$classes
[]
=
'slide'
;
$classes
=
implode
(
$classes
,
' '
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
}
/**
...
...
widgets/TbDetailView.php
View file @
84381e8c
...
...
@@ -16,14 +16,13 @@ Yii::import('zii.widgets.CDetailView');
class
TbDetailView
extends
CDetailView
{
// Table types.
const
TYPE_PLAIN
=
''
;
const
TYPE_STRIPED
=
'striped'
;
const
TYPE_BORDERED
=
'bordered'
;
const
TYPE_CONDENSED
=
'condensed'
;
/**
* @var string|array the table type.
* Valid values are '
', '
striped', 'bordered' and/or 'condensed'.
* Valid values are 'striped', 'bordered' and/or 'condensed'.
*/
public
$type
=
array
(
self
::
TYPE_STRIPED
,
self
::
TYPE_CONDENSED
);
/**
...
...
@@ -41,19 +40,30 @@ class TbDetailView extends CDetailView
$classes
=
array
(
'table'
);
if
(
is_string
(
$this
->
type
))
$this
->
type
=
explode
(
' '
,
$this
->
type
);
if
(
isset
(
$this
->
type
))
{
if
(
is_string
(
$this
->
type
))
$this
->
type
=
explode
(
' '
,
$this
->
type
);
$validTypes
=
array
(
self
::
TYPE_STRIPED
,
self
::
TYPE_BORDERED
,
self
::
TYPE_CONDENSED
);
$validTypes
=
array
(
self
::
TYPE_STRIPED
,
self
::
TYPE_BORDERED
,
self
::
TYPE_CONDENSED
);
foreach
(
$this
->
type
as
$type
)
if
(
in_array
(
$type
,
$validTypes
))
$classes
[]
=
'table-'
.
$type
;
if
(
!
empty
(
$this
->
type
))
{
foreach
(
$this
->
type
as
$type
)
{
if
(
in_array
(
$type
,
$validTypes
))
$classes
[]
=
'table-'
.
$type
;
}
}
}
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
}
}
widgets/TbGridView.php
View file @
84381e8c
...
...
@@ -17,16 +17,15 @@ Yii::import('bootstrap.widgets.TbDataColumn');
class
TbGridView
extends
CGridView
{
// Table types.
const
TYPE_PLAIN
=
''
;
const
TYPE_STRIPED
=
'striped'
;
const
TYPE_BORDERED
=
'bordered'
;
const
TYPE_CONDENSED
=
'condensed'
;
/**
* @var string|array the table type.
* Valid values are '
', '
striped', 'bordered' and/or ' condensed'.
* Valid values are 'striped', 'bordered' and/or ' condensed'.
*/
public
$type
=
self
::
TYPE_PLAIN
;
public
$type
;
/**
* @var string the CSS class name for the pager container.
* Defaults to 'pagination'.
...
...
@@ -52,16 +51,31 @@ class TbGridView extends CGridView
$classes
=
array
(
'table'
);
if
(
is_string
(
$this
->
type
))
$this
->
type
=
explode
(
' '
,
$this
->
type
);
$validTypes
=
array
(
self
::
TYPE_STRIPED
,
self
::
TYPE_BORDERED
,
self
::
TYPE_CONDENSED
);
foreach
(
$this
->
type
as
$type
)
if
(
in_array
(
$type
,
$validTypes
))
$classes
[]
=
'table-'
.
$type
;
$this
->
itemsCssClass
.=
' '
.
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
type
))
{
if
(
is_string
(
$this
->
type
))
$this
->
type
=
explode
(
' '
,
$this
->
type
);
$validTypes
=
array
(
self
::
TYPE_STRIPED
,
self
::
TYPE_BORDERED
,
self
::
TYPE_CONDENSED
);
if
(
!
empty
(
$this
->
type
))
{
foreach
(
$this
->
type
as
$type
)
{
if
(
in_array
(
$type
,
$validTypes
))
$classes
[]
=
'table-'
.
$type
;
}
}
}
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
itemsCssClass
))
$this
->
itemsCssClass
.=
' '
.
$classes
;
else
$this
->
itemsCssClass
=
$classes
;
}
$popover
=
Yii
::
app
()
->
bootstrap
->
popoverSelector
;
$tooltip
=
Yii
::
app
()
->
bootstrap
->
tooltipSelector
;
...
...
widgets/TbHeroUnit.php
View file @
84381e8c
...
...
@@ -32,11 +32,10 @@ class TbHeroUnit extends CWidget
*/
public
function
init
()
{
$classes
=
'hero-unit'
;
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
'
'
.
$classes
;
$this
->
htmlOptions
[
'class'
]
.=
'
hero-unit'
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
$this
->
htmlOptions
[
'class'
]
=
'hero-unit'
;
if
(
$this
->
encodeHeading
)
$this
->
heading
=
CHtml
::
encode
(
$this
->
heading
);
...
...
widgets/TbLabel.php
View file @
84381e8c
...
...
@@ -13,7 +13,6 @@
class
TbLabel
extends
CWidget
{
// Label types.
const
TYPE_DEFAULT
=
''
;
const
TYPE_SUCCESS
=
'success'
;
const
TYPE_WARNING
=
'warning'
;
const
TYPE_IMPORTANT
=
'important'
;
...
...
@@ -22,9 +21,9 @@ class TbLabel extends CWidget
/**
* @var string the label type (defaults to '').
* Valid types are '
', '
success', 'warning', 'important', 'info' and 'inverse'.
* Valid types are 'success', 'warning', 'important', 'info' and 'inverse'.
*/
public
$type
=
self
::
TYPE_DEFAULT
;
public
$type
;
/**
* @var string the label text.
*/
...
...
@@ -45,14 +44,19 @@ class TbLabel extends CWidget
{
$classes
=
array
(
'label'
);
if
(
in_array
(
$this
->
type
,
array
(
self
::
TYPE_SUCCESS
,
self
::
TYPE_WARNING
,
self
::
TYPE_IMPORTANT
,
self
::
TYPE_INFO
,
self
::
TYPE_INVERSE
)))
$validTypes
=
array
(
self
::
TYPE_SUCCESS
,
self
::
TYPE_WARNING
,
self
::
TYPE_IMPORTANT
,
self
::
TYPE_INFO
,
self
::
TYPE_INVERSE
);
if
(
isset
(
$this
->
type
)
&&
in_array
(
$this
->
type
,
$validTypes
))
$classes
[]
=
'label-'
.
$this
->
type
;
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
if
(
$this
->
encodeLabel
===
true
)
$this
->
label
=
CHtml
::
encode
(
$this
->
label
);
...
...
widgets/TbMenu.php
View file @
84381e8c
...
...
@@ -12,14 +12,13 @@ Yii::import('bootstrap.widgets.TbBaseMenu');
class
TbMenu
extends
TbBaseMenu
{
// Menu types.
const
TYPE_UNSTYLED
=
''
;
const
TYPE_TABS
=
'tabs'
;
const
TYPE_PILLS
=
'pills'
;
const
TYPE_LIST
=
'list'
;
/**
* @var string the menu type.
* Valid values are '
', '
tabs' and 'pills'. Defaults to ''.
* Valid values are 'tabs' and 'pills'. Defaults to ''.
*/
public
$type
;
/**
...
...
@@ -40,7 +39,9 @@ class TbMenu extends TbBaseMenu
$classes
=
array
(
'nav'
);
if
(
isset
(
$this
->
type
)
&&
in_array
(
$this
->
type
,
array
(
self
::
TYPE_TABS
,
self
::
TYPE_PILLS
,
self
::
TYPE_LIST
)))
$validTypes
=
array
(
self
::
TYPE_TABS
,
self
::
TYPE_PILLS
,
self
::
TYPE_LIST
);
if
(
isset
(
$this
->
type
)
&&
in_array
(
$this
->
type
,
$validTypes
))
$classes
[]
=
'nav-'
.
$this
->
type
;
if
(
$this
->
type
!==
self
::
TYPE_LIST
&&
$this
->
stacked
)
...
...
@@ -55,11 +56,14 @@ class TbMenu extends TbBaseMenu
}
}
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
if
(
isset
(
$this
->
scrollspy
)
&&
is_array
(
$this
->
scrollspy
)
&&
isset
(
$this
->
scrollspy
[
'spy'
]))
{
...
...
widgets/TbModal.php
View file @
84381e8c
...
...
@@ -14,9 +14,13 @@
class
TbModal
extends
CWidget
{
/**
* @var boolean whether to automatically open the modal when initialized.
* @var boolean
indicates
whether to automatically open the modal when initialized.
*/
public
$autoOpen
=
false
;
/**
* @var boolean indicates whether the modal should use transitions.
*/
public
$fade
=
true
;
/**
* @var array the options for the Bootstrap JavaScript plugin.
*/
...
...
@@ -41,11 +45,19 @@ class TbModal extends CWidget
if
(
!
$this
->
autoOpen
&&
!
isset
(
$this
->
options
[
'show'
]))
$this
->
options
[
'show'
]
=
false
;
$classes
=
'modal fade'
;
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
$classes
=
array
(
'modal'
);
if
(
$this
->
fade
===
true
)
$classes
[]
=
'fade'
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
echo
CHtml
::
openTag
(
'div'
,
$this
->
htmlOptions
)
.
PHP_EOL
;
}
...
...
widgets/TbNavbar.php
View file @
84381e8c
...
...
@@ -99,11 +99,14 @@ class TbNavbar extends CWidget
}
}
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
}
/**
...
...
@@ -157,7 +160,7 @@ class TbNavbar extends CWidget
*/
protected
function
getCollapseTarget
()
{
return
$this
->
type
===
self
::
TYPE_DEFAULT
?
'nav-collapse'
:
'subnav-collapse'
;
return
!
isset
(
$this
->
type
)
?
'nav-collapse'
:
'subnav-collapse'
;
}
/**
...
...
@@ -166,6 +169,6 @@ class TbNavbar extends CWidget
*/
protected
function
getCollapseCssClass
()
{
return
$this
->
type
===
self
::
TYPE_DEFAULT
?
'nav-collapse'
:
'nav-collapse subnav-collapse'
;
return
!
isset
(
$this
->
type
)
?
'nav-collapse'
:
'nav-collapse subnav-collapse'
;
}
}
widgets/TbPager.php
View file @
84381e8c
...
...
@@ -13,7 +13,6 @@
class
TbPager
extends
CLinkPager
{
// Pager alignments.
const
ALIGNMENT_LEFT
=
''
;
const
ALIGNMENT_CENTER
=
'centered'
;
const
ALIGNMENT_RIGHT
=
'right'
;
...
...
@@ -21,7 +20,7 @@ class TbPager extends CLinkPager
* @var string the pager alignment (default to '').
* Valid values are 'left', 'centered' and 'right'.
*/
public
$alignment
=
self
::
ALIGNMENT_LEFT
;
public
$alignment
;
/**
* @var string the text shown before page buttons (defaults to '').
*/
...
...
@@ -49,7 +48,9 @@ class TbPager extends CLinkPager
$classes
=
array
();
if
(
in_array
(
$this
->
alignment
,
array
(
self
::
ALIGNMENT_LEFT
,
self
::
ALIGNMENT_CENTER
,
self
::
ALIGNMENT_RIGHT
)))
$validAlignments
=
array
(
self
::
ALIGNMENT_CENTER
,
self
::
ALIGNMENT_RIGHT
);
if
(
in_array
(
$this
->
alignment
,
$validAlignments
))
$classes
[]
=
'pagination-'
.
$this
->
alignment
;
if
(
!
empty
(
$classes
))
...
...
widgets/TbProgress.php
View file @
84381e8c
...
...
@@ -14,7 +14,6 @@
class
TbProgress
extends
CWidget
{
// Progress bar types.
const
TYPE_DEFAULT
=
''
;
const
TYPE_INFO
=
'info'
;
const
TYPE_SUCCESS
=
'success'
;
const
TYPE_WARNING
=
'warning'
;
...
...
@@ -22,9 +21,9 @@ class TbProgress extends CWidget
/**
* @var string the bar type.
* Valid values are '
', '
info', 'success', and 'danger'.
* Valid values are 'info', 'success', and 'danger'.
*/
public
$type
=
self
::
TYPE_DEFAULT
;
public
$type
;
/**
* @var boolean whether the bar is striped.
*/
...
...
@@ -49,8 +48,9 @@ class TbProgress extends CWidget
{
$classes
=
array
(
'progress'
);
$validTypes
=
array
(
self
::
TYPE_DEFAULT
,
self
::
TYPE_INFO
,
self
::
TYPE_SUCCESS
,
self
::
TYPE_WARNING
,
self
::
TYPE_DANGER
);
if
(
$this
->
type
!==
self
::
TYPE_DEFAULT
&&
in_array
(
$this
->
type
,
$validTypes
))
$validTypes
=
array
(
self
::
TYPE_INFO
,
self
::
TYPE_SUCCESS
,
self
::
TYPE_WARNING
,
self
::
TYPE_DANGER
);
if
(
isset
(
$this
->
type
)
&&
in_array
(
$this
->
type
,
$validTypes
))
$classes
[]
=
'progress-'
.
$this
->
type
;
if
(
$this
->
striped
)
...
...
@@ -59,11 +59,14 @@ class TbProgress extends CWidget
if
(
$this
->
animated
)
$classes
[]
=
'active'
;
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
if
(
!
empty
(
$classes
))
{
$classes
=
implode
(
' '
,
$classes
);
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
$this
->
htmlOptions
[
'class'
]
=
$classes
;
}
if
(
$this
->
percent
<
0
)
$this
->
percent
=
0
;
...
...
widgets/TbTabbable.php
View file @
84381e8c
...
...
@@ -31,7 +31,7 @@ class TbTabbable extends CWidget
* @var string the placement of the tabs.
* Valid values are 'above', 'below', 'left' and 'right'.
*/
public
$placement
=
self
::
PLACEMENT_ABOVE
;
public
$placement
;
/**
* @var array the tab configuration.
*/
...
...
@@ -57,11 +57,16 @@ class TbTabbable extends CWidget
if
(
!
isset
(
$this
->
htmlOptions
[
'id'
]))
$this
->
htmlOptions
[
'id'
]
=
$this
->
getId
();
$validPlacements
=
array
(
self
::
PLACEMENT_ABOVE
,
self
::
PLACEMENT_BELOW
,
self
::
PLACEMENT_LEFT
,
self
::
PLACEMENT_RIGHT
);
$classes
=
array
(
);
if
(
isset
(
$this
->
placement
)
&&
in_array
(
$this
->
placement
,
$validPlacements
))
$validPlacements
=
array
(
self
::
PLACEMENT_ABOVE
,
self
::
PLACEMENT_BELOW
,
self
::
PLACEMENT_LEFT
,
self
::
PLACEMENT_RIGHT
);
if
(
isset
(
$this
->
placement
)
&&
in_array
(
$this
->
placement
,
$validPlacements
))
$classes
[]
=
'tabs-'
.
$this
->
placement
;
if
(
!
empty
(
$classes
))
{
$classes
=
'tabs-'
.
$this
->
placement
;
$classes
=
implode
(
' '
,
$classes
)
;
if
(
isset
(
$this
->
htmlOptions
[
'class'
]))
$this
->
htmlOptions
[
'class'
]
.=
' '
.
$classes
;
else
...
...
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