<?php $id = $_GET["id"]; $cant = $_GET["cant"]; $filtro = " " ; if($_GET["ini"]){ $filtro .= " AND created_at >= '".$_GET["ini"]." 00:00:00' " ; } if($_GET["ter"]){ $filtro .= " created_at <= '".$_GET["ter"]." 23:59:00' " ; } $documentos = 0; $videos = 0; $chats = 0; $interactivo = 0; $documentos = 0; $queryStand = mysqli_query($connect,"SELECT * FROM Stands WHERE id = '".$id."' "); $dataStand = mysqli_fetch_array($queryStand); $queryAnalitica = mysqli_query($connect,"SELECT * FROM Analitica WHERE url = '".$id."' ".$filtro." "); while($dataAnalitica = mysqli_fetch_array($queryAnalitica)){ if($dataAnalitica["tipo"] == 1){ $documentos ++;} if($dataAnalitica["tipo"] == 2){ $videos ++;} if($dataAnalitica["tipo"] == 3){ $chats ++;} if($dataAnalitica["tipo"] == 5){ $interactivo ++;} if($dataAnalitica["tipo"] == 10){ $stand ++;} } ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.js"></script> <div class="row" style="padding-top: 15px;"> <!-- FICHA --> <div class="col-md-12" style="margin-bottom: 20px"> <div class="card" align="center"> <div class="card-body"> <h1><?php echo $dataStand["nombre"]; ?></h1> Clicks en página <b><?php echo $cant; ?></b> </div> </div> </div> <!-- FICHA --> <div class="col-md-12" align="center"> <h1>Interacciones</h1> </div> <!-- FICHA --> <div class="col-md-3"> <table width="100%" style="background-color: #607d8b; color: #ffffff;"> <tr> <td align="center" style="font-size: 20px; line-height: 35px;"> Documentos<br> <b style="font-size: 50px;"><?php echo $documentos; ?></b> </td> </tr> </table> </div> <!-- FICHA --> <div class="col-md-3"> <table width="100%" style="background-color: #607d8b; color: #ffffff;"> <tr> <td align="center" style="font-size: 20px; line-height: 35px;"> Videos<br> <b style="font-size: 50px;"><?php echo $videos; ?></b> </td> </tr> </table> </div> <!-- FICHA --> <div class="col-md-3"> <table width="100%" style="background-color: #607d8b; color: #ffffff;"> <tr> <td align="center" style="font-size: 20px; line-height: 35px;"> Chats<br> <b style="font-size: 50px;"><?php echo $chats; ?></b> </td> </tr> </table> </div> <!-- FICHA --> <div class="col-md-3"> <table width="100%" style="background-color: #607d8b; color: #ffffff;"> <tr> <td align="center" style="font-size: 20px; line-height: 35px;"> Interactivos<br> <b style="font-size: 50px;"><?php echo $interactivo; ?></b> </td> </tr> </table> </div> <!-- FICHA --> <div class="col-md-12" > <!-- INICIA --> <div class="card" style="margin-top: 20px"> <div class="card-header"> <h2>Descarga de documentos</h2> </div> <div class="card-body"> <table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">Participante</th> <th scope="col">Tipo</th> <th scope="col">Fecha</th> </tr> </thead> <tbody> <?php $count = 1; $queryAna = mysqli_query($connect,"SELECT * FROM Analitica WHERE url = '".$id."' AND url = '".$id."' AND tipo = 1 ".$filtro." "); while($dataAna = mysqli_fetch_array($queryAna)){ $queryUser = mysqli_query($connect,"SELECT * FROM Asistentes WHERE id = '".$dataAna["id_user"]."' "); $dataUser = mysqli_fetch_array($queryUser); echo ' <tr> <th scope="row">'.$count.'</th> <td>'.$dataUser["nombre"].'</td> <td>'.$dataUser["titulo"].'</td> <td>'.$dataAna["created_at"].'</td> </tr> '; $count++; } ?> </tbody> </table> </div> </div> <!-- TERMINA --> <!-- INICIA --> <div class="card" style="margin-top: 20px"> <div class="card-header"> <h2>Videos</h2> </div> <div class="card-body"> <table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">Participante</th> <th scope="col">Tipo</th> <th scope="col">Fecha</th> </tr> </thead> <tbody> <?php $count = 1; $queryAna = mysqli_query($connect,"SELECT * FROM Analitica WHERE url = '".$id."' AND url = '".$id."' AND tipo = 2 ".$filtro." "); while($dataAna = mysqli_fetch_array($queryAna)){ $queryUser = mysqli_query($connect,"SELECT * FROM Asistentes WHERE id = '".$dataAna["id_user"]."' "); $dataUser = mysqli_fetch_array($queryUser); echo ' <tr> <th scope="row">'.$count.'</th> <td>'.$dataUser["nombre"].'</td> <td>Video</td> <td>'.$dataAna["created_at"].'</td> </tr> '; $count++; } ?> </tbody> </table> </div> </div> <!-- TERMINA --> <!-- INICIA --> <div class="card" style="margin-top: 20px"> <div class="card-header"> <h2>Interacciones en Chat</h2> </div> <div class="card-body"> <table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">Participante</th> <th scope="col">Tipo</th> <th scope="col">Fecha</th> </tr> </thead> <tbody> <?php $count = 1; $queryAna = mysqli_query($connect,"SELECT * FROM Analitica WHERE url = '".$id."' AND url = '".$id."' AND tipo = 3 ".$filtro." "); while($dataAna = mysqli_fetch_array($queryAna)){ $queryUser = mysqli_query($connect,"SELECT * FROM Asistentes WHERE id = '".$dataAna["id_user"]."' "); $dataUser = mysqli_fetch_array($queryUser); echo ' <tr> <th scope="row">'.$count.'</th> <td>'.$dataUser["nombre"].'</td> <td>Documentos</td> <td>'.$dataAna["created_at"].'</td> </tr> '; $count++; } ?> </tbody> </table> </div> </div> <!-- TERMINA --> <!-- INICIA --> <div class="card" style="margin-top: 20px"> <div class="card-header"> <h2>Interactivos</h2> </div> <div class="card-body"> <table class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">Participante</th> <th scope="col">Tipo</th> <th scope="col">Fecha</th> </tr> </thead> <tbody> <?php $count = 1; $queryAna = mysqli_query($connect,"SELECT * FROM Analitica WHERE url = '".$id."' AND url = '".$id."' AND tipo = 5 ".$filtro." "); while($dataAna = mysqli_fetch_array($queryAna)){ $queryUser = mysqli_query($connect,"SELECT * FROM Asistentes WHERE id = '".$dataAna["id_user"]."' "); $dataUser = mysqli_fetch_array($queryUser); echo ' <tr> <th scope="row">'.$count.'</th> <td>'.$dataUser["nombre"].'</td> <td>Documentos</td> <td>'.$dataAna["created_at"].'</td> </tr> '; $count++; } ?> </tbody> </table> </div> </div> <!-- TERMINA --> </div> </div> <style> .col-md-4{ margin-bottom:15px } .col-md-6{ margin-bottom:15px } .btn-primary_blue{ color: #fff; background-color: #2196f3; border-color: #2196f3; } </style> <?php $arrayFechas = array(); $arraycantidad = array(); $querySol = mysqli_query($connect,"SELECT COUNT(id),update_at FROM Asistentes WHERE acepto = 'on' GROUP BY DAYOFMONTH(update_at) ORDER BY update_at ASC "); while($dataSol = mysqli_fetch_array($querySol)){ $fh = explode(" ", $dataSol["update_at"]); array_push($arrayFechas, $fh ); array_push($arraycantidad, $dataSol["COUNT(id)"] ); } ?> <script> var MONTHS = <?php echo json_encode($arrayFechas) ?>; var config = { type: 'line', data: { labels: MONTHS, datasets: [{ label: 'Registros Días', backgroundColor: "#03A9F4", borderColor: "#035da5", data: <?php echo json_encode($arraycantidad) ?>, fill: false, }] }, options: { responsive: true, title: { display: true, text: 'Registrados' }, tooltips: { mode: 'index', intersect: false, }, hover: { mode: 'nearest', intersect: true }, scales: { x: { display: true, scaleLabel: { display: true, labelString: 'Month' } }, y: { display: true, scaleLabel: { display: true, labelString: 'Value' } } } } }; window.onload = function() { var ctx = document.getElementById('canvas').getContext('2d'); window.myLine = new Chart(ctx, config); }; </script>