212 lines
8.1 KiB
PHP
212 lines
8.1 KiB
PHP
<?php require_once('include/headscript.php'); ?>
|
|
<?php
|
|
// Connessione al database
|
|
$conn = new mysqli($servername, $username, $password, $dbname);
|
|
|
|
if ($conn->connect_error) {
|
|
die("Connessione fallita: " . $conn->connect_error);
|
|
}
|
|
|
|
// ID dell'utente (esempio, da sostituire con l'utente loggato)
|
|
$userid = 1; // Sostituisci con l'ID utente corrente, ad esempio da sessione
|
|
|
|
// Query per ottenere il valore di lessonnotification
|
|
$query = "SELECT lessonnotification FROM auth_users WHERE id = ?";
|
|
$stmt = $conn->prepare($query);
|
|
$stmt->bind_param("i", $userid);
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
$row = $result->fetch_assoc();
|
|
$lessonnotification = $row['lessonnotification'];
|
|
} else {
|
|
$lessonnotification = 'Y'; // Valore di default se l'utente non esiste
|
|
}
|
|
|
|
$stmt->close();
|
|
$conn->close();
|
|
?>
|
|
|
|
<!doctype html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>YogiBook - Opzioni</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta content="YogiBook - Opzioni YogaSoul" name="description" />
|
|
<meta content="Advanced Creative Solutions" name="author" />
|
|
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
|
|
|
<!-- Bootstrap Css -->
|
|
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
|
<!-- Icons Css -->
|
|
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
|
<!-- App Css-->
|
|
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
|
|
|
<style>
|
|
.custom-card {
|
|
margin: 20px auto;
|
|
max-width: 600px;
|
|
background-color: white;
|
|
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.custom-card h2 {
|
|
font-size: 24px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-check {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.form-check-label {
|
|
margin-left: 10px;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.save-button {
|
|
background-color: #1ebf73;
|
|
color: white;
|
|
border: none;
|
|
padding: 8px 16px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s;
|
|
}
|
|
|
|
.save-button:hover {
|
|
background-color: #18a060;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#lessonnotification').on('change', function() {
|
|
var isChecked = $(this).is(':checked') ? 'Y' : 'N';
|
|
|
|
$.ajax({
|
|
url: 'update_lessonnotification.php',
|
|
method: 'POST',
|
|
data: {
|
|
userid: <?php echo $userid; ?>,
|
|
lessonnotification: isChecked
|
|
},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
if (response.success) {
|
|
Swal.fire({
|
|
title: 'Successo!',
|
|
text: 'Impostazione notifiche lezione aggiornata con successo.',
|
|
icon: 'success',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
title: 'Errore!',
|
|
text: 'Errore durante l\'aggiornamento: ' + response.error,
|
|
icon: 'error',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
}
|
|
},
|
|
error: function(xhr, status, error) {
|
|
Swal.fire({
|
|
title: 'Errore!',
|
|
text: 'Errore durante la richiesta AJAX.',
|
|
icon: 'error',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="layout-wrapper">
|
|
<header id="page-topbar" class="isvertical-topbar">
|
|
<div class="navbar-header">
|
|
<div class="d-flex">
|
|
<?php include('include/logoarea.php'); ?>
|
|
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
|
<i class="bx bx-menu align-middle"></i>
|
|
</button>
|
|
<div class="page-title-box align-self-center d-none d-md-block">
|
|
<h4 class="page-title mb-0">Opzioni</h4>
|
|
</div>
|
|
</div>
|
|
<div class="d-flex">
|
|
<?php include('include/languageselection.php'); ?>
|
|
<div class="dropdown d-inline-block">
|
|
<button type="button" class="btn header-item noti-icon" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
<i class="bx bx-search icon-sm align-middle"></i>
|
|
</button>
|
|
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0">
|
|
<form class="p-2">
|
|
<div class="search-box">
|
|
<div class="position-relative">
|
|
<input type="text" class="form-control rounded bg-light border-0" placeholder="Search...">
|
|
<i class="bx bx-search search-icon"></i>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php include('include/profiletopbar.php'); ?>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<?php include('include/sidebar.php'); ?>
|
|
|
|
<header class="ishorizontal-topbar">
|
|
<div class="navbar-header">
|
|
<div class="d-flex"></div>
|
|
</div>
|
|
<div class="topnav">
|
|
<div class="container-fluid">
|
|
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="main-content">
|
|
<div class="page-content">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div class="custom-card">
|
|
<h2>Impostazioni Notifiche</h2>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="lessonnotification" <?php echo $lessonnotification === 'Y' ? 'checked' : ''; ?>>
|
|
<label class="form-check-label" for="lessonnotification">
|
|
Abilita notifiche per le lezioni
|
|
</label>
|
|
<p>con questa notifica riceverai un promemoria qualche ora prima della lezione, che ti permetterà , entro i limiti consentiti, di cancellare o riprogrammare la lezione</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php include('include/footer.php'); ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
|
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
|
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
|
<script src="assets/js/app.js"></script>
|
|
</body>
|
|
|
|
</html>
|