stany.ferer vor 2 Jahren
Ursprung
Commit
5dc321beb4

+ 1 - 0
conf.inc.php

@@ -14,6 +14,7 @@ define("DIR_DATAS_JSON", DOCUMENT_ROOT . "datas/json/");
 define("DIR_DATAS_JSONDATA", DOCUMENT_ROOT . "core/json/");
 define("DIR_DATAS_FILES", DOCUMENT_ROOT . "datas/files/");
 define("DIR_DATAS", DOCUMENT_ROOT . "datas/");
+define("DIR_PRINT", DOCUMENT_ROOT . "core/print/");
 define("DIR_BACKUP", DOCUMENT_ROOT . "backups/");
 define("DIR_TEMP", DOCUMENT_ROOT . "tmp/");
 

+ 2 - 2
core/class/event.class.php

@@ -25,9 +25,9 @@ class event
         $link = core::base64_url_encode("https://" . DOMAIN_EVENTS . "/?e=" . $md5);
 
         if ($_link == NULL) {
-            echo '<img src="/qrcode.php?q= ' . $link . '" width="' . $_width . '" >';
+            return '<img src="/qrcode.php?q= ' . $link . '" width="' . $_width . '" >';
         } else {
-            echo '<a href="https://' . DOMAIN_EVENTS . '/qrcode.php?q=' . $link . '" target="_blank"><img src="/qrcode.php?q= ' . $link . '" width="' . $_width . '" ></a>';
+            return '<a href="https://' . DOMAIN_EVENTS . '/qrcode.php?q=' . $link . '" target="_blank"><img src="/qrcode.php?q= ' . $link . '" width="' . $_width . '" ></a>';
         }
     }
 

+ 64 - 0
core/class/printPaper.class.php

@@ -0,0 +1,64 @@
+<?php
+
+class printPaper
+{
+    public static function switch(string $_page, int $_id){
+        switch ($_page) {
+            case 'qrcode-event':
+                self::qrcodeEmargement($_id);
+                break;
+            
+            default:
+                echo NULL;
+                break;
+        }
+    }
+    
+    private static function searchElementPage(string $_element){
+        return "{{" . $_element . "}}";
+    }
+    
+    private static function show(string $_page, array $_search, array $_replace){
+        $template = DIR_PRINT . "cms." . $_page . ".html";
+        if(file_exists($template)){
+            $pageEmpty = file_get_contents($template);
+            $pageCompleted = $pageEmpty;
+            echo str_replace($_search, $_replace, $pageCompleted);
+        } else {
+            return NULL;
+        }
+        
+    }
+    
+    private static function qrcodeEmargement(int $_idEvent){
+        $event = event::getFiche($_idEvent);
+
+        if($event["actif"] == 0){
+            $alert = '<div class="alert alert-danger" role="alert">Cet évènement est désactivé et non visible des salariés.</div>';
+        } else {
+            $alert = "";
+        }
+
+        $explication = "Pour vous émarger il vous faut scanner ce QRCode ou vous rendre sur <span style='font-weight : bold;'>https://" . DOMAIN_EVENTS . "</span> dans le navigateur de votre mobile.<br />";
+        $explication .= "Une fois sur l'app mobile, il vous faut renseigner votre <span style='font-weight : bold;'>matricule Capgemini</span> (composé de chiffres et présent sur la fiche paie) ou votre <span style='font-weight : bold;'>identifiant Capgemini</span> (qui est généralement la première lettre de votre prénom et votre nom) et votre <span style='font-weight : bold;'>date de naissance</span> (celle renseignée sur le site).<br />";
+        $explication .= "";
+
+        $search = array(
+            self::searchElementPage("TITRE"),
+            self::searchElementPage("PERIODE"),
+            self::searchElementPage("QRCODE"),
+            self::searchElementPage("EXPLICATION"),
+            self::searchElementPage("ALERTE")
+        );
+
+        $replace = array(
+            $event["titre"], // TITRE
+            "DU " . core::convertDate($event["startDate"]) . " AU " . core::convertDate($event["endDate"]), // PERIODE
+            event::getQRCode($event["id"], "400"), // QRCODE
+            $explication, // EXPLICATION
+            $alert // ALERTE
+        );
+
+        self::show("qrcode-event", $search, $replace);
+    }
+}

