Skip to content
Snippets Groups Projects

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

1 unresolved thread
@@ -125,30 +125,31 @@ class Class_ExternalAgenda_OpenAgenda_Event {
'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']))
foreach ($this->getArray('registration') as $registration){
$type = in_array($registration['type'], array_keys($type_mapping))
? $registration['type']
: 'email';
if (!isset($registration['value'])
|| !($registration['value']))
continue;
$contacts []= $this->_addInfoElement($type,
$element['value']);
$contacts []= $this->_renderDtDd($type_mapping[$type],
$registration['value']);
}
if ($url = $this->getString('registrationUrl'))
$contacts []= $this->_AddInfoElement($this->_('Lien'),
$url);
$contacts []= $this->_renderDtDd($this->_('Lien'),
$url);
if (!$contacts)
return '';
return '<p>' . $this->_('Pour s\'inscrire :') . '</p><dl>' . implode("",$contacts) . '</dl>';
return '<p>' . $this->_('Pour s\'inscrire :') . '</p><dl>' . implode('', $contacts) . '</dl>';
}
protected function _addInfoElement($label, $description){
protected function _renderDtDd($label, $description){
return '<dt>' . $label . '</dt>'
. '<dd>' . $description . '</dd>';
}
@@ -165,25 +166,21 @@ class Class_ExternalAgenda_OpenAgenda_Event {
protected function _prepareConditionsString() {
return ($conditions = $this->getString('conditions'))
? $this->_addInfoElement(
$this->_('Conditions'),
$conditions)
: "";
? $this->_renderDtDd(
$this->_('Conditions'),
$conditions)
: '';
}
protected function _prepareAgeString() {
return ($this->_event['age'])
? $this->_addInfoElement(
$this->_('Âge'),
$this->_('de %s à %s ans',
$this->_event['age']['min'],
$this->_event['age']['max']))
: "";
}
protected function _prepareContactString() {
? $this->_renderDtDd(
$this->_('Âge'),
$this->_('de %s à %s ans',
$this->_event['age']['min'],
$this->_event['age']['max']))
: '';
}