Skip to content
Snippets Groups Projects

hotline#115625: External : Import openAgenda improvements : registration informations

1 unresolved thread
Files
3
@@ -117,17 +117,34 @@ class Class_ExternalAgenda_OpenAgenda_Event {
public function getInscriptionsTag(){
$contacts = '';
$contacts = [];
$type_mapping = [
'email' => $this->_('Courriel'),
'phone' => $this->_('Téléphone'),
'lien' => $this->_('Site')
];
foreach ($this->getArray('registration') as $element){
if (!isset($type_mapping[$element['type']])
|| !($type = $type_mapping[$element['type']]))
$type = $this->_('Courriel');
if (!isset($element['value'])
|| !($element['value']))
continue;
$contacts []= $this->_addInfoElement($type,
$element['value']);
}
$contacts .= $this->_prepareContactString();
if ($url = $this->getString('registrationUrl'))
$contacts .= $this->_AddInfoElement($this->_('Lien'),
$contacts []= $this->_AddInfoElement($this->_('Lien'),
$url);
if (!$contacts)
return '';
return '<p>' . $this->_('Pour s\'inscrire :') . '</p><dl>' . $contacts . '</dl>';
return '<p>' . $this->_('Pour s\'inscrire :') . '</p><dl>' . implode("",$contacts) . '</dl>';
}
@@ -167,26 +184,6 @@ class Class_ExternalAgenda_OpenAgenda_Event {
protected function _prepareContactString() {
$type_mapping = [
'email' => $this->_('Courriel'),
'phone' => $this->_('Téléphone'),
'lien' => $this->_('Site')];
return ($registrations = $this->getArray('registration'))
? implode("\n",
array_map(function ($element) use ($type_mapping){
xdebug_break();
if (!isset($type_mapping[$element['type']])
|| !($type = $type_mapping[$element['type']]))
$type = $this->_('Courriel');
return $this->_addInfoElement(
$type,
$element['value']
);
},
$registrations
))
: "";
}