Parcourir la source

Structure views / webpack, twig extensions, routes

develop
Guillaume il y a 3 ans
Parent
révision
cbb131922c
64 fichiers modifiés avec 477 ajouts et 422 suppressions
  1. +7
    -0
      Controller/Reminder/ReminderAdminController.php
  2. +8
    -4
      Controller/Security/SecurityAdminController.php
  3. +9
    -7
      Controller/Setting/SettingAdminController.php
  4. +4
    -4
      Controller/Ticket/TicketAdminController.php
  5. +9
    -2
      Controller/User/AccountAdminController.php
  6. +4
    -14
      EventSubscriber/SiteSettingEventSubscriber.php
  7. +8
    -25
      Repository/AbstractRepository.php
  8. +0
    -6
      Repository/AbstractRepositoryInterface.php
  9. +8
    -13
      Repository/File/FileRepository.php
  10. +8
    -0
      Repository/File/FileRepositoryInterface.php
  11. +5
    -10
      Repository/Newsletter/NewsletterRepository.php
  12. +8
    -0
      Repository/Newsletter/NewsletterRepositoryInterface.php
  13. +2
    -3
      Repository/Reminder/ReminderRepository.php
  14. +0
    -56
      Repository/Reminder/ReminderRepositoryBack.php
  15. +8
    -0
      Repository/Reminder/ReminderRepositoryInterface.php
  16. +24
    -1
      Repository/Reminder/ReminderRepositoryQuery.php
  17. +52
    -6
      Repository/Reminder/ReminderStore.php
  18. +5
    -10
      Repository/Setting/SiteSettingRepository.php
  19. +8
    -0
      Repository/Setting/SiteSettingRepositoryInterface.php
  20. +5
    -10
      Repository/Site/NewsRepository.php
  21. +8
    -0
      Repository/Site/NewsRepositoryInterface.php
  22. +5
    -10
      Repository/Site/PageRepository.php
  23. +8
    -0
      Repository/Site/PageRepositoryInterface.php
  24. +6
    -12
      Repository/Site/SiteRepository.php
  25. +8
    -0
      Repository/Site/SiteRepositoryInterface.php
  26. +5
    -12
      Repository/Ticket/TicketMessageRepository.php
  27. +8
    -0
      Repository/Ticket/TicketMessageRepositoryInterface.php
  28. +5
    -12
      Repository/Ticket/TicketRepository.php
  29. +8
    -0
      Repository/Ticket/TicketRepositoryInterface.php
  30. +5
    -12
      Repository/User/GroupUserRepository.php
  31. +8
    -0
      Repository/User/GroupUserRepositoryInterface.php
  32. +22
    -56
      Repository/User/UserRepository.php
  33. +8
    -0
      Repository/User/UserRepositoryInterface.php
  34. +0
    -0
      Resources/assets/app/admin/reminder/app.reminder.js
  35. +0
    -0
      Resources/assets/app/admin/reminder/reminder.js
  36. +0
    -0
      Resources/assets/app/admin/reminder/reminder.scss
  37. +0
    -0
      Resources/assets/app/admin/ticket/app.ticket.js
  38. +0
    -0
      Resources/assets/app/admin/ticket/ticket.js
  39. +3
    -31
      Resources/config/routes.yaml
  40. +0
    -0
      Resources/views/admin/setting/edit_site.html.twig
  41. +3
    -3
      Resources/views/admin/ticket/detail.html.twig
  42. +0
    -0
      Resources/views/admin/ticket/field/email.html.twig
  43. +0
    -0
      Resources/views/admin/ticket/field/lastmessage.html.twig
  44. +0
    -0
      Resources/views/admin/ticket/field/status.html.twig
  45. +0
    -0
      Resources/views/admin/ticket/field/username.html.twig
  46. +1
    -1
      Resources/views/admin/ticket/new.html.twig
  47. +1
    -1
      Resources/views/admin/user/edit_password.html.twig
  48. +1
    -1
      Resources/views/admin/user/edit_profile.html.twig
  49. +0
    -0
      Resources/views/admin/user/request_password.html.twig
  50. +1
    -1
      Resources/views/adminlte/block/menu.html.twig
  51. +0
    -0
      Resources/views/adminlte/block/modal_filemanager.html.twig
  52. +2
    -2
      Resources/views/adminlte/block/navbar_header.html.twig
  53. +2
    -2
      Resources/views/adminlte/crud/edit.html.twig
  54. +3
    -3
      Resources/views/adminlte/crud/field/image.html.twig
  55. +3
    -3
      Resources/views/adminlte/crud/form_theme.html.twig
  56. +2
    -2
      Resources/views/adminlte/crud/index.html.twig
  57. +0
    -0
      Resources/views/adminlte/crud/layout_form.html.twig
  58. +2
    -2
      Resources/views/adminlte/crud/new.html.twig
  59. +1
    -1
      Resources/views/adminlte/crud/sort.html.twig
  60. +1
    -1
      Resources/views/adminlte/dashboard.html.twig
  61. +1
    -1
      Resources/views/adminlte/layout.html.twig
  62. +40
    -0
      Twig/StoreTwigExtension.php
  63. +107
    -0
      Twig/TranslatorTwigExtension.php
  64. +17
    -82
      Twig/TwigExtension.php

+ 7
- 0
Controller/Reminder/ReminderAdminController.php Voir le fichier

@@ -13,6 +13,7 @@ use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Annotation\Route;

class ReminderAdminController extends AbstractController
{
@@ -43,6 +44,9 @@ class ReminderAdminController extends AbstractController
$this->parameterBag = $parameterBag;
}

/**
* @Route("/admin/reminder/modal", name="sov_admin_reminder_render_modal")
*/
public function renderModal(Request $request): Response
{
$crudAction = $request->get('crudAction');
@@ -69,6 +73,9 @@ class ReminderAdminController extends AbstractController
);
}

