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
a10361a8
Commit
a10361a8
authored
Feb 13, 2012
by
Crisu83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BootActiveForm inputList multiselect bug. (fixes #6)
parent
de3d4a54
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
+27
-7
BootActiveForm.php
widgets/BootActiveForm.php
+27
-7
No files found.
widgets/BootActiveForm.php
View file @
a10361a8
...
...
@@ -256,7 +256,7 @@ class BootActiveForm extends CActiveForm
* @param boolean $checkbox flag that indicates if the list is a checkbox-list.
* @param CModel $model the data model
* @param string $attribute the attribute
* @param array $data value-label pairs used to generate the
radio button
list.
* @param array $data value-label pairs used to generate the
input
list.
* @param array $htmlOptions additional HTML options.
* @return string the generated input list.
* @since 0.9.5
...
...
@@ -264,7 +264,7 @@ class BootActiveForm extends CActiveForm
protected
function
inputsList
(
$checkbox
,
$model
,
$attribute
,
$data
,
$htmlOptions
=
array
())
{
CHtml
::
resolveNameID
(
$model
,
$attribute
,
$htmlOptions
);
$select
ion
=
CHtml
::
resolveValue
(
$model
,
$attribute
);
$select
=
CHtml
::
resolveValue
(
$model
,
$attribute
);
if
(
$model
->
hasErrors
(
$attribute
))
{
...
...
@@ -288,11 +288,25 @@ class BootActiveForm extends CActiveForm
$hiddenOptions
=
isset
(
$htmlOptions
[
'id'
])
?
array
(
'id'
=>
CHtml
::
ID_PREFIX
.
$htmlOptions
[
'id'
])
:
array
(
'id'
=>
false
);
$hidden
=
$uncheck
!==
null
?
CHtml
::
hiddenField
(
$name
,
$uncheck
,
$hiddenOptions
)
:
''
;
unset
(
$htmlOptions
[
'template'
],
$htmlOptions
[
'separator'
],
$htmlOptions
[
'labelOptions'
]);
if
(
isset
(
$htmlOptions
[
'template'
]))
$template
=
$htmlOptions
[
'template'
];
else
$template
=
'<label class="{labelCssClass}">{input}{label}</label>'
;
unset
(
$htmlOptions
[
'template'
],
$htmlOptions
[
'separator'
],
$htmlOptions
[
'hint'
]);
if
(
$checkbox
&&
substr
(
$name
,
-
2
)
!==
'[]'
)
$name
.=
'[]'
;
unset
(
$htmlOptions
[
'checkAll'
],
$htmlOptions
[
'checkAllLast'
]);
$labelOptions
=
isset
(
$htmlOptions
[
'labelOptions'
])
?
$htmlOptions
[
'labelOptions'
]
:
array
();
unset
(
$htmlOptions
[
'labelOptions'
]);
$items
=
array
();
$baseID
=
CHtml
::
getIdByName
(
$name
);
$id
=
0
;
$checkAll
=
true
;
$method
=
$checkbox
?
'checkBox'
:
'radioButton'
;
$labelCssClass
=
$checkbox
?
'checkbox'
:
'radio'
;
...
...
@@ -302,16 +316,22 @@ class BootActiveForm extends CActiveForm
unset
(
$htmlOptions
[
'inline'
]);
}
foreach
(
$data
as
$value
=>
$label
)
foreach
(
$data
as
$value
=>
$label
)
{
$checked
=!
strcmp
(
$value
,
$selection
);
$checked
=
!
is_array
(
$select
)
&&
!
strcmp
(
$value
,
$select
)
||
is_array
(
$select
)
&&
in_array
(
$value
,
$select
);
$checkAll
=
$checkAll
&&
$checked
;
$htmlOptions
[
'value'
]
=
$value
;
$htmlOptions
[
'id'
]
=
$baseID
.
'_'
.
$id
++
;
$option
=
CHtml
::
$method
(
$name
,
$checked
,
$htmlOptions
);
$items
[]
=
'<label class="'
.
$labelCssClass
.
'">'
.
$option
.
$label
.
'</label>'
;
$label
=
CHtml
::
label
(
$label
,
$htmlOptions
[
'id'
],
$labelOptions
);
$items
[]
=
strtr
(
$template
,
array
(
'{labelCssClass}'
=>
$labelCssClass
,
'{input}'
=>
$option
,
'{label}'
=>
$label
,
));
}
return
implode
(
''
,
$items
);
return
$hidden
.
implode
(
''
,
$items
);
}
/**
...
...
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