@@ -338,6 +338,7 @@ abstract class AbstractAdminController extends EaAbstractCrudController | |||
$filters | |||
); | |||
//TOdo utiliser les repositoryQuery ? | |||
if ($this->isInstanceOf(TreeInterface::class)) { | |||
$entityId = $searchDto->getRequest()->get('entityId'); | |||
@@ -362,9 +363,7 @@ abstract class AbstractAdminController extends EaAbstractCrudController | |||
$filterManager = $this->get(FilterManager::class); | |||
$this->filtersForm->handleRequest($searchDto->getRequest()); | |||
/*if (($this->filtersForm->isSubmitted() && $this->filtersForm->isValid())) { | |||
}*/ | |||
$filterManager->handleFiltersForm($queryBuilder, $this->filtersForm, $fields, $entityDto); | |||
@@ -62,7 +62,10 @@ class TicketAdminController extends AbstractAdminController | |||
DateField::new('createdAt')->setFormat('short') | |||
->hideOnForm(), | |||
TextField::new('visitorFirstName') | |||
->setTemplatePath('@LcSov/admin/ticket/field/username.html.twig') | |||
->setTemplatePath('@LcSov/admin/ticket/field/firstname.html.twig') | |||
->hideOnForm(), | |||
TextField::new('visitorLastName') | |||
->setTemplatePath('@LcSov/admin/ticket/field/lastname.html.twig') | |||
->hideOnForm(), | |||
TextField::new('visitorEmail') | |||
->setTemplatePath('@LcSov/admin/ticket/field/email.html.twig') |
@@ -20,14 +20,14 @@ class AssociationFilter | |||
{ | |||
$targetEntity = $options['entity_dto']->getPropertyMetadata($fieldDto->getProperty())->get('targetEntity'); | |||
$classImplements = class_implements($targetEntity); | |||
//todo utiliser choices plutot que query_builder voir ProductCategoriesFilter | |||
$builder->add( | |||
$fieldDto->getProperty(), | |||
EntityType::class, | |||
array( | |||
'class' => $targetEntity, | |||
'placeholder' => '--', | |||
'query_builder' => function (EntityRepository $repo) use ($classImplements) { | |||
'query_builder' => function (EntityRepository $repo){ | |||
return $repo->createQueryBuilder('entity'); | |||
}, | |||
'required' => false, | |||
@@ -41,7 +41,7 @@ class AssociationFilter | |||
); | |||
} | |||
public function applyFilter(QueryBuilder $queryBuilder, string $fieldProperty, string $filteredValue = null) | |||
public function applyFilter(QueryBuilder $queryBuilder, string $fieldProperty, $filteredValue = null) | |||
{ | |||
if ($filteredValue !== null) { | |||
$queryBuilder->andWhere('entity.'.$fieldProperty.' = :'.$fieldProperty.''); |
@@ -47,13 +47,13 @@ class CheckboxFilter | |||
); | |||
$queryBuilder->setParameter( | |||
$this->getFieldPropertySnake($fieldProperty), | |||
'%'.$filteredValue.'%' | |||
$filteredValue | |||
); | |||
} else { | |||
$queryBuilder->andWhere( | |||
'entity.'.$fieldProperty.' = :'.$fieldProperty.'' | |||
); | |||
$queryBuilder->setParameter($fieldProperty, '%'.$filteredValue.'%'); | |||
$queryBuilder->setParameter($fieldProperty, $filteredValue); | |||
} | |||
} |
@@ -27,27 +27,25 @@ class ChoiceFilter | |||
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array()) | |||
{ | |||
$entity = new $options['entity_class']; | |||
$choicesFct = 'get'.u($fieldDto->getProperty())->title()->toString().'Choices'; | |||
if (method_exists($entity, $choicesFct)) { | |||
$builder->add( | |||
$fieldDto->getProperty(), | |||
ChoiceType::class, | |||
array( | |||
'required' => false, | |||
'choices' => $this->translatorAdmin->transChoices( | |||
$entity->$choicesFct(), | |||
$options['entity_name'], | |||
$fieldDto->getProperty() | |||
), | |||
'attr' => array( | |||
'class' => 'select2 input-sm', | |||
'form' => 'filters-form', | |||
), | |||
) | |||
if($fieldDto->getCustomOption('choices')){ | |||
$choices = $fieldDto->getCustomOption('choices'); | |||
}else if($fieldDto->getFormTypeOption('choices') !=null){ | |||
$choices = $fieldDto->getFormTypeOption('choices'); | |||
}else{ | |||
$choices = array(); | |||
} | |||
$builder->add( | |||
$fieldDto->getProperty(), | |||
ChoiceType::class, | |||
array( | |||
'required' => false, | |||
'choices' => $choices, | |||
'attr' => array( | |||
'class' => 'select2 input-sm', | |||
'form' => 'filters-form', | |||
), | |||
) | |||
); | |||
} | |||
} | |||
public function applyFilter(QueryBuilder $queryBuilder, string $fieldProperty, string $filteredValue = null) |
@@ -18,46 +18,42 @@ class DateFilter | |||
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array()) | |||
{ | |||
$builder->add( | |||
$builder->create( | |||
str_replace('.', '_', $fieldDto->getProperty()), | |||
FormType::class, | |||
array('inherit_data' => true) | |||
$builder->create( | |||
str_replace('.', '_', $fieldDto->getProperty()), | |||
FormType::class, | |||
array('inherit_data' => true) | |||
) | |||
->add( | |||
'dateStart', | |||
DateType::class, | |||
array( | |||
'widget' => 'single_text', | |||
'required' => false, | |||
) | |||
) | |||
->add( | |||
'dateStart', | |||
DateType::class, | |||
array( | |||
'widget' => 'single_text', | |||
'required' => false, | |||
) | |||
) | |||
->add( | |||
'dateEnd', | |||
DateType::class, | |||
array( | |||
'widget' => 'single_text', | |||
'required' => false, | |||
->add( | |||
'dateEnd', | |||
DateType::class, | |||
array( | |||
'widget' => 'single_text', | |||
'required' => false, | |||
) | |||
) | |||
) | |||
) | |||
); | |||
} | |||
public function applyFilter( | |||
QueryBuilder $queryBuilder, | |||
string $fieldProperty, | |||
\DateTime $dateStart = null, | |||
\DateTime $dateEnd = null | |||
) { | |||
public function applyFilter(QueryBuilder $queryBuilder, string $fieldProperty, \DateTime $dateStart = null, \DateTime $dateEnd = null) | |||
{ | |||
if ($dateStart) { | |||
$queryBuilder->andWhere( | |||
'entity.'.$fieldProperty.' >= :dateStart' | |||
'entity.' . $fieldProperty . ' >= :dateStart' | |||
)->setParameter('dateStart', $dateStart); | |||
} | |||
if ($dateEnd) { | |||
$dateEnd->setTime(23, 59, 59); | |||
$queryBuilder->andWhere( | |||
'entity.'.$fieldProperty.' <= :dateEnd' | |||
'entity.' . $fieldProperty . ' <= :dateEnd' | |||
)->setParameter('dateEnd', $dateEnd); | |||
} | |||
} |
@@ -4,6 +4,7 @@ namespace Lc\SovBundle\Field\Filter; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Doctrine\ORM\QueryBuilder; | |||
use DoctrineExtensions\Query\Mysql\Field; | |||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | |||
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; | |||
@@ -76,40 +77,59 @@ class FilterManager | |||
} | |||
} | |||
public function getFieldProperty(FieldDto $fieldDto) | |||
{ | |||
$property = $fieldDto->getProperty(); | |||
//TODO pas forcément utile, à discuter | |||
if ($fieldDto->getCustomOption('filter_on')) { | |||
$property = $property . '.' . $fieldDto->getCustomOption('filter_on'); | |||
} | |||
return $property; | |||
} | |||
public function applyFilter(QueryBuilder $queryBuilder, FieldDto $fieldDto, array $filteredValue) | |||
{ | |||
switch ($fieldDto->getFormType()) { | |||
case CheckboxType::class: | |||
$checkboxFilter = new CheckboxFilter(); | |||
$checkboxFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']); | |||
break; | |||
case ChoiceType::class: | |||
$choiceFilter = new ChoiceFilter(); | |||
$choiceFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']); | |||
break; | |||
case IntegerType::class: | |||
$integerFilter = new IntegerFilter(); | |||
$integerFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']); | |||
break; | |||
case TextareaType::class: | |||
case TextType::class: | |||
$textFilter = new TextFilter(); | |||
$textFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']); | |||
break; | |||
case EntityType::class: | |||
$textFilter = new AssociationFilter(); | |||
$textFilter->applyFilter($queryBuilder, $fieldDto->getProperty(), $filteredValue['value']); | |||
break; | |||
case DateTimeType::class: | |||
case DateType::class: | |||
$textFilter = new DateFilter(); | |||
$textFilter->applyFilter( | |||
$queryBuilder, | |||
$fieldDto->getProperty(), | |||
$filteredValue['dateStart'], | |||
$filteredValue['dateEnd'] | |||
); | |||
break; | |||
if ($fieldDto->getCustomOption('filter_fqcn')) { | |||
$filterFqcn = $fieldDto->getCustomOption('filter_fqcn'); | |||
$customFilter = new $filterFqcn; | |||
$customFilter->applyFilter($queryBuilder, $this->getFieldProperty($fieldDto), $filteredValue['value']); | |||
} else { | |||
switch ($this->guessFormType($fieldDto)) { | |||
case CheckboxType::class: | |||
$checkboxFilter = new CheckboxFilter(); | |||
$checkboxFilter->applyFilter($queryBuilder, $this->getFieldProperty($fieldDto), $filteredValue['value']); | |||
break; | |||
case ChoiceType::class: | |||
$choiceFilter = new ChoiceFilter(); | |||
$choiceFilter->applyFilter($queryBuilder, $this->getFieldProperty($fieldDto), $filteredValue['value']); | |||
break; | |||
case IntegerType::class: | |||
$integerFilter = new IntegerFilter(); | |||
$integerFilter->applyFilter($queryBuilder, $this->getFieldProperty($fieldDto), $filteredValue['value']); | |||
break; | |||
case TextareaType::class: | |||
case TextType::class: | |||
$textFilter = new TextFilter(); | |||
$textFilter->applyFilter($queryBuilder, $this->getFieldProperty($fieldDto), $filteredValue['value']); | |||
break; | |||
case EntityType::class: | |||
$textFilter = new AssociationFilter(); | |||
$textFilter->applyFilter($queryBuilder, $this->getFieldProperty($fieldDto), $filteredValue['value']); | |||
break; | |||
case DateTimeType::class: | |||
case DateType::class: | |||
$textFilter = new DateFilter(); | |||
$textFilter->applyFilter( | |||
$queryBuilder, | |||
$this->getFieldProperty($fieldDto), | |||
$filteredValue['dateStart'], | |||
$filteredValue['dateEnd'] | |||
); | |||
break; | |||
} | |||
} | |||
} | |||
@@ -162,12 +182,7 @@ class FilterManager | |||
} | |||
public | |||
function getFormField( | |||
Form $filtersForm, | |||
string $field, | |||
string $extraField = null | |||
): Form | |||
public function getFormField(Form $filtersForm, string $field, string $extraField = null): Form | |||
{ | |||
if ($extraField) { | |||
return $filtersForm->get($field)->get($extraField); | |||
@@ -175,4 +190,15 @@ class FilterManager | |||
return $filtersForm->get($field); | |||
} | |||
} | |||
protected function guessFormType(FieldDto $fieldDto) | |||
{ | |||
if ($fieldDto->getCustomOption('filter_type')) { | |||
return $fieldDto->getCustomOption('filter_type'); | |||
} else { | |||
return $fieldDto->getFormType(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
<?php | |||
namespace Lc\SovBundle\Field\Filter; | |||
use Doctrine\ORM\QueryBuilder; | |||
use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto; | |||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
/** | |||
* @author La clic ! <contact@laclic.fr> | |||
*/ | |||
class ImageFilter | |||
{ | |||
use FilterTrait; | |||
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array()) | |||
{ | |||
$targetEntity = $options['entity_dto']->getPropertyMetadata($fieldDto->getProperty())->get('targetEntity'); | |||
$builder->add( | |||
$fieldDto->getProperty(), | |||
ChoiceType::class, | |||
array( | |||
'required' => false, | |||
'choices' => array( | |||
'Sans image' => 0, | |||
'Avec image' => 1, | |||
), | |||
'attr' => array( | |||
'class' => 'select2 input-sm', | |||
'form' => 'filters-form', | |||
), | |||
) | |||
); | |||
} | |||
public function applyFilter(QueryBuilder $queryBuilder, string $fieldProperty, $filteredValue = null) | |||
{ | |||
if ($filteredValue !== null) { | |||
if($filteredValue === 1){ | |||
$queryBuilder->andWhere( | |||
'entity.' . $fieldProperty . ' IS NOT NULL' | |||
); | |||
}else{ | |||
$queryBuilder->andWhere( | |||
'entity.' . $fieldProperty . ' IS NULL' | |||
); | |||
} | |||
} | |||
} | |||
} |
@@ -15,22 +15,22 @@ class TextFilter | |||
use FilterTrait; | |||
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array()) | |||
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array()) | |||
{ | |||
$builder->add( | |||
str_replace('.', '_', $fieldDto->getProperty()), | |||
TextType::class, | |||
array( | |||
'required' => false, | |||
'attr' => array( | |||
'class' => ' input-sm', | |||
'form' => 'filters-form', | |||
), | |||
) | |||
str_replace('.', '_', $fieldDto->getProperty()), | |||
TextType::class, | |||
array( | |||
'required' => false, | |||
'attr' => array( | |||
'class' => ' input-sm', | |||
'form' => 'filters-form', | |||
), | |||
) | |||
); | |||
} | |||
public function applyFilter(QueryBuilder $queryBuilder, string $fieldProperty, string $filteredValue= null) | |||
public function applyFilter(QueryBuilder $queryBuilder, string $fieldProperty, string $filteredValue = null) | |||
{ | |||
if ($filteredValue !== null) { | |||
@@ -38,20 +38,20 @@ class TextFilter | |||
$aliasRelation = $this->getFieldPropertyRelationAlias($fieldProperty); | |||
if (array_search($aliasRelation, $queryBuilder->getAllAliases()) === false) { | |||
$queryBuilder->innerJoin('entity.'.$aliasRelation, $aliasRelation); | |||
$queryBuilder->innerJoin('entity.' . $aliasRelation, $aliasRelation); | |||
} | |||
$queryBuilder->andWhere( | |||
$fieldProperty.' LIKE :'.$this->getFieldPropertySnake($fieldProperty).'' | |||
$fieldProperty . ' LIKE :' . $this->getFieldPropertySnake($fieldProperty) . '' | |||
); | |||
$queryBuilder->setParameter( | |||
$this->getFieldPropertySnake($fieldProperty), | |||
'%'.$filteredValue.'%' | |||
$this->getFieldPropertySnake($fieldProperty), | |||
'%' . $filteredValue . '%' | |||
); | |||
} else { | |||
$queryBuilder->andWhere( | |||
'entity.'.$fieldProperty.' LIKE :'.$fieldProperty.'' | |||
'entity.' . $fieldProperty . ' LIKE :' . $fieldProperty . '' | |||
); | |||
$queryBuilder->setParameter($fieldProperty, '%'.$filteredValue.'%'); | |||
$queryBuilder->setParameter($fieldProperty, '%' . $filteredValue . '%'); | |||
} | |||
} | |||
} |
@@ -4,6 +4,7 @@ namespace Lc\SovBundle\Field; | |||
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait; | |||
use Lc\SovBundle\Field\Filter\ImageFilter; | |||
use Lc\SovBundle\Form\Common\FileManagerType; | |||
/** | |||
@@ -28,7 +29,8 @@ final class ImageManagerField implements FieldInterface | |||
->setCustomOption('type', 'image') | |||
->addCssClass('field-text') | |||
->setCustomOption(self::OPTION_MAX_LENGTH, null) | |||
->setCustomOption(self::OPTION_RENDER_AS_HTML, false); | |||
->setCustomOption(self::OPTION_RENDER_AS_HTML, false) | |||
->setCustomOption('filter_fqcn', ImageFilter::class); | |||
} | |||
public function setMaxLength(int $length): self |
@@ -4,6 +4,8 @@ namespace Lc\SovBundle\Field; | |||
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait; | |||
use Lc\SovBundle\Field\Filter\BooleanFilter; | |||
use Lc\SovBundle\Field\Filter\CheckboxFilter; | |||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||
/** | |||
@@ -23,7 +25,8 @@ final class StatusField implements FieldInterface | |||
->setFormTypeOption('multiple', false) | |||
->setFormTypeOption('choices', ['En ligne' => 1, 'Hors ligne' => 0]) | |||
->setFormTypeOption('placeholder', false) | |||
->setCustomOption('toggle_label', 'En ligne'); | |||
->setCustomOption('toggle_label', 'En ligne') | |||
->setCustomOption('filter_fqcn', CheckboxFilter::class); | |||
$template = 'toggle.html.twig'; | |||
if (!$templateToggle) { |
@@ -2,26 +2,22 @@ | |||
namespace Lc\SovBundle\Form\Common; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Doctrine\ORM\EntityRepository; | |||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | |||
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto; | |||
use Lc\SovBundle\Field\Filter\AssociationFilter; | |||
use Lc\SovBundle\Field\Filter\CheckboxFilter; | |||
use Lc\SovBundle\Field\Filter\ChoiceFilter; | |||
use Lc\SovBundle\Field\Filter\DateFilter; | |||
use Lc\SovBundle\Field\Filter\FilterManager; | |||
use Lc\SovBundle\Field\Filter\IntegerFilter; | |||
use Lc\SovBundle\Field\Filter\TextFilter; | |||
use Lc\SovBundle\Translation\TranslatorAdmin; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\Extension\Core\Type\ButtonType; | |||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | |||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||
use Symfony\Component\Form\Extension\Core\Type\DateTimeType; | |||
use Symfony\Component\Form\Extension\Core\Type\DateType; | |||
use Symfony\Component\Form\Extension\Core\Type\FormType; | |||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\IntegerType; | |||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||
@@ -29,7 +25,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
use Symfony\Contracts\Translation\TranslatorInterface; | |||
use function Symfony\Component\String\u; | |||
@@ -52,43 +47,46 @@ class FiltersFormType extends AbstractType | |||
} else { | |||
$fieldDto = $field; | |||
} | |||
if ($fieldDto->isDisplayedOn(Crud::PAGE_INDEX)) { | |||
switch ($fieldDto->getFormType()) { | |||
case CheckboxType::class: | |||
$checkboxFilter = new CheckboxFilter(); | |||
$checkboxFilter->buildProperty($builder, $fieldDto); | |||
//POurt modifier le type de filtre filter_type | |||
//Pour désactiver le filtre sur un champ filter à false | |||
break; | |||
case ChoiceType::class: | |||
$choiceFilter = new ChoiceFilter($this->translatorAdmin); | |||
$choiceFilter->buildProperty($builder, $fieldDto, $options); | |||
break; | |||
case IntegerType::class: | |||
$integerFilter = new IntegerFilter(); | |||
$integerFilter->buildProperty($builder, $fieldDto); | |||
if ($fieldDto->isDisplayedOn(Crud::PAGE_INDEX) && $fieldDto->getCustomOption('filter')!==false) { | |||
if($fieldDto->getCustomOption('filter_fqcn')){ | |||
$filterFqcn = $fieldDto->getCustomOption('filter_fqcn'); | |||
$checkboxFilter = new $filterFqcn; | |||
$checkboxFilter->buildProperty($builder, $fieldDto, $options); | |||
}else { | |||
break; | |||
case TextType::class: | |||
case TextareaType::class: | |||
$textFilter = new TextFilter(); | |||
$textFilter->buildProperty($builder, $fieldDto); | |||
break; | |||
case DateTimeType::class: | |||
case DateType::class: | |||
$textFilter = new DateFilter(); | |||
$textFilter->buildProperty($builder, $fieldDto); | |||
break; | |||
case EntityType::class: | |||
//$associationFilter = new AssociationFilter(); | |||
//$associationFilter->buildProperty($builder, $fieldDto, $options); | |||
break; | |||
case 'dateinterval': | |||
switch ($this->guessFormType($fieldDto)) { | |||
case CheckboxType::class: | |||
$checkboxFilter = new CheckboxFilter(); | |||
$checkboxFilter->buildProperty($builder, $fieldDto); | |||
break; | |||
case ChoiceType::class: | |||
$choiceFilter = new ChoiceFilter($this->translatorAdmin); | |||
$choiceFilter->buildProperty($builder, $fieldDto, $options); | |||
break; | |||
case IntegerType::class: | |||
$integerFilter = new IntegerFilter(); | |||
$integerFilter->buildProperty($builder, $fieldDto); | |||
break; | |||
case 'float': | |||
break; | |||
break; | |||
case TextType::class: | |||
case TextareaType::class: | |||
$textFilter = new TextFilter(); | |||
$textFilter->buildProperty($builder, $fieldDto); | |||
break; | |||
case DateTimeType::class: | |||
case DateType::class: | |||
$textFilter = new DateFilter(); | |||
$textFilter->buildProperty($builder, $fieldDto); | |||
break; | |||
case EntityType::class: | |||
$associationFilter = new AssociationFilter(); | |||
$associationFilter->buildProperty($builder, $fieldDto, $options); | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
@@ -140,4 +138,13 @@ class FiltersFormType extends AbstractType | |||
] | |||
); | |||
} | |||
protected function guessFormType(FieldDto $fieldDto){ | |||
if($fieldDto->getCustomOption('filter_type')){ | |||
return $fieldDto->getCustomOption('filter_type'); | |||
}else{ | |||
return$fieldDto->getFormType(); | |||
} | |||
} | |||
} |
@@ -32,7 +32,7 @@ abstract class NewsModel extends AbstractFullEntity implements NewsInterface, Op | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface", inversedBy="news") | |||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface") | |||
*/ | |||
protected $newsletter; | |||
@@ -40,7 +40,8 @@ action: | |||
save_and_return: Sauvegarder les modifications | |||
save_and_continue: Sauvegarder et continuer l'édition | |||
save_and_add_another: Créer et ajouter un nouvel élément | |||
reset: Réinitialiser | |||
apply: Appliquer | |||
entity: | |||
User: | |||
label: Utilisateur |
@@ -1 +1,7 @@ | |||
{#{{ entity.instance.getEmail() }}#} | |||
{% set item = entity.instance %} | |||
{% if item.user is not null %} | |||
{{ item.user.email }} | |||
{% else %} | |||
{{ item.visitorEmail }} | |||
{% endif %} |
@@ -0,0 +1,6 @@ | |||
{% set item = entity.instance %} | |||
{% if item.user is not null %} | |||
{{ item.user.firstname }} | |||
{% else %} | |||
{{ item.visitorFirstname }} | |||
{% endif %} |
@@ -0,0 +1,6 @@ | |||
{% set item = entity.instance %} | |||
{% if item.user is not null %} | |||
{{ item.user.lastname }} | |||
{% else %} | |||
{{ item.visitorLastname }} | |||
{% endif %} |
@@ -1 +0,0 @@ | |||
{#{{ entity.instance.user.getUsername() }}#} |
@@ -7,7 +7,7 @@ | |||
{% set id_modal = 'modal-'~field.value.id %} | |||
<a href="{{ sov_liip(field.value.path, 'big') }}" data-toggle="modal" data-target="#{{ id_modal }}" title="{{ field.value.legend }}"> | |||
<img src="{{ sov_liip(field.value.path, 'thumbnail') }}" alt="{{ field.value.legend }}"> | |||
<img src="{{ sov_liip(field.value.path, 'index') }}" alt="{{ field.value.legend }}"> | |||
</a> | |||
{% embed "@LcSov/adminlte/embed/modal.twig" %} |