/**
* @Route("/admin/reminder/new", name="sov_admin_reminder_new")
*/
public function new(Request $request)
{
$reminder = $this->createEntity();

+ 8
- 4
Controller/Security/SecurityAdminController.php Voir le fichier

@@ -9,11 +9,13 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

class SecurityAdminController extends AbstractController
{

/**
* @Route("/login", name="sov_login")
*/
public function login(AuthenticationUtils $authenticationUtils): Response
{
if ($this->getUser()) {
return $this->redirectToRoute('admin_dashboard');
return $this->redirectToRoute('app_admin_dashboard');
}

// get the login error if there is one
@@ -44,7 +46,7 @@ class SecurityAdminController extends AbstractController
'csrf_token_intention' => 'authenticate',

// the URL users are redirected to after the login (default: '/admin')
'target_path' => $this->generateUrl('admin_dashboard'),
'target_path' => $this->generateUrl('app_admin_dashboard'),

// the label displayed for the username form field (the |trans filter is applied to it)
'username_label' => 'Your username',
@@ -63,7 +65,9 @@ class SecurityAdminController extends AbstractController
]);
}


/**
* @Route("/logout", name="sov_logout")
*/
public function logout()
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');

+ 9
- 7
Controller/Setting/SettingAdminController.php Voir le fichier

@@ -3,15 +3,14 @@
namespace Lc\SovBundle\Controller\Setting;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Form\Setting\MerchantSettingsFormType;
use Lc\CaracoleBundle\Form\Setting\SectionSettingsFormType;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Form\Setting\SiteSettingsFormType;
use Lc\SovBundle\Repository\Setting\SiteSettingRepository;
use Lc\SovBundle\Repository\Site\SiteRepository;
use Lc\SovBundle\Repository\Setting\SiteSettingRepositoryInterface;
use Lc\SovBundle\Repository\Site\SiteRepositoryInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class SettingAdminController extends AbstractController
{
@@ -24,9 +23,9 @@ class SettingAdminController extends AbstractController
public function __construct(
EntityManagerInterface $em,
TranslatorAdmin $translatorAdmin,
SiteSettingRepository $siteSettingRepository,
SiteSettingRepositoryInterface $siteSettingRepository,
SiteSettingDefinitionInterface $siteSettingDefinition,
SiteRepository $siteRepository
SiteRepositoryInterface $siteRepository
) {
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
@@ -35,6 +34,9 @@ class SettingAdminController extends AbstractController
$this->siteRepository = $siteRepository;
}

/**
* @Route("/admin/setting/site", name="sov_admin_setting_global")
*/
public function manageGlobal(Request $request)
{
$site = $this->siteRepository->findOneByDevAlias('default') ;
@@ -51,7 +53,7 @@ class SettingAdminController extends AbstractController
}

return $this->render(
'@LcSov/admin/setting/global.html.twig' ,
'@LcSov/admin/setting/edit_site.html.twig' ,
[
'setting_definition' => $this->siteSettingDefinition,
'form' => $form->createView()

+ 4
- 4
Controller/Ticket/TicketAdminController.php Voir le fichier

@@ -63,16 +63,16 @@ class TicketAdminController extends AbstractAdminController
DateField::new('createdAt')->setFormat('short')
->hideOnForm(),
TextField::new('visitorFirstName')
->setTemplatePath('@LcSov/admin/ticket/index_username.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/username.html.twig')
->hideOnForm(),
TextField::new('visitorEmail')
->setTemplatePath('@LcSov/admin/ticket/index_email.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/email.html.twig')
->hideOnForm(),
AssociationField::new('user')
->hideOnIndex(),
TextField::new('subject'),
TextField::new('lastMessage')
->setTemplatePath('@LcSov/admin/ticket/index_lastmessage.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/lastmessage.html.twig')
->hideOnForm(),
ChoiceField::new('type')
->autocomplete()
@@ -84,7 +84,7 @@ class TicketAdminController extends AbstractAdminController
->setChoices(
TicketModel::getChoicesStatus()
)
->setTemplatePath('@LcSov/admin/ticket/index_status.html.twig')
->setTemplatePath('@LcSov/admin/ticket/field/status.html.twig')
->hideOnForm(),
];
}

+ 9
- 2
Controller/User/AccountAdminController.php Voir le fichier

@@ -11,6 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Component\Routing\Annotation\Route;

class AccountAdminController extends AbstractController
{
@@ -21,6 +22,9 @@ class AccountAdminController extends AbstractController
$this->em = $em;
}

/**
* @Route("/admin/account/profile", name="sov_admin_account_profile")
*/
public function profile(Request $request): Response
{
$user = $this->getUser();
@@ -39,13 +43,16 @@ class AccountAdminController extends AbstractController
}

return $this->render(
'@LcSov/user/profile.html.twig',
'@LcSov/admin/user/edit_profile.html.twig',
[
'form' => $form->createView(),
]
);
}

/**
* @Route("/admin/account/password", name="sov_admin_account_password")
*/
public function changePassword(Request $request, UserPasswordEncoderInterface $passwordEncoder): Response
{
$user = $this->getUser();
@@ -67,7 +74,7 @@ class AccountAdminController extends AbstractController
}

