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

Amélioration des liens des références : page dans pdf

parent fb9f4527
Loading
Loading
Loading
Loading
+1 −1
Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.MetierReference.dcm.xml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
        </many-to-one>
        <field name="code"           type="string"   length="256"      column="code"               nullable="false"  />
        <field name="lien"           type="string"   length="1024"     column="lien"               nullable="true"  />

        <field name="page"           type="integer"                    column="page"               nullable="true"  />

        <!-- HISTORISATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <field name="histoCreation"     type="datetime"                 column="histo_creation"     nullable="false"/>
+1 −1
Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.MetierReferentiel.dcm.xml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
        <field name="libelleCourt"      type="string"   length="256"      column="libelle_court"               nullable="false"  />
        <field name="libelleLong"       type="string"   length="1024"     column="libelle_long"                nullable="false"  />
        <field name="prefix"            type="string"   length="1024"     column="prefix"                      nullable="true"  />

        <field name="type"              type="string"   length="255"      column="type"                        nullable="true"  />

        <!-- HISTORISATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <field name="histoCreation"     type="datetime"                 column="histo_creation"     nullable="false"/>
+36 −2
Changes for module/Application/src/Application/Entity/Db/MetierReference.php: 36 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ class MetierReference implements HistoriqueAwareInterface {
    private $code;
    /** @var string */
    private $lien;
    /** @var integer */
    private $page;

    /**
     * @return int
@@ -112,7 +114,39 @@ class MetierReference implements HistoriqueAwareInterface {
     */
    public function getUrl()
    {
        if ($this->getLien() !== null) return $this->getLien();
        return $this->referentiel->getPrefix() . $this->getCode();
        switch($this->getReferentiel()->getType()) {
            case MetierReferentiel::WEB :
                if ($this->getLien())                       return $this->getLien();
                if ($this->getReferentiel()->getPrefix())   return $this->referentiel->getPrefix() . $this->getCode();
                return "";
            case MetierReferentiel::PDF :
                $url = "";
                if ($this->getReferentiel()->getPrefix())   $url = $this->getReferentiel()->getPrefix();
                if ($this->getLien())                       $url = $this->getLien();
                if ($this->getPage()) {
                    $url = $url . "#page=" . $this->getPage();
                }
                return $url;
        }
    }

    /**
     * @return int
     */
    public function getPage()
    {
        return $this->page;
    }

    /**
     * @param int $page
     * @return MetierReference
     */
    public function setPage($page)
    {
        $this->page = $page;
        return $this;
    }


}
 No newline at end of file
+25
Changes for module/Application/src/Application/Entity/Db/MetierReferentiel.php: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -8,6 +8,10 @@ use UnicaenUtilisateur\Entity\HistoriqueAwareTrait;
class MetierReferentiel implements HistoriqueAwareInterface {
    use HistoriqueAwareTrait;

    const WEB="web";
    const PDF="pdf";


    /** @var integer */
    private $id;
    /** @var string */
@@ -16,6 +20,8 @@ class MetierReferentiel implements HistoriqueAwareInterface {
    private $libelleLong;
    /** @var string */
    private $prefix;
    /** @var string */
    private $type;

    /**
     * @return int
@@ -89,5 +95,24 @@ class MetierReferentiel implements HistoriqueAwareInterface {
        return $this;
    }

    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @param string $type
     * @return MetierReferentiel
     */
    public function setType($type)
    {
        $this->type = $type;
        return $this;
    }



}
 No newline at end of file
+14 −1
Changes for module/Application/src/Application/Form/MetierReference/MetierReferenceForm.php: 14 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ namespace Application\Form\MetierReference;
use Application\Service\Metier\MetierServiceAwareTrait;
use Application\Service\MetierReferentiel\MetierReferentielServiceAwareTrait;
use Zend\Form\Element\Button;
use Zend\Form\Element\Number;
use Zend\Form\Element\Select;
use Zend\Form\Element\Text;
use Zend\Form\Form;
@@ -63,7 +64,7 @@ class MetierReferenceForm extends Form {
                'id' => 'code',
            ],
        ]);
        //code
        //lien
        $this->add([
            'type' => Text::class,
            'name' => 'lien',
@@ -74,6 +75,17 @@ class MetierReferenceForm extends Form {
                'id' => 'lien',
            ],
        ]);
        //page
        $this->add([
            'type' => Number::class,
            'name' => 'page',
            'options' => [
                'label' => "Page dans le document PDF :",
            ],
            'attributes' => [
                'id' => 'page',
            ],
        ]);
        // button
        $this->add([
            'type' => Button::class,
@@ -96,6 +108,7 @@ class MetierReferenceForm extends Form {
            'referentiel'           => [ 'required' => true,  ],
            'code'                  => [ 'required' => true,  ],
            'lien'                  => [ 'required' => false,  ],
            'page'                  => [ 'required' => false,  ],
        ]));
    }
}
 No newline at end of file
Loading