+ 56 - 0
core/print/cms.qrcode-event.html

@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html lang="fr">
+    
+    <head>
+        <meta charset="UTF-8">
+        <title>CSE Invent : Emargement :. {{TITRE}}</title>
+        <link rel="stylesheet" href="libs/bootstrap/assets/dist/css/bootstrap.min.css">
+        <link rel="stylesheet" type="texte/css" href="css/print.css">
+        <style>
+            .logo {
+                width: 8cm;
+            }
+
+            .periode {
+                color: dimgrey;
+            }
+
+            .qrcode {
+                text-align: center;
+            }
+
+            .explication {
+                text-align: justify;
+            }
+        </style>
+    </head>
+
+    <body>
+        <page size="A4">
+            <div class="container">
+                <div class="row justify-content-md-center">
+                    <div class="col-md-auto text-center">
+                        <img class="logo" src="/img/logo.png">
+                    </div>
+                </div>
+            </div>
+            <div class="container">
+                <div class="card text-center">
+                    <div class="card-header">
+                        EMARGEMENT A L'EVENEMENT
+                    </div>
+                    <div class="card-body">
+                        {{ALERTE}}
+                        <h1 class="card-title titre">{{TITRE}}</h5>
+                        <p class="card-text periode">{{PERIODE}}</p>
+                        <div class="qrcode">{{QRCODE}}</div>
+                    </div>
+                    <div class="card-footer text-body-secondary">
+                        <p class="explication">{{EXPLICATION}}</p>
+                    </div>
+                </div>
+            </div>
+        </page>
+    </body>
+
+</html>

+ 1 - 1
core/views/pages/cms.evenement-fiche.php

