Skip to content
Permalink
Browse files

Personal data - Add extra fields in export

  • Loading branch information...
jmontoyaa committed Aug 2, 2018
1 parent a8c00c8 commit a7567be9c54fbd1ed16779479b7a051c76c3a282
Showing with 21 additions and 2 deletions.
  1. +8 −0 main/social/personal_data.php
  2. +13 −2 src/Chamilo/UserBundle/Repository/UserRepository.php
@@ -70,6 +70,14 @@
foreach ($properties as $key => $value) {
if (is_array($value) || is_object($value)) {
if ($key === 'extraFields') {
$personalDataContent .= '<li>'.$key.': </li><ul>';
foreach ($value as $subValue) {
$personalDataContent .= '<li>'.$subValue->variable.': '.$subValue->value.'</li>';
}
$personalDataContent .= '</ul>';
}
/*foreach ($value as $subValue) {
foreach ($subValue as $subSubValue) {
var_dump($subSubValue);
@@ -482,7 +482,11 @@ public function getPersonalDataToJson($userId, array $substitutionTerms)
$user->setGroups([]);
$user->setCurriculumItems([]);
$user->setPortals([]);
$user->setExtraFields([]);
$extraFieldValues = new \ExtraFieldValue('user');
$items = $extraFieldValues->getAllValuesByItem($userId);
$user->setExtraFields($items);
$user->setSessionCourseSubscriptions([]);
$user->setSessionAsGeneralCoach([]);
@@ -529,7 +533,14 @@ public function getPersonalDataToJson($userId, array $substitutionTerms)
? $dateTime->format(\DateTime::ISO8601)
: '';
};
$dateNormalizer->setCallbacks(['createdAt' => $callback, 'lastLogin' => $callback]);
$dateNormalizer->setCallbacks(
[
'createdAt' => $callback,
'lastLogin' => $callback,
'registrationDate' => $callback,
'memberSince' => $callback,
]
);
$normalizers = [$dateNormalizer];
$serializer = new Serializer($normalizers, [new JsonEncoder()]);

0 comments on commit a7567be

Please sign in to comment.
You can’t perform that action at this time.