diff --git a/fields/InscriptionField.php b/fields/InscriptionField.php index faa5053..de80e2b 100644 --- a/fields/InscriptionField.php +++ b/fields/InscriptionField.php @@ -10,52 +10,54 @@ use Psr\Container\ContainerInterface; */ class InscriptionField extends BazarField { - protected $inscriptionForm; - protected const INSCRIPTION_FIELD = 1; + protected $inscriptionForm; + protected const INSCRIPTION_FIELD = 1; - public function __construct(array $values, ContainerInterface $services) - { - parent::__construct($values, $services); + public function __construct(array $values, ContainerInterface $services) + { + parent::__construct($values, $services); - $this->inscriptionForm = $values[self::INSCRIPTION_FIELD]; - $this->size = null; - $this->maxChars = null; - $this->default = ""; + $this->inscriptionForm = $values[self::INSCRIPTION_FIELD]; + $this->size = null; + $this->maxChars = null; + $this->default = ""; + } + + protected function renderInput($entry) + { + return; + } + + protected function renderStatic($entry) + { + if ( + $this->getWiki()->UserIsInGroup('admins') + || $this->getWiki()->UserIsInGroup('Employeur') + || $this->getWiki()->UserIsInGroup('Coordination') + ) { + if ($entry['id_typeannonce'] == '13') { + return 'Vous inscrire à cette rencontre'; + } + return 'Inscrire des adultes relais à cette formation'; + } else { + return '
Pour vous inscrire à cette session, vous devez en faire la demande à votre employeur qui une fois connecté pourra vous inscrire.
'; } + } - protected function renderInput($entry) - { - return; - } + public function formatValuesBeforeSave($entry) + { + return ''; + } - protected function renderStatic($entry) - { - if ( - $this->getWiki()->UserIsInGroup('admins') - || $this->getWiki()->UserIsInGroup('Employeur') - ||$this->getWiki()->UserIsInGroup('Coordination') - ) { - - return 'Inscrire des adultes relais à cette formation'; - } else { - return '
Pour vous inscrire à cette session, vous devez en faire la demande à votre employeur qui une fois connecté pourra vous inscrire.
'; - } - } - - public function formatValuesBeforeSave($entry) - { - return ''; - } - - // change return of this method to keep compatible with php 7.3 (mixed is not managed) - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return array_merge( - parent::jsonSerialize(), - [ - 'reservation_button' => ' Je profite de ce trajet' - ] - ); - } + // change return of this method to keep compatible with php 7.3 (mixed is not managed) + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return array_merge( + parent::jsonSerialize(), + [ + 'reservation_button' => ' Je profite de ce trajet' + ] + ); + } }