return $this->render(
'@LcSov/user/change_password.html.twig',
'@LcSov/admin/user/edit_password.html.twig',
[
'entity_class' => User::class,
'form' => $form->createView()

+ 4
- 14
EventSubscriber/SiteSettingEventSubscriber.php Voir le fichier

@@ -3,23 +3,13 @@
namespace Lc\SovBundle\EventSubscriber;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface;
use Lc\CaracoleBundle\Factory\Setting\MerchantSettingFactory;
use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory;
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Lc\CaracoleBundle\Definition\SectionSettingDefinitionInterface;
use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Factory\Setting\SiteSettingFactory;
use Lc\SovBundle\Factory\Site\SiteFactory;
use Lc\SovBundle\Repository\Setting\SiteSettingRepository;
use Lc\SovBundle\Repository\Site\SiteRepository;
use Lc\SovBundle\Repository\Setting\SiteSettingRepositoryInterface;
use Lc\SovBundle\Repository\Site\SiteRepositoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Core\Security;

class SiteSettingEventSubscriber implements EventSubscriberInterface
{
@@ -32,8 +22,8 @@ class SiteSettingEventSubscriber implements EventSubscriberInterface

public function __construct(
EntityManagerInterface $em,
SiteSettingRepository $siteSettingRepository,
SiteRepository $siteRepository,
SiteSettingRepositoryInterface $siteSettingRepository,
SiteRepositoryInterface $siteRepository,
SiteSettingDefinitionInterface $siteSettingDefinition,
SiteSettingFactory $siteSettingFactory,
SiteFactory $siteFactory

+ 8
- 25
Repository/AbstractRepository.php Voir le fichier

@@ -2,20 +2,16 @@

namespace Lc\SovBundle\Repository;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Gedmo\Translatable\TranslatableListener;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;

abstract class AbstractRepository extends EntityRepository implements ServiceEntityRepositoryInterface,
AbstractRepositoryInterface
abstract class AbstractRepository extends ServiceEntityRepository implements ServiceEntityRepositoryInterface,
AbstractRepositoryInterface
{

protected $defaultLocale;

public function setDefaultLocale($locale)
@@ -23,17 +19,12 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
$this->defaultLocale = $locale;
}

public function __construct(EntityManagerInterface $entityManager)
{
parent::__construct($entityManager, $entityManager->getClassMetadata($this->getInterfaceClass()));
}

public function findOneByOldUrl($url)
{
$qb = $this->createQueryBuilder('entity')
->where('entity.oldUrls LIKE :oldUrl')
->andWhere('entity.status = 1')
->setParameter(':oldUrl', '%'.$url.'%');
->setParameter(':oldUrl', '%' . $url . '%');

return $qb->getQuery()->getOneOrNullResult();
}
@@ -43,31 +34,26 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
return $this->getTranslatedQuery($qb, $locale)->getOneOrNullResult($hydrationMode);
}


public function getResult(QueryBuilder $qb, $locale = null, $hydrationMode = AbstractQuery::HYDRATE_OBJECT)
{
return $this->getTranslatedQuery($qb, $locale)->getResult($hydrationMode);
}


public function getArrayResult(QueryBuilder $qb, $locale = null)
{
return $this->getTranslatedQuery($qb, $locale)->getArrayResult();
}


public function getSingleResult(QueryBuilder $qb, $locale = null, $hydrationMode = null)
{
return $this->getTranslatedQuery($qb, $locale)->getSingleResult($hydrationMode);
}


public function getScalarResult(QueryBuilder $qb, $locale = null)
{
return $this->getTranslatedQuery($qb, $locale)->getScalarResult();
}


public function getSingleScalarResult(QueryBuilder $qb, $locale = null)
{
return $this->getTranslatedQuery($qb, $locale)->getSingleScalarResult();
@@ -94,15 +80,12 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
$qb = $this->createQueryBuilder('entity')
->select('entity.id, COUNT(entity.slug) as niche')
->andWhere('entity.status>=0')
->andWhere('entity.merchant= :merchant')
->setParameter('merchant', $merchant)
->groupBy('entity.slug')
->having('COUNT(entity.slug) >1');

return $qb->getQuery()->getResult();
}


public function findAll()
{
return $this->findBy(array());
@@ -122,9 +105,9 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
return parent::findOneBy($criteria, $orderBy);
}

protected function setCriteria(array $criteria) :array
protected function setCriteria(array $criteria): array
{
$className = $this->getClassMetadata()->getName();
/*$className = $this->getClassMetadata()->getName();
$entity = new $className;

if ($entity instanceof StatusInterface) {
@@ -134,9 +117,9 @@ abstract class AbstractRepository extends EntityRepository implements ServiceEnt
if ($criteria['status'] === false) {
unset($criteria['status']);
}
}
}*/

return $criteria;
}


}

+ 0
- 6
Repository/AbstractRepositoryInterface.php Voir le fichier

@@ -6,10 +6,4 @@ namespace Lc\SovBundle\Repository;
interface AbstractRepositoryInterface
{

/**
* Retourne la class ou l'interface correspondant à ce repository
*
* @return string
*/
public function getInterfaceClass();
}

+ 8
- 13
Repository/File/FileRepository.php Voir le fichier

@@ -2,19 +2,14 @@

namespace Lc\SovBundle\Repository\File;

use Lc\SovBundle\Model\File\FileInterface;
use App\Entity\File\File;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;
/**
* @method FileInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method FileInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method FileInterface[] findAll()
* @method FileInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class FileRepository extends AbstractRepository
{
public function getInterfaceClass()
{
return FileInterface::class;
}

class FileRepository extends AbstractRepository implements FileRepositoryInterface
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, File::class);
}
}

+ 8
- 0
Repository/File/FileRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\File;

interface FileRepositoryInterface
{

}

+ 5
- 10
Repository/Newsletter/NewsletterRepository.php Voir le fichier

@@ -2,19 +2,14 @@

namespace Lc\SovBundle\Repository\Newsletter;

use Lc\SovBundle\Model\Newsletter\NewsletterInterface;
use App\Entity\Newsletter\Newsletter;
use Doctrine\Persistence\ManagerRegistry;
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
class NewsletterRepository extends AbstractRepository implements NewsletterRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return NewsletterInterface::class;
parent::__construct($registry, Newsletter::class);
}
}

+ 8
- 0
Repository/Newsletter/NewsletterRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Newsletter;

interface NewsletterRepositoryInterface
{

}

+ 2
- 3
Repository/Reminder/ReminderRepository.php Voir le fichier

@@ -3,11 +3,10 @@
namespace Lc\SovBundle\Repository\Reminder;

use App\Entity\Reminder\Reminder;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

class ReminderRepository extends ServiceEntityRepository implements ServiceEntityRepositoryInterface
class ReminderRepository extends AbstractRepository implements ReminderRepositoryInterface
{
public function __construct(ManagerRegistry $registry)
{

+ 0
- 56
Repository/Reminder/ReminderRepositoryBack.php Voir le fichier

@@ -1,56 +0,0 @@
<?php

namespace Lc\SovBundle\Repository\Reminder;

use Lc\SovBundle\Repository\AbstractRepository;
use Lc\SovBundle\Model\Reminder\ReminderInterface;

/**
* @method ReminderInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ReminderInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ReminderInterface[] findAll()
* @method ReminderInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ReminderRepositoryBack extends AbstractRepository
{
public function getInterfaceClass()
{
return ReminderInterface::class;
}

public function findByUser($user)
{
$qb = $this->createQueryBuilder('e')
->leftJoin('e.users', 'u')
->having('COUNT(u.id) = 0')
->orHaving(':user MEMBER OF e.users')
->andWhere('e.done = 0')
->setParameter('user', $user)
->orderBy('e.dateReminder', 'ASC')
->groupBy('e.id');

return $qb->getQuery()->getResult();
}

public function findByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId = null)
{
$qb = $this->createQueryBuilder('e');
$qb->leftJoin('e.users', 'u');
$qb->having('COUNT(u.id) = 0');
$qb->orHaving(':user MEMBER OF e.users');
$qb->andWhere('e.done = 0');
$qb->andWhere('e.crudAction LIKE :crudAction');
$qb->andWhere('e.crudControllerFqcn LIKE :entity');
$qb->setParameter('crudAction', $crudAction);
$qb->setParameter('crudControllerFqcn', $crudControllerFqcn);
$qb->setParameter('user', $user);
if ($entityId) {
$qb->andWhere('e.entityId LIKE :id');
$qb->setParameter('entityId', $entityId);
}
$qb->orderBy('e.dateReminder', 'ASC');
$qb->groupBy('e.id');

return $qb->getQuery()->getResult();
}
}

+ 8
- 0
Repository/Reminder/ReminderRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Reminder;

interface ReminderRepositoryInterface
{

}

+ 24
- 1
Repository/Reminder/ReminderRepositoryQuery.php Voir le fichier

@@ -7,8 +7,31 @@ use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class ReminderRepositoryQuery extends AbstractRepositoryQuery
{
public function __construct(ReminderRepository $repository, PaginatorInterface $paginator)
public function __construct(ReminderRepositoryInterface $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}

public function filterDone()
{
return $this
->andWhere('.done = 0');
}

public function filterUser($user)
{
return $this
->leftJoin('.users', 'u')
->having('COUNT(u.id) = 0')
->orHaving(':user MEMBER OF .users')
->setParameter(':user', $user)
->groupBy('.id');
}

public function orderDefault()
{
return $this
->orderBy('.dateReminder', 'ASC');
}

}

+ 52
- 6
Repository/Reminder/ReminderStore.php Voir le fichier

@@ -2,11 +2,6 @@

namespace Lc\SovBundle\Repository\Reminder;

/**
* class ReminderStore.
*
* @author Simon Vieille <simon@deblan.fr>
*/
class ReminderStore
{
protected ReminderRepositoryQuery $query;
@@ -16,7 +11,18 @@ class ReminderStore
$this->query = $query;
}

public function getFoo($query = null)
public function getByUser($user)
{
$query = $this->query->create();

return $query
->filterDone()
->filterUser($user)
->orderDefault()
->find();
}

/*public function getFoo($query = null)
{
if (!$query) {
$query = $this->query->create();
@@ -27,5 +33,45 @@ class ReminderStore
->andWhere('.description = :description')
->setParameter(':description', 'ahah')
->findOne();
}*/

/*

public function findByUser($user)
{
$qb = $this->createQueryBuilder('e')
->leftJoin('e.users', 'u')
->having('COUNT(u.id) = 0')
->orHaving(':user MEMBER OF e.users')
->andWhere('e.done = 0')
->setParameter('user', $user)
->orderBy('e.dateReminder', 'ASC')
->groupBy('e.id');

return $qb->getQuery()->getResult();
}

public function findByEasyAdminConfigAndUser($crudAction, $crudControllerFqcn, $user, $entityId = null)
{
$qb = $this->createQueryBuilder('e');
$qb->leftJoin('e.users', 'u');
$qb->having('COUNT(u.id) = 0');
$qb->orHaving(':user MEMBER OF e.users');
$qb->andWhere('e.done = 0');
$qb->andWhere('e.crudAction LIKE :crudAction');
$qb->andWhere('e.crudControllerFqcn LIKE :entity');
$qb->setParameter('crudAction', $crudAction);
$qb->setParameter('crudControllerFqcn', $crudControllerFqcn);
$qb->setParameter('user', $user);
if ($entityId) {
$qb->andWhere('e.entityId LIKE :id');
$qb->setParameter('entityId', $entityId);
}
$qb->orderBy('e.dateReminder', 'ASC');
$qb->groupBy('e.id');

return $qb->getQuery()->getResult();
}

*/
}

+ 5
- 10
Repository/Setting/SiteSettingRepository.php Voir le fichier

@@ -2,19 +2,14 @@

namespace Lc\SovBundle\Repository\Setting;

use App\Entity\Setting\SiteSetting;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;
use Lc\SovBundle\Model\Setting\SiteSettingInterface;

/**
* @method SiteSettingInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method SiteSettingInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method SiteSettingInterface[] findAll()
* @method SiteSettingInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SiteSettingRepository extends AbstractRepository
class SiteSettingRepository extends AbstractRepository implements SiteSettingRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return SiteSettingInterface::class;
parent::__construct($registry, SiteSetting::class);
}
}

+ 8
- 0
Repository/Setting/SiteSettingRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Setting;

interface SiteSettingRepositoryInterface
{

}

+ 5
- 10
Repository/Site/NewsRepository.php Voir le fichier

@@ -2,19 +2,14 @@

namespace Lc\SovBundle\Repository\Site;

use Lc\SovBundle\Model\Site\NewsInterface;
use App\Entity\Site\News;
use Doctrine\Persistence\ManagerRegistry;
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
class NewsRepository extends AbstractRepository implements NewsRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return NewsInterface::class;
parent::__construct($registry, News::class);
}
}

+ 8
- 0
Repository/Site/NewsRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Site;

interface NewsRepositoryInterface
{

}

+ 5
- 10
Repository/Site/PageRepository.php Voir le fichier

@@ -2,19 +2,14 @@

namespace Lc\SovBundle\Repository\Site;

use Lc\SovBundle\Model\Site\PageInterface;
use App\Entity\Site\Page;
use Doctrine\Persistence\ManagerRegistry;
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
class PageRepository extends AbstractRepository implements PageRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return PageInterface::class;
parent::__construct($registry, Page::class);
}
}

+ 8
- 0
Repository/Site/PageRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Site;

interface PageRepositoryInterface
{

}

+ 6
- 12
Repository/Site/SiteRepository.php Voir le fichier

@@ -2,20 +2,14 @@

namespace Lc\SovBundle\Repository\Site;

use Lc\SovBundle\Model\File\FileInterface;
use Lc\SovBundle\Model\Site\SiteInterface;
use App\Entity\Site\Site;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;
/**
* @method SiteInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method SiteInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method SiteInterface[] findAll()
* @method SiteInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SiteRepository extends AbstractRepository

class SiteRepository extends AbstractRepository implements SiteRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return SiteInterface::class;
parent::__construct($registry, Site::class);
}

}

+ 8
- 0
Repository/Site/SiteRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Site;

interface SiteRepositoryInterface
{

}

+ 5
- 12
Repository/Ticket/TicketMessageRepository.php Voir le fichier

@@ -2,21 +2,14 @@

namespace Lc\SovBundle\Repository\Ticket;

use Lc\SovBundle\Model\Ticket\TicketMessageInterface;
use App\Entity\Ticket\TicketMessage;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method TicketMessageInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketMessageInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketMessageInterface[] findAll()
* @method TicketMessageInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketMessageRepository extends AbstractRepository
class TicketMessageRepository extends AbstractRepository implements TicketMessageRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return TicketMessageInterface::class;
parent::__construct($registry, TicketMessage::class);
}


}

+ 8
- 0
Repository/Ticket/TicketMessageRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Ticket;

interface TicketMessageRepositoryInterface
{

}

+ 5
- 12
Repository/Ticket/TicketRepository.php Voir le fichier

@@ -2,21 +2,14 @@

namespace Lc\SovBundle\Repository\Ticket;

use Lc\SovBundle\Model\Ticket\TicketInterface;
use App\Entity\Ticket\Ticket;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method TicketInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketInterface[] findAll()
* @method TicketInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketRepository extends AbstractRepository
class TicketRepository extends AbstractRepository implements TicketRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return TicketInterface::class;
parent::__construct($registry, Ticket::class);
}


}

+ 8
- 0
Repository/Ticket/TicketRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\Ticket;

interface TicketRepositoryInterface
{

}

+ 5
- 12
Repository/User/GroupUserRepository.php Voir le fichier

@@ -2,21 +2,14 @@

namespace Lc\SovBundle\Repository\User;

use App\Entity\User\GroupUser;
use Doctrine\Persistence\ManagerRegistry;
use Lc\SovBundle\Repository\AbstractRepository;
use Lc\SovBundle\Model\User\GroupUserInterface;

/**
* @method GroupUserInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method GroupUserInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method GroupUserInterface[] findAll()
* @method GroupUserInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class GroupUserRepository extends AbstractRepository
class GroupUserRepository extends AbstractRepository implements GroupUserRepositoryInterface
{
public function getInterfaceClass()
public function __construct(ManagerRegistry $registry)
{
return GroupUserInterface::class;
parent::__construct($registry, GroupUser::class);
}


}

+ 8
- 0
Repository/User/GroupUserRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\User;

interface GroupUserRepositoryInterface
{

}

+ 22
- 56
Repository/User/UserRepository.php Voir le fichier

@@ -2,73 +2,39 @@

namespace Lc\SovBundle\Repository\User;

use Lc\SovBundle\Model\User\UserInterface;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\User\User;
use Lc\SovBundle\Repository\AbstractRepository;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface as SfUserInterface;

/**
* @method UserInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method UserInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method UserInterface[] findAll()
* @method UserInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UserRepository extends AbstractRepository implements PasswordUpgraderInterface
class UserRepository extends AbstractRepository implements UserRepositoryInterface
{
public function getInterfaceClass()
{
return UserInterface::class;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, User::class);
}

/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(SfUserInterface $user, string $newEncodedPassword): void
{
if (!$user instanceof SfUserInterface) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
}

/**
* Used to upgrade (rehash) the user's password automatically over time.
*/
public function upgradePassword(SfUserInterface $user, string $newEncodedPassword): void
{
if (!$user instanceof SfUserInterface) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
}
$user->setPassword($newEncodedPassword);
$this->_em->persist($user);
$this->_em->flush();
}

