Commit e480f4c5 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Vers PHP 8.0 + retrait de certaines dependance à unicaen/app

parent 9e3255a2
Loading
Loading
Loading
Loading
Loading
+15 −16
Changes for config/unicaen-indicateur.global.php.dist: 15 added lines, 16 removed lines.
Original line number Diff line number Diff line
<?php

return [

//    'navigation'      => [
//        'default' => [
//            'home' => [
//                'pages' => [
//                    'indicateur' => [
//                        'label' => 'Mes indicateurs',
//                        'route' => 'mes-indicateurs',
//                        'resource' => PrivilegeController::getResourceId(IndexController::class, 'index'),
//                        'order'    => 10001,
//                        'icon' => 'fas fa-angle-right',
//                    ],
//                ],
//            ],
//        ],
//    ],
    'navigation'      => [
        'default' => [
            'home' => [
                'pages' => [
                    'mes-indicateurs' => [
                        'label' => 'Mes indicateurs',
                        'route' => 'mes-indicateurs',
                        'resource' => PrivilegeController::getResourceId(IndexController::class, 'index'),
                        'order'    => 10001,
                        'icon' => 'fas fa-angle-right',
                    ],
                ],
            ],
        ],
    ],
];
 No newline at end of file
+2 −2
Changes for documentation/02_privileges.sql: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
    VALUES ('indicateur', 'Gestions des indicateurs', 800, 'Indicateur\Provider\Privilege');
    VALUES ('indicateur', 'Gestions des indicateurs', 800, 'UnicaenIndicateur\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'afficher-indicateur', 'Afficher un indicateur', 1   UNION
@@ -11,7 +11,7 @@ FROM d
JOIN unicaen_privilege_categorie cp ON cp.CODE = 'indicateur';

INSERT INTO unicaen_privilege_categorie (code, libelle, ordre, namespace)
VALUES ('abonnement', 'Gestions des abonnement', 810, 'Indicateur\Provider\Privilege');
VALUES ('abonnement', 'Gestions des abonnement', 810, 'UnicaenIndicateur\Provider\Privilege');
INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE)
WITH d(code, lib, ordre) AS (
    SELECT 'afficher-abonnement', 'Afficher un abonnement', 4   UNION
+7 −9
Changes for src/UnicaenIndicateur/Controller/AbonnementController.php: 7 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -2,8 +2,7 @@

namespace UnicaenIndicateur\Controller;

use DateInterval;
use DateTime;
use Laminas\Http\Response;
use UnicaenIndicateur\Entity\Db\Abonnement;
use UnicaenIndicateur\Service\Abonnement\AbonnementServiceAwareTrait;
use UnicaenIndicateur\Service\Indicateur\IndicateurServiceAwareTrait;
@@ -13,10 +12,10 @@ use Laminas\View\Model\ViewModel;

class AbonnementController extends AbstractActionController {
    use AbonnementServiceAwareTrait;
    use UnicaenIndicateurServiceAwareTrait;
    use IndicateurServiceAwareTrait;
    use UserServiceAwareTrait;

    public function indexAction()
    public function indexAction() : ViewModel
    {
        $abonnements = [];

@@ -25,7 +24,7 @@ class AbonnementController extends AbstractActionController {
        ]);
    }

    public function souscrireAction()
    public function souscrireAction(): Response
    {
        $indicateur = $this->getIndicateurService()->getRequestedIndicateur($this);
        $user = $this->getUserService()->getConnectedUser();
@@ -39,7 +38,7 @@ class AbonnementController extends AbstractActionController {
        return $this->redirect()->toRoute('indicateurs', [], [], true);
    }

    public function resilierAction()
    public function resilierAction(): Response
    {
        $indicateur = $this->getIndicateurService()->getRequestedIndicateur($this);
        $user = $this->getUserService()->getConnectedUser();
@@ -52,15 +51,14 @@ class AbonnementController extends AbstractActionController {
        return $this->redirect()->toRoute('indicateurs', [], [], true);
    }

    public function notifierAction()
    public function notifierAction(): Response
    {
        $this->getAbonnementService()->notifyAbonnements();
        return $this->redirect()->toRoute('indicateurs', [], [], true);
    }

    public function notifierConsoleAction()
    public function notifierConsoleAction() : void
    {
        $this->getAbonnementService()->notifyAbonnements();
        exit();
    }
}
 No newline at end of file
+9 −2
Changes for src/UnicaenIndicateur/Controller/AbonnementControllerFactory.php: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace UnicaenIndicateur\Controller;

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use UnicaenIndicateur\Service\Abonnement\AbonnementService;
use UnicaenIndicateur\Service\Indicateur\IndicateurService;
use Interop\Container\ContainerInterface;
@@ -9,7 +11,13 @@ use UnicaenUtilisateur\Service\User\UserService;;

class AbonnementControllerFactory {

    public function __invoke(ContainerInterface $container)
    /**
     * @param ContainerInterface $container
     * @return AbonnementController
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __invoke(ContainerInterface $container): AbonnementController
    {
        /**
         * @var AbonnementService $abonnementService
@@ -20,7 +28,6 @@ class AbonnementControllerFactory {
        $indicateurService = $container->get(IndicateurService::class);
        $userService = $container->get(UserService::class);

        /** @var AbonnementController $controller */
        $controller = new AbonnementController();
        $controller->setAbonnementService($abonnementService);
        $controller->setIndicateurService($indicateurService);
+4 −7
Changes for src/UnicaenIndicateur/Controller/IndexController.php: 4 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -2,16 +2,16 @@

namespace UnicaenIndicateur\Controller;

use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
use UnicaenIndicateur\Entity\Db\Abonnement;
use UnicaenIndicateur\Service\Abonnement\AbonnementServiceAwareTrait;
use UnicaenIndicateur\Service\Indicateur\IndicateurServiceAwareTrait;
use UnicaenUtilisateur\Service\User\UserServiceAwareTrait;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;

class IndexController extends AbstractActionController {
    use AbonnementServiceAwareTrait;
    use UnicaenIndicateurServiceAwareTrait;
    use IndicateurServiceAwareTrait;
    use UserServiceAwareTrait;

    public function indexAction() : ViewModel
@@ -32,7 +32,7 @@ class IndexController extends AbstractActionController {
        ]);
    }

    public function abonnementAction()
    public function abonnementAction() : ViewModel
    {
        $user = $this->getUserService()->getConnectedUser();
        $indicateurs = $this->getIndicateurService()->getIndicateurs();
@@ -48,11 +48,8 @@ class IndexController extends AbstractActionController {
                $abonnement = new Abonnement();
                $abonnement->setUser($user);
                $abonnement->setIndicateur($indicateur);
//                $abonnement->setFrequence('P1W');
                $this->getAbonnementService()->create( $abonnement );
            }

            exit();
        }

        return new ViewModel([
Loading