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

Retrait des méthodes gérant les zips

parent ee273c4a
Loading
Loading
Loading
Loading
−36
Changes for module/Application/config/others/these.config.php: 0 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -143,16 +143,6 @@ return [
                    'privileges' => ThesePrivileges::THESE_CONSULTATION_RDV_BU,
                    'assertion'  => 'Assertion\\These',
                ],
                [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
                        'zip',
                        'constituer-zip',
                    ],
                    'privileges' => ThesePrivileges::THESE_CREATION_ZIP,
                    'assertion'  => 'Assertion\\These',
                ],

//                [ NB: ECLATÉ JUSTE APRÈS
//                    'controller' => 'Application\Controller\These',
//                    'action'     => [
@@ -425,18 +415,6 @@ return [
                            ],
                        ],
                    ],
                    'zip' => [
                        'type'          => 'Segment',
                        'options'       => [
                            'route'       => '/zip/:these',
                            'constraints' => [
                                'these' => '\d+',
                            ],
                            'defaults'    => [
                                'action' => 'zip',
                            ],
                        ],
                    ],
                    'attestation' => [
                        'type'          => 'Segment',
                        'options'       => [
@@ -557,20 +535,6 @@ return [
                            ],
                        ],
                    ],

                    'constituer-zip' => [
                        'type'          => 'Segment',
                        'options'       => [
                            'route'       => '/constituer-zip/:these',
                            'constraints' => [
                                'these' => '\d+',
                            ],
                            'defaults'    => [
                                'action' => 'constituer-zip',
                            ],
                        ],
                    ],

                    'modifier-description' => [
                        'type'          => 'Segment',
                        'options'       => [
−14
Changes for module/Application/src/Application/Controller/Plugin/UrlThese.php: 0 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -193,13 +193,6 @@ class UrlThese extends UrlPlugin
        ]);
    }

    public function zipUrl(These $these)
    {
        return $this->fromRoute('these/zip', [
            'these' => $this->idify($these),
        ]);
    }

    public function attestationThese(These $these, $version)
    {
        if (!in_array($version, [VersionFichier::CODE_ORIG, VersionFichier::CODE_ORIG_CORR])) {
@@ -273,13 +266,6 @@ class UrlThese extends UrlPlugin
        );
    }

    public function constituerZipUrl(These $these)
    {
        return $this->fromRoute('these/constituer-zip',
            ['these' => $this->idify($these)]
        );
    }

    public function modifierRdvBuUrl(These $these)
    {
        return $this->fromRoute('these/modifier-rdv-bu',
−63
Changes for module/Application/src/Application/Controller/TheseController.php: 0 added lines, 63 removed lines.
Original line number Diff line number Diff line
@@ -306,7 +306,6 @@ class TheseController extends AbstractController implements
            'these'            => $these,
            'theseUrl'         => $this->urlThese()->depotFichiers($these, NatureFichier::CODE_THESE_PDF, $codeVersion),
            'annexesUrl'       => $this->urlThese()->depotFichiers($these, NatureFichier::CODE_FICHIER_NON_PDF, $codeVersion),
            'zipUrl'           => $this->urlThese()->zipUrl($these),
            'attestationUrl'   => $this->urlThese()->attestationThese($these, $codeVersion),
            'diffusionUrl'     => $this->urlThese()->diffusionThese($these, $codeVersion),
            'nextStepUrl'      => $this->urlWorkflow()->nextStepBox($these, null, [
@@ -901,19 +900,6 @@ class TheseController extends AbstractController implements
        return $view;
    }

    public function zipAction()
    {
        $these = $this->requestedThese();

        $view = new ViewModel([
            'these'            => $these,
            'constituerZipUrl' => $this->urlThese()->constituerZipUrl($these),
        ]);
        $view->setTemplate('application/these/zip');

        return $view;
    }

    public function attestationAction()
    {
        $these = $this->requestedThese();
@@ -1223,55 +1209,6 @@ class TheseController extends AbstractController implements
        exit;
    }

    /**
     * TODO a supprimer car pas utilisée
     * @deprecated
     */
    public function constituerZipAction()
    {
        $these = $this->requestedThese();

        $tmpDirPath = sys_get_temp_dir();

        /**
         * Création d'un répertoire contenant les fichiers à compresser.
         */
        $sourceDirName = uniqid('sodoct_');
        $sourceDirPath = $tmpDirPath . '/' . $sourceDirName;
        if (! mkdir($sourceDirPath)) {
            throw new \RuntimeException("Impossible de créer le répertoire temporaire " . $sourceDirPath);
        }
        /** @var Fichier $fichier */
        foreach ($these->getFichiers() as $fichier) {
            $fichier->exportToFile($sourceDirPath . '/' . $fichier->getNom(), true);
        }

        /**
         * Compression du répertoire.
         */
        $zipFileName = $sourceDirName . '.zip';
        $zipFilePath = $tmpDirPath . '/' . $zipFileName;
        Util::zip($sourceDirPath, $zipFilePath);

        /**
         * Envoi du zip au client.
         */
        header("Pragma: public");
        header("Expires: 0");
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header("Cache-Control: public");
        header("Content-Description: File Transfer");
        header("Content-type: application/zip");
//        header("Content-type: application/octet-stream");
        header("Content-Disposition: attachment; filename=$zipFileName");
        header('Content-Transfer-Encoding: binary');
        header("Content-Length: " . filesize($zipFilePath));
        ob_end_flush();
        readfile($zipFilePath);
        unlink($zipFilePath);
        exit;
    }

    public function modifierDescriptionAction()
    {
        $these = $this->requestedThese();
−1
Changes for module/Application/src/Application/Provider/Privilege/ThesePrivileges.php: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ class ThesePrivileges extends Privileges
     */
    const THESE_CONSULTATION_ARCHIVAGE              = 'these-consultation-archivage';
    const THESE_SAISIE_CONFORMITE_ARCHIVAGE         = 'these-saisie-conformite-archivage';
    const THESE_CREATION_ZIP                        = 'these-creation-zip';

    /**
     * Rendez-vous BU
−7
Changes for module/Application/view/application/these/depot-version-corrigee.phtml: 0 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ use Application\View\Renderer\PhpRenderer;
 * @var These       $these
 * @var string      $theseUrl
 * @var string      $annexesUrl
 * @var string      $zipUrl
 * @var string      $attestationUrl
 * @var string      $diffusionUrl
 * @var string      $nextStepUrl
@@ -61,11 +60,6 @@ $toggleDetails = clone $this->toggleDetails('div-depot-corrige');

    </div>

    <!-------------------------------------- Zip --------------------------------------->
    <div id="zipDiv" class="box" data-url="<?php echo $zipUrl ?>" style="display: none">
        <!-- màj via ajax -->
    </div>

    <!-------------------------------------- Attestations --------------------------------------->
    <div id="attestationDiv" data-url="<?php echo $attestationUrl ?>">
        <!-- màj via ajax -->
@@ -100,7 +94,6 @@ $toggleDetails = clone $this->toggleDetails('div-depot-corrige');
        var theseDiv = $("#theseDiv");
        var annexesDiv = $("#annexesDiv");

        var zipDiv = $("#zipDiv");
        var attestationDiv = $("#attestationDiv");
        var diffusionDiv = $("#diffusionDiv");

Loading