瀏覽代碼

Maj : Debug Logs

stany.ferer 1 年之前
父節點
當前提交
86c7ad58ec

+ 26 - 20
core/class/core.class.php

@@ -163,32 +163,38 @@ class core
 
     public static function elementMenu(string $_id, string $_href, string $_titre, string $_feather, string $_style = NULL)
     {
-        ($_style != NULL) ? $_style = ' style="' . $_style . '"' : NULL;
-        echo '<li class="nav-item">
-                <a class="nav-link' . get::currentPage($_id) . '" aria-current="page"  href="' . $_href . '"' . $_style . '>
-                    <span data-feather="' . $_feather . '"' . $_style . '></span>
-                    ' . $_titre . '
-                </a>
-            </li>';
+        if(access::ifAccesss($_id)){
+            ($_style != NULL) ? $_style = ' style="' . $_style . '"' : NULL;
+            echo '<li class="nav-item">
+                    <a class="nav-link' . get::currentPage($_id) . '" aria-current="page"  href="' . $_href . '"' . $_style . '>
+                        <span data-feather="' . $_feather . '"' . $_style . '></span>
+                        ' . $_titre . '
+                    </a>
+                </li>';
+        }
     }
 
-    public static function elementMenuLink(string $_href, string $_titre, string $_feather, string $_style = NULL, string $_target = "_blank")
+    public static function elementMenuLink(string $_id, string $_href, string $_titre, string $_feather, string $_style = NULL, string $_target = "_blank")
     {
-        ($_style != NULL) ? $_style = ' style="' . $_style . '"' : NULL;
-        echo '<li class="nav-item">
-                <a class="nav-link" target="'. $_target .'" href="' . $_href . '"' . $_style . '>
-                    <span data-feather="' . $_feather . '"' . $_style . '></span>
-                    ' . $_titre . '
-                </a>
-            </li>';
+        if(access::ifAccesss($_id)){
+            ($_style != NULL) ? $_style = ' style="' . $_style . '"' : NULL;
+            echo '<li class="nav-item">
+                    <a class="nav-link" target="'. $_target .'" href="' . $_href . '"' . $_style . '>
+                        <span data-feather="' . $_feather . '"' . $_style . '></span>
+                        ' . $_titre . '
+                    </a>
+                </li>';
+        }
     }
 
-    public static function elementMenuH6(string $_titre, string $_style = NULL, string $_collapse = NULL)
+    public static function elementMenuH6(string $_id, string $_titre, string $_style = NULL, string $_collapse = NULL)
     {
-        ($_style != NULL) ? $_style = $_style : NULL;
-        echo '<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
-                    <a style="text-decoration: none; ' . $_style . '" href="#'.$_collapse.'" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle text-dark">' . $_titre . '</a>
-                </h6>';
+        if(access::ifAccesss($_id)){
+            ($_style != NULL) ? $_style = $_style : NULL;
+            echo '<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
+                        <a style="text-decoration: none; ' . $_style . '" href="#'.$_collapse.'" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle text-dark">' . $_titre . '</a>
+                    </h6>';
+        }
     }
 
     public static function filAriane(array $_arbo)

+ 201 - 0
core/class/debug.class.php

