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

Reprise du résumé

parent 6e960746
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ return [
                [
                    'controller' => StructureController::class,
                    'action' => [
                        'editer-description'
                        'editer-description',
                        'toggle-resume-mere',
                    ],
                    'privileges' => StructurePrivileges::STRUCTURE_DESCRIPTION,
                    'assertion'  => StructureAssertion::class,
@@ -183,6 +184,18 @@ return [
                        'may_terminate' => true,
                        'child_routes' => [],
                    ],
                    'toggle-resume-mere' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/toggle-resume-mere/:structure',
                            'defaults' => [
                                'controller' => StructureController::class,
                                'action'     => 'toggle-resume-mere',
                            ],
                        ],
                        'may_terminate' => true,
                        'child_routes' => [],
                    ],
                    /** Fonctions de recherche de structures **********************************************************/
                    'rechercher' => [
                        'type'  => Literal::class,
+9 −0
Original line number Diff line number Diff line
@@ -189,6 +189,15 @@ class StructureController extends AbstractActionController {
        return $this->redirect()->toRoute('structure/afficher', ['structure' => $structure->getId()], [], true);
    }

    public function toggleResumeMereAction()
    {
        $structure = $this->getStructureService()->getRequestedStructure($this, 'structure');
        $structure->setRepriseResumeMere(! $structure->getRepriseResumeMere());
        $this->getStructureService()->update($structure);

        return $this->redirect()->toRoute('structure/afficher', ['structure' => $structure->getId()], [], true);
    }

    /** Fonctions de recherche ****************************************************************************************/
    public function rechercherAction()
    {
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
        <field name="description"               column="description"        type="string" length="10240"/>
        <field name="ouverture"                 column="ouverture"          type="datetime"  />
        <field name="fermeture"                 column="fermeture"          type="datetime"  />
        <field name="repriseResumeMere"         column="resume_mere"        type="boolean"  />

        <many-to-one target-entity="Application\Entity\Db\StructureType" field="type">
            <join-column name="type" referenced-column-name="source_id" />
+23 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ class Structure implements ResourceInterface, SynchroAwareInterface {
    private $ouverture;
    /** @var DateTime */
    private $fermeture;
    /** @var Boolean */
    private $repriseResumeMere;
    /** @var Structure */
    private $parent;
    /** @var ArrayCollection (Structure) */
@@ -116,7 +118,11 @@ class Structure implements ResourceInterface, SynchroAwareInterface {
     */
    public function getDescription()
    {
        return $this->description;
        $text = "";
        if ($this->getRepriseResumeMere() AND $this->parent !== null) {
            $text .= $this->parent->getDescription() . "<br/>";
        }
        return $text . $this->description ;
    }

    /**
@@ -267,7 +273,23 @@ class Structure implements ResourceInterface, SynchroAwareInterface {
        return $this;
    }

    /**
     * @return bool
     */
    public function getRepriseResumeMere()
    {
        return $this->repriseResumeMere;
    }

    /**
     * @param bool $repriseResumeMere
     * @return Structure
     */
    public function setRepriseResumeMere($repriseResumeMere)
    {
        $this->repriseResumeMere = $repriseResumeMere;
        return $this;
    }

    /**
     * @return string
+20 −0
Original line number Diff line number Diff line
@@ -27,8 +27,28 @@ $canEditerGestionnaire = $this->isAllowed($structure, StructurePrivileges::STRU
                    <span class="icon editer" data-toggle="tooltip" data-html="true"
                          title="Modifier la description de la structure <span class='highlight structure'><?php echo $structure->getLibelleLong(); ?></span>">
                    </span></a>
                <a
                    <?php /** @see \Application\Controller\StructureController::editerDescriptionAction() */ ?>
                        href="<?php echo $this->url('structure/toggle-resume-mere', ['structure' => $structure->getId()], [], true); ?>"
                >
                    <?php if ($structure->getRepriseResumeMere()) : ?>
                        <span class="icon ko" data-toggle="tooltip" data-html="true"
                              title="Ne plus réutiliser le résumé de la structure mère">
                        </span></a>
                    <?php else : ?>
                        <span class="icon ok" data-toggle="tooltip" data-html="true"
                          title="Réutiliser le résumé de la structure mère">
                        </span></a>
                    <?php endif; ?>

            <?php endif; ?>
        </h2>
        <?php if ($structure->getRepriseResumeMere()) : ?>
            <div class="alert alert-info">
                <span class="icon information"></span>
                Reprise du résumé de la structure mère.
            </div>
        <?php endif; ?>
        <?php if ($structure->getDescription()) : ?>
            <?php echo $structure->getDescription(); ?>
        <?php else : ?>
Loading