Nome della materia corto

This commit is contained in:
2025-11-01 10:24:01 +01:00
parent 59359d33d3
commit 5053db033f

View File

@@ -73,7 +73,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
// Cerca/crea materia // Cerca/crea materia
$stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND room = ?"); $stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND room = ?");
$stmt->bind_param("sss", $materiaCompleta, $docente, $laboratorio); $stmt->bind_param("sss", $materia, $docente, $laboratorio);
$stmt->execute(); $stmt->execute();
$result = $stmt->get_result(); $result = $stmt->get_result();
@@ -81,11 +81,11 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
$subject_id = $result->fetch_assoc()['id']; $subject_id = $result->fetch_assoc()['id'];
} else { } else {
$stmt2 = $conn->prepare("INSERT INTO subjects (name, teacher, room) VALUES (?, ?, ?)"); $stmt2 = $conn->prepare("INSERT INTO subjects (name, teacher, room) VALUES (?, ?, ?)");
$stmt2->bind_param("sss", $materiaCompleta, $docente, $laboratorio); $stmt2->bind_param("sss", $materia, $docente, $laboratorio);
$stmt2->execute(); $stmt2->execute();
$subject_id = $conn->insert_id; $subject_id = $conn->insert_id;
$stmt2->close(); $stmt2->close();
$materie_create[] = "$materiaCompleta ($docente - $laboratorio)"; $materie_create[] = "$materia ($docente - $laboratorio)";
} }
$stmt->close(); $stmt->close();
@@ -105,10 +105,10 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
// Cerca/crea materia // Cerca/crea materia
if ($laboratorio) { if ($laboratorio) {
$stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND room = ?"); $stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND room = ?");
$stmt->bind_param("sss", $materiaCompleta, $docente, $laboratorio); $stmt->bind_param("sss", $materia, $docente, $laboratorio);
} else { } else {
$stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND (room IS NULL OR room = '')"); $stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND (room IS NULL OR room = '')");
$stmt->bind_param("ss", $materiaCompleta, $docente); $stmt->bind_param("ss", $materia, $docente);
} }
$stmt->execute(); $stmt->execute();
@@ -118,11 +118,11 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
$subject_id = $result->fetch_assoc()['id']; $subject_id = $result->fetch_assoc()['id'];
} else { } else {
$stmt2 = $conn->prepare("INSERT INTO subjects (name, teacher, room) VALUES (?, ?, ?)"); $stmt2 = $conn->prepare("INSERT INTO subjects (name, teacher, room) VALUES (?, ?, ?)");
$stmt2->bind_param("sss", $materiaCompleta, $docente, $laboratorio); $stmt2->bind_param("sss", $materia, $docente, $laboratorio);
$stmt2->execute(); $stmt2->execute();
$subject_id = $conn->insert_id; $subject_id = $conn->insert_id;
$stmt2->close(); $stmt2->close();
$materie_create[] = "$materiaCompleta ($docente" . ($laboratorio ? " - $laboratorio" : "") . ")"; $materie_create[] = "$materia ($docente" . ($laboratorio ? " - $laboratorio" : "") . ")";
} }
$stmt->close(); $stmt->close();
@@ -140,7 +140,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
foreach ($docenti as $docente) { foreach ($docenti as $docente) {
$stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND room = ?"); $stmt = $conn->prepare("SELECT id FROM subjects WHERE name = ? AND teacher = ? AND room = ?");
$stmt->bind_param("sss", $materiaCompleta, $docente, $laboratorio); $stmt->bind_param("sss", $materia, $docente, $laboratorio);
$stmt->execute(); $stmt->execute();
$result = $stmt->get_result(); $result = $stmt->get_result();
@@ -148,11 +148,11 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
$subject_id = $result->fetch_assoc()['id']; $subject_id = $result->fetch_assoc()['id'];
} else { } else {
$stmt2 = $conn->prepare("INSERT INTO subjects (name, teacher, room) VALUES (?, ?, ?)"); $stmt2 = $conn->prepare("INSERT INTO subjects (name, teacher, room) VALUES (?, ?, ?)");
$stmt2->bind_param("sss", $materiaCompleta, $docente, $laboratorio); $stmt2->bind_param("sss", $materia, $docente, $laboratorio);
$stmt2->execute(); $stmt2->execute();
$subject_id = $conn->insert_id; $subject_id = $conn->insert_id;
$stmt2->close(); $stmt2->close();
$materie_create[] = "$materiaCompleta ($docente - $laboratorio)"; $materie_create[] = "$materia ($docente - $laboratorio)";
} }
$stmt->close(); $stmt->close();