@@ -0,0 +1,201 @@
+<?php
+
+class debug
+{
+
+    private static $logs = [];
+    private static $startTime;
+    private static $closeTime;
+
+    public static function includeDebug()
+    {
+        if (core::isDebug()) {
+            echo '<link rel="stylesheet" href="css/debug.css">';
+        }
+    }
+
+    public static function dump($var, $label = 'Dump', $echo = true)
+    {
+        // Start output buffering
+        ob_start();
+
+        echo "<pre class='debug-dump'>";
+        echo "<strong>$label:</strong> ";
+
+        // Convert array or object to string
+        if (is_array($var)) {
+            print_r($var);
+        } elseif (is_object($var)) {
+            echo self::objectToString($var);
+        } else {
+            var_dump($var);
+        }
+
+        echo "</pre>";
+
+        // Get the contents of the buffer
+        $output = ob_get_clean();
+
+        // If echo is true, print the output
+        if ($echo) {
+            echo $output;
+        } else {
+            return $output;
+        }
+    }
+
+    public static function objectToString($object, $_tab = NULL) {
+        ob_start();
+
+        $tab = "&nbsp;&nbsp;&nbsp;&nbsp;" . $_tab;
+        
+        echo "<span class='debug-console-capsule'>Object (" . get_class($object) . ")\n</span>";
+        echo $_tab . "<span class='debug-console-capsule'>{\n</span>";
+        
+        foreach (get_object_vars($object) as $property => $value) {
+            echo $tab . "<span class='debug-console-capsule'>[<span class='debug-console-key'>$property</span>] => </span>";
+            if (is_array($value)) {
+                echo self::arrayToString($value, $tab);
+            } elseif (is_object($value)) {
+                echo self::objectToString($value, $tab);
+            } else {
+                echo "<span class='debug-console-value'>" . var_export($value, true) . "</span>\n";
+            }
+        }
+        
+        echo $_tab . "<span class='debug-console-capsule'>}\n</span>";
+        
+        return ob_get_clean();
+    }
+
+
+
+    public static function arrayToString($array, $_tab = NULL)
+    {
+        ob_start();
+
+        $tab = "&nbsp;&nbsp;&nbsp;&nbsp;".$_tab;
+        
+        echo "<span class='debug-console-capsule'>Array\n</span>";
+        echo $_tab . "<span class='debug-console-capsule'>(\n</span>";
+        
+        foreach ($array as $key => $value) {
+            echo $tab . "<span class='debug-console-capsule'>[<span class='debug-console-key'>$key</span>] => </span>";
+            if (is_array($value)) {
+                echo self::arrayToString($value, $tab);
+            } elseif (is_object($value)) {
+                echo self::objectToString($value, $tab);
+            } else {
+                echo "<span class='debug-console-value'>" . var_export($value, true) . "</span>\n";
+            }
+        }
+        
+        echo $_tab . "<span class='debug-console-capsule'>)\n</span>";
+        
+        return ob_get_clean();
+    }
+
+    private static function variableToString($var, $label)
+    {
+        ob_start();
+        echo "$label: ";
+        if (is_array($var) || is_object($var)) {
+            print_r($var);
+        } else {
+            var_dump($var);
+        }
+        return ob_get_clean();
+    }
+
+    public static function getTraces(){
+        $return = "Trace : ";
+        
+        // Obtenir la trace d'exécution
+        $backtrace = debug_backtrace();
+        $nb = count($backtrace)-1;
+
+        for ($i=$nb; $i > 0; $i--) { 
+            $return .= ($i != 0) ? "[".$backtrace[$i]["function"]."] " : NULL;
+            $return .= str_replace(DOCUMENT_ROOT, '', $backtrace[$i]["file"]).":".$backtrace[$i]["line"];
+            $return .= ($i != 1) ? " >> " : NULL;
+        }
+
+        return $return;
+    }
+
+    public static function log($_message, $_mark = NULL)
+    {        
+        $mark = "<div class='debug-head-console'>";
+        $mark .= ($_mark != NULL) ? "<div style='font-weight: bold;'>". $_mark . "</div>" : NULL;
+        $mark .= self::getTraces();
+        $mark .= "</div>";
+        if($_message != NULL) {
+            if(is_array($_message)){
+                self::$logs[] = $mark ."<div class='debug-console'>" . self::arrayToString($_message) . "</div>";
+            } elseif(is_object($_message)){
+                self::$logs[] = $mark ."<div class='debug-console'>" . self::objectToString($_message) . "</div>";
+            } elseif($mark != NULL){
+                self::$logs[] = $mark ."<div class='debug-console' style='color:blue;'>" . $_message . "</div>";
+            } else {
+                self::$logs[] = $_message;
+            }
+        }
+    }
+
+    public static function renderLogs()
+    {
+        //if (!empty(self::$logs)) {
+            echo "<div id='debugger-logs'>";
+
+            echo "<div class='debug-renderLogs-header'>";
+            echo "PHP ". phpversion() . " | " . number_format(self::$closeTime, 4) . " secondes";
+            echo "</div>";
+
+            foreach (self::$logs as $log) {
+                echo ($log != NULL) ? "<div class='debug-renderLogs-print'>".nl2br($log)."</div>" : NULL;
+            }
+
+            echo "</div>";
+
+            echo "
+            <script>
+                $(document).ready(function() {
+                    $('#toggle-logs').click(function() {
+                        $('#debugger-logs').slideToggle();
+                    });
+
+                    // Apply syntax highlighting to log entries
+                    $('.log-entry').each(function() {
+                        var html = $(this).html();
+                        html = html.replace(/(\\$\\w+)/g, '<span class=\"variable\">$1</span>');
+                        html = html.replace(/(\\bfunction\\b)/g, '<span class=\"function\">$1</span>');
+                        $(this).html(html);
+                    });
+                });
+            </script>
+        ";
+        //}
+    }
+
+    public static function init()
+    {
+        // Register shutdown function to render logs at the end of the script execution
+        register_shutdown_function(function () {
+            self::renderLogs();
+        });
+    }
+
+    public static function startTimer()
+    {
+        self::$startTime = microtime(true);
+    }
+
+    public static function endTimer()
+    {
+        self::$closeTime = microtime(true) - self::$startTime;
+    }
+
+    public static function getBadge(string $_link,string $_label){
+        return '<a href="'. $_link .'" target="_blank" class="badge debug-badge">'. $_label .'</a>';
+    }
+}

+ 1 - 0
core/controllers/header.php

