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
8d1d077d
Commit
8d1d077d
authored
Jul 09, 2013
by
Bertrand Gauthier
Browse files
Aide de vue UserInfo : n'a besoin que du mapper d'accès aux structures LDAP.
parent
075bdac1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Module.php
View file @
8d1d077d
...
...
@@ -137,7 +137,7 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
},
'userInfo'
=>
function
(
HelperPluginManager
$sm
)
{
$helper
=
new
View\Helper\UserInfo
(
$sm
->
getServiceLocator
()
->
get
(
'zfcuser_auth_service'
));
$helper
->
set
Service
Structure
(
$sm
->
getServiceLocator
()
->
get
(
'ldap_structure_
service
'
));
$helper
->
set
Mapper
Structure
(
$sm
->
getServiceLocator
()
->
get
(
'ldap_structure_
mapper
'
));
return
$helper
;
},
),
...
...
src/UnicaenAuth/View/Helper/UserInfo.php
View file @
8d1d077d
...
...
@@ -2,7 +2,7 @@
namespace
UnicaenAuth\View\Helper
;
use
UnicaenApp\Entity\Ldap\People
;
use
UnicaenApp\
Service
\Ldap\Structure
as
Service
Structure
;
use
UnicaenApp\
Mapper
\Ldap\Structure
as
Mapper
Structure
;
use
Zend\View\Helper\HtmlList
;
/**
...
...
@@ -15,9 +15,9 @@ use Zend\View\Helper\HtmlList;
class
UserInfo
extends
UserAbstract
{
/**
* @var
Service
Structure
* @var
Mapper
Structure
*/
protected
$
service
Structure
;
protected
$
mapper
Structure
;
/**
* @var bool
...
...
@@ -28,7 +28,7 @@ class UserInfo extends UserAbstract
* Point d'entrée.
*
* @param boolean $affectationPrincipale Indique s'il ne faut prendre en compte que l'affectation principale
* @return
U
se
rInfo
* @return se
lf
*/
public
function
__invoke
(
$affectationPrincipale
=
false
)
{
...
...
@@ -48,18 +48,18 @@ class UserInfo extends UserAbstract
}
$out
=
''
;
$templateAff
=
'<strong>'
.
$this
->
getView
()
->
translate
(
"Affectations administratives"
)
.
' :</strong> %s'
;
$templateAffRech
=
'<strong>'
.
$this
->
getView
()
->
translate
(
"Affectations recherche"
)
.
' :</strong> %s'
;
$templateFonctStruct
=
'<strong>'
.
$this
->
getView
()
->
translate
(
"Responsabilités"
)
.
' :</strong> %s'
;
$templateAff
=
'<strong>'
.
$this
->
getView
()
->
translate
(
"Affectations administratives"
)
.
' :</strong> %s'
;
$templateAffRech
=
'<strong>'
.
$this
->
getView
()
->
translate
(
"Affectations recherche"
)
.
' :</strong> %s'
;
$templateFonctStruct
=
'<strong>'
.
$this
->
getView
()
->
translate
(
"Responsabilités"
)
.
' :</strong> %s'
;
$helperHtmlList
=
new
HtmlList
();
if
(
$authIdentity
instanceof
People
)
{
// affectations admin
$affectations
=
$authIdentity
->
getAffectationsAdmin
(
$this
->
get
Service
Structure
()
->
getMapper
()
,
$this
->
getAffectationPrincipale
());
$affectations
=
$authIdentity
->
getAffectationsAdmin
(
$this
->
get
Mapper
Structure
(),
$this
->
getAffectationPrincipale
());
if
(
$affectations
)
{
// $affectations = (array)$this->get
Service
Structure()->getMapper()->findChemin(array_keys($affectations));
// $affectations = (array)$this->get
Mapper
Structure()->getMapper()->findChemin(array_keys($affectations));
if
(
empty
(
$affectations
))
$affectations
[]
=
$this
->
getView
()
->
translate
(
"Aucune affectation trouvée."
);
ksort
(
$affectations
);
...
...
@@ -70,7 +70,7 @@ class UserInfo extends UserAbstract
// affectations recherche
$affectations
=
$authIdentity
->
getAffectationsRecherche
();
if
(
$affectations
)
{
$affectations
=
(
array
)
$this
->
get
Service
Structure
()
->
getMapper
()
->
findAllPathByCodeStructure
(
array_keys
(
$affectations
));
$affectations
=
(
array
)
$this
->
get
Mapper
Structure
()
->
findAllPathByCodeStructure
(
array_keys
(
$affectations
));
ksort
(
$affectations
);
$affectations
=
$helperHtmlList
(
$affectations
,
$ordered
=
false
,
$attribs
=
false
,
$escape
=
false
);
$out
.
=
sprintf
(
$templateAffRech
,
$affectations
);
...
...
@@ -101,7 +101,7 @@ class UserInfo extends UserAbstract
// // affectations admin
// $affectations = $authIdentity->getLdapIdentityData()->getAffectationsAdmin($this->getAffectationPrincipale());
// if ($affectations) {
// $affectations = (array)$this->get
Service
Structure()->findChemin(array_keys($affectations));
// $affectations = (array)$this->get
Mapper
Structure()->findChemin(array_keys($affectations));
// if (empty($affectations))
// $affectations[] = "Aucune affectation trouvée.";
// ksort($affectations);
...
...
@@ -112,7 +112,7 @@ class UserInfo extends UserAbstract
// // affectations recherche
// $affectations = $authIdentity->getLdapIdentityData()->getAffectationsRecherche();
// if ($affectations) {
// $affectations = (array)$this->get
Service
Structure()->findChemin(array_keys($affectations));
// $affectations = (array)$this->get
Mapper
Structure()->findChemin(array_keys($affectations));
// ksort($affectations);
// $affectations = $helperHtmlList($affectations, $ordered = false, $attribs = false, $escape = false);
// $out .= sprintf($templateAffRech, $affectations);
...
...
@@ -174,7 +174,7 @@ class UserInfo extends UserAbstract
* Active ou non l'affichage de l'affectation principale seulement.
*
* @param bool $affectationPrincipale
* @return
U
se
rInfo
* @return se
lf
*/
public
function
setAffectationPrincipale
(
$affectationPrincipale
=
true
)
{
...
...
@@ -183,24 +183,24 @@ class UserInfo extends UserAbstract
}
/**
* Spécifie le
service
d'accès aux structures de l'annuaire LDAP.
* Spécifie le
mapper
d'accès aux structures de l'annuaire LDAP.
*
* @param
Service
Structure $
service
Structure
* @return
U
se
rInfo
* @param
Mapper
Structure $
mapper
Structure
* @return se
lf
*/
public
function
set
Service
Structure
(
Service
Structure
$
service
Structure
)
public
function
set
Mapper
Structure
(
Mapper
Structure
$
mapper
Structure
)
{
$this
->
service
Structure
=
$
service
Structure
;
$this
->
mapper
Structure
=
$
mapper
Structure
;
return
$this
;
}
/**
* Retourne le
service
d'accès aux structures de l'annuaire LDAP.
* Retourne le
mapper
d'accès aux structures de l'annuaire LDAP.
*
* @return
Service
Structure
* @return
Mapper
Structure
*/
public
function
get
Service
Structure
()
public
function
get
Mapper
Structure
()
{
return
$this
->
service
Structure
;
return
$this
->
mapper
Structure
;
}
}
}
\ No newline at end of file
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