Commit bc6d815d authored by Jean-Baptiste Oellers's avatar Jean-Baptiste Oellers
Browse files

Ajout menu admin

parent 5928dafc
Loading
Loading
Loading
Loading
+0 −35
Changes for module/Oscar/src/Oscar/Controller/ConventionModeleEtapeAdministrationController.php: 0 added lines, 35 removed lines.
Original line number Diff line number Diff line
@@ -130,41 +130,6 @@ class ConventionModeleEtapeAdministrationController extends AbstractOscarControl
            $conventionModeleEtape->updatedBy = $this->getCurrentPerson();
            $this->getEntityManager()->flush();


        } else if ($this->params()->fromPost('action') == "process_fichier") {

            $documentLocation = $this->getOscarConfigurationService()->getDocumentDropLocation();
            $documentPath = $documentLocation . DIRECTORY_SEPARATOR . $conventionModeleEtape->fichier;


            $conventionModeleFileContent = file_get_contents('zip://' . $documentPath . "#content.xml");

            $conventionModeleFileContentReplaced = replace_in_xml($conventionModeleFileContent, "MES_CONVENTIONS_REMPLACER[Coucou]", "OKJB");

            $slugify = new \Cocur\Slugify\Slugify();
            $tmp_location = sprintf("/tmp/oscar-conventions-%s-%s",
                $slugify->slugify((new \DateTime())->format(\DateTime::ATOM)),
                $slugify->slugify($conventionModeleEtape->fichier)
            );

            file_put_contents($tmp_location, $conventionModeleFileContentReplaced);

            $documentPath2 = $documentLocation . DIRECTORY_SEPARATOR . $conventionModeleEtape->fichier . 'v2';
            copy($documentPath, $documentPath2);

            // copy($tmp_location, $documentPath2);

            $za = new \ZipArchive();
            $za->open($documentPath2);
            $i = 0;
            for ($i=0; $i<$za->numFiles;$i++) {
                if ($za->statIndex($i)['name'] == "content.xml") {
                    $za->replaceFile($tmp_location, $i);
                    break;
                }
            }
            $za->close();

        } else if ($this->params()->fromPost('action') == "definir_etape_suivante") {
            
            if ($this->params()->fromPost('type_suite') == "etape") {
+19 −0
Changes for module/Oscar/view/oscar/administration/accueil.phtml: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -210,6 +210,25 @@
            <p>Permet de visualiser la configuration issue des fichiers</p>
        </article>

        <article class="card">
            <h3 class="card-title">
                <strong>
                    <i class="icon-cog"></i>
                    Configurer les modèles de convention
                </strong>
                <?php
                if ($this->grant()->privilege(\Oscar\Provider\Privileges::MAINTENANCE_PARAMETERS_MANAGE)): ?>
                <a href="<?= $this->url('administration/conventionModeles') ?>"
                    class="right btn-secondary btn btn-sm"><i
                            class="icon-cog"></i><?= _("Configurer") ?></a>
                <?php else: ?>
                <em><i class="icon-lock"></i> Privilège insuffisant</em>
                <?php endif; ?>
            </h3>
            <p>Permet de configurer les modèles de convention</p>
        </article>


        <h2>
            <i class="icon-tags"></i>
            Nomenclatures
+0 −6
Changes for module/Oscar/view/oscar/convention-modele-etape-administration/configurer.phtml: 0 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -134,11 +134,5 @@
      </div>
      <input type="submit" value="📤 <?= $conventionModeleEtape->fichier === NULL ? "Téléverser" : "Remplacer" ?> le fichier">
    </form>

    <form method="post" enctype="multipart/form-data" style="margin-top: 2rem;">
      <input type="hidden" name="action" value="process_fichier">
      <input type="submit" value="PROCESS le fichier">
    </form>

  </div>
</div>