More stuff & install system
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
</main>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
[].forEach.call(document.querySelectorAll('.dropimage'), function(img){
|
||||
img.onchange = function(e){
|
||||
var inputfile = this, reader = new FileReader();
|
||||
reader.onloadend = function(){
|
||||
inputfile.style['background-image'] = 'url('+reader.result+')';
|
||||
}
|
||||
reader.readAsDataURL(e.target.files[0]);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
71
public_html/_install.php
Normal file
71
public_html/_install.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if (file_exists("/DATA/SISTEMA_INSTALADO.txt")) {
|
||||
header("Location: /");
|
||||
die();
|
||||
}
|
||||
|
||||
switch ($_GET['form'] ?? '') {
|
||||
case 'create_admin':
|
||||
$admin_user = trim(strtolower($_POST['admin_user'] ?? ''));
|
||||
$admin_password = $_POST['admin_password'] ?? '';
|
||||
if (empty($admin_user) || empty($admin_password)) {
|
||||
die("El nombre de usuario y la contraseña son obligatorios.");
|
||||
}
|
||||
$password_hash = password_hash($admin_password, PASSWORD_DEFAULT);
|
||||
$admin_userdata = [
|
||||
'display_name' => 'Administrador',
|
||||
'email' => "$admin_user@nomail.arpa",
|
||||
'permissions' => ['*', 'sysadmin:access', 'entreaulas:access'],
|
||||
'password_hash' => $password_hash
|
||||
];
|
||||
if (!is_dir("/DATA/Usuarios")) {
|
||||
mkdir("/DATA/Usuarios", 0755, true);
|
||||
}
|
||||
file_put_contents("/DATA/Usuarios/$admin_user.json", json_encode($admin_userdata, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
file_put_contents("/DATA/SISTEMA_INSTALADO.txt", "Sistema instalado el ".date("Y-m-d H:i:s")."\n");
|
||||
header("Location: /_login.php");
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($_GET["step"]) {
|
||||
case "0":
|
||||
default:
|
||||
require_once "_incl/pre-body.php";
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Instalación de Axia4</h1>
|
||||
<span>Bienvenidx al asistente de instalación de Axia4. Por favor, sigue los pasos para completar la configuración inicial del sistema.</span>
|
||||
<ol>
|
||||
<li>Crear el usuario administrador.</li>
|
||||
<!--<li>Configurar los ajustes básicos del sistema.</li>-->
|
||||
<li>Finalizar la instalación y acceder al sistema.</li>
|
||||
</ol>
|
||||
<a href="/_install.php?step=1" class="button">Comenzar instalación</a>
|
||||
</div>
|
||||
<?php
|
||||
require_once "_incl/post-body.php";
|
||||
break;
|
||||
case "1":
|
||||
require_once "_incl/pre-body.php";
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Crear usuario administrador</h1>
|
||||
<form method="post" action="?form=create_admin">
|
||||
<label>
|
||||
<b>Nombre de usuario:</b><br>
|
||||
<input required type="text" name="admin_user" placeholder="Ej: AdminUser">
|
||||
</label><br><br>
|
||||
<label>
|
||||
<b>Contraseña:</b><br>
|
||||
<input required type="password" name="admin_password" placeholder="Ej: StrongPassword123">
|
||||
</label><br><br>
|
||||
<button type="submit">Crear usuario administrador</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
require_once "_incl/post-body.php";
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -33,6 +33,10 @@ if (isset($_POST["user"])) {
|
||||
}
|
||||
|
||||
}
|
||||
if (!file_exists("/DATA/SISTEMA_INSTALADO.txt")) {
|
||||
header("Location: /_install.php");
|
||||
die();
|
||||
}
|
||||
require_once "_incl/pre-body.php"; ?>
|
||||
<div class="card pad">
|
||||
|
||||
|
||||
37
public_html/entreaulas/_filefetch.php
Executable file
37
public_html/entreaulas/_filefetch.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
ini_set("display_errors", 0);
|
||||
ob_implicit_flush(true);
|
||||
ob_end_flush();
|
||||
ini_set('memory_limit', '1G');
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
|
||||
switch ($_GET["type"]) {
|
||||
case "panel_actividades":
|
||||
$centro = str_replace('..', '_', $_GET["centro"] ?? '');
|
||||
$activity = str_replace('..', '_', $_GET["activity"] ?? '');
|
||||
$relpath = "entreaulas/Centros/$centro/Panel/Actividades/$activity/photo.jpg";
|
||||
break;
|
||||
}
|
||||
$path = "/DATA/$relpath";
|
||||
$uripath = "/$relpath";
|
||||
if (!file_exists($path) || !is_file($path)) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
die("File not found");
|
||||
}
|
||||
$mime = mime_content_type($path);
|
||||
|
||||
// Check if thumbnail is requested
|
||||
if (file_exists($path . ".thumbnail") && $_GET["thumbnail"] == "1") {
|
||||
$path .= ".thumbnail";
|
||||
$uripath .= ".thumbnail";
|
||||
$mime = "image/jpeg";
|
||||
}
|
||||
header("Content-Type: " . $mime);
|
||||
header('Content-Length: ' . filesize($path));
|
||||
header('Cache-Control: max-age=7200');
|
||||
header("X-Accel-Redirect: $uripath");
|
||||
|
||||
// // stream the file
|
||||
// $fp = fopen($path, 'rb');
|
||||
// fpassthru($fp);
|
||||
exit;
|
||||
@@ -53,7 +53,7 @@ switch ($_GET["action"]) {
|
||||
Calendario
|
||||
</a>
|
||||
<!-- Actividades -->
|
||||
<a onclick="document.getElementById('click-sound').play()" href="?action=activities&aulario=<?php echo urlencode($_GET['aulario'] ?? ''); ?>" class="button grid-item">
|
||||
<a onclick="document.getElementById('click-sound').play()" href="?action=actividades&aulario=<?php echo urlencode($_GET['aulario'] ?? ''); ?>" class="button grid-item">
|
||||
<span class="iconify" style="font-size: 125px" data-icon="mdi-school"></span>
|
||||
<br>
|
||||
Actividades
|
||||
@@ -93,6 +93,52 @@ switch ($_GET["action"]) {
|
||||
}, 250); window.onresize = () => {msnry.layout()}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
break;
|
||||
case "actividades":
|
||||
// Actividades, establecidas en /DATA/entreaulas/Centros/$centro/Panel/Actividades.json
|
||||
// Formato: {"NOMBRE_ACTIVIDAD": {"Foto": "url"}}
|
||||
$actividades = json_decode(file_get_contents("/DATA/entreaulas/Centros/" . $_SESSION["auth_data"]["entreaulas"]["centro"] . "/Panel/Actividades.json"), true);
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Actividades</h1>
|
||||
<span>
|
||||
Aquí podrás ver y seleccionar las actividades del día para el aulario.
|
||||
</span>
|
||||
</div>
|
||||
<div id="grid">
|
||||
<?php foreach ($actividades as $actividad_name => $actividad_data) { ?>
|
||||
<a class="button grid-item">
|
||||
<img src="<?php echo htmlspecialchars($actividad_data["Foto"]); ?>" height="125">
|
||||
<br>
|
||||
<?php echo htmlspecialchars($actividad_name); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<style>
|
||||
.grid-item {
|
||||
margin-bottom: 10px !important;
|
||||
padding: 15px;
|
||||
width: 250px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.grid-item img {
|
||||
margin: 0 auto;
|
||||
height: 125px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var msnry = new Masonry('#grid', {
|
||||
"columnWidth": 250,
|
||||
"itemSelector": ".grid-item",
|
||||
"gutter": 10,
|
||||
"transitionDuration": 0
|
||||
});
|
||||
setTimeout(() => {
|
||||
msnry.layout()
|
||||
}, 250); window.onresize = () => {msnry.layout()}
|
||||
</script>
|
||||
<?php
|
||||
break;
|
||||
case "menu":
|
||||
@@ -244,9 +290,6 @@ switch ($_GET["action"]) {
|
||||
|
||||
<?php
|
||||
break;
|
||||
case "activities":
|
||||
// Actividades
|
||||
break;
|
||||
case "calendar":
|
||||
// Calendario, elegir el dia, mes, y dia-de-la-semana.
|
||||
$mes_correcto = date('m');
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-club.png" alt="Logo Club">
|
||||
<b>La web del club</b>
|
||||
<b>No disponible</b>
|
||||
<a href="/club/" class="button">Acceso publico</a>
|
||||
</div>
|
||||
<div class="card grid-item">
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<a href="/sysadmin/users.php" class="button pseudo">Gestión de Usuarios</a>
|
||||
<a href="/sysadmin/settings.php" class="button pseudo">Configuración del Sistema</a>
|
||||
<a href="/sysadmin/logs.php" class="button pseudo">Ver Registros</a>
|
||||
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
require_once "_incl/auth_redir.php";
|
||||
require_once "_incl/pre-body.php";
|
||||
switch ($_GET["form"]) {
|
||||
case "create":
|
||||
$user_data = $_SESSION["auth_data"];
|
||||
$centro_id = $user_data["entreaulas"]["centro"];
|
||||
$centro_id = $_POST["centro"];
|
||||
if (empty($centro_id) || !is_dir("/DATA/entreaulas/Centros/$centro_id")) {
|
||||
die("Centro no válido.");
|
||||
}
|
||||
$aulario_id = uniqid("aulario_");
|
||||
$aulario_data = [
|
||||
"name" => $_POST["name"],
|
||||
@@ -20,6 +22,7 @@ switch ($_GET["form"]) {
|
||||
break;
|
||||
}
|
||||
|
||||
require_once "_incl/pre-body.php";
|
||||
switch ($_GET["action"]) {
|
||||
case "new":
|
||||
?>
|
||||
@@ -29,13 +32,26 @@ switch ($_GET["action"]) {
|
||||
Aquí puedes crear un nuevo aulario para el centro que administras.
|
||||
</span>
|
||||
<form method="post" action="?form=create">
|
||||
<label>
|
||||
<b>Centro:</b><br>
|
||||
<select required name="centro">
|
||||
<option value="">-- Selecciona un centro --</option>
|
||||
<?php
|
||||
foreach (glob("/DATA/entreaulas/Centros/*", GLOB_ONLYDIR) as $centro_folder) {
|
||||
$centro_id = basename($centro_folder);
|
||||
$selected = ($centro_id == $_SESSION["auth_data"]["entreaulas"]["centro"]) ? "selected" : "";
|
||||
echo '<option value="' . htmlspecialchars($centro_id) . '" ' . $selected . '>' . htmlspecialchars($centro_id) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</label><br><br>
|
||||
<label>
|
||||
Nombre del Aulario:<br>
|
||||
<input required type="text" name="name" placeholder="Ej: Aulario Principal">
|
||||
</label><br><br>
|
||||
<label>
|
||||
Icono del Aulario (URL):<br>
|
||||
<input type="url" name="icon" placeholder="Ej: https://example.com/icon.png" value="/static/logo-entreaulas.png">
|
||||
<input type="text" name="icon" placeholder="Ej: https://example.com/icon.png" value="/static/logo-entreaulas.png">
|
||||
</label><br><br>
|
||||
<button type="submit">Crear Aulario</button>
|
||||
</form>
|
||||
@@ -43,6 +59,33 @@ switch ($_GET["action"]) {
|
||||
|
||||
<?php
|
||||
break;
|
||||
case "edit":
|
||||
$aulario_id = $_GET["aulario"];
|
||||
$centro_id = $_GET["centro"];
|
||||
$aulario_file = "/DATA/entreaulas/Centros/$centro_id/Aularios/$aulario_id.json";
|
||||
if (!file_exists($aulario_file)) {
|
||||
die("Aulario no encontrado.");
|
||||
}
|
||||
$aulario_data = json_decode(file_get_contents($aulario_file), true);
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Editar Aulario: <?php echo htmlspecialchars($aulario_data['name'] ?? 'Sin Nombre'); ?></h1>
|
||||
<form method="post" action="?form=save_edit">
|
||||
<label>
|
||||
Nombre del Aulario:<br>
|
||||
<input required type="text" name="name" value="<?php echo htmlspecialchars($aulario_data['name'] ?? ''); ?>">
|
||||
</label><br><br>
|
||||
<label>
|
||||
Icono del Aulario (URL):<br>
|
||||
<input type="text" name="icon" value="<?php echo htmlspecialchars($aulario_data['icon'] ?? '/static/logo-entreaulas.png'); ?>">
|
||||
</label><br><br>
|
||||
<input type="hidden" name="aulario_id" value="<?php echo htmlspecialchars($aulario_id); ?>">
|
||||
<input type="hidden" name="centro_id" value="<?php echo htmlspecialchars($centro_id); ?>">
|
||||
<button type="submit">Guardar Cambios</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case "index":
|
||||
default:
|
||||
?>
|
||||
@@ -52,6 +95,31 @@ switch ($_GET["action"]) {
|
||||
Desde esta sección puedes administrar los aularios asociados al centro que estás administrando.
|
||||
</span>
|
||||
<a href="?action=new" class="button">Nuevo Aulario</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Icono</th>
|
||||
<th>Nombre</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$user_data = $_SESSION["auth_data"];
|
||||
$centro_filter = $_GET['centro'] ?? "*";
|
||||
$aulas_filelist = glob("/DATA/entreaulas/Centros/$centro_filter/Aularios/*.json");
|
||||
foreach ($aulas_filelist as $aula_file) {
|
||||
$aula_data = json_decode(file_get_contents($aula_file), true);
|
||||
$centro_id = basename(dirname(dirname($aula_file)));
|
||||
echo '<tr>';
|
||||
echo '<td><img src="' . htmlspecialchars($aula_data['icon'] ?? '/static/logo-entreaulas.png') . '" alt="Icono" style="height: 50px;"></td>';
|
||||
echo '<td>' . htmlspecialchars($aula_data['name'] ?? 'Sin Nombre') . '<br><small>' . $centro_id . '</small></td>';
|
||||
echo '<td><a href="?action=edit&aulario=' . urlencode(basename($aula_file, ".json")) . '¢ro=' . urlencode($centro_id) . '" class="button">Gestionar</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
|
||||
230
public_html/sysadmin/centros.php
Normal file
230
public_html/sysadmin/centros.php
Normal file
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
require_once "_incl/auth_redir.php";
|
||||
switch ($_GET["form"]) {
|
||||
case "create":
|
||||
$centro_id = $_POST["name"];
|
||||
if (empty($centro_id)) {
|
||||
die("Nombre del centro no proporcionado.");
|
||||
}
|
||||
$centro_path = "/DATA/entreaulas/Centros/$centro_id";
|
||||
if (is_dir($centro_path)) {
|
||||
die("El centro ya existe.");
|
||||
}
|
||||
mkdir($centro_path, 0777, true);
|
||||
header("Location: ?action=index");
|
||||
exit();
|
||||
break;
|
||||
case "create_activity":
|
||||
ini_set('memory_limit', '512M');
|
||||
ini_set("display_errors", 1);
|
||||
ini_set('upload_max_filesize', '256M');
|
||||
ini_set('post_max_size', '256M');
|
||||
$centro_id = $_GET['centro'] ?? '';
|
||||
$centro_path = "/DATA/entreaulas/Centros/$centro_id";
|
||||
if (!is_dir($centro_path)) {
|
||||
die("Centro no válido.");
|
||||
}
|
||||
$activity_name = $_POST["name"] ?? '';
|
||||
if (empty($activity_name)) {
|
||||
die("Nombre de la actividad no proporcionado.");
|
||||
}
|
||||
$activity_photo = $_FILES["photo"] ?? null;
|
||||
if ($activity_photo === null || $activity_photo["error"] !== UPLOAD_ERR_OK) {
|
||||
die("Error al subir la foto.");
|
||||
}
|
||||
$activity_path = "$centro_path/Panel/Actividades/$activity_name";
|
||||
if (is_dir($activity_path)) {
|
||||
die("La actividad ya existe.");
|
||||
}
|
||||
mkdir($activity_path, 0777, true);
|
||||
$photo_path = "$activity_path/photo.jpg";
|
||||
move_uploaded_file($activity_photo["tmp_name"], $photo_path);
|
||||
header("Location: ?action=edit¢ro=" . urlencode($centro_id));
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
|
||||
require_once "_incl/pre-body.php";
|
||||
switch ($_GET["action"]) {
|
||||
case "edit_activity":
|
||||
$centro_id = $_GET['centro'] ?? '';
|
||||
$activity_name = $_GET['activity'] ?? '';
|
||||
$activity_path = "/DATA/entreaulas/Centros/$centro_id/Panel/Actividades/$activity_name";
|
||||
if (!is_dir($activity_path)) {
|
||||
die("Actividad no válida.");
|
||||
}
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Gestión de la Actividad: <?php echo htmlspecialchars($activity_name); ?></h1>
|
||||
<span>
|
||||
Desde esta sección puedes administrar la actividad seleccionada del panel del centro <?php echo htmlspecialchars($centro_id); ?>.
|
||||
</span>
|
||||
<form method="post" action="?form=edit_activity¢ro=<?php echo urlencode($centro_id); ?>&activity=<?php echo urlencode($activity_name); ?>" enctype="multipart/form-data">
|
||||
<div style="width: 200px;">
|
||||
<label class="dropimage" style="background-image: url('<?php
|
||||
$image_path = "$activity_path/photo.jpg";
|
||||
$image_fetchpath = file_exists($image_path) ? "/entreaulas/_filefetch.php?type=panel_actividades¢ro=" . urlencode($centro_id) . "&activity=" . urlencode($activity_name) : '/static/logo-entreaulas.png';
|
||||
echo htmlspecialchars($image_fetchpath);
|
||||
?>');">
|
||||
<input title="Drop image or click me" type="file">
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit">Guardar Cambios</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case "new_activity":
|
||||
$centro_id = $_GET['centro'] ?? '';
|
||||
$centro_path = "/DATA/entreaulas/Centros/$centro_id";
|
||||
if (!is_dir($centro_path)) {
|
||||
die("Centro no válido.");
|
||||
}
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Nueva Actividad del Panel</h1>
|
||||
<span>
|
||||
Aquí puedes crear una nueva actividad para el panel del centro <?php echo htmlspecialchars($centro_id); ?>.
|
||||
</span>
|
||||
<form method="post" action="?form=create_activity¢ro=<?php echo urlencode($centro_id); ?>" enctype="multipart/form-data">
|
||||
<label>
|
||||
Nombre de la actividad:<br>
|
||||
<input required type="text" name="name" placeholder="Ej: Biblioteca">
|
||||
</label><br><br>
|
||||
<label>
|
||||
Foto:<br>
|
||||
<input required type="file" name="photo" accept="image/*">
|
||||
</label><br><br>
|
||||
<button type="submit">Crear Actividad</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case "new":
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Nuevo Centro</h1>
|
||||
<span>
|
||||
Aquí puedes crear un nuevo centro para el sistema.
|
||||
</span>
|
||||
<form method="post" action="?form=create">
|
||||
<label>
|
||||
ID del centro:<br>
|
||||
<input required type="text" name="name" placeholder="Ej: Centro-Principal-001">
|
||||
</label><br><br>
|
||||
<button type="submit">Crear Centro</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
break;
|
||||
case "edit":
|
||||
$centro_id = $_GET['centro'] ?? '';
|
||||
$centro_path = "/DATA/entreaulas/Centros/$centro_id";
|
||||
if (!is_dir($centro_path)) {
|
||||
die("Centro no válido.");
|
||||
}
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Gestión del Centro: <?php echo htmlspecialchars($centro_id); ?></h1>
|
||||
<span>
|
||||
Desde esta sección puedes administrar el centro seleccionado.
|
||||
</span>
|
||||
</div>
|
||||
<div class="card pad">
|
||||
<h2>Aularios</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Icono</th>
|
||||
<th>Nombre</th>
|
||||
<th>
|
||||
<a href="/sysadmin/aularios.php?action=new¢ro=<?php echo urlencode($centro_id); ?>" class="button pseudo" style="background: white; color: black;">+ Nuevo</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$aulas_filelist = glob("/DATA/entreaulas/Centros/$centro_id/Aularios/*.json");
|
||||
foreach ($aulas_filelist as $aula_file) {
|
||||
$aula_data = json_decode(file_get_contents($aula_file), true);
|
||||
echo '<tr>';
|
||||
echo '<td><img src="' . htmlspecialchars($aula_data['icon'] ?? '/static/logo-entreaulas.png') . '" alt="Icono" style="height: 50px;"></td>';
|
||||
echo '<td>' . htmlspecialchars($aula_data['name'] ?? 'Sin Nombre') . '</td>';
|
||||
echo '<td><a href="/sysadmin/aularios.php?action=edit&aulario=' . urlencode(basename($aula_file, ".json")) . '¢ro=' . urlencode($centro_id) . '" class="button">Gestionar</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card pad">
|
||||
<h2>Actividades del panel</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Foto</th>
|
||||
<th>Nombre</th>
|
||||
<th>
|
||||
<a href="?action=new_activity¢ro=<?php echo urlencode($centro_id); ?>" class="button pseudo" style="background: white; color: black;">+ Nuevo</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$activities = glob("/DATA/entreaulas/Centros/$centro_id/Panel/Actividades/*", GLOB_ONLYDIR);
|
||||
foreach ($activities as $activity_path) {
|
||||
$activity_name = basename($activity_path);
|
||||
$image_path = "/DATA/entreaulas/Centros/$centro_id/Panel/Actividades/" . basename($activity_name) . "/photo.jpg";
|
||||
$image_fetchpath = file_exists($image_path) ? "/entreaulas/_filefetch.php?type=panel_actividades¢ro=" . urlencode($centro_id) . "&activity=" . urlencode(basename($activity_name)) : '/static/logo-entreaulas.png';
|
||||
echo '<tr>';
|
||||
echo '<td><img src="' . htmlspecialchars($image_fetchpath) . '" alt="Foto" style="height: 50px;"></td>';
|
||||
echo '<td>' . htmlspecialchars($activity_name) . '</td>';
|
||||
echo '<td><a href="?action=edit_activity¢ro=' . urlencode($centro_id) . '&activity=' . urlencode($activity_name) . '" class="button">Gestionar</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
break;
|
||||
case "index":
|
||||
default:
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Gestión de Centros</h1>
|
||||
<span>
|
||||
Desde esta sección puedes administrar los centros asociados al sistema.
|
||||
</span>
|
||||
<a href="?action=new" class="button">Nuevo Centro</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nombre</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$user_data = $_SESSION["auth_data"];
|
||||
$centros_filelist = glob("/DATA/entreaulas/Centros/*");
|
||||
foreach ($centros_filelist as $centro_folder) {
|
||||
$centro_id = basename($centro_folder);
|
||||
echo '<tr>';
|
||||
echo '<td>' . htmlspecialchars($centro_id) . '</td>';
|
||||
echo '<td><a href="?action=edit¢ro=' . urlencode($centro_id) . '" class="button">Gestionar</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once "_incl/post-body.php"; ?>
|
||||
@@ -5,4 +5,48 @@ require_once "_incl/pre-body.php"; ?>
|
||||
<h1>Administración del Sistema</h1>
|
||||
<p>Bienvenido a la sección de administración del sistema. Aquí puedes gestionar las configuraciones y usuarios del sistema.</p>
|
||||
</div>
|
||||
<div id="grid">
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-entreaulas.png" alt="Logo EntreAulas">
|
||||
<b>Gestión de Centros</b>
|
||||
<span>Administra los centros del sistema EntreAulas.</span>
|
||||
<a href="/sysadmin/centros.php" class="button">Gestionar Centros</a>
|
||||
</div>
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-entreaulas.png" alt="Logo EntreAulas">
|
||||
<b>Gestión de Aularios</b>
|
||||
<span>Administra los aularios dentro de los centros.</span>
|
||||
<a href="/sysadmin/aularios.php" class="button">Gestionar Aularios</a>
|
||||
</div>
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo.png" alt="Logo Usuarios">
|
||||
<b>Gestión de Usuarios</b>
|
||||
<span>Administra los usuarios del sistema.</span>
|
||||
<a href="/sysadmin/users.php" class="button">Gestionar Usuarios</a>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.grid-item {
|
||||
margin-bottom: 10px !important;
|
||||
padding: 15px;
|
||||
width: 250px;
|
||||
text-align: center;
|
||||
}
|
||||
.grid-item img {
|
||||
margin: 0 auto;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var msnry = new Masonry('#grid', {
|
||||
"columnWidth": 250,
|
||||
"itemSelector": ".grid-item",
|
||||
"gutter": 10,
|
||||
"transitionDuration": 0
|
||||
});
|
||||
setTimeout(() => {msnry.layout()}, 250)
|
||||
setInterval(() => {
|
||||
msnry.layout()
|
||||
}, 1000);
|
||||
</script>
|
||||
<?php require_once "_incl/post-body.php"; ?>
|
||||
Reference in New Issue
Block a user