view.ctp 12.1 KB
<?php

//use App\View\Helper\MyHelperHelper;

// Variables passees a la vue :
$configurationObj = $configurationObj;
//debug($configurationObj);

// Ces sections sont affichées ou cachées en cliquant dessus
// Ce comportement est géré par le javascript webroot/js/script.js
// qui contient une fonction pour chaque section (avec le nom "t_<nom de la section>")
// Ex pour la section "emprunts" : $('#t_emprunts').click(function()...
//function $this->MyHelper->echoSectionStart($title, $section) {
/*
function $this->MyHelper->echoSectionStart($title) {
    //echo '<h3 id="t_'.$section.'" style="cursor: pointer;">';
    //echo "<h3 id='t_$section' class='toggle' style='cursor: pointer;'>";
    echo "<h3 id='t_$title' class='toggle' style='cursor: pointer;'>";
    //echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_'.$section.'"></i>';
    echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_'.$title.'"></i>';
    echo '<span style="text-decoration: underline;">'.$title.'</span>';
    echo '</h3>';
    //echo '<div id="'.$section.'" style="margin-bottom: 20px;">';
    echo '<div id="'.$title.'" style="margin-bottom: 20px;">';
    echo '<table>';
    echo '<tr><th style="width: 250px;"></th><th></th></tr>';
}
function $this->MyHelper->echoSectionStop() {
    echo '</table>';
    echo '</div>';
}
*/
?>

