Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
1b25075a
Commit
1b25075a
authored
Mar 27, 2015
by
David Surville
Browse files
Bug sur la récupération du role dans l'aide de vue
parent
a81033a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/UnicaenAuth/View/Helper/UserProfileSelectRadioItem.php
View file @
1b25075a
<?php
namespace
UnicaenAuth\View\Helper
;
use
Applicat
ion\Acl\Role
;
use
Zend\Permiss
ion
s
\Acl\Role
\RoleInterface
;
use
Zend\Form\Element\Radio
;
/**
...
...
@@ -14,7 +14,7 @@ use Zend\Form\Element\Radio;
class
UserProfileSelectRadioItem
extends
UserAbstract
{
/**
* @var Role
* @var Role
Interface
*/
protected
$role
;
...
...
@@ -30,11 +30,11 @@ class UserProfileSelectRadioItem extends UserAbstract
/**
*
* @param Role $role
* @param Role
Interface
$role
* @param bool $selected
* @return self
*/
public
function
__invoke
(
Role
$role
,
$selected
=
false
)
public
function
__invoke
(
Role
Interface
$role
,
$selected
=
false
)
{
$this
->
role
=
$role
;
$this
->
selected
=
$selected
;
...
...
@@ -74,10 +74,12 @@ class UserProfileSelectRadioItem extends UserAbstract
$id
=
$this
->
role
->
getRoleId
();
$inputClass
=
'user-profile-select-input'
;
$roleToString
=
method_exists
(
$this
->
role
,
'__toString'
)
?
(
string
)
$this
->
role
:
$this
->
role
->
getRoleId
();
// rendu sous forme de radio
$radio
=
new
Radio
(
'role'
);
$radio
->
setValueOptions
(
array
(
$id
=>
(
string
)
$this
->
role
))
->
setValueOptions
(
array
(
$id
=>
$roleToString
))
->
setAttribute
(
'class'
,
$inputClass
)
->
setAttribute
(
'title'
,
"Cliquez pour changer de profil courant"
)
->
setValue
(
$this
->
selected
?
$id
:
null
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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