add.ctp 1.93 KB

<div class="documents form">
    <?= $this->Form->create($document, ['type' => 'file']) ?>
    <fieldset>
    <?php
    if (isset($photo)) {
        echo '<h2><i class="icon-plus"></i> Lier une photo</h2>';
    } else {
        echo '<h2><i class="icon-plus"></i> Lier un document</h2>';
    }
    if (isset($materiel)) {
        echo $this->Form->control('materiel_id', [
            'label' => 'N° materiel labo',
            'options' => $materiel,
            'default' => $this->request->getAttribute('params')['pass'][0],
            'readonly' => true
        ]);
    } else if (isset($suivi)) {
        echo $this->Form->control('suivi_id', [
            'label' => 'N° suivi',
            'options' => $suivi,
            'default' => $this->request->getAttribute('params')['pass'][0],
            'readonly' => true
        ]);
    }
    
    echo $this->Form->control('nom');
    
    if (isset($photo)) {
        echo $this->Form->hidden('type_document_id', [
            'label' => 'Type',
            'options' => $typesD,
            'default' => $idType
        ]);
    } else {
        echo $this->Form->control('type_document_id', [
            'label' => 'Type',
            'options' => $typesD,
            'default' => 1
        ]);
    }
    
    echo $this->Form->control('description');
    echo $this->Form->control('chemin_file', [
        'label' => 'Fichier (' . substr($configuration->taille_max_doc / (1024 * 1024), 0, 4) . ' Mo max)',
        'type' => 'file'
    ]);
    
    if (isset($photo)) {
        echo $this->Form->hidden('photo', [
            'default' => 1
        ]);
    } else {
        echo $this->Form->hidden('photo', [
            'default' => 0
        ]);
    }
    
    ?>
    </fieldset>
    <?= $this->Form->submit(__('Valider')) ?>
    <?= $this->Form->end() ?>
</div>

<!--
<div class="actions">
	<php
echo $this->element('menu');
echo $this->element('menu_form', [
    'pluralHumanName' => 'Documents'
]);
?>
</div>
-->