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

Ajout dans le formulaire des ED de l'image (non fini)

parent 2a66137c
Loading
Loading
Loading
Loading
+35
Changes for module/Application/src/Application/Entity/Db/EcoleDoctorale.php: 35 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use UnicaenApp\Entity\HistoriqueAwareInterface;
use UnicaenApp\Entity\HistoriqueAwareTrait;
use UnicaenApp\Util;
use UnicaenImport\Entity\Db\Interfaces\SourceAwareInterface;
use UnicaenImport\Entity\Db\Traits\SourceAwareTrait;

@@ -38,6 +39,11 @@ class EcoleDoctorale implements HistoriqueAwareInterface, SourceAwareInterface
     */
    protected $sourceCode;

    /**
     * @var string
     */
    protected $cheminLogo;

    /**
     * @var Collection
     */
@@ -167,4 +173,33 @@ class EcoleDoctorale implements HistoriqueAwareInterface, SourceAwareInterface

        return $this;
    }


    public function getLogoContent()
    {
        if ($this->cheminLogo === null) {
            $image = Util::createImageWithText("Aucun logo pour l'ED|[".$this->getSourceCode()." - ".$this->getSigle()."]",200,200);
            return $image;
        }
        return file_get_contents(APPLICATION_DIR . $this->cheminLogo);

    }

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

    /**
     * @param string $cheminLogo
     */
    public function setCheminLogo($cheminLogo)
    {
        $this->cheminLogo = $cheminLogo;
    }


}
 No newline at end of file
+1
Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.EcoleDoctorale.dcm.xml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
    <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/>

    <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/>
    <field name="cheminLogo" type="string" column="CHEMIN_LOGO" length="200" nullable="true"/>

    <many-to-one field="source" target-entity="UnicaenImport\Entity\Db\Source">
      <join-columns>
+15
Changes for module/Application/src/Application/Form/EcoleDoctoraleForm.php: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,9 @@
namespace Application\Form;

use Application\Entity\Db\EcoleDoctorale;
use Zend\Form\Element;
use Zend\Form\Element\Hidden;
use Zend\Form\Element\Image;
use Zend\Form\Element\Submit;
use Zend\Form\Element\Text;
use Zend\Form\Form;
@@ -36,6 +39,18 @@ class EcoleDoctoraleForm extends Form
                new Text('sourceCode'))
                    ->setLabel("Code :")
        );
        $this
            ->add((
            new Text('cheminLogo'))
                ->setLabel("Logo :")
            );

        $this
            ->add((
            new Element\Image('logo'))
                ->setAttribute('src',APPLICATION_DIR.$this->getObject()->getCheminLogo())
                ->setValue($this->getObject()->getLogoContent())
            );

        $this
            ->add((
+6
Changes for module/Application/view/application/ecole-doctorale/index.phtml: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -103,10 +103,16 @@ $selectedEcole = null;
                    <?php else: ?>
                        <p><?php echo $this->translate("Aucun");?></p>
                    <?php endif ?>
                    <div id="logo-div" class="pull-right">
                        <img style="max-width: 200px; max-height: 200px; border: 1px solid black; background-color: white;"
                             src="data:image/png;base64,<?php echo base64_encode($ecole->getLogoContent()); ?>"
                        />
                    </div>

                    <?php if ($this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoctoralePrivileges::ECOLE_DOCT_MODIFICATION))): ?>
                        <div class="row">
                            <div class="col-md-6">

                                <?php $url = $this->url('ecole-doctorale/ajouter-individu', ['ecoleDoctorale' => $selected], [], true) ?>
                                <form method="post" action="<?php echo $url ?>">
                                    <?php
+8 −1
Changes for module/Application/view/application/ecole-doctorale/modifier.phtml: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -18,7 +18,14 @@ $fcg = $this->formControlGroup();
<?php echo $this->formHidden($form->get('id')) ?>
<?php echo $fcg($form->get('libelle')) ?>
<?php echo $fcg($form->get('sigle')) ?>
<?php echo $fcg($form->get('sourceCode')) ?>
<div id="logo-div">
    <img
            style="max-width: 200px; max-height: 200px; border: 1px solid black; background-color: white;"
            src="data:image/png;base64,<?php echo base64_encode($form->getObject()->getLogoContent()); ?>"

    />
</div>

<?php echo $this->formElement($form->get('submit')) ?>
<?php echo $this->form()->closeTag() ?>