Feature: Agregar selección de idiomas por plataforma (Telegram/Discord)
- Agregar columnas telegram_enabled y discord_enabled a supported_languages - Nueva interfaz en admin/languages.php con checkboxes para Telegram y Discord - Los bots ahora solo muestran botones de traducción para los idiomas seleccionados por plataforma
This commit is contained in:
@@ -83,6 +83,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
|
||||
} catch (Exception $e) {
|
||||
$syncError = "Error al conectar con LibreTranslate: " . $e->getMessage() . ". Verifica que el servicio esté configurado correctamente en el archivo .env";
|
||||
}
|
||||
|
||||
} elseif ($action === 'toggle_telegram') {
|
||||
$id = (int) $_POST['id'];
|
||||
$stmt = $pdo->prepare("UPDATE supported_languages SET telegram_enabled = NOT telegram_enabled WHERE id = ? AND is_active = TRUE");
|
||||
$stmt->execute([$id]);
|
||||
logActivity(getCurrentUserId(), 'toggle_telegram_language', "Idioma Telegram ID: $id");
|
||||
header('Location: languages.php');
|
||||
exit;
|
||||
|
||||
} elseif ($action === 'toggle_discord') {
|
||||
$id = (int) $_POST['id'];
|
||||
$stmt = $pdo->prepare("UPDATE supported_languages SET discord_enabled = NOT discord_enabled WHERE id = ? AND is_active = TRUE");
|
||||
$stmt->execute([$id]);
|
||||
logActivity(getCurrentUserId(), 'toggle_discord_language', "Idioma Discord ID: $id");
|
||||
header('Location: languages.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,6 +310,8 @@ require_once __DIR__ . '/../templates/header.php';
|
||||
<th><?= t('Código') ?></th>
|
||||
<th><?= t('Nombre') ?></th>
|
||||
<th><?= t('Estado') ?></th>
|
||||
<th><?= t('Telegram') ?></th>
|
||||
<th><?= t('Discord') ?></th>
|
||||
<th><?= t('Acciones') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -310,6 +328,32 @@ require_once __DIR__ . '/../templates/header.php';
|
||||
<span class="badge bg-secondary"><?= t('Inactivo') ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($lang['is_active']): ?>
|
||||
<form method="POST" class="d-inline">
|
||||
<input type="hidden" name="action" value="toggle_telegram">
|
||||
<input type="hidden" name="id" value="<?= $lang['id'] ?>">
|
||||
<button type="submit" class="btn btn-sm btn-outline-<?= $lang['telegram_enabled'] ? 'info' : 'secondary' ?>">
|
||||
<i class="bi bi-<?= $lang['telegram_enabled'] ? 'check-circle-fill' : 'circle' ?>"></i>
|
||||
</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<span class="text-muted"><i class="bi bi-circle"></i></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($lang['is_active']): ?>
|
||||
<form method="POST" class="d-inline">
|
||||
<input type="hidden" name="action" value="toggle_discord">
|
||||
<input type="hidden" name="id" value="<?= $lang['id'] ?>">
|
||||
<button type="submit" class="btn btn-sm btn-outline-<?= $lang['discord_enabled'] ? 'primary' : 'secondary' ?>">
|
||||
<i class="bi bi-<?= $lang['discord_enabled'] ? 'check-circle-fill' : 'circle' ?>"></i>
|
||||
</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<span class="text-muted"><i class="bi bi-circle"></i></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<form method="POST" class="d-inline">
|
||||
<input type="hidden" name="action" value="toggle_status">
|
||||
|
||||
Reference in New Issue
Block a user