63 lines
2.2 KiB
PHP
63 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace YesWiki\Custom\Field;
|
|
|
|
use YesWiki\Bazar\Field\BazarField;
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
/**
|
|
* @Field({"inscription"})
|
|
*/
|
|
class InscriptionField extends BazarField
|
|
{
|
|
protected $inscriptionForm;
|
|
protected const INSCRIPTION_FIELD = 1;
|
|
|
|
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 = "";
|
|
}
|
|
|
|
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'] == '10') {
|
|
return '<a href="' . $this->getWiki()->href('iframe', 'inscription-employeur', 'vue=saisir&action=saisir_fiche&listefiche' . $entry['id_typeannonce'] . 'inscription=' . $entry['id_fiche'] . '&id=' . $this->inscriptionForm) . '" class="modalbox btn btn-primary" data-iframe="1" title="Vous inscrire a cette rencontre">Vous inscrire à cette rencontre</a>';
|
|
}
|
|
return '<a href="' . $this->getWiki()->href('iframe', 'inscription-employeur', 'vue=saisir&action=saisir_fiche&listefiche' . $entry['id_typeannonce'] . 'inscription=' . $entry['id_fiche'] . '&id=' . $this->inscriptionForm) . '" class="modalbox btn btn-primary" data-iframe="1" title="Inscrire des adultes relais">Inscrire des adultes relais à cette formation</a>';
|
|
} else {
|
|
return '<div class="alert alert-info">Pour vous inscrire à cette session, vous devez en faire la demande à votre employeur qui une fois connecté pourra vous inscrire.</div>';
|
|
}
|
|
}
|
|
|
|
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' => '<a class="btn btn-primary" href="#"><i class="fa fa-plus"></i> Je profite de ce trajet</a>'
|
|
]
|
|
);
|
|
}
|
|
}
|