Individual JSON's
This commit is contained in:
@@ -16,11 +16,34 @@ $user = unserialize($_SESSION['user']);
|
||||
/* $json = file_get_contents('php://input');
|
||||
$data = json_decode($json, true); */
|
||||
|
||||
$query = $db
|
||||
->where('usuario_id', $user->user['id'])
|
||||
->getOne('last_auditoria', 'auditoria')['auditoria'];
|
||||
|
||||
$data = json_decode($query, true);
|
||||
$data = $db->query(
|
||||
"SELECT
|
||||
auditoria->>'registro_fecha_ideal' as registro_fecha_ideal,
|
||||
auditoria->>'profesor_clave' as profesor_clave,
|
||||
auditoria->>'profesor_nombre' as profesor_nombre,
|
||||
auditoria->>'profesor_correo' as profesor_correo,
|
||||
auditoria->>'facultad' as facultad,
|
||||
auditoria->>'materia' as materia,
|
||||
auditoria->>'carrera' as carrera,
|
||||
auditoria->>'horario_grupo' as horario_grupo,
|
||||
auditoria->>'horario_hora_completa' as horario_hora_completa,
|
||||
auditoria->>'salon' as salon,
|
||||
auditoria->>'salon_array' as salon_array,
|
||||
auditoria->>'asistencia' as asistencia,
|
||||
auditoria->>'registro_fecha' as registro_fecha,
|
||||
auditoria->>'usuario_nombre' as usuario_nombre,
|
||||
auditoria->>'nombre' as nombre,
|
||||
auditoria->>'registro_fecha_supervisor' as registro_fecha_supervisor,
|
||||
auditoria->>'comentario' as comentario,
|
||||
auditoria->>'justificacion' as justificacion,
|
||||
auditoria->>'horario_hora' as horario_hora,
|
||||
auditoria->>'horario_fin' as horario_fin,
|
||||
auditoria->>'registro_retardo' as registro_retardo
|
||||
FROM last_auditoria
|
||||
WHERE auditoria->>'registro_fecha_ideal' IS NOT NULL
|
||||
AND USUARIO_ID = ?",
|
||||
[$user->user['id']]
|
||||
);
|
||||
|
||||
empty($data) and die(json_encode(['error' => 'No se recibieron datos', 'data' => $data]));
|
||||
|
||||
@@ -149,7 +172,7 @@ function getFormattedValue($key, $registro)
|
||||
'nombre' => $registro[$key] ?? "Sin registro",
|
||||
'horario_hora_completa' => "{$registro['horario_hora']} - {$registro['horario_fin']}",
|
||||
'usuario_nombre' => $registro[$key] ?? "Sin registro",
|
||||
'salon_array' => json_encode($registro[$key], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
|
||||
'salon_array' => json_encode($registro[$key], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
|
||||
'justificacion',
|
||||
'comentario' => $registro[$key] ?? "Sin registro",
|
||||
default => $registro[$key]
|
||||
@@ -172,7 +195,7 @@ foreach ($data as $index => $registro) {
|
||||
array_walk($values, function ($row, $column_index) use ($sheet, $index, $registro) {
|
||||
$value = getFormattedValue($row, $registro);
|
||||
$cellLocation = chr(65 + $column_index) . (ROW + $index + 1);
|
||||
|
||||
|
||||
$sheet->setCellValue($cellLocation, $value);
|
||||
|
||||
if ($value == "Sin registro") {
|
||||
|
||||
Reference in New Issue
Block a user