index.ctp 8.82 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<?php
if (!empty($modeles)) {
    ?>
    <!-- Tableau modèles pour l'extrait de registre -->
    <table class="table">
        <!-- Titre tableau -->
        <thead>
            <tr>
                <th class="thleft col-md-2">
                    <?php 
                        echo __d('modele', 'modele.titreTableauFormulaire');
                    ?>
                </th>
                
                <th class="thleft col-md-8">
                    <?php 
                        echo __d('modele', 'modele.titreTableauFichierModele'); 
                    ?>
                </th>
                
                <th class="thleft col-md-2">
                    <?php 
                        echo __d('modele', 'modele.titreTableauActions');
                    ?>
                </th>
            </tr>
        </thead>

        <!-- Info tableau -->
        <tbody>
            <?php
                foreach ($modeles as $key => $value) {
                    ?>
                    <tr>
                        <!-- Nom du formulaire -->
                        <td class="tdleft">
                            <?php
                                echo $value['Formulaire']['libelle'];
                            ?>
                        </td>
                        
                        <?php
                            if ($value['Modele']['fichier'] != null) {
                                ?>
                                <!-- Nom du fichier -->
                                <td class="tdleft">
47
                                    <i class="fa fa-file-text-o fa-lg fa-fw"><!----></i>
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
                                    <?php
                                        echo $value['Modele']['name_modele'];
                                    ?>
                                </td>
                                <?php
                            }   else {
                                ?>
                                <!-- Aucun modèle pour ce formulaire -->
                                <td class="tdleft">
                                    <?php
                                        echo __d('modele', 'modele.textTableauAucunModele');
                                    ?>
                                </td>
                                <?php
                            }
                        ?>
                            
                        <!-- Actions -->
                        <td class="tdleft">
                            <div class="btn-group">
                                <?php
                                if ($value['Modele']['fichier'] != null) {
70
                                    echo $this->Html->link('<i class="fa fa-download fa-lg"><!----></i>', [
71 72 73 74 75 76 77 78 79 80
                                        'controller' => 'modeles',
                                        'action' => 'download',
                                        $value['Modele']['fichier'],
                                        $value['Modele']['name_modele']
                                            ], [
                                        'escape' => false,
                                        'class' => 'btn btn-default-default btn-sm my-tooltip',
                                        'title' => __d('modele', 'modele.commentaireTelechargerModel')
                                    ]);

81
                                    echo $this->Html->link('<span class="fa fa-trash fa-lg"><!----></span>', [
82 83 84 85 86 87 88 89 90
                                        'controller' => 'modeles',
                                        'action' => 'delete',
                                        $value['Modele']['fichier']
                                            ], [
                                        'class' => 'btn btn-default-danger btn-sm my-tooltip',
                                        'title' => __d('modele', 'modele.commentaireSupprimerModel'),
                                        'escape' => false
                                    ], __d('modele', 'modele.confirmationSupprimerModel'));
                                } else {    
91
                                    echo $this->Form->button('<i class="fa fa-upload fa-lg"><!----></i>', [
92 93 94 95 96 97 98 99 100
                                        'escape' => false,
                                        'class' => 'btn btn-default-default btn-sm my-tooltip btn-upload-modele',
                                        'title' => __d('modele', 'modele.commentaireImporterModel'),
                                        'data-toggle' => 'modal',
                                        'data-target' => '#modalUploadModele',
                                        'data' => $value['Formulaire']['id']
                                    ]);
                                }
                                
101
                                echo $this->Html->link('<i class="fa fa-info-circle fa-lg"><!----></i>', [
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
                                    'controller' => 'modeles',
                                    'action' => 'infoVariable',
                                    $value['Formulaire']['id']
                                        ], [
                                    'class' => 'btn btn-default-default btn-sm my-tooltip',
                                    'title' => __d('modele', 'modele.commentaireVariableModel'),
                                    'escape' => false
                                ]);
                                ?>
                            </div>
                        </td>
                    </tr>
                    <?php
                }
            ?>
        </tbody>
    </table>
    <?php
} else {
    ?>
    <div class='text-center'>
        <h3>
            <?php
                echo __d('modele', 'modele.textAucunFormulaire');
            ?>
        </h3>
    </div>
    <?php
}
?>

<!--Pop-up pour importé un model dans l'application -->
<div class="modal fade" id="modalUploadModele" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    <?php 
                        echo __d('modele', 'modele.popupEnvoiModele');
                    ?>
                </h4>
            </div>
            <div class="modal-body">
                <div class="row top17">
                    <div class="col-md-12">
                        <?php
                            echo $this->Form->create('Modele', [
tguillon's avatar
tguillon committed
152
                                'url' => 'add',
153 154 155 156 157 158 159 160 161
                                'class' => 'form-horizontal',
                                'type' => 'file'
                            ]);
                            
                            echo $this->Form->input('modele', [
                                'id' => 'modele',
                                'div' => 'input-group inputsForm',
                                'type' => 'file',
                                'class' => 'filestyle',
162
                                'accept' => 'application/vnd.oasis.opendocument.text',
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
                                'label' => [
                                    'text' => __d('modele', 'modele.popupChampModele'),
                                    'class' => 'col-md-4 control-label'
                                ]
                            ]);

                            echo $this->Form->hidden('idUploadModele', [
                                'id' => 'idUploadModele'
                            ]);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <div class="btn-group">
                    <button type="button" class="btn btn-default-default" data-dismiss="modal">
179
                        <i class="fa fa-times-circle fa-lg"><!----></i>
180 181 182 183 184
                        <?php 
                            echo __d('default', 'default.btnAnnuler'); 
                        ?>
                    </button>
                    <?php
185
                        echo $this->Form->button("<i class='fa fa-floppy-o fa-lg'><!----></i>" . __d('modele', 'modele.btnEnregistrerModele'), [
186 187 188 189 190 191 192 193 194 195 196 197
                            'type' => 'submit',
                            'class' => 'btn btn-default-success',
                            'escape' => false
                        ]);
                    ?>
                </div>
                <?php
                    echo $this->Form->end();
                ?>
            </div>
        </div>
    </div>
198 199 200 201 202 203 204 205 206 207 208
</div>

<script type="text/javascript">

    $(document).ready(function () {
        
        $("span.icon-span-filestyle").removeClass('icon-span-filestyle');
        
    });

</script>