@@ -119,7 +119,7 @@ if (!core::ifGet("id")) {
         ?>
         
     </div>
-  
+
     <?php 
         if(core::ifGet("add")) { echo '<input type="hidden" name="actif" value="0">'; } 
         echo $actif;

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

@@ -22,8 +22,8 @@
     data-url="/json.php?jsonData=event-inscrits&id=<?php echo core::getGet("id") ?>">
     <thead>
         <tr>
-            <th data-sortable="true" data-field="idLocal" data-filter-control="input" data-width="100">Identifiant</th>
-            <th data-sortable="true" data-field="loginId" data-filter-control="input" data-width="100">Matricule</th>
+            <th data-sortable="true" data-field="idLocal" data-filter-control="input" data-width="100">Matricule</th>
+            <th data-sortable="true" data-field="loginId" data-filter-control="input" data-width="100">Identifiant</th>
             <th data-sortable="true" data-field="dateNaissance" data-filter-control="input" data-width="90">Naissances</th>
             <th data-sortable="true" data-field="nom" data-filter-control="input">Nom</th>
             <th data-sortable="true" data-field="prenom" data-filter-control="input">Prénom</th>

+ 3 - 3
core/views/pages/cms.evenement-salaries.php

@@ -18,9 +18,9 @@ if(core::ifGet("id")){
     data-url="/json.php?jsonData=event-salaries&id=<?php echo core::getGet("id") ?>">
     <thead>
         <tr>
-            <th data-sortable="true" data-field="idLocal" data-filter-control="input">Identifiant</th>
-            <th data-sortable="true" data-field="loginId" data-filter-control="input">Matricule</th>
-            <th data-sortable="true" data-field="dateNaissance" data-filter-control="input">Naissances</th>
+            <th data-sortable="true" data-field="idLocal" data-filter-control="input" data-width="100">Matricule</th>
+            <th data-sortable="true" data-field="loginId" data-filter-control="input" data-width="100">Identifiant</th>
+            <th data-sortable="true" data-field="dateNaissance" data-filter-control="input" data-width="90">Naissances</th>
             <th data-sortable="true" data-field="nom" data-filter-control="input">Nom</th>
             <th data-sortable="true" data-field="prenom" data-filter-control="input">Prénom</th>
             <th data-sortable="true" data-field="sexe" data-filter-control="select">Sexe</th>

+ 12 - 3
core/views/pages/cms.evenement.php

@@ -49,7 +49,7 @@ if(alert::ifTab()){
             </h2>
         </div>
         <?php if(isset($event["id"]) AND isset($event["type_emargement"]) AND $event["type_emargement"] != 1){ ?>
-            <div class="col-1" style="text-align:right; cursor: pointer;" data-toggle="modal" data-target="#QRCodeModal"><?php event::getQRCode($event["id"]) ?></div>
+            <div class="col-1" style="text-align:right; cursor: pointer;" data-toggle="modal" data-target="#QRCodeModal"><?php echo event::getQRCode($event["id"]) ?></div>
         <?php } ?>
     </div>
 </header>
@@ -133,8 +133,17 @@ if(alert::ifTab()){
 <div class="modal fade" id="QRCodeModal" tabindex="-1" role="dialog" aria-hidden="true">
     <div class="modal-dialog modal-dialog-centered" role="document">
         <div class="modal-content">
-            <div class="modal-body">
-                <?php event::getQRCode($event["id"], "100%") ?>
+            <div class="modal-body" style="text-align:center;">
+                <h3><?php echo $event["titre"] ?></h3>
+                <h6>Du <?php echo core::convertDate($event["startDate"]) ?> au <?php echo core::convertDate($event["endDate"]) ?></h6>
+                <?php echo event::getQRCode($event["id"], "100%") ?>
+                <?php 
+                    if($event["actif"] == 0){ 
+                        echo '<div class="alert alert-danger" role="alert">Cet évènement est désactivé et non visible des salariés.</div>'; 
+                    } else {
+                        echo '<a href="/print.php?p=qrcode-event&id='.$event["id"].'" target="_blank"><button type="button" class="btn btn-outline-primary btn-lg">Imprimer la fiche</button></a>';
+                    }
+                ?>
             </div>
         </div>
     </div>

+ 1 - 1
core/views/pages/cms.lottery.php

@@ -137,7 +137,7 @@ if(alert::ifTab()){
     <div class="modal-dialog modal-dialog-centered" role="document">
         <div class="modal-content">
             <div class="modal-body">
-                <?php event::getQRCode($lottery["id"], "100%") ?>
+                <?php echo event::getQRCode($lottery["id"], "100%") ?>
             </div>
         </div>
     </div>

+ 51 - 0
public-cms/css/print.css

@@ -0,0 +1,51 @@
+body {
+    background: rgb(204, 204, 204);
+}
+
+page {
+    background: white;
+    display: block;
+    margin: 0 auto;
+    margin-bottom: 0.5cm;
+    box-shadow: 0 0 0.5cm rgba(0, 0, 0, 0.5);
+}
+
+page[size="A4"] {
+    width: 21cm;
+    height: 29.7cm;
+}
+
+page[size="A4"][layout="landscape"] {
+    width: 29.7cm;
+    height: 21cm;
+}
+
+page[size="A3"] {
+    width: 29.7cm;
+    height: 42cm;
+}
+
+page[size="A3"][layout="landscape"] {
+    width: 42cm;
+    height: 29.7cm;
+}
+
+page[size="A5"] {
+    width: 14.8cm;
+    height: 21cm;
+}
+
+page[size="A5"][layout="landscape"] {
+    width: 21cm;
+    height: 14.8cm;
+}
+
+@media print {
+
+    body,
+    page {
+        background: white;
+        margin: 0;
+        box-shadow: 0;
+    }
+}

+ 11 - 0
public-cms/print.php

@@ -0,0 +1,11 @@
+<?php
+
+session_start();
+
+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.session.php";
+
+printPaper::switch(core::getGet("p"), core::getGet("id"));