$user->setPassword($newEncodedPassword);
$this->_em->persist($user);
$this->_em->flush();
}

public function findByRole($role) {
return $this->createQueryBuilder('u')
public function findByRole($role) {
return $this->createQueryBuilder('u')
->andWhere('u.roles LIKE :role')
->setParameter('role', '%'.$role.'%')
->getQuery()
->getResult();
}

// /**
// * @return User[] Returns an array of User objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('u')
->andWhere('u.exampleField = :val')
->setParameter('val', $value)
->orderBy('u.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
}

/*
public function findOneBySomeField($value): ?User
{
return $this->createQueryBuilder('u')
->andWhere('u.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

+ 8
- 0
Repository/User/UserRepositoryInterface.php Voir le fichier

@@ -0,0 +1,8 @@
<?php

namespace Lc\SovBundle\Repository\User;

interface UserRepositoryInterface
{

}

Resources/assets/app/adminlte/reminder/app.reminder.js → Resources/assets/app/admin/reminder/app.reminder.js Voir le fichier


Resources/assets/app/adminlte/reminder/reminder.js → Resources/assets/app/admin/reminder/reminder.js Voir le fichier


Resources/assets/app/adminlte/reminder/reminder.scss → Resources/assets/app/admin/reminder/reminder.scss Voir le fichier


Resources/assets/app/adminlte/ticket/app.ticket.js → Resources/assets/app/admin/ticket/app.ticket.js Voir le fichier


Resources/assets/app/adminlte/ticket/ticket.js → Resources/assets/app/admin/ticket/ticket.js Voir le fichier


+ 3
- 31
Resources/config/routes.yaml Voir le fichier

@@ -6,34 +6,6 @@ artgris_bundle_file_manager:
type: annotation
prefix: /manager

sov_login:
path: /login
controller: Lc\SovBundle\Controller\Security\SecurityAdminController::login

sov_logout:
path: /logout
controller: Lc\SovBundle\Controller\Security\SecurityAdminController::logout

sov_admin_account_profile:
path: /admin/account/profile
controller: Lc\SovBundle\Controller\User\AccountAdminController::profile

sov_admin_account_password:
path: /admin/account/password
controller: Lc\SovBundle\Controller\User\AccountAdminController::changePassword

sov_admin_setting_global:
path: /admin/setting/global
controller: Lc\SovBundle\Controller\Setting\SettingAdminController::manageGlobal

sov_admin_create_ticket:
path: /admin/ticket/create
controller: Lc\SovBundle\Controller\Ticket\TicketAdminController::create

sov_admin_reminder_render_modal:
path: /admin/reminder/modal
controller: Lc\SovBundle\Controller\Reminder\ReminderAdminController::renderModal

sov_admin_reminder_new:
path: /admin/reminder/new
controller: Lc\SovBundle\Controller\Reminder\ReminderAdminController::new
lc_sov_bundle:
resource: "@LcSovBundle/Controller"
type: annotation

Resources/views/admin/setting/global.html.twig → Resources/views/admin/setting/edit_site.html.twig Voir le fichier


+ 3
- 3
Resources/views/admin/ticket/detail.html.twig Voir le fichier

@@ -2,7 +2,7 @@
{% import '@LcSov/adminlte/macro/infobox.html.twig' as macro %}

{% block content_title %}
{{ 'detail'|lc_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{% endblock %}

{% block main %}
@@ -69,9 +69,9 @@
<p>{{ message.message|nl2br }}</p>
{% if message.imageFilename is not null %}
<i>Photo jointe au message : </i> <br/>
<a href="{{ lc_liip(message.imageFilename, 'big') }}"
<a href="{{ sov_liip(message.imageFilename, 'big') }}"
data-toggle="lightbox">
<img src="{{ lc_liip(message.imageFilename, 'thumb') }}"
<img src="{{ sov_liip(message.imageFilename, 'thumb') }}"
alt="Illustration ticket"/>
</a>
{% endif %}

Resources/views/admin/ticket/index_email.html.twig → Resources/views/admin/ticket/field/email.html.twig Voir le fichier


Resources/views/admin/ticket/index_lastmessage.html.twig → Resources/views/admin/ticket/field/lastmessage.html.twig Voir le fichier


Resources/views/admin/ticket/index_status.html.twig → Resources/views/admin/ticket/field/status.html.twig Voir le fichier


Resources/views/admin/ticket/index_username.html.twig → Resources/views/admin/ticket/field/username.html.twig Voir le fichier


+ 1
- 1
Resources/views/admin/ticket/new.html.twig Voir le fichier

@@ -1,7 +1,7 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title %}
{# {{ 'ticket.profile'|lc_trans_admin_title }} #}
{# {{ 'ticket.profile'|sov_trans_admin_title }} #}
Créer un ticket
{% endblock %}


Resources/views/user/change_password.html.twig → Resources/views/admin/user/edit_password.html.twig Voir le fichier

@@ -2,7 +2,7 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title %}
{{ 'account.change_password'|lc_trans_admin_title }}
{{ 'account.change_password'|sov_trans_admin_title }}
{% endblock %}

{% block main %}

Resources/views/user/profile.html.twig → Resources/views/admin/user/edit_profile.html.twig Voir le fichier

@@ -1,7 +1,7 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title %}
{{ 'account.profile'|lc_trans_admin_title }}
{{ 'account.profile'|sov_trans_admin_title }}
{% endblock %}

{% block main %}

Resources/views/user/request_password.html.twig → Resources/views/admin/user/request_password.html.twig Voir le fichier


+ 1
- 1
Resources/views/adminlte/block/menu.html.twig Voir le fichier

@@ -12,7 +12,7 @@
{% if item.icon is not empty %}
<i class="{{ item.icon }} nav-icon"></i>
{% endif %}
<p>{{ item.label|lc_trans_admin_menu }}</p>
<p>{{ item.label|sov_trans_admin_menu }}</p>
{% if item.hasSubItems %}<i class="right fas fa-angle-left"></i>{% endif %}
</a>
{% endif %}

Resources/views/adminlte/filemanager/file-manager-modal.html.twig → Resources/views/adminlte/block/modal_filemanager.html.twig Voir le fichier


+ 2
- 2
Resources/views/adminlte/block/navbar_header.html.twig Voir le fichier

@@ -39,13 +39,13 @@
</li>

<li class="nav-item">
<a href="{{ path(sov_get_parameter('app.reminder.route_render_modal')) }}" class="btn btn-sm btn-outline-info btn-reminder" data-crud-action="{{ ea.request.query.get('crudAction') }}" data-crud-controller-fqcn="{{ ea.request.query.get('crudControllerFqcn') }}">
<a href="{{ path(sov_parameter('app.reminder.route_render_modal')) }}" class="btn btn-sm btn-outline-info btn-reminder" data-crud-action="{{ ea.request.query.get('crudAction') }}" data-crud-controller-fqcn="{{ ea.request.query.get('crudControllerFqcn') }}">
<i class="action-icon fa fa-plus"></i>
Pense-bête
</a>
</li>
<li class="nav-item">
<a href="{{ path(homepage_route()) }}" class="btn btn-sm btn-block btn-outline-success" target="_blank"
<a href="{{ path(sov_homepage_route()) }}" class="btn btn-sm btn-block btn-outline-success" target="_blank"
rel="noreferrer">
<i class="action-icon fa fa-eye"></i>
Afficher le site

+ 2
- 2
Resources/views/adminlte/crud/edit.html.twig Voir le fichier

@@ -1,13 +1,13 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set form = edit_form %}
{% extends '@LcSov/adminlte/crud/_form.html.twig' %}
{% extends '@LcSov/adminlte/crud/layout_form.html.twig' %}

{% block body_id 'ea-edit-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %}
{% block body_class 'ea-edit ea-edit-' ~ entity.name %}

{% block content_title %}
{{ 'edit'|lc_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{{ 'edit'|sov_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{% endblock %}

{% block delete_form %}

+ 3
- 3
Resources/views/adminlte/crud/field/image.html.twig Voir le fichier

@@ -6,8 +6,8 @@

{% set id_modal = 'modal-'~field.value.id %}

<a href="{{ lc_liip(field.value.path, 'big') }}" data-toggle="modal" data-target="#{{ id_modal }}" title="{{ field.value.legend }}">
<img src="{{ lc_liip(field.value.path, 'thumbnail') }}" alt="{{ field.value.legend }}">
<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 }}">
</a>

{% embed "@LcSov/adminlte/embed/modal.twig" %}
@@ -15,7 +15,7 @@
{% block size %}modal-xl{% endblock %}
{% block title %}{{ field.value.legend ? field.value.legend : 'Image' }}{% endblock %}
{% block body %}
<img src="{{ lc_liip(field.value.path, 'big') }}" alt="{{ field.value.legend }}" />
<img src="{{ sov_liip(field.value.path, 'big') }}" alt="{{ field.value.legend }}" />
{% endblock %}
{% block footer_wrapper %}{% endblock %}
{% endembed %}

+ 3
- 3
Resources/views/adminlte/crud/form_theme.html.twig Voir le fichier

@@ -79,7 +79,7 @@
</div>
{% endif %}

{% set help_message = name|lc_trans_admin_help(form.parent.vars.data) %}
{% set help_message = name|sov_trans_admin_help(form.parent.vars.data) %}
{% if help_message != '' %}
<small class="form-help">{{ help_message }}</small>
{% endif %}
@@ -118,7 +118,7 @@
{% 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') }}>
<{{ 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|sov_trans_admin_field(entityNameOrObject) }}</{{ element|default('label') }}>

{%- endif -%}
{%- endblock form_label %}
@@ -294,7 +294,7 @@
{% import '@LcSov/adminlte/macro/tabs.html.twig' as mtabs %}
{% block menu_items %}
{% for panel_name, panel_config in ea_crud_form.form_panels|filter(panel_config => not panel_config.form_tab or panel_config.form_tab == tab_name) %}
{{ mtabs.menu_item(panel_name, loop.first, panel_config.label|lc_trans_admin_panel(ea.getEntity().getFqcn())) }}
{{ mtabs.menu_item(panel_name, loop.first, panel_config.label|sov_trans_admin_panel(ea.getEntity().getFqcn())) }}
{% endfor %}
{% endblock %}


+ 2
- 2
Resources/views/adminlte/crud/index.html.twig Voir le fichier

@@ -9,7 +9,7 @@
{% block body_class 'index' ~ (entities|length > 0 ? ' index-' ~ entities|first.name : '') %}

{% block content_title %}
{{ 'index'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{{ 'index'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}

{% block content_breadcrumb %}
@@ -91,7 +91,7 @@
class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.getProperty|lc_trans_admin_field(ea.getEntity().getFqcn()) }}</span>
<span>{{ field.getProperty|sov_trans_admin_field(ea.getEntity().getFqcn()) }}</span>
{% endif %}
</th>
{% endif %}

Resources/views/adminlte/crud/_form.html.twig → Resources/views/adminlte/crud/layout_form.html.twig Voir le fichier


+ 2
- 2
Resources/views/adminlte/crud/new.html.twig Voir le fichier

@@ -1,13 +1,13 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set form = new_form %}
{% extends '@LcSov/adminlte/crud/_form.html.twig' %}
{% extends '@LcSov/adminlte/crud/layout_form.html.twig' %}

{% block body_id 'ea-new-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %}
{% block body_class 'ea-new ea-new-' ~ entity.name %}

{% block content_title %}
{{ 'new'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{{ 'new'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}

{% block body_javascript %}

+ 1
- 1
Resources/views/adminlte/crud/sort.html.twig Voir le fichier

@@ -8,7 +8,7 @@
{% block body_class 'index' ~ (entities|length > 0 ? ' index-' ~ entities|first.name : '') %}

{% block content_title %}
{{ 'sort'|lc_trans_admin_title(ea.getEntity().getFqcn()) }}
{{ 'sort'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}

{% block content_breadcrumb %}

+ 1
- 1
Resources/views/adminlte/dashboard.html.twig Voir le fichier

@@ -1,7 +1,7 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title %}
{{ 'dashboard'|lc_trans_admin_title }}
{{ 'dashboard'|sov_trans_admin_title }}
{% endblock %}

{% block main %}

+ 1
- 1
Resources/views/adminlte/layout.html.twig Voir le fichier

@@ -211,7 +211,7 @@
{% endfor %}
{% endblock %}

{% include '@LcSov/adminlte/filemanager/file-manager-modal.html.twig' %}
{% include '@LcSov/adminlte/block/modal_filemanager.html.twig' %}

{% if app.session is not null and app.session.started %}
{% set flash_messages = app.session.flashbag.all %}

+ 40
- 0
Twig/StoreTwigExtension.php Voir le fichier

@@ -0,0 +1,40 @@
<?php

namespace Lc\SovBundle\Twig;

use Lc\SovBundle\Repository\Reminder\ReminderStore;
use Symfony\Component\Security\Core\Security;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class StoreTwigExtension extends AbstractExtension
{
protected Security $security;
protected ReminderStore $reminderStore;

public function __construct(
Security $security,
ReminderStore $reminderStore
) {
$this->security = $security;
$this->reminderStore = $reminderStore;
}

public function getFunctions()
{
return [
new TwigFunction('sov_get_reminders', [$this, 'getReminders']),
];
}

public function getFilters()
{
return [];
}

public function getReminders()
{
return $this->reminderStore->getByUser($this->security->getUser());
}

}

+ 107
- 0
Twig/TranslatorTwigExtension.php Voir le fichier

@@ -0,0 +1,107 @@
<?php

namespace Lc\SovBundle\Twig;

use App\Repository\ReminderRepository;
use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Model\Reminder\ReminderInterface;
use Lc\SovBundle\Repository\Reminder\ReminderStore;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

class TranslatorTwigExtension extends AbstractExtension
{
protected $parameterBag;
protected $requestStack;
protected $router;
protected $translatorAdmin;

public function __construct(
ParameterBagInterface $parameterBag,
RequestStack $requestStack,
UrlGeneratorInterface $router,
TranslatorAdmin $translatorAdmin
) {
$this->parameterBag = $parameterBag;
$this->requestStack = $requestStack;
$this->router = $router;
$this->translatorAdmin = $translatorAdmin;
}

public function getFunctions()
{
return [
new TwigFunction('sov_translated_urls', [$this, 'getTranslatedUrls']),
];
}


public function getFilters()
{
return [
new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']),
new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']),
new TwigFilter('sov_trans_admin_panel', [$this, 'transAdminPanel']),
new TwigFilter('sov_trans_admin_menu', [$this, 'transAdminMenu']),
new TwigFilter('sov_trans_admin_title', [$this, 'transAdminTitle']),
new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']),
];
}

function getTranslatedUrls()
{
$ret = array();
$langs = $this->parameterBag->get('app.locales');
$currentRoute = $this->requestStack->getCurrentRequest()->get('_route');

$params = array_merge((array)$this->requestStack->getCurrentRequest()->get('_route_params'), $_GET);

if ($currentRoute) {
foreach ($langs as $lg) {
$ret[$lg] = $this->router->generate($currentRoute, array_merge($params, array('_locale' => $lg)));
}
}

return $ret;
}

public function transAdminField($fieldName, $entityClass)
{
return $this->translatorAdmin->transField($fieldName, $entityClass);
}

public function transAdminHelp($fieldName, $entityClass)
{
return $this->translatorAdmin->transHelp($fieldName, $entityClass);
}

public function transAdminPanel($panelName, $entityClass)
{
return $this->translatorAdmin->transPanel($panelName, $entityClass);
}

public function transAdminMenu($menuName)
{
return $this->translatorAdmin->transMenu($menuName);;
}

public function transAdminAction($actionName)
{
return $this->translatorAdmin->transAction($actionName);;
}

public function transAdminTitle($pageName, $entityClass = null, $params = [])
{
return $this->translatorAdmin->transTitle($pageName, $entityClass, $params);
}

}

+ 17
- 82
Twig/TwigExtension.php Voir le fichier

@@ -5,12 +5,14 @@ namespace Lc\SovBundle\Twig;
use App\Repository\ReminderRepository;
use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Model\Reminder\ReminderInterface;
use Lc\SovBundle\Repository\Reminder\ReminderStore;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
@@ -26,6 +28,8 @@ class TwigExtension extends AbstractExtension
protected $router;
protected $translator;
protected $translatorAdmin;
protected $reminderStore;
protected $security;

public function __construct(
KernelInterface $kernel,
@@ -35,7 +39,9 @@ class TwigExtension extends AbstractExtension
RequestStack $requestStack,
UrlGeneratorInterface $router,
TranslatorInterface $translator,
TranslatorAdmin $translatorAdmin
TranslatorAdmin $translatorAdmin,
ReminderStore $reminderStore,
Security $security
) {
$this->kernel = $kernel;
$this->parameterBag = $parameterBag;
@@ -45,75 +51,27 @@ class TwigExtension extends AbstractExtension
$this->router = $router;
$this->translator = $translator;
$this->translatorAdmin = $translatorAdmin;
$this->reminderStore = $reminderStore;
$this->security = $security;
}

public function getFunctions()
{
return array(
new TwigFunction('lc_liip', [$this, 'lcLiip']),
new TwigFunction('homepage_route', [$this, 'homepageRoute']),
new TwigFunction('page_by_dev_alias', [$this, 'getPageByDevAlias']),
new TwigFunction('translated_urls', [$this, 'getTranslatedUrls']),
new TwigFunction('sov_get_reminders', [$this, 'getReminders']),
new TwigFunction('sov_get_parameter', [$this, 'getParameter']),
);
}


public function getFilters()
{
return [
new TwigFilter('lc_cache', [$this, 'lcCache']),
new TwigFilter('lc_trans_admin_field', [$this, 'lcTransAdminField']),
new TwigFilter('lc_trans_admin_help', [$this, 'lcTransAdminHelp']),
new TwigFilter('lc_trans_admin_panel', [$this, 'lcTransAdminPanel']),
new TwigFilter('lc_trans_admin_menu', [$this, 'lcTransAdminMenu']),
new TwigFilter('lc_trans_admin_title', [$this, 'lcTransAdminTitle']),
new TwigFilter('lc_trans_admin_action', [$this, 'lcTransAdminAction']),
new TwigFunction('sov_liip', [$this, 'liip']),
new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']),
new TwigFunction('sov_parameter', [$this, 'getParameter']),
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']),
];
}

public function lcCache($file)
{
$cacheTime = filemtime($this->kernel->getProjectDir() . '/public' . $file);
if ($cacheTime) {
return $file . '?c=' . $cacheTime;
} else {
return $file . "?c=0";
}
}

public function lcTransAdminField($fieldName, $entityClass)
{
return $this->translatorAdmin->transField($fieldName, $entityClass);
}

public function lcTransAdminHelp($fieldName, $entityClass)
{
return $this->translatorAdmin->transHelp($fieldName, $entityClass);
}

public function lcTransAdminPanel($panelName, $entityClass)
{
return $this->translatorAdmin->transPanel($panelName, $entityClass);
}

public function lcTransAdminMenu($menuName)
{
return $this->translatorAdmin->transMenu($menuName);;
}

public function lcTransAdminAction($actionName)
{
return $this->translatorAdmin->transAction($actionName);;
}

public function lcTransAdminTitle($pageName, $entityClass = null, $params = [])
public function getFilters()
{
return $this->translatorAdmin->transTitle($pageName, $entityClass, $params);
return [];
}

public function lcLiip($path, $thumb = 'tile', $default = 'default.jpg')
public function liip($path, $thumb = 'tile', $default = 'default.jpg')
{
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
@@ -134,29 +92,12 @@ class TwigExtension extends AbstractExtension
return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb);
}

function getTranslatedUrls()
{
$ret = array();
$langs = $this->parameterBag->get('app.locales');
$currentRoute = $this->requestStack->getCurrentRequest()->get('_route');

$params = array_merge((array)$this->requestStack->getCurrentRequest()->get('_route_params'), $_GET);

if ($currentRoute) {
foreach ($langs as $lg) {
$ret[$lg] = $this->router->generate($currentRoute, array_merge($params, array('_locale' => $lg)));
}
}

return $ret;
}

public function getFileManagerFolder()
{
return $this->parameterBag->get('app.path_uploads');
}

public function homepageRoute()
public function getHomepageRoute()
{
return $this->parameterBag->get('lc_sov.homepage_route');
}
@@ -166,10 +107,4 @@ class TwigExtension extends AbstractExtension
return $this->parameterBag->get($name) ;
}

public function getReminders()
{
$reminders = $this->em->getRepository(ReminderInterface::class)->findAll() ;
return $reminders;
}

}

Chargement…
Annuler
Enregistrer