-
Notifications
You must be signed in to change notification settings - Fork 0
/
vistas.php
38 lines (29 loc) · 936 Bytes
/
vistas.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use SARCO\App;
use SARCO\Modelos\Periodo;
require_once __DIR__ . '/base de datos.php';
App::view()->path = ROOT . '/vistas';
App::view()->preserveVars = false;
App::view()->set('vistas', App::view());
App::view()->set('root', str_replace('index.php', '', $_SERVER['SCRIPT_NAME']));
App::view()->set('estudiantes', []);
App::view()->set('periodoActual', bd()->query("
SELECT id, anio_inicio as inicio, fecha_registro as fechaRegistro
FROM periodos ORDER BY inicio DESC LIMIT 1
")->fetchObject(Periodo::class) ?: null);
App::view()->set(
'puedeRestaurar',
file_exists(__DIR__ . '/../../base de datos/sarco.db.backup')
);
/**
* Opcionalmente añade una ruta a un archivo `JS` y devuelve todas las rutas
* @return string[]
*/
function scripts(?string $rutaAlScript = null): array {
/** @var string[] */
static $rutas = [];
if (is_string($rutaAlScript)) {
$rutas[] = $rutaAlScript;
}
return $rutas;
}