use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection; | use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Action; | use EasyCorp\Bundle\EasyAdminBundle\Config\Action; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; | use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore; | use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Option\EA; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext; | use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController as EaAbstractCrudController; | use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController as EaAbstractCrudController; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; | use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityUpdatedEvent; | use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityUpdatedEvent; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent; | use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityDeletedEvent; | use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityDeletedEvent; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityUpdatedEvent; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException; | use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException; | use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory; | use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission; | |||||
use Lc\SovBundle\Doctrine\EntityManager; | |||||
use Lc\SovBundle\Doctrine\Extension\DevAliasInterface; | use Lc\SovBundle\Doctrine\Extension\DevAliasInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\SeoInterface; | use Lc\SovBundle\Doctrine\Extension\SeoInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\SortableInterface; | use Lc\SovBundle\Doctrine\Extension\SortableInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\TranslatableInterface; | use Lc\SovBundle\Doctrine\Extension\TranslatableInterface; | ||||
use Lc\SovBundle\Doctrine\Extension\TreeInterface; | use Lc\SovBundle\Doctrine\Extension\TreeInterface; | ||||
use Lc\SovBundle\Field\CollectionField; | use Lc\SovBundle\Field\CollectionField; | ||||
use Lc\SovBundle\Field\GalleryManagerField; | |||||
use Lc\SovBundle\Form\Type\Crud\PositionType; | |||||
use Lc\SovBundle\Form\Common\PositionType; | |||||
use Lc\SovBundle\Translation\TranslatorAdmin; | use Lc\SovBundle\Translation\TranslatorAdmin; | ||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType; | use Symfony\Component\Form\Extension\Core\Type\CollectionType; | ||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||||
use Symfony\Component\HttpFoundation\RequestStack; | use Symfony\Component\HttpFoundation\RequestStack; | ||||
return $event->getResponse(); | return $event->getResponse(); | ||||
} | } | ||||
if (!$this->isGranted(Permission::EA_EXECUTE_ACTION) || !$this->isInstanceOf(SortableInterface::class)) { | |||||
//if (!$this->isGranted(Permission::EA_EXECUTE_ACTION) || !$this->isInstanceOf(SortableInterface::class)) { | |||||
if (!$this->isInstanceOf(SortableInterface::class)) { | |||||
throw new ForbiddenActionException($context); | throw new ForbiddenActionException($context); | ||||
} | } | ||||
<?php | |||||
namespace Lc\SovBundle\Controller\Newsletter; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | |||||
use Lc\SovBundle\Field\BooleanField; | |||||
use Lc\SovBundle\Field\CKEditorField; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
abstract class NewsletterAdminController extends AbstractAdminController | |||||
{ | |||||
public function configureFields(string $pageName): iterable | |||||
{ | |||||
$panel = parent::configureFields($pageName); | |||||
return array_merge( | |||||
[ | |||||
FormField::addPanel('general'), | |||||
TextField::new('title'), | |||||
BooleanField::new('isMain') | |||||
->setCustomOption('toggle_label', 'Principale'), | |||||
CKEditorField::new('description') | |||||
->hideOnIndex(), | |||||
StatusField::new('status'), | |||||
], | |||||
$panel | |||||
); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Controller\Site; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | |||||
use Lc\SovBundle\Field\CKEditorField; | |||||
use Lc\SovBundle\Field\ImageManagerField; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
abstract class NewsAdminController extends AbstractAdminController | |||||
{ | |||||
public function configureFields(string $pageName): iterable | |||||
{ | |||||
$panel = parent::configureFields($pageName); | |||||
return array_merge( | |||||
[ | |||||
FormField::addPanel('general'), | |||||
TextField::new('title'), | |||||
DateField::new('date') | |||||
->setFormat('d/MM/y'), | |||||
NumberField::new('position') | |||||
->hideOnIndex() | |||||
->hideOnForm(), | |||||
CKEditorField::new('description'), | |||||
StatusField::new('status'), | |||||
], | |||||
$panel | |||||
); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Controller\Site; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||||
use Lc\SovBundle\Controller\AbstractAdminController; | |||||
use Lc\SovBundle\Field\CKEditorField; | |||||
use Lc\SovBundle\Field\StatusField; | |||||
abstract class PageAdminController extends AbstractAdminController | |||||
{ | |||||
public function configureFields(string $pageName): iterable | |||||
{ | |||||
$panel = parent::configureFields($pageName); | |||||
return array_merge( | |||||
[ | |||||
FormField::addPanel('general'), | |||||
TextField::new('title'), | |||||
NumberField::new('position') | |||||
->hideOnIndex() | |||||
->hideOnForm(), | |||||
CKEditorField::new('description'), | |||||
StatusField::new('status'), | |||||
], | |||||
$panel | |||||
); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Model\Newsletter ; | |||||
interface NewsletterInterface | |||||
{ | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Model\Newsletter; | |||||
use Doctrine\ORM\Mapping as ORM; | |||||
use Doctrine\Common\Collections\ArrayCollection; | |||||
use Doctrine\Common\Collections\Collection; | |||||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | |||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
abstract class NewsletterModel extends AbstractFullEntity implements NewsletterInterface | |||||
{ | |||||
/** | |||||
* @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface", mappedBy="newsletters") | |||||
*/ | |||||
protected $users; | |||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $isMain; | |||||
public function __toString() | |||||
{ | |||||
return $this->getTitle(); | |||||
} | |||||
public function __construct() | |||||
{ | |||||
$this->users = new ArrayCollection(); | |||||
} | |||||
/** | |||||
* @return Collection|UserInterface[] | |||||
*/ | |||||
public function getUsers(): Collection | |||||
{ | |||||
return $this->users; | |||||
} | |||||
public function addUser(UserInterface $user): self | |||||
{ | |||||
if (!$this->users->contains($user)) { | |||||
$this->users[] = $user; | |||||
$user->addNewsletter($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeUser(UserInterface $user): self | |||||
{ | |||||
if ($this->users->contains($user)) { | |||||
$this->users->removeElement($user); | |||||
$user->removeNewsletter($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function getIsMain(): ?bool | |||||
{ | |||||
return $this->isMain; | |||||
} | |||||
public function setIsMain(?bool $isMain): self | |||||
{ | |||||
$this->isMain = $isMain; | |||||
return $this; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Model\Site ; | |||||
interface NewsInterface | |||||
{ | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Model\Site; | |||||
use Doctrine\ORM\Mapping as ORM; | |||||
use Gedmo\Mapping\Annotation as Gedmo; | |||||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
abstract class NewsModel extends AbstractFullEntity implements NewsInterface | |||||
{ | |||||
/** | |||||
* @ORM\Column(type="datetime") | |||||
* @Gedmo\Timestampable(on="create") | |||||
*/ | |||||
protected $date; | |||||
public function __toString() | |||||
{ | |||||
return $this->getTitle(); | |||||
} | |||||
public function getDate(): ?\DateTimeInterface | |||||
{ | |||||
return $this->date; | |||||
} | |||||
public function setDate(\DateTimeInterface $date): self | |||||
{ | |||||
$this->date = $date; | |||||
return $this; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Model\Site; | |||||
interface PageInterface | |||||
{ | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Model\Site; | |||||
use Doctrine\ORM\Mapping as ORM; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | |||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
abstract class PageModel extends AbstractFullEntity implements PageInterface | |||||
{ | |||||
/** | |||||
* @ORM\Column(type="text", nullable=true) | |||||
*/ | |||||
protected $content; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="pages") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $merchant; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pages") | |||||
*/ | |||||
protected $section; | |||||
public function __toString() | |||||
{ | |||||
return $this->getTitle(); | |||||
} | |||||
public function getContent(): ?string | |||||
{ | |||||
return $this->content; | |||||
} | |||||
public function setContent(?string $content): self | |||||
{ | |||||
$this->content = $content; | |||||
return $this; | |||||
} | |||||
public function getMerchant(): ?MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(?MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getSection(): ?SectionInterface | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(?SectionInterface $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Repository\Newsletter; | |||||
use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepository; | |||||
/** | |||||
* @method NewsletterInterface|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method NewsletterInterface|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method NewsletterInterface[] findAll() | |||||
* @method NewsletterInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | |||||
class NewsletterRepository extends AbstractRepository | |||||
{ | |||||
public function getInterfaceClass() | |||||
{ | |||||
return NewsletterInterface::class; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Repository\Site; | |||||
use Lc\SovBundle\Model\Site\NewsInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepository; | |||||
/** | |||||
* @method NewsInterface|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method NewsInterface|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method NewsInterface[] findAll() | |||||
* @method NewsInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | |||||
class NewsRepository extends AbstractRepository | |||||
{ | |||||
public function getInterfaceClass() | |||||
{ | |||||
return NewsInterface::class; | |||||
} | |||||
} |
<?php | |||||
namespace Lc\SovBundle\Repository\Site; | |||||
use Lc\SovBundle\Model\Site\PageInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepository; | |||||
/** | |||||
* @method PageInterface|null find($id, $lockMode = null, $lockVersion = null) | |||||
* @method PageInterface|null findOneBy(array $criteria, array $orderBy = null) | |||||
* @method PageInterface[] findAll() | |||||
* @method PageInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||||
*/ | |||||
class PageRepository extends AbstractRepository | |||||
{ | |||||
public function getInterfaceClass() | |||||
{ | |||||
return PageInterface::class; | |||||
} | |||||
} |
menu: | menu: | ||||
dashboard: Tableau de bord | dashboard: Tableau de bord | ||||
page: Pages | page: Pages | ||||
news: Actualités | |||||
newsletters: Bulletins d'informations | |||||
user: Utilisateurs | user: Utilisateurs | ||||
user_index: Liste | user_index: Liste | ||||
account: Mon compte | account: Mon compte | ||||
new: Ajouter "%label%" | new: Ajouter "%label%" | ||||
edit: Modifier "%label%" (#%id%) | edit: Modifier "%label%" (#%id%) | ||||
detail: Voir "%label%" (#%id%) | detail: Voir "%label%" (#%id%) | ||||
un_titre: Un titre | |||||
account: | account: | ||||
profile: Mes informations personnelles | profile: Mes informations personnelles | ||||
change_password: Changer de mot de passe | change_password: Changer de mot de passe | ||||
Page: | Page: | ||||
label: Page | label: Page | ||||
label_plurial: Pages | label_plurial: Pages | ||||
News: | |||||
label: Actualité | |||||
label_plurial: Actualités | |||||
Newsletter: | |||||
label: Bulletin d'information | |||||
label_plurial: Bulletins d'informations | |||||
fields: | |||||
isMain: Principale | |||||
Ticket: | Ticket: | ||||
label: Ticket | label: Ticket | ||||
label_plurial: Tickets | label_plurial: Tickets | ||||
gallery: Galerie | gallery: Galerie | ||||
color: Couleur | color: Couleur | ||||
active: Activer | active: Activer | ||||
image: Image | |||||
date: Date | |||||
panels: | panels: | ||||
general: Général | general: Général |
<div {% with { attr: row_attr } %}{{ block('attributes') }}{% endwith %}> | <div {% with { attr: row_attr } %}{{ block('attributes') }}{% endwith %}> | ||||
{{- form_label(form) -}} | {{- form_label(form) -}} | ||||
<div class="form-widget"> | <div class="form-widget"> | ||||
{% set has_prepend_html = ea.field.prepend_html|default(null) is not null %} | |||||
{% set has_append_html = ea.field.append_html|default(null) is not null %} | |||||
{% set has_input_groups = has_prepend_html or has_append_html %} | |||||
{# | |||||
{% set has_prepend_html = ea.field.prepend_html|default(null) is not null %} | |||||
{% set has_append_html = ea.field.append_html|default(null) is not null %} | |||||
{% set has_input_groups = has_prepend_html or has_append_html %} | |||||
#} | |||||
{% set has_prepend_html = false %} | |||||
{% set has_append_html = false %} | |||||
{% set has_input_groups = false %} | |||||
{% if ea_crud_form.ea_field is defined and ea_crud_form.ea_field is not null %} | |||||
{% set prepend_html = ea_crud_form.ea_field.customOptions.get('prependHtml') %} | |||||
{% set append_html = ea_crud_form.ea_field.customOptions.get('appendHtml') %} | |||||
{% set has_prepend_html = prepend_html is not null %} | |||||
{% set has_append_html = append_html is not null %} | |||||
{% set has_input_groups = has_prepend_html or has_append_html %} | |||||
{% endif %} | |||||
{% if has_input_groups %} | {% if has_input_groups %} | ||||
<div class="input-group">{% endif %} | <div class="input-group">{% endif %} | ||||
{% if has_prepend_html %} | {% if has_prepend_html %} | ||||
<div class="input-group-prepend"> | <div class="input-group-prepend"> | ||||
<span class="input-group-text">{{ ea.field.prepend_html|raw }}</span> | |||||
<span class="input-group-text">{{ prepend_html|raw }}</span> | |||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
{% if has_append_html %} | {% if has_append_html %} | ||||
<div class="input-group-append"> | <div class="input-group-append"> | ||||
<span class="input-group-text">{{ ea.field.append_html|raw }}</span> | |||||
<span class="input-group-text">{{ append_html|raw }}</span> | |||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
{% if has_input_groups %}</div>{% endif %} | {% if has_input_groups %}</div>{% endif %} | ||||
{%- endif -%} | {%- endif -%} | ||||
{%- endif -%} | {%- endif -%} | ||||
{# <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ (translation_domain is same as(false)) ? label : label|lower|lc_trans_admin_field(ea.getEntity().getFqcn()) }}</{{ element|default('label') }}> #} | |||||
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|lc_trans_admin_field(form.parent.vars.data) }}</{{ element|default('label') }}> | |||||
{% set entityNameOrObject = form.parent.vars.data %} | |||||
{% if not entityNameOrObject and form.parent.vars.errors.form.config.dataClass is defined %} | |||||
{% set entityNameOrObject = form.parent.vars.errors.form.config.dataClass %} | |||||
{% endif %} | |||||
<{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>{{ (label is not empty and '.' in label) ? label|trans({}, 'admin') : name|lc_trans_admin_field(entityNameOrObject) }}</{{ element|default('label') }}> | |||||
{%- endif -%} | {%- endif -%} | ||||
{%- endblock form_label %} | {%- endblock form_label %} |