All
This commit is contained in:
@@ -37,7 +37,7 @@ try {
|
||||
WHERE (periodo_id, facultad.facultad_id) = (:periodo_id, COALESCE(:facultad_id, facultad.facultad_id))
|
||||
),
|
||||
fechas AS (
|
||||
SELECT fechas_clase(h.horario_id) as registro_fecha_ideal, h.horario_id
|
||||
SELECT fechas_clase(h.horario_id, true) as registro_fecha_ideal, h.horario_id
|
||||
FROM horarios h
|
||||
),
|
||||
sin_registro AS (
|
||||
@@ -74,11 +74,6 @@ try {
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$last_query = [
|
||||
'query' => $db->getLastQuery(),
|
||||
];
|
||||
|
||||
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
http_response_code(405);
|
||||
@@ -89,7 +84,7 @@ try {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
'query' => $db->getLastQuery(),
|
||||
// 'query' => $db->getLastQuery(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
|
||||
@@ -12,7 +12,6 @@ $params = array(':id' => $user->user['id'], ':per' => $_POST['id']);
|
||||
$user->print_to_log('Actualizando periodo from ' . $user->periodo_id . ' to ' . $_POST['id']);
|
||||
|
||||
query("SELECT FU_UPDATEPERIODO(:id, :per)", $params);
|
||||
$user->periodo_id = $params[':per'];
|
||||
|
||||
$_SESSION['user'] = serialize($user);
|
||||
header("Location: {$_POST["target"]}");
|
||||
|
||||
@@ -28,7 +28,11 @@ try {
|
||||
->get('salon_view');
|
||||
|
||||
// step 3: get horarios
|
||||
|
||||
$fecha = "'2023-10-13':DATE";
|
||||
|
||||
$data = array_map(
|
||||
|
||||
fn($ruta) => array_merge(
|
||||
[
|
||||
'horarios' => $db
|
||||
@@ -37,9 +41,9 @@ try {
|
||||
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
||||
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
||||
->join('profesor', 'profesor.profesor_id = horario_profesor.profesor_id')
|
||||
->join('registro', '(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, CURRENT_DATE)', 'LEFT')
|
||||
->where('CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin')
|
||||
->where('horario_dia = EXTRACT(DOW FROM CURRENT_DATE)')
|
||||
->join('registro', "(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, $fecha)", 'LEFT')
|
||||
->where("$fecha BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin")
|
||||
->where("horario_dia = EXTRACT(DOW FROM $fecha)")
|
||||
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->get('horario_view', null, '*, horario_view.horario_id, profesor.profesor_id'),
|
||||
@@ -61,7 +65,7 @@ try {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $th->getMessage(),
|
||||
'query' => $db->getLastQuery(),
|
||||
// 'query' => $db->getLastQuery(),
|
||||
], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
exit;
|
||||
} catch (Exception $th) {
|
||||
|
||||
243
auditoria.php
243
auditoria.php
@@ -242,114 +242,114 @@
|
||||
</div>
|
||||
|
||||
<!-- refresh -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped table-bordered table-sm">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col"
|
||||
class="text-center align-middle px-2 d-flex align-items-center justify-content-center">
|
||||
<button @click="store.registros.invertir" class="btn btn-light btn-sm text-primary mr-3"
|
||||
v-if="store.registros.relevant.length > 1">
|
||||
<i class="ing-cambiar ing-rotate-90"></i>
|
||||
</button>
|
||||
<span style="white-space: nowrap;">Fecha</span>
|
||||
</th>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-striped table-bordered table-sm">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col"
|
||||
class="text-center align-middle px-2 d-flex align-items-center justify-content-center">
|
||||
<button @click="store.registros.invertir" class="btn btn-light btn-sm text-primary mr-3"
|
||||
v-if="store.registros.relevant.length > 1">
|
||||
<i class="ing-cambiar ing-rotate-90"></i>
|
||||
</button>
|
||||
<span style="white-space: nowrap;">Fecha</span>
|
||||
</th>
|
||||
|
||||
<th scope="col" class="text-center align-middle px-2" width="10%">Salón</th>
|
||||
<th scope="col" class="text-center align-middle px-2">Profesor</th>
|
||||
<th scope="col" class="text-center align-middle px-2" width="10%">Salón</th>
|
||||
<th scope="col" class="text-center align-middle px-2">Profesor</th>
|
||||
|
||||
<th scope="col" class="text-center align-middle px-2" width="7%">Horario</th>
|
||||
<th scope="col" class="text-center align-middle px-2">Registro</th>
|
||||
<th scope="col" class="text-center align-middle px-2">Supervisor</th>
|
||||
<? if ($user->acceso == 'w') { ?>
|
||||
<th scope="col" class="text-center align-middle px-2" width="10%">Justificar</th>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="store.registros.relevant.length == 0">
|
||||
<td colspan="7" class="text-center">No hay clases en este horario</td>
|
||||
</tr>
|
||||
<tr v-for="registro in store.registros.relevant?.slice((store.current.page - 1) * store.current.perPage, store.current.page * store.current.perPage)"
|
||||
:key="`${registro.registro_id}-${registro.registro_fecha_ideal}-${registro.horario_id}-${registro.profesor_id}-${registro.salon_id}`">
|
||||
<td class="text-center align-middle px-2">{{ registro.registro_fecha_ideal }}
|
||||
</td>
|
||||
<td class="text-center align-middle px-2">{{ registro.salon }}</td>
|
||||
<td class="align-middle px-2">
|
||||
<strong>{{ registro.profesor_clave }}</strong>
|
||||
{{ registro.profesor_nombre }}
|
||||
<button type="button" class="ml-3 btn btn-sm btn-outline-primary"
|
||||
@click="store.current.clase_vista = registro" data-toggle="modal"
|
||||
data-target="#ver-detalle">
|
||||
<i class="ing-ojo"></i>
|
||||
Ver detalle
|
||||
</button>
|
||||
</td>
|
||||
<th scope="col" class="text-center align-middle px-2" width="7%">Horario</th>
|
||||
<th scope="col" class="text-center align-middle px-2">Registro</th>
|
||||
<th scope="col" class="text-center align-middle px-2">Supervisor</th>
|
||||
<? if ($user->acceso == 'w') { ?>
|
||||
<th scope="col" class="text-center align-middle px-2" width="10%">Justificar</th>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="store.registros.relevant.length == 0">
|
||||
<td colspan="7" class="text-center">No hay clases en este horario</td>
|
||||
</tr>
|
||||
<tr v-for="registro in store.registros.relevant?.slice((store.current.page - 1) * store.current.perPage, store.current.page * store.current.perPage)"
|
||||
:key="`${registro.registro_id}-${registro.registro_fecha_ideal}-${registro.horario_id}-${registro.profesor_id}-${registro.salon_id}`">
|
||||
<td class="text-center align-middle px-2">{{ registro.registro_fecha_ideal }}
|
||||
</td>
|
||||
<td class="text-center align-middle px-2">{{ registro.salon }}</td>
|
||||
<td class="align-middle px-2">
|
||||
<strong>{{ registro.profesor_clave }}</strong>
|
||||
{{ registro.profesor_nombre }}
|
||||
<button type="button" class="ml-3 btn btn-sm btn-outline-primary"
|
||||
@click="store.current.clase_vista = registro" data-toggle="modal"
|
||||
data-target="#ver-detalle">
|
||||
<i class="ing-ojo"></i>
|
||||
Ver detalle
|
||||
</button>
|
||||
</td>
|
||||
|
||||
|
||||
<td class="text-center align-middle px-2">{{ registro.horario_hora?.slice(0,5) }} -
|
||||
{{registro.horario_fin?.slice(0,5) }}</td>
|
||||
<!-- -->
|
||||
<td class="text-center align-middle px-2">
|
||||
<div v-if="registro.registro_fecha">
|
||||
<div class="col-12">
|
||||
Registro <small>{{ registro.registro_fecha?.slice(11,19) }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<strong>
|
||||
<div class="col-12">
|
||||
<span class="text-dark ing-2x"><i class="ing-cancelar"></i></span>
|
||||
</div>
|
||||
</strong>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<!-- Sí checó supervisor -->
|
||||
<td class="text-center align-middle px-2">
|
||||
<td class="text-center align-middle px-2">{{ registro.horario_hora?.slice(0,5) }} -
|
||||
{{registro.horario_fin?.slice(0,5) }}</td>
|
||||
<!-- -->
|
||||
<td class="text-center align-middle px-2">
|
||||
<div v-if="registro.registro_fecha">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span class="mr-2" :class="`text-${registro.estado_color}`">
|
||||
<i :class="`${registro.estado_icon} ing-2x`"></i>
|
||||
</span>
|
||||
<strong v-if="registro.usuario_nombre">{{ registro.usuario_nombre
|
||||
}}</strong>
|
||||
</div>
|
||||
<div class="col-12" v-if="registro.registro_fecha_supervisor">
|
||||
Hora
|
||||
<small>{{ registro.registro_fecha_supervisor?.slice(11,19) }}</small>
|
||||
</div>
|
||||
Registro <small>{{ registro.registro_fecha?.slice(11,19) }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<strong>
|
||||
<div class="col-12">
|
||||
<span class="text-dark ing-2x"><i class="ing-cancelar"></i></span>
|
||||
</div>
|
||||
<div class="col-12 "
|
||||
@click="store.registros.mostrarComentario(registro.registro_id)"
|
||||
v-if="registro.comentario" style="cursor: pointer;">
|
||||
<strong class="badge border border-primary">Observaciones:</strong>
|
||||
<small
|
||||
class="text-truncate">{{registro.comentario?.slice(0,25)}}{{registro.comentario.length
|
||||
> 10 ? '...' : ''}}</small>
|
||||
</strong>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<!-- Sí checó supervisor -->
|
||||
<td class="text-center align-middle px-2">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<span class="mr-2" :class="`text-${registro.estado_color}`">
|
||||
<i :class="`${registro.estado_icon} ing-2x`"></i>
|
||||
</span>
|
||||
<strong v-if="registro.usuario_nombre">{{ registro.usuario_nombre
|
||||
}}</strong>
|
||||
</div>
|
||||
<div class="col-12" v-if="registro.registro_fecha_supervisor">
|
||||
Hora
|
||||
<small>{{ registro.registro_fecha_supervisor?.slice(11,19) }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 "
|
||||
@click="store.registros.mostrarComentario(registro.registro_id)"
|
||||
v-if="registro.comentario" style="cursor: pointer;">
|
||||
<strong class="badge border border-primary">Observaciones:</strong>
|
||||
<small
|
||||
class="text-truncate">{{registro.comentario?.slice(0,25)}}{{registro.comentario.length
|
||||
> 10 ? '...' : ''}}</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<? if ($user->acceso == 'w') { ?>
|
||||
<td class="text-center align-middle px-2">
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-link text-center mx-2 btn-sm" data-toggle="modal"
|
||||
:class="`text-${registro.registro_justificada ? 'success' : 'primary'}`"
|
||||
data-target="#justificar" :class="{ 'active': registro.comentario }"
|
||||
@click="set_justificar(registro.horario_id, registro.profesor_id, registro.registro_fecha_ideal)">
|
||||
<i :class="`ing-${registro.registro_justificada ? 'finalistas' : 'reporte-resultados'}`"
|
||||
style="font-size: 2rem;"></i>
|
||||
<span class="sr-only">{{ registro.registro_justificada ? 'Justificada' :
|
||||
'Justificar' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<? if ($user->acceso == 'w') { ?>
|
||||
<td class="text-center align-middle px-2">
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-link text-center mx-2 btn-sm" data-toggle="modal"
|
||||
:class="`text-${registro.registro_justificada ? 'success' : 'primary'}`"
|
||||
data-target="#justificar" :class="{ 'active': registro.comentario }"
|
||||
@click="set_justificar(registro.horario_id, registro.profesor_id, registro.registro_fecha_ideal)">
|
||||
<i :class="`ing-${registro.registro_justificada ? 'finalistas' : 'reporte-resultados'}`"
|
||||
style="font-size: 2rem;"></i>
|
||||
<span class="sr-only">{{ registro.registro_justificada ? 'Justificada' :
|
||||
'Justificar' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- page -->
|
||||
<nav v-if="store.registros.relevant.length > 0" class="mt-3 col-12">
|
||||
@@ -579,32 +579,37 @@
|
||||
<div class="container">
|
||||
<h2 class="text-center">¿Desea justificar la asistencia?</h2>
|
||||
<br>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input form-control-lg my-auto"
|
||||
id="está-justificada" v-model="store.current.justificada.registro_justificada"
|
||||
@click="store.current.justificada.justificacion = ''">
|
||||
<label class="custom-control-label" for="está-justificada">Justificar
|
||||
<strong v-if="store.current.justificada.estado_supervisor_id"
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
Justificar <strong v-if="store.current.justificada.estado_supervisor_id"
|
||||
:class="`text-${store.current.justificada.estado_color}`"
|
||||
class="text-uppercase">
|
||||
{{store.current.justificada.nombre.toUpperCase()}}
|
||||
</strong>
|
||||
del día
|
||||
<span class="text-muted">{{store.current.justificada.registro_fecha_ideal}}</span>
|
||||
a las
|
||||
<span
|
||||
{{store.current.justificada.nombre.toUpperCase()}}</strong> del día <span
|
||||
class="text-muted">{{store.current.justificada.registro_fecha_ideal}}</span> a
|
||||
las <span
|
||||
class="text-muted">{{store.current.justificada.horario_hora?.slice(0,5)}}</span>
|
||||
para el profesor
|
||||
<span class="text-muted">{{store.current.justificada.profesor_nombre}}</span>
|
||||
</label>
|
||||
para el profesor <span
|
||||
class="text-muted">{{store.current.justificada.profesor_nombre}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="store.current.justificada.registro_justificada">
|
||||
<div class="input-group" v-if="store.current.justificada.registro_justificada">
|
||||
<div class="row mt-3">
|
||||
<div class="col-12">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" value="" id="observaciones" v-model="store.current.observaciones">
|
||||
<label class="form-check-label" for="observaciones">
|
||||
¿Deseas añadir observaciones?
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr v-if="store.current.observaciones">
|
||||
<div class="input-group" v-if="store.current.observaciones">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text text-white bg-primary">Observación</span>
|
||||
<span class="input-group-text text-white bg-primary">Observaciones</span>
|
||||
</div>
|
||||
<textarea class="form-control" aria-label="Observación"
|
||||
placeholder="Puedes justificar sin observación" rows="2"
|
||||
placeholder="Puedes justificar sin observaciones" rows="2"
|
||||
v-model="store.current.justificada.justificacion"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@@ -617,7 +622,7 @@
|
||||
Cancelar
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal" @click="store.justificar">
|
||||
Aceptar
|
||||
Justificar
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,8 +18,38 @@ require_once($ruta ?? '') . "vendor/autoload.php";
|
||||
|
||||
class Login
|
||||
{
|
||||
public ?string $acceso;
|
||||
public function __construct(public array $user, public array $facultad, public array $rol, public bool $admin, public ?int $periodo_id, public bool $supervisor, public bool $jefe_carrera, public bool $profesor)
|
||||
private function es_usuario(): bool
|
||||
{
|
||||
global $db;
|
||||
return $db->where('usuario_clave', $this->user['clave'])->has("usuario");
|
||||
}
|
||||
public function __get($property)
|
||||
{
|
||||
global $db;
|
||||
return match ($property) {
|
||||
'acceso' => $this->access(),
|
||||
'profesor' => $db->where('profesor_clave', preg_replace('/\D/','', $this->user['clave']))->getOne("profesor")['profesor_id'] ?? null,
|
||||
'jefe_de_carrera' => $db->where('usuario_id', $this->user["id"])->has('usuario_carrera'),
|
||||
'periodo_id' => $db->where('usuario_id', $this->user["id"])->getOne('usuario')["periodo_id"],
|
||||
'admin' => $this->es_usuario() and $db->where('usuario_id', $this->user["id"])->getOne('usuario')["usuario_admin"],
|
||||
'facultad' => $this->es_usuario()
|
||||
? $db
|
||||
->where('usuario_id', $this->user["id"])
|
||||
->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT')
|
||||
->getOne('usuario', 'facultad.facultad_nombre as facultad, facultad.facultad_id')
|
||||
: array ('facultad' => null, 'facultad_id' => null),
|
||||
'rol' => $this->es_usuario()
|
||||
? $db
|
||||
->join('rol', 'rol.rol_id = usuario.rol_id')
|
||||
->where('usuario_id', $this->user["id"])
|
||||
->getOne('usuario', 'rol.rol_titulo as rol, rol.rol_id')
|
||||
: $db
|
||||
->where('rol_titulo', 'docente', 'ILIKE')
|
||||
->getOne('rol', 'rol.rol_titulo as rol, rol.rol_id'),
|
||||
default => throw new Exception("Propiedad no definida"),
|
||||
};
|
||||
}
|
||||
public function __construct(public array $user)
|
||||
{
|
||||
}
|
||||
public function print_to_log(string $desc, array $old = null, array $new = null): void
|
||||
@@ -31,40 +61,17 @@ class Login
|
||||
$desc .= " |#| NEW:" . json_encode($new);
|
||||
$log->appendLog($this->user["id"], $this->user["nombre"], $desc);
|
||||
}
|
||||
public function access(string $pagina = null): void
|
||||
public function access(string $pagina = null): string|null
|
||||
{
|
||||
global $db;
|
||||
$user = $db
|
||||
->join('rol', 'rol.rol_id = usuario.rol_id')
|
||||
->join('facultad', 'facultad.facultad_id = usuario.facultad_id', 'LEFT')
|
||||
->where('usuario_id', $this->user["id"])
|
||||
->getOne('usuario');
|
||||
|
||||
$this->admin = $user["usuario_admin"];
|
||||
|
||||
$this->rol = array(
|
||||
'id' => $user["rol_id"],
|
||||
'rol' => $user["rol_titulo"]
|
||||
);
|
||||
|
||||
$this->facultad = array(
|
||||
'facultad_id' => $user["facultad_id"],
|
||||
'facultad' => $user["facultad_nombre"],
|
||||
);
|
||||
|
||||
if ($this->admin) {
|
||||
$this->acceso = "w";
|
||||
return;
|
||||
}
|
||||
|
||||
# print_r( $access );
|
||||
if ($this->admin)
|
||||
return "w";
|
||||
$acceso = $db
|
||||
->where('id', $this->user["id"])
|
||||
->where('pagina_ruta', $pagina ?? substr(basename($_SERVER['PHP_SELF']), 0, -4))
|
||||
->getOne('permiso_view');
|
||||
|
||||
$this->acceso = isset($acceso["tipo"]) ? $acceso["tipo"] : null;
|
||||
|
||||
return isset($acceso["tipo"]) ? $acceso["tipo"] : null;
|
||||
}
|
||||
private static function validaUsuario($user, $pass): bool
|
||||
{
|
||||
@@ -84,69 +91,26 @@ class Login
|
||||
}
|
||||
public static function validUser(string $user, string $pass): Login|array
|
||||
{
|
||||
if (Login::validaUsuario($user, $pass) === false) {
|
||||
return [
|
||||
'error' => true,
|
||||
'msg' => 'Error al autenticar usuario'
|
||||
];
|
||||
}
|
||||
global $db;
|
||||
|
||||
if (!Login::validaUsuario($user, $pass))
|
||||
return ['error' => true, 'msg' => 'Error al autenticar usuario'];
|
||||
|
||||
if ($db->has("FS_VALIDACLAVEULSA('$user')")) {
|
||||
#die (Login::validaUsuario($user, $pass));
|
||||
$fs_validaclaveulsa = $db->querySingle(
|
||||
'SELECT * FROM FS_VALIDACLAVEULSA(?)',
|
||||
[$user]
|
||||
);
|
||||
$fs = $db->querySingle('SELECT * FROM FS_VALIDACLAVEULSA(?)', [$user]);
|
||||
return new Login(user: ['id' => $fs["id"], 'nombre' => $fs["nombre"], 'clave' => $fs["clave"]]);
|
||||
}
|
||||
|
||||
$user = array(
|
||||
'id' => $fs_validaclaveulsa["id"],
|
||||
'nombre' => $fs_validaclaveulsa["nombre"],
|
||||
'clave' => $db->where('usuario_id', $fs_validaclaveulsa["id"])->getOne("usuario")["usuario_clave"]
|
||||
);
|
||||
$facultad = array(
|
||||
'facultad_id' => $fs_validaclaveulsa["facultad_id"],
|
||||
'facultad' => $fs_validaclaveulsa["facultad"],
|
||||
);
|
||||
$rol = array(
|
||||
'id' => $fs_validaclaveulsa["rol_id"],
|
||||
'rol' => $fs_validaclaveulsa["rol"]
|
||||
);
|
||||
$supervisor = $db
|
||||
->join('rol', 'rol.rol_id = usuario.rol_id')
|
||||
->where('usuario_id', $user["id"])
|
||||
->where('rol.rol_titulo', 'Supervisor')
|
||||
->has('usuario');
|
||||
$jefe_carrera = $db->where('usuario_id', $user["id"])->has('usuario_carrera');
|
||||
$profesorClave = preg_replace('/\D/', '', $user);
|
||||
if ($db->where('profesor_clave', $profesorClave)->has("profesor")) {
|
||||
$profesor = $db->where('profesor_clave', $profesorClave)->getOne("profesor");
|
||||
return new Login(user: ['id' => $profesor["profesor_id"], 'nombre' => $profesor["profesor_nombre"], 'clave' => $profesor["profesor_clave"]]);
|
||||
}
|
||||
|
||||
$admin = $fs_validaclaveulsa["is_admin"];
|
||||
$periodo = $fs_validaclaveulsa["periodo_id"];
|
||||
|
||||
return new Login($user, $facultad, $rol, $admin, $periodo, $supervisor, $jefe_carrera, false);
|
||||
} else if ($db->where('profesor_clave', preg_replace('/^do0*/', '', $user), 'ilike')->has("profesor")) {
|
||||
$profesor = $db->where('profesor_clave', preg_replace('/^do0*/', '', $user), 'ilike')->getOne("profesor");
|
||||
$user = array(
|
||||
'id' => $profesor["profesor_clave"],
|
||||
'nombre' => $profesor["profesor_nombre"],
|
||||
);
|
||||
$facultad = array(
|
||||
'facultad_id' => null,
|
||||
'facultad' => null,
|
||||
);
|
||||
$rol = array(
|
||||
'id' => null,
|
||||
'rol' => 'Docente'
|
||||
);
|
||||
|
||||
// CREATE A COOKIE FOR THE REST OF THE day for example: 23:00 then duration will be 1 hour
|
||||
setcookie("profesor", $user["id"], strtotime('today midnight') + 86400, "/");
|
||||
return new Login($user, $facultad, $rol, admin: false, periodo_id: null, supervisor: false, jefe_carrera: false, profesor: true);
|
||||
} else
|
||||
return [
|
||||
'error' => true,
|
||||
'msg' => 'Usuario no encontrado'
|
||||
];
|
||||
return ['error' => true, 'msg' => 'Usuario no encontrado'];
|
||||
}
|
||||
|
||||
|
||||
public static function log_out(): void
|
||||
{
|
||||
session_start();
|
||||
|
||||
@@ -3,7 +3,7 @@ require_once 'class/c_login.php';
|
||||
$error = isset($_SESSION["error"]);
|
||||
unset($_SESSION["error"]);
|
||||
if ($error) $errorDesc = "El usuario y/o contraseña son incorrectos.";
|
||||
|
||||
// session_destroy();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="es" prefix="og: http://ogp.me/ns#">
|
||||
|
||||
@@ -16,6 +16,7 @@ const store = reactive({
|
||||
modal_state: "Cargando datos...",
|
||||
justificada: null,
|
||||
fechas_clicked: false,
|
||||
observaciones: false,
|
||||
},
|
||||
facultades: {
|
||||
data: [],
|
||||
@@ -127,6 +128,7 @@ const store = reactive({
|
||||
async justificar() {
|
||||
if (!store.current.justificada)
|
||||
return;
|
||||
store.current.justificada.registro_justificada = true;
|
||||
let data;
|
||||
try {
|
||||
const res = await fetch('action/action_justificar.php', {
|
||||
@@ -276,6 +278,7 @@ createApp({
|
||||
set_justificar(horario_id, profesor_id, registro_fecha_ideal) {
|
||||
store.current.justificada = store.registros.relevant.find((registro) => registro.horario_id === horario_id && registro.profesor_id === profesor_id && registro.registro_fecha_ideal === registro_fecha_ideal);
|
||||
store.current.clone_justificada = JSON.parse(JSON.stringify(store.current.justificada));
|
||||
store.current.observaciones = false;
|
||||
},
|
||||
cancelar_justificacion() {
|
||||
Object.assign(store.current.justificada, store.current.clone_justificada);
|
||||
|
||||
@@ -6,10 +6,15 @@ if (!isset($_SESSION['user'])){
|
||||
}
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
print_r($user);
|
||||
print_r($user->profesor);
|
||||
print_r($user->acceso);//null sin permisos, w o r
|
||||
//profesor, admin, rol, facultad
|
||||
if (!$user->profesor && !$user->admin){
|
||||
die(header('Location: index.php'));
|
||||
}
|
||||
$user->access();
|
||||
|
||||
|
||||
//if (!$user->admin && in_array($user->acceso, ['n']))
|
||||
//die(header('Location: main.php?error=1'));
|
||||
$user->print_to_log('Reposiciones');
|
||||
@@ -42,8 +47,7 @@ else{
|
||||
}
|
||||
|
||||
// Materias
|
||||
//$id_prof = $user->user["id"];
|
||||
$id_prof = 2142;
|
||||
$id_prof = $user->user["id"];
|
||||
//$facultad_id = 28;
|
||||
$materias_rs = $db->query('SELECT * FROM fs_materiasprofesor(:id)', [':id' => $id_prof]);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
<?
|
||||
$redirect = $_SERVER['PHP_SELF'];
|
||||
include "import/html_header.php";
|
||||
// 200.0.0.1/checador_otros/admin_checdor/[this_page].php => ruta = [this_page].php
|
||||
global $user;
|
||||
html_header(
|
||||
"Registro de asistencia - Vicerrectoría Académica",
|
||||
|
||||
@@ -85,8 +85,9 @@ const store = reactive({
|
||||
maxPages: 10,
|
||||
perPage: 10,
|
||||
modal_state: "Cargando datos...",
|
||||
justificada: null,
|
||||
justificada: null as Registro | null,
|
||||
fechas_clicked: false,
|
||||
observaciones: false,
|
||||
},
|
||||
facultades: {
|
||||
data: [] as Facultad[],
|
||||
@@ -205,7 +206,14 @@ const store = reactive({
|
||||
},
|
||||
async justificar() {
|
||||
if (!store.current.justificada) return;
|
||||
let data;
|
||||
store.current.justificada.registro_justificada = true
|
||||
let data: {
|
||||
justificador_nombre: string;
|
||||
justificador_clave: string;
|
||||
justificador_facultad: string;
|
||||
justificador_rol: string;
|
||||
registro_fecha_justificacion: Date;
|
||||
};
|
||||
try {
|
||||
const res = await fetch('action/action_justificar.php', {
|
||||
method: 'PUT',
|
||||
@@ -357,6 +365,7 @@ createApp({
|
||||
set_justificar(horario_id: Number, profesor_id: Number, registro_fecha_ideal: Date) {
|
||||
store.current.justificada = store.registros.relevant.find((registro: Registro) => registro.horario_id === horario_id && registro.profesor_id === profesor_id && registro.registro_fecha_ideal === registro_fecha_ideal)
|
||||
store.current.clone_justificada = JSON.parse(JSON.stringify(store.current.justificada))
|
||||
store.current.observaciones = false
|
||||
},
|
||||
cancelar_justificacion() {
|
||||
Object.assign(store.current.justificada, store.current.clone_justificada)
|
||||
|
||||
Reference in New Issue
Block a user