@@ -10,6 +10,7 @@
     if(core::isDebug()){
         error_reporting(E_ALL);
         ini_set("display_errors", 1);
+        debug::startTimer();
     }
 
     if(core::isMaintenance() AND $_SERVER['HTTP_HOST'] != DOMAIN_CMS){

+ 7 - 0
core/views/_cms.foot.php

@@ -29,3 +29,10 @@
 
 </body>
 </html>
+
+<?php
+    if(core::isDebug()){
+        debug::init();
+        debug::endTimer();
+    }
+?>

+ 2 - 0
core/views/_cms.head.php

@@ -24,6 +24,8 @@
         <script src="libs/js/Chart.min.js" type="text/javascript"></script>
         <script src="libs/js/powerbuttons.min.js"></script>
 
+        <?php debug::includeDebug(); ?>
+
         <style>
 
             .bd-placeholder-img {

+ 65 - 98
core/views/_cms.menu.php

@@ -1,112 +1,79 @@
 <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
     <div class="position-sticky pt-2">
-        <ul class="nav flex-column" id="accordion">         
+        <ul class="nav flex-column" id="accordion">
 
-            <?php  
-                $temp_accordion = array("rh-liste-salaries", "rh-historique-excel", "rh-upload-excel", "rh-import-to-temp", "stats");
-                (in_array(core::getGet("p"), $temp_accordion) OR (core::ifGet("p") == FALSE AND session::getType() != 3)) ? $_show = "show" : $_show = NULL;
-                (access::ifAccesss("rh")) ? 
-                    core::elementMenuH6("Salariés", NULL, "col-salaries") : NULL;
-                echo '<ul class="collapse '. $_show .' list-unstyled" id="col-salaries" data-parent="#accordion">';
-                (access::ifAccesss("rh-liste-salaries")) ?
-                    core::elementMenu("rh-liste-salaries", "/", "RH : Liste des salariés", "users") : NULL;
-                (access::ifAccesss("rh-historique-excel")) ?
-                    core::elementMenu("rh-historique-excel", "/rh-historique-excel.html", "RH : Historique des Excels", "archive") : NULL;
-                (access::ifAccesss("rh-historique-excel") AND isset(salaries::excelGetInProgress()["name"])) ? 
-                    core::elementMenu("rh-historique-excel", "/rh-import-to-temp.html", "RH : Reprise du traitement", "file-text") : NULL;
-                (access::ifAccesss("stats")) ? 
-                    core::elementMenu("stats", "/stats.html", "RH : Stats salariés", "pie-chart") : NULL;
+            <?php
+            $temp_accordion = array("rh-liste-salaries", "rh-historique-excel", "rh-upload-excel", "rh-import-to-temp", "stats");
+            (in_array(core::getGet("p"), $temp_accordion) or (core::ifGet("p") == FALSE and session::getType() != 3)) ? $_show = "show" : $_show = NULL;
+                core::elementMenuH6("rh", "Salariés", NULL, "col-salaries");
+                echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-salaries" data-parent="#accordion">';
+                    core::elementMenu("rh-liste-salaries", "/", "RH : Liste des salariés", "users");
+                    core::elementMenu("rh-historique-excel", "/rh-historique-excel.html", "RH : Historique des Excels", "archive");
+                (isset(salaries::excelGetInProgress()["name"])) ? core::elementMenu("rh-historique-excel", "/rh-import-to-temp.html", "RH : Reprise du traitement", "file-text") : NULL;
+                    core::elementMenu("stats", "/stats.html", "RH : Stats salariés", "pie-chart");
                 echo '</ul>';
 
-                $temp_accordion = array("proweb-salaries", "proweb-historique-excel", "proweb-export-csv", "proweb-salaries-upload");
-                (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
-                (access::ifAccesss("proweb")) ? 
-                    core::elementMenuH6("ProWeb", NULL, "col-proweb") : NULL;
-                echo '<ul class="collapse '. $_show .' list-unstyled" id="col-proweb" data-parent="#accordion">';
-                (access::ifAccesss("proweb-salaries")) ?  
-                    core::elementMenu("proweb-salaries", "/proweb-salaries.html", "Proweb : Liste des salariés", "users") : NULL;
-                (access::ifAccesss("proweb-historique-excel")) ? 
-                    core::elementMenu("proweb-historique-excel", "/proweb-historique-excel.html", "Proweb : Historique des Excels", "archive") : NULL;
-                (access::ifAccesss("proweb-export-csv")) ? 
-                core::elementMenu("proweb-export-csv", "/proweb-export-csv.html", "Proweb : Transfert des données", "send") : NULL;
-                echo '</ul>';
+            $temp_accordion = array("proweb-salaries", "proweb-historique-excel", "proweb-export-csv", "proweb-salaries-upload");
+            (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
+            core::elementMenuH6("proweb", "ProWeb", NULL, "col-proweb");
+            echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-proweb" data-parent="#accordion">';
+                core::elementMenu("proweb-salaries", "/proweb-salaries.html", "Proweb : Liste des salariés", "users");
+                core::elementMenu("proweb-historique-excel", "/proweb-historique-excel.html", "Proweb : Historique des Excels", "archive");
+                core::elementMenu("proweb-export-csv", "/proweb-export-csv.html", "Proweb : Transfert des données", "send");
+            echo '</ul>';
 
-                $temp_accordion = array("compte", "compte-historique-csv", "compte-upload");
-                (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
-                (access::ifAccesss("compte")) ?  
-                    core::elementMenuH6("Comptes bancaires", NULL, "col-banque") : NULL;
-                echo '<ul class="collapse '. $_show .' list-unstyled" id="col-banque" data-parent="#accordion">';
-                (access::ifAccesss("compte-1")) ?  
-                    core::elementMenu("compte-1", "/compte-1.html", "Banque : Compte Courant ASC", "bar-chart-2") : NULL;
-                (access::ifAccesss("compte-2")) ? 
-                    core::elementMenu("compte-2", "/compte-2.html", "Banque : Compte Courant AEP", "bar-chart-2") : NULL;
-                (access::ifAccesss("compte-3")) ?  
-                    core::elementMenu("compte-3", "/compte-3.html", "Banque : Livret OBNL TRIPLEX", "bar-chart-2") : NULL;
-                (access::ifAccesss("compte-4")) ? 
-                    core::elementMenu("compte-4", "/compte-4.html", "Banque : Épargne financière", "bar-chart-2") : NULL;
-                (access::ifAccesss("compte-historique-csv")) ? 
-                    core::elementMenu("compte-historique-csv", "/compte-historique-csv.html", "Banque : Historique des CSV", "archive") : NULL;
-                echo '</ul>';
-                
-                $temp_accordion = array("sociale-check-salarie");
-                (in_array(core::getGet("p"), $temp_accordion) OR (core::ifGet("p") == FALSE AND session::getType() == 3)) ? $_show = "show" : $_show = NULL;
-                (access::ifAccesss("sociale")) ? 
-                    core::elementMenuH6("Accès services sociaux", NULL, "col-sociaux") : NULL;
-                echo '<ul class="collapse '. $_show .' list-unstyled" id="col-sociaux" data-parent="#accordion">';
-                (access::ifAccesss("sociale-check-salarie")) ?
-                    core::elementMenu("sociale-check-salarie", "/sociale-check-salarie.html", "Validation d'un compte salarié", "check-square") : NULL;
-                echo '</ul>';
+            $temp_accordion = array("compte", "compte-historique-csv", "compte-upload");
+            (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
+            core::elementMenuH6("compte", "Comptes bancaires", NULL, "col-banque");
+            echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-banque" data-parent="#accordion">';
+                core::elementMenu("compte-1", "/compte-1.html", "Banque : Compte Courant ASC", "bar-chart-2");
+                core::elementMenu("compte-2", "/compte-2.html", "Banque : Compte Courant AEP", "bar-chart-2");
+                core::elementMenu("compte-3", "/compte-3.html", "Banque : Livret OBNL TRIPLEX", "bar-chart-2");
+                core::elementMenu("compte-4", "/compte-4.html", "Banque : Épargne financière", "bar-chart-2");
+                core::elementMenu("compte-historique-csv", "/compte-historique-csv.html", "Banque : Historique des CSV", "archive");
+            echo '</ul>';
 
-                $temp_accordion = array("evenements", "evenement", "lotterys", "lottery");
-                (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
-                (access::ifAccesss("evenements")) ?
-                    core::elementMenuH6("Evènements", NULL, "col-events") : NULL;
-                echo '<ul class="collapse '. $_show .' list-unstyled" id="col-events" data-parent="#accordion">';
-                (access::ifAccesss("evenements")) ?
-                    core::elementMenu("evenements", "/evenements.html", "Listes des évènements", "calendar") : NULL;
-                (access::ifAccesss("lotterys")) ? 
-                    core::elementMenu("lotterys", "/lotterys.html", "Listes des tirages au sort", "zap") : NULL;
-                echo '</ul>';
-                
-                $temp_accordion = array();
-                (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuH6("Pratiques", NULL, "col-practice") : NULL;
-                echo '<ul class="collapse '. $_show .' list-unstyled" id="col-practice" data-parent="#accordion">';
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuLink("https://corporatedirectory.capgemini.com/MyDirectory/portals/std/index-portal.jsp", "Corporate Directory", "link") : NULL;
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuLink("https://www.cse-invent.com", "Site du CSE", "link") : NULL;
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuLink("https://" . DOMAIN_EVENTS, "Emargement Salariés", "link") : NULL;
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuLink("https://" . DOMAIN_CONTROL, "Emargement Contrôleur", "link") : NULL;
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuLink("https://wiki.cse-invent.com", "Wiki CSE", "link") : NULL;
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuLink("https://contact.cse-invent.com", "Contact CSE", "link") : NULL;
-                (access::ifAccesss("pratique")) ?
-                    core::elementMenuLink("https://sender.cse-invent.com", "SendPortal CSE", "link") : NULL;
-                echo '</ul>';
+            $temp_accordion = array("sociale-check-salarie");
+            (in_array(core::getGet("p"), $temp_accordion) or (core::ifGet("p") == FALSE and session::getType() == 3)) ? $_show = "show" : $_show = NULL;
+            core::elementMenuH6("sociale", "Accès services sociaux", NULL, "col-sociaux");
+            echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-sociaux" data-parent="#accordion">';
+                core::elementMenu("sociale-check-salarie", "/sociale-check-salarie.html", "Validation d'un compte salarié", "check-square");
+            echo '</ul>';
 
-                $temp_accordion = array("user", "parametres", "parametre-users", "parametre-teams", "historique");
-                (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
-                (access::ifAccesss("parametres")) ?
-                    core::elementMenuH6("Administration", NULL, "col-admin") : NULL;
-                echo '<ul class="collapse '. $_show .' list-unstyled" id="col-admin" data-parent="#accordion">';
-                (access::ifAccesss("parametre-users")) ?
-                    core::elementMenu("parametre-users", "/parametre-users.html", "Admin : Utilisateurs", "users") : NULL;
-                (access::ifAccesss("parametre-teams")) ?
-                    core::elementMenu("parametre-teams", "/parametre-teams.html", "Admin : Groupes & Droits", "users") : NULL;
-                (access::ifAccesss("historique")) ?
-                    core::elementMenu("historique", "/historique.html", "Admin : Historique", "activity") : NULL;
-                (access::ifAccesss("parametres")) ?
-                    core::elementMenu("parametres", "/parametres.html", "Admin : Paramètres", "tool") : NULL;
-                echo '</ul>';
+            $temp_accordion = array("evenements", "evenement", "lotterys", "lottery");
+            (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
+                core::elementMenuH6("evenements", "Evènements", NULL, "col-events");
+            echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-events" data-parent="#accordion">';
+                core::elementMenu("evenements", "/evenements.html", "Listes des évènements", "calendar");
+                core::elementMenu("lotterys", "/lotterys.html", "Listes des tirages au sort", "zap");
+            echo '</ul>';
+
+            $temp_accordion = array();
+            (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
+                core::elementMenuH6("pratique", "Pratiques", NULL, "col-practice");
+            echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-practice" data-parent="#accordion">';
+                core::elementMenuLink("pratique", "https://corporatedirectory.capgemini.com/MyDirectory/portals/std/index-portal.jsp", "Corporate Directory", "link");
+                core::elementMenuLink("pratique", "https://www.cse-invent.com", "Site du CSE", "link");
+                core::elementMenuLink("pratique", "https://" . DOMAIN_EVENTS, "Emargement Salariés", "link");
+                core::elementMenuLink("pratique", "https://" . DOMAIN_CONTROL, "Emargement Contrôleur", "link");
+                core::elementMenuLink("pratique", "https://wiki.cse-invent.com", "Wiki CSE", "link");
+                core::elementMenuLink("pratique", "https://contact.cse-invent.com", "Contact CSE", "link");
+                core::elementMenuLink("pratique", "https://sender.cse-invent.com", "SendPortal CSE", "link");
+            echo '</ul>';
+
+            $temp_accordion = array("user", "parametres", "parametre-users", "parametre-teams", "historique");
+            (in_array(core::getGet("p"), $temp_accordion)) ? $_show = "show" : $_show = NULL;
+                core::elementMenuH6("parametres", "Administration", NULL, "col-admin");
+            echo '<ul class="collapse ' . $_show . ' list-unstyled" id="col-admin" data-parent="#accordion">';
+                core::elementMenu("parametre-users", "/parametre-users.html", "Admin : Utilisateurs", "users");
+                core::elementMenu("parametre-teams", "/parametre-teams.html", "Admin : Groupes & Droits", "users");
+                core::elementMenu("historique", "/historique.html", "Admin : Historique", "activity");
+                core::elementMenu("parametres", "/parametres.html", "Admin : Paramètres", "tool");
+            echo '</ul>';
             ?>
         </ul>
     </div>
-    
+
     <div style="position: absolute; bottom: 0; margin: 0 0 5px 10px; color: gray;">
         <small>Chargement le <?php echo core::printDateTxt(); ?></small>
     </div>

+ 1 - 1
core/views/_cms.nav.php

@@ -18,7 +18,7 @@
     }
 
     if(core::isDebug()){
-        $titleDebug = "<a href=\"/parametres.html\"><span class=\"badge\" style=\"background-color:red; margin-left:5px;\">MODE DEBUG</span></a>";
+        $titleDebug = "<a href=\"#\" id='toggle-logs'><span class=\"badge\" style=\"background-color:red; margin-left:5px;\">MODE DEBUG</span></a>";
     } else {
         $titleDebug = "";
     }

+ 7 - 1
core/views/pages/cms.compte-historique-csv.php

@@ -1,3 +1,9 @@
+<?php
+    $json = "/json.php?file=banque-csv";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    }
+?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
         <span>Banque : Historique des CSV</span>
@@ -25,7 +31,7 @@
         data-flat="true"
         data-sort-name="cree"
         data-sort-order="desc"
-        data-url="/json.php?file=banque-csv">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="creer" data-filter-control="input" data-width="160">Charger le</th>

+ 7 - 1
core/views/pages/cms.compte.php

@@ -1,3 +1,9 @@
+<?php
+    $json = "/json.php?file=banque-lignes-".core::getGet("id");
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    }
+?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
 <h2 class="bd-title" id="content">
     <span>Etat des comptes</span>
@@ -34,7 +40,7 @@
         data-flat="true"
         data-sort-name="num"
         data-sort-order="desc"
-        data-url="/json.php?file=banque-lignes-<?php echo core::getGet("id") ?>">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="num" data-width="20">#</th>

+ 7 - 2
core/views/pages/cms.evenement-inscrits.php

@@ -1,4 +1,9 @@
-
+<?php
+    $json = "/json.php?jsonData=event-inscrits&id=".core::getGet("id");
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
+?>
 <div style="float:right; margin-top: -60px;">
 <?php 
     $evenement = event::getFiche(core::getGet("id"));
@@ -19,7 +24,7 @@
     data-pagination="true"
     data-filter-control="true"
     data-flat="true"
-    data-url="/json.php?jsonData=event-inscrits&id=<?php echo core::getGet("id") ?>">
+    data-url="<?php echo $json ?>">
     <thead>
         <tr>
             <th data-sortable="true" data-field="idLocal" data-filter-control="input" data-width="100">Matricule</th>

+ 9 - 4
core/views/pages/cms.evenement-salaries.php

@@ -1,7 +1,12 @@
 <?php
-if(core::ifGet("id")){
-    $event = event::getFiche(core::getGet("id"));
-}
+    if(core::ifGet("id")){
+        $event = event::getFiche(core::getGet("id"));
+    }
+
+    $json = "/json.php?jsonData=event-salaries&id=".core::getGet("id");
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 
 <table
@@ -15,7 +20,7 @@ if(core::ifGet("id")){
     data-pagination="true"
     data-filter-control="true"
     data-flat="true"
-    data-url="/json.php?jsonData=event-salaries&id=<?php echo core::getGet("id") ?>">
+    data-url="<?php echo $json ?>">
     <thead>
         <tr>
             <th data-sortable="true" data-field="idLocal" data-filter-control="input" data-width="100">Matricule</th>

+ 6 - 1
core/views/pages/cms.evenements.php

@@ -1,5 +1,10 @@
 <?php
     json::create("events");
+
+    $json = "/json.php?file=events";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
@@ -34,7 +39,7 @@
         data-flat="true"
         data-sort-name="cree"
         data-sort-order="desc"
-        data-url="/json.php?file=events">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="id" data-filter-control="input" data-width="15">#</th>

+ 7 - 1
core/views/pages/cms.historique.php

@@ -1,3 +1,9 @@
+<?php
+    $json = "/json.php?jsonData=historique";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
+?>
 
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
 <h2 class="bd-title" id="content">
@@ -26,7 +32,7 @@
         data-flat="true"
         data-sort-name="addDate"
         data-sort-order="desc"
-        data-url="/json.php?jsonData=historique">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="addDate" data-filter-control="input" data-width="160">Date</th>

+ 8 - 3
core/views/pages/cms.lottery-inscrits.php

@@ -1,6 +1,11 @@
 <?php
-$lottery = lottery::getFiche(core::getGet("id"));
-$dataLottery = lottery::getInscriptionData(core::getGet("id"));
+    $lottery = lottery::getFiche(core::getGet("id"));
+    $dataLottery = lottery::getInscriptionData(core::getGet("id"));
+
+    $json = "/json.php?jsonData=lottery-inscrits&id=" . core::getGet("id");
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 <div style="float:right; margin-top: -60px;">
     <?php
@@ -55,7 +60,7 @@ $dataLottery = lottery::getInscriptionData(core::getGet("id"));
     </div>
     <div class="card-body">
 
-        <table id="table" class="table-striped table-hover table-sm" data-page-size="25" data-toggle="table" data-show-columns="true" data-search="true" data-buttons-align="left" data-pagination="true" data-filter-control="true" data-flat="true" data-url="/json.php?jsonData=lottery-inscrits&id=<?php echo core::getGet("id") ?>">
+        <table id="table" class="table-striped table-hover table-sm" data-page-size="25" data-toggle="table" data-show-columns="true" data-search="true" data-buttons-align="left" data-pagination="true" data-filter-control="true" data-flat="true" data-url="<?php echo $json ?>">
             <thead>
                 <tr>
                     <th data-sortable="true" data-field="id_presta" data-width="50" data-formatter="selectPrestation">Prestation</th>

+ 9 - 4
core/views/pages/cms.lottery-winners.php

@@ -1,6 +1,11 @@
-<?php
-$dataLottery = lottery::getInscriptionData(core::getGet("id"));
-$sortLottery = lottery::getCloture(core::getGet("id"));
+<?php    $dataLottery = lottery::getInscriptionData(core::getGet("id"));
+    $sortLottery = lottery::getCloture(core::getGet("id"));
+
+
+    $json = "/json.php?jsonData=lottery-winners&id=" . core::getGet("id");
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 
 if($sortLottery["sortDate"] == NULL) {
 ?>
@@ -71,7 +76,7 @@ if($sortLottery["sortDate"] == NULL) {
             data-pagination="true"
             data-filter-control="true"
             data-flat="true"
-            data-url="/json.php?jsonData=lottery-winners&id=<?php echo core::getGet("id") ?>">
+            data-url="<?php echo $json ?>">
             <thead>
                 <tr>
                     <th data-sortable="true" data-field="id_dossier" data-filter-control="input" data-width="50" data-formatter="selectDossier">Id Dossier</th>

+ 6 - 1
core/views/pages/cms.lotterys.php

@@ -1,5 +1,10 @@
 <?php
     json::create("lotterys");
+
+    $json = "/json.php?file=lotterys";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
@@ -34,7 +39,7 @@
         data-flat="true"
         data-sort-name="cree"
         data-sort-order="desc"
-        data-url="/json.php?file=lotterys">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="id" data-filter-control="input" data-width="15">#</th>

+ 7 - 1
core/views/pages/cms.parametre-teams.php

@@ -1,3 +1,9 @@
+<?php
+    $json = "/json.php?jsonData=parametre-access";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
+?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
         <span>Administration : Groupes & Droits</span>
@@ -18,7 +24,7 @@ echo core::filAriane(array(
             class="table-striped table-hover table-sm" 
             data-toggle="table" 
             data-flat="true" 
-            data-url="/json.php?jsonData=parametre-access">
+            data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="access">Accès</th>

+ 7 - 1
core/views/pages/cms.parametre-users.php

@@ -1,3 +1,9 @@
+<?php
+    $json = "/json.php?file=users";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
+?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
         <span>Administration : Utilisateurs</span>
@@ -30,7 +36,7 @@ echo core::filAriane(array(
             data-toggle="table"
             data-buttons-align="left"
             data-flat="true"
-            data-url="/json.php?file=users">
+            data-url="<?php echo $json ?>">
             <thead>
                 <tr>
                     <th data-sortable="true" data-field="id" data-filter-control="input">#</th>

+ 7 - 2
core/views/pages/cms.parametres-restore.php

@@ -1,4 +1,9 @@
-
+<?php
+    $json = "/json.php?jsonData=parametres-restore";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
+?>
 <div style="margin-top:20px;">
 
     <a href="/submit.php?from=parametres-add-backup" style="position:absolute; right:25px; margin-top:-60px;">
@@ -13,7 +18,7 @@
         data-toggle="table" 
         data-sort-name="date" 
         data-sort-order="desc" 
-        data-url="/json.php?jsonData=parametres-restore">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-formatter="downloadFile" data-field="file" data-filter-control="input" data-align="left">Nom</th>

+ 10 - 2
core/views/pages/cms.proweb-export-csv.php

@@ -5,7 +5,15 @@ if ($lastExcelForSFTP = salaries::lastExcelForSFTP()) {
     $getExcelJsonForSFTP = "";
 }
 json::create("host");
+
+    $json1 = "/json.php?jsonData=proweb-transfert-sftp";
+    $json2 = "/json.php?jsonData=proweb-transfert-local";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json1, "OUVRIR LE JSON : ".$json1), "JSON chargé en arrière plan");
+        debug::log(debug::getBadge($json2, "OUVRIR LE JSON : ".$json2), "JSON chargé en arrière plan");
+    } 
 ?>
+
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
         <span>Proweb : Exporter vers ProWeb</span>
@@ -60,7 +68,7 @@ echo core::filAriane(array(
             <div class="col m-3">
                 <label style="color: gray;">Fichiers présents sur le serveur</label>
 
-                <table id="table" class="table-striped table-hover table-sm" data-toggle="table" data-sort-name="date" data-sort-order="desc" data-url="/json.php?jsonData=proweb-transfert-sftp">
+                <table id="table" class="table-striped table-hover table-sm" data-toggle="table" data-sort-name="date" data-sort-order="desc" data-url="<?php echo $json1 ?>">
                     <thead>
                         <tr>
                             <th data-formatter="downloadFileRemote" data-sortable="true" data-field="file" data-filter-control="input" data-align="left">Nom</th>
@@ -112,7 +120,7 @@ echo core::filAriane(array(
             <div class="col m-3">
                 <label style="color: gray;">Fichiers présents dans le dossier du CSE</label>
 
-                <table id="table" class="table-striped table-hover table-sm" data-toggle="table" data-sort-name="date" data-sort-order="desc" data-url="/json.php?jsonData=proweb-transfert-local">
+                <table id="table" class="table-striped table-hover table-sm" data-toggle="table" data-sort-name="date" data-sort-order="desc" data-url="<?php echo $json2 ?>">
                     <thead>
                         <tr>
                             <th data-formatter="downloadFileLocal" data-sortable="true" data-field="file" data-filter-control="input" data-align="left">Nom</th>

+ 7 - 1
core/views/pages/cms.proweb-historique-excel.php

@@ -1,3 +1,9 @@
+<?php
+    $json = "/json.php?file=excel-proweb";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
+?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
         <span>Proweb : Historique des Excels</span>
@@ -29,7 +35,7 @@
         data-flat="true"
         data-sort-name="cree"
         data-sort-order="desc"
-        data-url="/json.php?file=excel-proweb">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="cree" data-filter-control="input" data-width="160">Charger le</th>

+ 6 - 1
core/views/pages/cms.proweb-salaries.php

@@ -1,6 +1,11 @@
 <?php
 $dateData = get::jsonDateDataExcelProweb();
 $date = ($dateData != NULL) ? " (au " . core::convertDate($dateData, FALSE) . ")" : "";
+
+    $json = "/json.php?file=salaries-proweb";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
@@ -37,7 +42,7 @@ echo core::filAriane(array(
             <option value="errorAbsent">Filtre : Problème car le salarié n'est plus présent et aucune date de sortie sur Proweb</option>
         </select>
     </div>
-    <table id="ProWebSalary" class="table-striped table-hover table-sm" data-page-size="25" data-toggle="table" data-buttons-align="left" data-pagination="true" data-filter-control="true" data-flat="true" data-show-columns-toggle-all="true" data-url="/json.php?file=salaries-proweb">
+    <table id="ProWebSalary" class="table-striped table-hover table-sm" data-page-size="25" data-toggle="table" data-buttons-align="left" data-pagination="true" data-filter-control="true" data-flat="true" data-show-columns-toggle-all="true" data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="idProweb" data-filter-control="input" data-formatter="selectFicheProweb" data-width="35">#</th>

+ 6 - 1
core/views/pages/cms.rh-historique-excel.php

@@ -1,6 +1,11 @@
 <?php
     $inProgress = salaries::excelGetInProgress();
     json::create("excel");
+
+    $json = "/json.php?file=excel";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
@@ -33,7 +38,7 @@
         data-flat="true"
         data-sort-name="cree"
         data-sort-order="desc"
-        data-url="/json.php?file=excel">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="cree" data-filter-control="input" data-width="160">Charger le</th>

+ 6 - 1
core/views/pages/cms.rh-import-to-temp.php

@@ -32,6 +32,11 @@ if(empty($json["excel"])){
 <?php
 }
 else {
+
+    $json = "/json.php?file=tmp_salaries";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
@@ -69,7 +74,7 @@ else {
         data-search="true"
         data-sort-name="cree"
         data-sort-order="desc"
-        data-url="/json.php?file=tmp_salaries">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="action" data-filter-control="select">Action</th>

+ 6 - 1
core/views/pages/cms.rh-liste-salaries.php

@@ -1,6 +1,11 @@
 <?php 
     $dateData = get::jsonDateDataExcel();
     $date = ($dateData != NULL) ? " (au " . core::convertDate($dateData, FALSE) . ")" : "";
+
+    $json = "/json.php?file=salaries";
+    if(core::isDebug()){
+        debug::log(debug::getBadge($json, "OUVRIR LE JSON : ".$json), "JSON chargé en arrière plan");
+    } 
 ?>
 <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
     <h2 class="bd-title" id="content">
@@ -32,7 +37,7 @@
         data-pagination="true"
         data-filter-control="true"
         data-flat="true"
-        data-url="/json.php?file=salaries">
+        data-url="<?php echo $json ?>">
         <thead>
             <tr>
                 <th data-sortable="true" data-field="idLocal" data-filter-control="input">Id Capgemini</th>

+ 88 - 0
public-cms/css/debug.css

@@ -0,0 +1,88 @@
+.debug-dum {
+    background: #f4f4f4;
+    padding: 10px;
+    border: 1px solid #ddd;
+    font-size: 14px;
+}
+
+#debugger-logs {
+    position: fixed;
+    z-index: 999;
+    bottom: 0;
+    left: 0;
+    width: 100%;
+    max-height: 90%;
+    overflow-y: auto;
+    background: #333;
+    color: #fff;
+    font-size: 12px;
+    padding: 10px;
+    display: none;
+}
+
+.debug-renderLogs-header {
+    text-align: right;
+    padding: 5px;
+}
+
+.debug-renderLogs-print {
+    padding: 5px 0;
+}
+
+.debug-renderLogs-button {
+    position: fixed;
+    z-index: 999;
+    bottom: 0;
+    right: 0;
+    background: #333;
+    color: #fff;
+    border: none;
+    padding: 10px;
+    cursor: pointer;
+}
+
+.debug-head-console {
+    border-radius: 3px 3px 0 0;
+    padding: 5px 10px;
+    background-color:#b4b4b4; 
+    color:rgb(58, 58, 58);
+}
+
+.debug-console {
+    border-radius: 0 0 3px 3px;
+    background-color:#D3D3D3; 
+    padding: 10px;
+}
+
+.debug-console-key {
+    color: blueviolet
+}
+
+.debug-console-value {
+    color: red;
+}
+
+.debug-console-capsule {
+    color: black;
+}
+
+.log-entry span.variable {
+    color: #56b6c2;
+}
+
+.log-entry span.function {
+    color: #61afef;
+}
+
+.debug-badge {
+    padding:10px;
+    font-size:1em;
+    background-color:#343a40;
+    text-decoration: none;
+    color:white;
+}
+
+.debug-badge:hover {
+    color:rgb(197, 197, 197);
+    background-color:#485561;
+}

+ 1 - 1
public-cms/index.php

@@ -6,4 +6,4 @@ require_once "../env.inc.php";
 require_once "../access.inc.php";
 require_once "../conf.inc.php";
 require_once DIR_PHP_LAYOUTS . "header.php";
-require_once DIR_PHP_LAYOUTS . "cms.index.php";
+require_once DIR_PHP_LAYOUTS . "cms.index.php";