Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
ldap
Commits
f5e8085d
Commit
f5e8085d
authored
Jun 26, 2020
by
David Surville
Browse files
[Evolution] Développement UnicaenLdap WIP
parent
8d66ec30
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/UnicaenLdap/Entity/Base/People.php
View file @
f5e8085d
...
...
@@ -18,6 +18,25 @@ use Zend\Ldap\Exception\LdapException;
*/
class
People
extends
Entity
{
/**
* Constantes pour les champs eduPersonAffiliation et eduPersonPrimaryAffiliation
*/
const
STATUS_AFFILIATE
=
'affiliate'
;
const
STATUS_ALUM
=
'alum'
;
const
STATUS_EMERITUS
=
'emeritus'
;
const
STATUS_EMPLOYEE
=
'employee'
;
const
STATUS_FACULTY
=
'faculty'
;
const
STATUS_MEMBER
=
'member'
;
const
STATUS_REGISTERED_READER
=
'registered-reader'
;
const
STATUS_RESEARCHER
=
'researcher'
;
const
STATUS_RETIRED
=
'retired'
;
const
STATUS_STAFF
=
'staff'
;
const
STATUS_STUDENT
=
'student'
;
const
STATUS_TEACHER
=
'teacher'
;
/**
* @var string
*/
protected
$type
=
'People'
;
/**
...
...
@@ -208,18 +227,18 @@ class People extends Entity
* @var array
*/
protected
$eduPersonAffiliationAuthorizedValues
=
[
'affiliate'
,
'alum'
,
'emeritus'
,
'employee'
,
'faculty'
,
'member'
,
'registered-reader'
,
'researcher'
,
'retired'
,
'staff'
,
'student'
,
'teacher'
,
self
::
STATUS_AFFILIATE
,
self
::
STATUS_ALUM
,
self
::
STATUS_EMERITUS
,
self
::
STATUS_EMPLOYEE
,
self
::
STATUS_FACULTY
,
self
::
STATUS_MEMBER
,
self
::
STATUS_REGISTERED_READER
,
self
::
STATUS_RESEARCHER
,
self
::
STATUS_RETIRED
,
self
::
STATUS_STAFF
,
self
::
STATUS_STUDENT
,
self
::
STATUS_TEACHER
,
];
/**
...
...
src/UnicaenLdap/Entity/People.php
View file @
f5e8085d
...
...
@@ -70,27 +70,175 @@ class People extends BasePeople
}
/**
* Retourne le nom complet
de cet individu LDAP
.
* Retourne le nom complet.
*
* @param boolean $
nomEnMajuscule Mettre l
e nom de famille en majuscules
?
* @param boolean $
avec
Civilit
e I
nclure la civilité
?
* @param boolean $
prenomDabord Mettre le
prénom avant le nom de famille
?
* @param boolean $
uppercaseNam
e nom de famille en majuscules
* @param boolean $
with
Civilit
y i
nclure la civilité
* @param boolean $
firstNameFirst
prénom avant le nom de famille
* @return string
*/
public
function
get
NomComplet
(
$nomEnMajuscul
e
=
false
,
$
avec
Civilit
e
=
false
,
$
prenomDabord
=
false
)
public
function
get
FullName
(
$uppercaseNam
e
=
false
,
$
with
Civilit
y
=
false
,
$
firstNameFirst
=
false
)
{
$sn
=
$this
->
get
(
'sn'
)
;
$sn
=
$this
->
sn
;
$sn
=
is_array
(
$sn
)
?
current
(
$sn
)
:
$sn
;
if
(
!
$sn
)
{
return
''
;
}
$nom
=
$
nomEnMajuscul
e
?
strtoupper
(
$sn
)
:
$sn
;
$prenom
=
$this
->
get
(
'
given
n
ame
'
)
;
$civilite
=
$
avec
Civilit
e
?
' '
.
$this
->
get
(
'
supannCivilite
'
)
:
null
;
$nom
=
$
uppercaseNam
e
?
mb_
strtoupper
(
$sn
,
'UTF-8'
)
:
$sn
;
$prenom
=
$this
->
given
N
ame
;
$civilite
=
$
with
Civilit
y
?
$this
->
supannCivilite
.
' '
:
''
;
return
(
$prenomDabord
?
$prenom
.
' '
.
$nom
:
$nom
.
' '
.
$prenom
)
.
$civilite
;
return
$civilite
.
(
$firstNameFirst
?
$prenom
.
' '
.
$nom
:
$nom
.
' '
.
$prenom
);
}
/**
* Retourne la date de naissance
*
* @return DateTime|false
*/
public
function
getDateOfBirth
()
{
return
DateTime
::
createFromFormat
(
'Ymd h:i:s'
,
$this
->
schacDateOfBirth
.
' 00:00:00'
);
}
/**
* Retourne la date d'expiration
*
* @return DateTime|false
*/
public
function
getExpiryDate
()
{
return
DateTime
::
createFromFormat
(
'Ymd h:i:s'
,
$this
->
schacExpiryDate
.
' 00:00:00'
);
}
/**
* @param string $status
* @return bool
*/
protected
function
whichStatus
(
string
$status
):
bool
{
return
in_array
(
$status
,
(
array
)
$this
->
eduPersonAffiliation
);
}
/**
* Check "affiliate" status
*
* @return bool
*/
public
function
isAffiliate
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_AFFILIATE
);
}
/**
* Check "alum" status
*
* @return bool
*/
public
function
isAlum
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_ALUM
);
}
/**
* Check "emeritus" status
*
* @return bool
*/
public
function
isEmeritus
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_EMERITUS
);
}
/**
* Check "employee" status
*
* @return bool
*/
public
function
isEmployee
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_EMPLOYEE
);
}
/**
* Check "faculty" status
*
* @return bool
*/
public
function
isFaculty
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_FACULTY
);
}
/**
* Check "member" status
*
* @return bool
*/
public
function
isMember
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_MEMBER
);
}
/**
* Check "registered reader" status
*
* @return bool
*/
public
function
isRegisteredReader
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_REGISTERED_READER
);
}
/**
* Check "researcher" status
*
* @return bool
*/
public
function
isResearcher
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_RESEARCHER
);
}
/**
* Check "retired" status
*
* @return bool
*/
public
function
isRetired
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_RETIRED
);
}
/**
* Check "staff" status
*
* @return bool
*/
public
function
isStaff
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_STAFF
);
}
/**
* Check "student" status
*
* @return bool
*/
public
function
isStudent
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_STUDENT
);
}
/**
* Check "teacher" status
*
* @return bool
*/
public
function
isTeacher
():
bool
{
return
$this
->
whichStatus
(
parent
::
STATUS_TEACHER
);
}
/**
...
...
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