initial commit
This commit is contained in:
commit
a71cce877f
3 changed files with 288 additions and 0 deletions
51
fields/InscriptionField.php
Normal file
51
fields/InscriptionField.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace YesWiki\Custom\Field;
|
||||
|
||||
use YesWiki\Bazar\Field\BazarField;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* @Field({"inscription"})
|
||||
*/
|
||||
class InscriptionField extends BazarField
|
||||
{
|
||||
public function __construct(array $values, ContainerInterface $services)
|
||||
{
|
||||
parent::__construct($values, $services);
|
||||
$this->size = null;
|
||||
$this->maxChars = null;
|
||||
$this->default = "";
|
||||
}
|
||||
|
||||
protected function renderInput($entry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
protected function renderStatic($entry)
|
||||
{
|
||||
if ($this->wiki->UserIsInGroup('admins') ||$this->wiki->UserIsInGroup('Employeur') ||$this->wiki->UserIsInGroup('Coordination') ) {
|
||||
return "<a href=''>Inscrire a cette formation</a>";
|
||||
} else {
|
||||
return "Faut etre dans le bon groupe";
|
||||
}
|
||||
}
|
||||
|
||||
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>'
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue