Browse Source

Merge branch 'develop'

develop
Fabien Normand 3 years ago
parent
commit
6132633041
4 changed files with 34 additions and 3 deletions
  1. +15
    -3
      Form/Setting/BaseSettingType.php
  2. +7
    -0
      Repository/Ticket/TicketRepositoryQuery.php
  3. +11
    -0
      Repository/Ticket/TicketStore.php
  4. +1
    -0
      Resources/views/admin/setting/form.html.twig

+ 15
- 3
Form/Setting/BaseSettingType.php View File

use FOS\CKEditorBundle\Form\Type\CKEditorType; use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface; use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Form\Common\FileManagerType; use Lc\SovBundle\Form\Common\FileManagerType;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
{ {
protected EntityManagerInterface $em; protected EntityManagerInterface $em;
protected SiteSettingDefinitionInterface $settingDefinition; protected SiteSettingDefinitionInterface $settingDefinition;
protected TranslatorAdmin $translatorAdmin;


public function __construct( public function __construct(
EntityManagerInterface $entityManager, EntityManagerInterface $entityManager,
SiteSettingDefinitionInterface $settingDefinition
SiteSettingDefinitionInterface $settingDefinition,
TranslatorAdmin $translatorAdmin
) { ) {
$this->em = $entityManager; $this->em = $entityManager;
$this->settingDefinition = $settingDefinition; $this->settingDefinition = $settingDefinition;
$this->translatorAdmin = $translatorAdmin;
} }


public function buildFormSetting($label, $form, $settingDefinition, $settingEntity) public function buildFormSetting($label, $form, $settingDefinition, $settingEntity)
'text', 'text',
TextType::class, TextType::class,
[ [
'label' => $label
'label' => $label,
'translation_domain' => 'admin',
] ]
); );
} elseif ($settingType == 'textarea') { } elseif ($settingType == 'textarea') {
'text', 'text',
TextareaType::class, TextareaType::class,
[ [
'label' => $label
'label' => $label,
'translation_domain' => 'admin',
] ]
); );
} elseif ($settingType == 'textarea_advanced') { } elseif ($settingType == 'textarea_advanced') {
CKEditorType::class, CKEditorType::class,
[ [
'label' => $label, 'label' => $label,
'translation_domain' => 'admin',
'attr' => [ 'attr' => [
'class' => 'field-text_editor' 'class' => 'field-text_editor'
] ]
ChoiceType::class, ChoiceType::class,
[ [
'label' => $label, 'label' => $label,
'translation_domain' => 'admin',
'expanded' => false, 'expanded' => false,
'multiple' => false, 'multiple' => false,
'placeholder' => false, 'placeholder' => false,
ChoiceType::class, ChoiceType::class,
[ [
'label' => $label, 'label' => $label,
'translation_domain' => 'admin',
'expanded' => true, 'expanded' => true,
'multiple' => false, 'multiple' => false,
'placeholder' => false, 'placeholder' => false,
DateType::class, DateType::class,
[ [
'label' => $label, 'label' => $label,
'translation_domain' => 'admin',
'widget' => 'single_text', 'widget' => 'single_text',
] ]
); );
TimeType::class, TimeType::class,
[ [
'label' => $label, 'label' => $label,
'translation_domain' => 'admin',
'input' => 'datetime', 'input' => 'datetime',
'widget' => 'single_text', 'widget' => 'single_text',
] ]
FileManagerType::class, FileManagerType::class,
[ [
'label' => $label, 'label' => $label,
'translation_domain' => 'admin',
'attr' => [ 'attr' => [
'type' => $settingType 'type' => $settingType
] ]

+ 7
- 0
Repository/Ticket/TicketRepositoryQuery.php View File

return $this return $this
->select('count(ticket.id) as count'); ->select('count(ticket.id) as count');
} }

public function filterByVisitorToken(string $visitorToken): self
{
return $this
->andWhere('.visitorToken LIKE :visitorToken')
->setParameter('visitorToken', $visitorToken);
}
} }

+ 11
- 0
Repository/Ticket/TicketStore.php View File



return $query->count(); return $query->count();
} }

public function getOneByIdAndVisitorToken(int $id, string $token, $query = null)
{
$query = $this->createDefaultQuery($query);

$query
->filterById($id)
->filterByVisitorToken($token);

return $query->findOne();
}
} }

+ 1
- 0
Resources/views/admin/setting/form.html.twig View File

{# content #} {# content #}
{% block content %} {% block content %}
{% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %} {% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %}
{% trans_default_domain 'admin' %}
{{ form_start(form) }} {{ form_start(form) }}


{# panes #} {# panes #}

Loading…
Cancel
Save