<div class="configurations view">
	<h2>Configuration générale de l'application</h2>

    <?php
    echo $this->Html->link(__('<i class="icon-pencil"></i> Editer la configuration'), [
        'action' => 'edit',
        //$configurationObj->id // inutile car vaut toujours 1
    ], [
        'escape' => false,
        'onclick' => 'return true;'
    ]);
    echo '<br><br>';

    
    //$this->MyHelper->echoSectionStart("Modes", "informations");
    $this->MyHelper->echoSectionStart("Modes");
    /*
    echo '<h3 id="t_informations" style="cursor: pointer;">';
    echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_informations"></i>';
    echo '<span style="text-decoration: underline;">Modes</span>';
    echo '</h3>';
    echo '<div id="informations" style="margin-bottom: 20px;">';
    echo '<table>';
    echo '<tr><th style="width: 250px;"></th><th></th></tr>';
    */
    //$this->MyHelper->displayElement(__('Mode install'), $install);
    //$this->MyHelper->displayElement(__('Mode install'), $configurationObj->mode_install==1?"Oui":"Non");
    //MyHelperHelper::displayElement(__('Mode install'), $configurationObj->mode_install==1?"Oui":"Non");
    $this->MyHelper->displayElement(__('Mode install'), $configurationObj->mode_install==1?"Oui":"Non");
    
    //$this->MyHelper->displayElement(__('Mode debug'), $debug);
    $this->MyHelper->displayElement(__('Mode debug'), $configurationObj->mode_debug==1?"Oui":"Non");
    $this->MyHelper->echoSectionStop();

    
    //$this->MyHelper->echoSectionStart("Laboratoire", "informations_admin");
    $this->MyHelper->echoSectionStart("Laboratoire");
    /*
    echo '<h3 id="t_informations_admin" style="cursor: pointer;">';
    echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_informations_admin"></i>';
    echo '<span style="text-decoration: underline;">Laboratoire</span>';
    echo '</h3>';
    echo '<div id="informations_admin" style="margin-bottom: 20px;">';
    echo '<table>';
    echo '<tr><th style="width: 250px;"></th><th></th></tr>';
    */
    $this->MyHelper->displayElement(__('Nom complet du Labo'), h($configurationObj->labName));
    $this->MyHelper->displayElement(__('Nom court du Labo'), h($configurationObj->labNameShort));
    $this->MyHelper->displayElement(__('Liaison présentation nom du Labo'), h($configurationObj->labPresent));
    $this->MyHelper->displayElement(__('UMR du Labo'), h($configurationObj->labUmr));
    $this->MyHelper->echoSectionStop();
    
    
    //$this->MyHelper->echoSectionStart("Divers", "suivis");
    $this->MyHelper->echoSectionStart("Divers");
    /*
    echo '<h3 id="t_suivis" style="cursor: pointer;">';
    echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_suivis"></i>';
    echo '<span style="text-decoration: underline;">Divers</span>';
    echo '</h3>';
    echo '<div id="suivis" style="margin-bottom: 20px;">';
    echo '<table>';
    echo '<tr><th style="width: 250px;"></th><th></th></tr>';
    */
    $this->MyHelper->displayElement(__('Librairie pdf utilisée'), $configurationObj->pdf_engine);
    $this->MyHelper->displayElement(__('Afficher la procédure à suivre sur l\'écran d\'accueil'), $configurationObj->procedure_sur_accueil?'Oui':'Non');
    $this->MyHelper->displayElement(__('Imprimante disponible'), h($configurationObj->hasPrinter)?"Oui":"Non");
    $this->MyHelper->displayElement(__('Numéro format étiquette'), h($configurationObj->label_format_num));
    $this->MyHelper->displayElement(__('Seuil (prix) Matériel administratif'), h($configurationObj->prix_inventaire_administratif));
    $this->MyHelper->displayElement(__('Taille max documents (octets)'), substr($configurationObj->taille_max_doc / (1024 * 1024), 0, 4) . ' Mo');
    $this->MyHelper->displayElement(__('Numero labo sans année'), $configurationObj->numero_labo_sans_annee?'Oui':'Non');
    $this->MyHelper->displayElement(__('Champ date commande facultatif'), $configurationObj->date_commande_facultative?'Oui':'Non');
    $this->MyHelper->displayElement(__('Label groupe thématique'), h($configurationObj->nom_groupe_thematique));
    $this->MyHelper->displayElement(__('Label groupe métier'), h($configurationObj->nom_groupe_metier));
    $this->MyHelper->displayElement(__('Module métrologie'), $configurationObj->metrologie?'Oui':'Non');
    $this->MyHelper->echoSectionStop();
    
    //$this->MyHelper->echoSectionStart("Emails", "emprunts");
    $this->MyHelper->echoSectionStart("Emails");
    /*
    echo '<h3 id="t_emprunts" style="cursor: pointer;">';
    echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_emprunts"></i>';
    echo '<span style="text-decoration: underline;">Emails</span>';
    echo '</h3>';
    echo '<div id="emprunts" style="margin-bottom: 20px;">';
    echo '<table>';
    echo '<tr><th style="width: 250px;"></th><th></th></tr>';
    */
    $this->MyHelper->displayElement(__("Attribut 'sender' (expéditeur)"), h($configurationObj->sender_mail));
    $this->MyHelper->displayElement(__("Activer l'envoi 'général' des mails"), h($configurationObj->envoi_mail)?'Oui':'Non');
    $this->MyHelper->displayElement(__("Activer l'envoi 'spécifique' des mails pour la liste ci-dessous"), h($configurationObj->envoi_mail_guests)?'Oui':'Non');
    // (EP202009) non mais, faudrait arrêter d'être fainénant aussi...
    for ($i=1 ; $i<=10; $i++) {
        $dest = "emailGuest$i";
        $this->MyHelper->displayElement( __("Destinataire $i"), h($configurationObj->$dest) );
    }
    /*
    $this->MyHelper->displayElement(__('Mail guest 1'), h($configurationObj->emailGuest1));
    $this->MyHelper->displayElement(__('Mail guest 2'), h($configurationObj->emailGuest2));
    $this->MyHelper->displayElement(__('Mail guest 3'), h($configurationObj->emailGuest3));
    $this->MyHelper->displayElement(__('Mail guest 4'), h($configurationObj->emailGuest4));
    $this->MyHelper->displayElement(__('Mail guest 5'), h($configurationObj->emailGuest5));
    $this->MyHelper->displayElement(__('Mail guest 6'), h($configurationObj->emailGuest6));
    $this->MyHelper->displayElement(__('Mail guest 7'), h($configurationObj->emailGuest7));
    $this->MyHelper->displayElement(__('Mail guest 8'), h($configurationObj->emailGuest8));
    $this->MyHelper->displayElement(__('Mail guest 9'), h($configurationObj->emailGuest9));
    $this->MyHelper->displayElement(__('Mail guest 10'), h($configurationObj->emailGuest10));
    */
    $this->MyHelper->echoSectionStop();
    
    
    /*
     ********* 
     * LDAP 
     ********
    */ 
    
    //if ($configuration->use_ldap) :
    //$this->MyHelper->echoSectionStart("LDAP", "fichiers");
    $this->MyHelper->echoSectionStart("LDAP");
    /*
    echo '<h3 id="t_fichiers" style="cursor: pointer;">';
    echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_fichiers"></i>';
    echo '<span style="text-decoration: underline;">LDAP</span>';
    echo '</h3>';
    echo '<div id="fichiers" style="margin-bottom: 20px;">';
    echo '<table>';
    echo '<tr><th style="width: 250px;"></th><th></th></tr>';
    */
    $this->MyHelper->displayElement(__('Utilisation du LDAP'), h($configurationObj->ldap_used?"Oui":"Non"));
    $this->MyHelper->displayElement(__('Host'), h($configurationObj->ldap_host));
    $this->MyHelper->displayElement(__('Port'), h($configurationObj->ldap_port));
    $this->MyHelper->displayElement(__('Type d\'authentification du LDAP'), h($configurationObj->ldap_authenticationType));
    $this->MyHelper->displayElement(__('Base DN du LDAP'), h($configurationObj->ldap_baseDn));
    $this->MyHelper->displayElement(__('Filtre du LDAP'), h($configurationObj->ldap_filter));

    $this->MyHelper->displayElement(__('LDAP authentifié (non anonyme)'), h($configurationObj->ldap_authentified)?"Oui":"Non" );
    $this->MyHelper->displayElement(__('Bind du LDAP'), h($configurationObj->ldap_bindDn));
    // Inutile d'afficher le pass
    //$this->MyHelper->displayElement(__('Password Bind du LDAP'), h($configurationObj->ldap_bindPass));
    $this->MyHelper->echoSectionStop();

    
    /*
     *********
     * OPTIMISATION LISTE UTILISATEURS
     ********
     */ 
    
    $this->MyHelper->echoSectionStart("Optmisation");
    /* LDAP optimisation */
    if (is_null($configurationObj->ldap_cache_last_update)) $ldap_cache_elapsed_time = '';
    else {
        $date_now = date("Y-m-d H:i:s");
        $date_now = new \DateTime($date_now);
        $date_cached = $configurationObj->ldap_cache_last_update;
        /* bugfixing $date_cached pour Inventirap (IRAP) (php5 ou vieux mysql ou pb de config ???) :
         * Inventirap affiche l'année sur 2 chiffres : 'cached :05/06/19 15:36'
         * Ma version perso affiche l'année sur 4 chiffres : 'cached :05/06/2019 15:36'
         * => Il faut donc remettre l'année sur 4 chiffres si besoin
         */
        if ( strpos($date_cached,'/')!==FALSE ) {
            $year = substr(strrchr($date_cached, '/'), 0,4); // '/19 ' ou '/201'
            if (substr($year,-1) == ' ')
                //$year = '20'.substr($y,1,2); // '2019'
                $date_cached = substr($date_cached,0,6)."20".substr($year,1,2).substr($date_cached,8); // '05/06/19 15:36';
        }
        $date_cached = \DateTime::createFromFormat('d/m/Y H:i',$date_cached);
        //$ldap_cache_elapsed_time = $date_now->diff($date_cached)->format('%i mn %s sec');
        //$ldap_cache_elapsed_time = $date_now->diff($date_cached)->format('%hh %imn %ssec');
        $ldap_cache_elapsed_time = $date_now->diff($date_cached)->format('%d jour(s) %hh %imn %ss');
    }
    $this->MyHelper->displayElement(__('Optimisation liste utilisateurs (utilisation Cache en BD)'), h($configurationObj->ldap_cached)?"Oui":"Non" );
    $this->MyHelper->displayElement(__('Durée validité cache (mn)'), h($configurationObj->ldap_cache_validity_duration));
    $this->MyHelper->displayElement(__('Date dernière mise à jour cache'), h($configurationObj->ldap_cache_last_update));
    $this->MyHelper->displayElement(__('Temps écoulé depuis dernière mise à jour'), $ldap_cache_elapsed_time);
    $this->MyHelper->echoSectionStop();
    
    
    //$this->MyHelper->echoSectionStart("Affichage", "affichage");
    $this->MyHelper->echoSectionStart("Affichage");
    /*
    echo '<h3 id="t_emprunts" style="cursor: pointer;">';
    echo '<i class="icon-chevron-down" style="font-size: 14px;" id="i_emprunts"></i>';
    echo '<span style="text-decoration: underline;">Affichage</span>';
    echo '</h3>';
    echo '<div id="emprunts" style="margin-bottom: 20px;">';
    echo '<table>';
    echo '<tr><th style="width: 250px;"></th><th></th></tr>';
    */
    $this->MyHelper->displayElement(__('Nombre de matériels affichés par défaut (pagination)'), h($configurationObj->aff_par_defaut));
    $this->MyHelper->echoSectionStop();
    
    ?>


</div>

<script type="text/javascript"> toggle_all_sections(); </script>


<!--
<div class="actions">
		<php

echo $this->element('menu')?>
		</div>
-->