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

wip

parent e0b082ed
Loading
Loading
Loading
Loading
+61 −2
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ return [
                            PropositionPrivileges::PROPOSITION_VALIDER_UR,
                            PropositionPrivileges::PROPOSITION_VALIDER_BDD,
                            PropositionPrivileges::PROPOSITION_PRESIDENCE,

                            PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VISUALISER,
                            PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER,
                        ],
                        'resources' => ['These'],
                        'assertion' => PropositionAssertion::class,
@@ -131,8 +134,29 @@ return [
                    ],
                    'privileges' => PropositionPrivileges::PROPOSITION_SURSIS,
                ],


                [
                    'controller' => PropositionController::class,
                    'action' => [
                        'toggle-sursis',
                        'suppression',
                    ],
                    'privileges' => PropositionPrivileges::PROPOSITION_SURSIS,
                ],
                [
                    'controller' => PropositionController::class,
                    'action' => [
                        'declaration-non-plagiat',
                    ],
                    'privileges' => PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VISUALISER,
                ],
                [
                    'controller' => PropositionController::class,
                    'action' => [
                        'valider-declaration-non-plagiat',
                        'refuser-declaration-non-plagiat',
                    ],
                    'privileges' => PropositionPrivileges::PROPOSITION_DECLARATION_HONNEUR_VALIDER,
                ],
            ],
        ],
    ],
@@ -339,6 +363,41 @@ return [
                                    ],
                                ],
                            ],
                            'declaration-non-plagiat' => [
                                'type' => Literal::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route' => '/declaration-non-plagiat',
                                    'defaults' => [
                                        'controller' => PropositionController::class,
                                        'action' => 'declaration-non-plagiat',
                                    ],
                                ],
                                'child_routes' => [
                                    'valider' => [
                                        'type' => Literal::class,
                                        'may_terminate' => true,
                                        'options' => [
                                            'route' => '/valider',
                                            'defaults' => [
                                                'controller' => PropositionController::class,
                                                'action' => 'valider-declaration-non-plagiat',
                                            ],
                                        ],
                                    ],
                                    'refuser' => [
                                        'type' => Literal::class,
                                        'may_terminate' => true,
                                        'options' => [
                                            'route' => '/refuser',
                                            'defaults' => [
                                                'controller' => PropositionController::class,
                                                'action' => 'refuser-declaration-non-plagiat',
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
+42 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ use Soutenance\Form\LabelEuropeen\LabelEuropeenFormAwareTrait;
use Soutenance\Form\Membre\MembreFromAwareTrait;
use Soutenance\Form\Refus\RefusFormAwareTrait;
use Soutenance\Provider\Privilege\PropositionPrivileges;
use Soutenance\Provider\Validation\TypeValidation;
use Soutenance\Service\Evenement\EvenementServiceAwareTrait;
use Soutenance\Service\Justificatif\JustificatifServiceAwareTrait;
use Soutenance\Service\Membre\MembreServiceAwareTrait;
@@ -35,6 +36,7 @@ use UnicaenApp\Exception\RuntimeException;
use UnicaenAuth\Entity\Db\RoleInterface;
use Zend\Form\Form;
use Zend\Http\Request;
use Zend\Http\Response;
use Zend\View\Model\ViewModel;
use Zend\View\Renderer\PhpRenderer;

@@ -533,4 +535,44 @@ class PropositionController extends AbstractController
            'soutenances' => $soutenances,
        ]);
    }

    /** Declaration sur l'honneur *************************************************************************************/

    public function declarationNonPlagiatAction() : ViewModel
    {
        $these = $this->requestedThese();

        $individuUtilisateur = $this->userContextService->getIdentityDb()->getIndividu();
        $individuDoctorant = $these->getDoctorant()->getIndividu();

        return new ViewModel([
            'title' => '« Lutte anti-plagiat : Déclaration sur l’honneur »',
            'these' => $these,
            'isTheseDoctorant' => $individuDoctorant === $individuUtilisateur,
            'validation' => null,

            /** @see PropositionController::validerDeclarationNonPlagiatAction() */
            'urlValider' => $this->url()->fromRoute('soutenance/proposition/declaration-non-plagiat/valider', ['these' => $these->getId()], [], true),
            /** @see PropositionController::refuserDeclarationNonPlagiatAction() */
            'urlRefuser' => $this->url()->fromRoute('soutenance/proposition/declaration-non-plagiat/refuser', ['these' => $these->getId()], [], true),
        ]);
    }

    public function validerDeclarationNonPlagiatAction() : Response
    {
        $these = $this->requestedThese();
        $individuUtilisateur = $this->userContextService->getIdentityDb()->getIndividu();
        $this->getValidationService()->create(TypeValidation::CODE_VALIDATION_DECLARATION_HONNEUR, $these, $individuUtilisateur);

        return $this->redirect()->toRoute('soutenance/proposition', ['these' => $these->getId()], [], true);
    }

    public function refuserDeclarationNonPlagiatAction() : Response
    {
        $these = $this->requestedThese();
        $individuUtilisateur = $this->userContextService->getIdentityDb()->getIndividu();
        $this->getValidationService()->create(TypeValidation::CODE_REFUS_DECLARATION_HONNEUR, $these, $individuUtilisateur);

        return $this->redirect()->toRoute('soutenance/proposition', ['these' => $these->getId()], [], true);
    }
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -16,4 +16,6 @@ class PropositionPrivileges extends Privileges
    const PROPOSITION_VALIDER_BDD                     = 'soutenance-proposition-validation-bdd';
    const PROPOSITION_PRESIDENCE                      = 'soutenance-proposition-presidence';
    const PROPOSITION_SURSIS                          = 'soutenance-proposition-sursis';
    const PROPOSITION_DECLARATION_HONNEUR_VISUALISER  = 'soutenance-declaration-honneur-visualiser';
    const PROPOSITION_DECLARATION_HONNEUR_VALIDER     = 'soutenance-declaration-honneur-valider';
}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
<?php

namespace Soutenance\Provider\Validation;

class TypeValidation {

    const CODE_VALIDATION_DECLARATION_HONNEUR = 'DOCTORANT_DECLARATION_HONNEUR_NON_PLAGIAT';
    const CODE_REFUS_DECLARATION_HONNEUR = 'DOCTORANT_REFUS_HONNEUR_NON_PLAGIAT';

}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ use Exception;
use Soutenance\Entity\Etat;
use Soutenance\Entity\Membre;
use Soutenance\Entity\Proposition;
use Soutenance\Provider\Validation\TypeValidation as TypeValidationSoutenance;
use Soutenance\Service\Membre\MembreServiceAwareTrait;
use Soutenance\Service\Notifier\NotifierSoutenanceServiceAwareTrait;
use Soutenance\Service\Parametre\ParametreServiceAwareTrait;
@@ -480,6 +481,8 @@ class PropositionService {
        $validations['Impartialite'] = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_ENGAGEMENT_IMPARTIALITE, $these);
        $validations['Avis']        = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_AVIS_SOUTENANCE, $these);

        $validations[TypeValidationSoutenance::CODE_VALIDATION_DECLARATION_HONNEUR] = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidationSoutenance::CODE_VALIDATION_DECLARATION_HONNEUR, $these);
        $validations[TypeValidationSoutenance::CODE_REFUS_DECLARATION_HONNEUR] = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidationSoutenance::CODE_REFUS_DECLARATION_HONNEUR, $these);

        return $validations;
    }
Loading