chore: version inicial del codigo fuente del LMS Estafeta
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
require_once __DIR__.'/auth_guard.php';
|
||||
require_once __DIR__.'/audit.php';
|
||||
require_once "../config.php";
|
||||
|
||||
$idrecurso = isset($_POST['idrecurso']) ? (int)$_POST['idrecurso'] : 0;
|
||||
$catsuperior = isset($_POST['catsuperior']) ? (int)$_POST['catsuperior'] : 0;
|
||||
$nombre = isset($_POST['nombre']) ? $_POST['nombre'] : '';
|
||||
$url = isset($_POST['url']) ? $_POST['url'] : '';
|
||||
$desc = isset($_POST['desc']) ? $_POST['desc'] : '';
|
||||
$clave = isset($_POST['clave']) ? $_POST['clave'] : '';
|
||||
$habilitado = isset($_POST['habilitado']) ? (int)$_POST['habilitado'] : 0;
|
||||
if (isset($_POST['urlimgrecurso']) && $_POST['urlimgrecurso'] !== "") {
|
||||
$urlimgrecurso = $_POST['urlimgrecurso'];
|
||||
} else {
|
||||
$urlimgrecurso = $CFG->wwwroot.'img/icons/211-gift.png';
|
||||
}
|
||||
|
||||
global $link;
|
||||
dbConnect();
|
||||
|
||||
$sql = "UPDATE scormpkg SET idcategoria=?, clave=?, nombre=?, url=?, descripcion=?, habilitado=?, imagen=? WHERE id=?";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
if ($stmt) {
|
||||
mysqli_stmt_bind_param($stmt, 'issssisi', $catsuperior, $clave, $nombre, $url, $desc, $habilitado, $urlimgrecurso, $idrecurso);
|
||||
if (mysqli_stmt_execute($stmt)) {
|
||||
audit_log('recurso_update', 'id=' . $idrecurso . ' nombre=' . $nombre . ' cat=' . $catsuperior . ' url=' . $url);
|
||||
echo "Actualización correcta";
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo "Error al actualizar recurso";
|
||||
}
|
||||
mysqli_stmt_close($stmt);
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo "Error al preparar la consulta";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user