chore: version inicial del codigo fuente del LMS Estafeta
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active {
|
||||
color: #dcdcdd;
|
||||
background-color: #b60c0c;
|
||||
border-color: #c54141 #c54141 #fff;
|
||||
}
|
||||
|
||||
|
||||
.container-check {
|
||||
display: block;
|
||||
position: relative;
|
||||
padding-left: 35px;
|
||||
margin-bottom: 12px;
|
||||
cursor: pointer;
|
||||
font-size: 22px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* Hide the browser's default checkbox */
|
||||
.container-check input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
height: 0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
/* Create a custom checkbox */
|
||||
.checkmark {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 25px;
|
||||
width: 25px;
|
||||
background-color: #dcdcdd;
|
||||
}
|
||||
|
||||
/* On mouse-over, add a grey background color */
|
||||
.container-check:hover input ~ .checkmark {
|
||||
background-color: #8e97a1;
|
||||
}
|
||||
|
||||
/* When the checkbox is checked, add a blue background */
|
||||
.container-check input:checked ~ .checkmark {
|
||||
background-color: #b60c0c;
|
||||
}
|
||||
|
||||
/* Create the checkmark/indicator (hidden when not checked) */
|
||||
.checkmark:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Show the checkmark when checked */
|
||||
.container-check input:checked ~ .checkmark:after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Style the checkmark/indicator */
|
||||
.container-check .checkmark:after {
|
||||
left: 9px;
|
||||
top: 5px;
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
border: solid white;
|
||||
border-width: 0 3px 3px 0;
|
||||
-webkit-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
|
||||
.light-bg{
|
||||
background-color: #dcdcdd;
|
||||
}
|
||||
|
||||
|
||||
.dark-bg{
|
||||
background-color: #8e97a1a8;
|
||||
}
|
||||
|
||||
.gray-bg {
|
||||
background-color: #a9a8a81a;
|
||||
}
|
||||
|
||||
/* Estilos para motores Webkit y blink (Chrome, Safari, Opera... )*/
|
||||
|
||||
.card{
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
.card::-webkit-scrollbar {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
.card::-webkit-scrollbar:vertical {
|
||||
width:10px;
|
||||
}
|
||||
|
||||
.card::-webkit-scrollbar-button:increment,.card::-webkit-scrollbar-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.card::-webkit-scrollbar:horizontal {
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.card::-webkit-scrollbar-thumb {
|
||||
background-color: #797979;
|
||||
border-radius: 20px;
|
||||
border: 2px solid #f1f2f3;
|
||||
}
|
||||
|
||||
.card::-webkit-scrollbar-track {
|
||||
border-radius: 10px;
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
require_once "../config.php";
|
||||
|
||||
$idencuesta = $_POST['idencuesta'];
|
||||
|
||||
|
||||
$sql="SELECT
|
||||
e.idencuesta,
|
||||
e.titulo,
|
||||
e.descripcion
|
||||
FROM
|
||||
encuestas as e
|
||||
WHERE
|
||||
e.idencuesta = $idencuesta";
|
||||
|
||||
|
||||
$sqlQ="SELECT
|
||||
ep.idpregunta,
|
||||
ep.titulo,ep.descripcion_p,
|
||||
ep.orden_p
|
||||
FROM
|
||||
encuestas_preguntas as ep
|
||||
WHERE
|
||||
ep.idencuesta = $idencuesta
|
||||
ORDER BY ep.orden_p asc";
|
||||
|
||||
|
||||
|
||||
global $link;
|
||||
dbConnect();
|
||||
$return = new stdClass();
|
||||
$return->questions = [];
|
||||
|
||||
if($result = mysqli_query($link, $sql)){
|
||||
if ( mysqli_num_rows($result) <= 0) {
|
||||
$return->code = "300";
|
||||
$return->icon = "warning";
|
||||
$return->msg="Sin encuestas";
|
||||
}else{
|
||||
while ($row = mysqli_fetch_assoc($result)){
|
||||
$return->datos = $row;
|
||||
}
|
||||
if($resultQ = mysqli_query($link, $sqlQ)){
|
||||
if ( mysqli_num_rows($result) <= 0) {
|
||||
$return->code = "300";
|
||||
$return->icon = "warning";
|
||||
$return->msg="Sin preguntas";
|
||||
}else{
|
||||
while ($row = mysqli_fetch_assoc($resultQ)){
|
||||
$questions[] = $row;
|
||||
}
|
||||
|
||||
$alerts = [];
|
||||
$totalPreguntasRespuestas = 0;
|
||||
$total_votes = 0;
|
||||
foreach ($questions as $key => $q) {
|
||||
$total_votes = 0;
|
||||
$answers = [];
|
||||
$sqlAns = "SELECT
|
||||
*
|
||||
FROM
|
||||
encuestas_respuestas as er
|
||||
WHERE
|
||||
er.idpregunta = ".$q['idpregunta']."";
|
||||
|
||||
if($resultAns = mysqli_query($link, $sqlAns)){
|
||||
if ( mysqli_num_rows($resultAns) <= 0) {
|
||||
array_push($alerts, "Sin respuestas");
|
||||
$answers = [];
|
||||
}else{
|
||||
$totalPreguntasRespuestas++;
|
||||
while ($row = mysqli_fetch_assoc($resultAns)){
|
||||
$total_votes += $row['votos'];
|
||||
$answers[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$questions[$key]['total_votos'] = $total_votes;
|
||||
|
||||
foreach ($answers as $keyans => $val) {
|
||||
if ($val['votos'] == 0) {
|
||||
$promedio = 0;
|
||||
}else{
|
||||
$promedio = round(($val['votos']/$total_votes)*100);
|
||||
}
|
||||
|
||||
$answers[$keyans]['promedio'] = $promedio;
|
||||
}
|
||||
|
||||
$questions[$key]['respuestas'] = $answers;
|
||||
|
||||
}else{
|
||||
$return->code = "300";
|
||||
$return->icon = "warning";
|
||||
$return->msg="Sin respuestas";
|
||||
array_push($alerts, "Consulta fallo! SQL: ".$sqlAns."<br><br> Error: ".mysqli_error($link));
|
||||
}
|
||||
}
|
||||
|
||||
if ($totalPreguntasRespuestas == sizeof($questions)) {
|
||||
$return->code = "200";
|
||||
$return->icon = "success";
|
||||
$return->msg="Encuestas";
|
||||
}else{
|
||||
$return->code = "300";
|
||||
$return->icon = "error";
|
||||
$return->msg="Ocurrio un error al recuperar las respuestas";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$return->code = "400";
|
||||
$return->icon = "error";
|
||||
$return->msg="No se pudieron cargar los datos de la encuesta intenta más tarde.";
|
||||
}
|
||||
|
||||
|
||||
$return->questions = $questions;
|
||||
|
||||
echo json_encode($return, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
require_once "../config.php";
|
||||
|
||||
$idencuesta = $_POST['idencuesta'];
|
||||
$numempl = $_POST['numempl'];
|
||||
|
||||
|
||||
$sql="SELECT
|
||||
e.idencuesta,
|
||||
e.titulo,
|
||||
e.descripcion,
|
||||
e.estilo
|
||||
FROM
|
||||
encuestas as e
|
||||
WHERE
|
||||
e.idencuesta = $idencuesta";
|
||||
|
||||
$sqlCompleted = "SELECT
|
||||
est.estado
|
||||
FROM
|
||||
encuesta_estado as est
|
||||
WHERE
|
||||
est.numempl = '$numempl' AND idencuesta = $idencuesta";
|
||||
|
||||
$sqlQ="SELECT
|
||||
ep.idpregunta,
|
||||
ep.titulo,ep.descripcion_p,
|
||||
ep.orden_p
|
||||
FROM
|
||||
encuestas_preguntas as ep
|
||||
WHERE
|
||||
ep.idencuesta = $idencuesta
|
||||
ORDER BY ep.orden_p asc";
|
||||
|
||||
|
||||
global $link;
|
||||
dbConnect();
|
||||
$return = new stdClass();
|
||||
$return->questions = [];
|
||||
$return->estado = '';
|
||||
|
||||
if($result = mysqli_query($link, $sql)){
|
||||
if ( mysqli_num_rows($result) <= 0) {
|
||||
$return->code = "300";
|
||||
$return->icon = "warning";
|
||||
$return->msg="Sin encuestas";
|
||||
}else{
|
||||
while ($row = mysqli_fetch_assoc($result)){
|
||||
$return->datos = $row;
|
||||
}
|
||||
if($resultQ = mysqli_query($link, $sqlQ)){
|
||||
if ( mysqli_num_rows($result) <= 0) {
|
||||
$return->code = "300";
|
||||
$return->icon = "warning";
|
||||
$return->msg="Sin preguntas";
|
||||
}else{
|
||||
while ($row = mysqli_fetch_assoc($resultQ)){
|
||||
$questions[] = $row;
|
||||
}
|
||||
|
||||
$alerts = [];
|
||||
$totalPreguntasRespuestas = 0;
|
||||
|
||||
foreach ($questions as $key => $q) {
|
||||
$answers = [];
|
||||
$sqlAns = "SELECT
|
||||
*
|
||||
FROM
|
||||
encuestas_respuestas as er
|
||||
WHERE
|
||||
er.idpregunta = ".$q['idpregunta']."";
|
||||
|
||||
if($resultAns = mysqli_query($link, $sqlAns)){
|
||||
if ( mysqli_num_rows($resultAns) <= 0) {
|
||||
array_push($alerts, "Sin respuestas");
|
||||
$answers = [];
|
||||
}else{
|
||||
$totalPreguntasRespuestas++;
|
||||
while ($row = mysqli_fetch_assoc($resultAns)){
|
||||
$answers[] = $row;
|
||||
}
|
||||
}
|
||||
$questions[$key]['respuestas'] = $answers;
|
||||
}else{
|
||||
$return->code = "300";
|
||||
$return->icon = "warning";
|
||||
$return->msg="Sin respuestas";
|
||||
array_push($alerts, "Consulta fallo! SQL: ".$sqlAns."<br><br> Error: ".mysqli_error($link));
|
||||
}
|
||||
}
|
||||
|
||||
if ($totalPreguntasRespuestas == sizeof($questions)) {
|
||||
$return->code = "200";
|
||||
$return->icon = "success";
|
||||
$return->msg="Encuestas";
|
||||
}else{
|
||||
$return->code = "300";
|
||||
$return->icon = "error";
|
||||
$return->msg="Ocurrio un error al recuperar las respuestas";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
$return->code = "300";
|
||||
$return->icon = "warning";
|
||||
$return->msg="Sin preguntas";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$return->code = "400";
|
||||
$return->icon = "error";
|
||||
$return->msg="No se pudieron cargar los datos de la encuesta intenta más tarde.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($resultCompleted = mysqli_query($link, $sqlCompleted)){
|
||||
if ( mysqli_num_rows($resultCompleted) <= 0) {
|
||||
$return->estado = 'no completado';
|
||||
}else{
|
||||
while ($row = mysqli_fetch_assoc($resultCompleted)){
|
||||
$return->estado = $row['estado'];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$return->estado = 'no completado';
|
||||
}
|
||||
|
||||
$return->questions = $questions;
|
||||
|
||||
echo json_encode($return, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
require_once "../config.php";
|
||||
global $link;
|
||||
dbConnect();
|
||||
$return = new stdClass();
|
||||
|
||||
$idencuesta = $_POST['idencuesta'];
|
||||
$idpregunta = $_POST['idpregunta'];
|
||||
$numempl = $_POST['numerodeempleado'];
|
||||
$btn = $_POST['btnSave'];
|
||||
|
||||
$return->section = $btn;
|
||||
$return->encuesta = $idencuesta;
|
||||
$insertados = 0;
|
||||
$debug = [];
|
||||
|
||||
foreach ($idpregunta as $key => $p) {
|
||||
$answers = $_POST['answers'.$p];
|
||||
|
||||
$sql = "UPDATE encuestas_respuestas SET votos = votos +1 WHERE idrespuesta = $answers";
|
||||
|
||||
if($result = mysqli_query($link, $sql)){
|
||||
$insertados++;
|
||||
}else{
|
||||
array_push($debug, 'Consulta fallo! SQL: '.$sql.'<br><br> Error: '.mysqli_error($link));
|
||||
}
|
||||
}
|
||||
|
||||
$totalpreguntas = sizeof($idpregunta);
|
||||
if($totalpreguntas == $insertados){
|
||||
if ($btn == 'terminar') {
|
||||
$sql = "INSERT INTO encuesta_estado(numempl, idencuesta, estado) VALUES ($numempl, $idencuesta, 'completed')";
|
||||
if($result = mysqli_query($link, $sql)){
|
||||
$return->code = '200';
|
||||
$return->msg = 'Respuesta guardada';
|
||||
}else{
|
||||
$return->code = '400';
|
||||
$return->icon = 'error';
|
||||
$return->msg = 'No se pudo guardar la respuesta guardada';
|
||||
$return->debug = 'Consulta fallo! SQL: '.$sql.'<br><br> Error: '.mysqli_error($link);
|
||||
}
|
||||
}else{
|
||||
$return->code = '200';
|
||||
$return->msg = 'Respuesta guardada';
|
||||
}
|
||||
}else{
|
||||
$return->code = '400';
|
||||
$return->icon = 'error';
|
||||
$return->msg = 'Ocurrió un error al procesar tus datos, intenta más tarde.';
|
||||
$return->debug = $debug;
|
||||
}
|
||||
|
||||
|
||||
echo json_encode($return, JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
?>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user