diff options
| author | polo <ordipolo@gmx.fr> | 2025-06-21 01:44:16 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-06-21 01:44:16 +0200 |
| commit | 8ee3440f204dfc6532a49a05719ba37a8c4df359 (patch) | |
| tree | 03dec8764e55d1a4e1983fcceea8ccd99686989a /public | |
| parent | f0e0b449f2bd6c4417e467b2903b29ad03a9626d (diff) | |
| download | fullcalendar-8ee3440f204dfc6532a49a05719ba37a8c4df359.tar.gz fullcalendar-8ee3440f204dfc6532a49a05719ba37a8c4df359.tar.bz2 fullcalendar-8ee3440f204dfc6532a49a05719ba37a8c4df359.zip | |
échanges client/serveur
Diffstat (limited to 'public')
| -rw-r--r-- | public/index.php | 1 | ||||
| -rw-r--r-- | public/js/calendar.js | 6 | ||||
| -rw-r--r-- | public/js/calendar_admin.js | 13 |
3 files changed, 14 insertions, 6 deletions
diff --git a/public/index.php b/public/index.php index abcef90..99220e8 100644 --- a/public/index.php +++ b/public/index.php | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | <?php | 1 | <?php |
| 2 | session_start(); | 2 | session_start(); |
| 3 | $_SESSION['admin'] = false; | 3 | $_SESSION['admin'] = false; |
| 4 | require '../src/controller/calendar.php'; | ||
| 4 | ?> | 5 | ?> |
| 5 | <!DOCTYPE html> | 6 | <!DOCTYPE html> |
| 6 | <html lang="fr"> | 7 | <html lang="fr"> |
diff --git a/public/js/calendar.js b/public/js/calendar.js index f1c55c4..2193272 100644 --- a/public/js/calendar.js +++ b/public/js/calendar.js | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // js/calendar.js | ||
| 2 | |||
| 1 | document.addEventListener('DOMContentLoaded', function(){ | 3 | document.addEventListener('DOMContentLoaded', function(){ |
| 2 | const calendarEl = document.getElementById('calendar'); | 4 | const calendarEl = document.getElementById('calendar'); |
| 3 | let selected_start_string = null; | 5 | let selected_start_string = null; |
| @@ -34,10 +36,12 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
| 34 | allDayContent: 'Journée', // texte dans la case "toute la journée" | 36 | allDayContent: 'Journée', // texte dans la case "toute la journée" |
| 35 | nowIndicator: true, // barre rouge pour maintenant | 37 | nowIndicator: true, // barre rouge pour maintenant |
| 36 | 38 | ||
| 37 | events: '../src/load-events.php', // fichier PHP qui retourne les événements | 39 | // params en plus: https://fullcalendar.io/docs/events-json-feed |
| 40 | events: 'index.php?action=get_events', // fichier PHP qui retourne les événements | ||
| 38 | 41 | ||
| 39 | select: function(info){ | 42 | select: function(info){ |
| 40 | selected_start_string = info.startStr; // variable "globale" | 43 | selected_start_string = info.startStr; // variable "globale" |
| 44 | hideModal(); | ||
| 41 | }, | 45 | }, |
| 42 | //unselect: function(event, view){}, | 46 | //unselect: function(event, view){}, |
| 43 | 47 | ||
diff --git a/public/js/calendar_admin.js b/public/js/calendar_admin.js index 8fe91a3..a99b069 100644 --- a/public/js/calendar_admin.js +++ b/public/js/calendar_admin.js | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | // js/calendar_admin.js | ||
| 2 | |||
| 1 | document.addEventListener('DOMContentLoaded', function(){ | 3 | document.addEventListener('DOMContentLoaded', function(){ |
| 2 | const calendarEl = document.getElementById('calendar'); | 4 | const calendarEl = document.getElementById('calendar'); |
| 3 | let selected_start_string = null; | 5 | let selected_start_string = null; |
| @@ -35,7 +37,8 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
| 35 | allDayContent: 'Journée', // texte dans la case "toute la journée" | 37 | allDayContent: 'Journée', // texte dans la case "toute la journée" |
| 36 | nowIndicator: true, // barre rouge pour maintenant | 38 | nowIndicator: true, // barre rouge pour maintenant |
| 37 | 39 | ||
| 38 | events: '../src/load-events.php', // fichier PHP qui retourne les événements | 40 | // params en plus: https://fullcalendar.io/docs/events-json-feed |
| 41 | events: 'index.php?action=get_events', // fichier PHP qui retourne les événements | ||
| 39 | 42 | ||
| 40 | select: function(info){ | 43 | select: function(info){ |
| 41 | selected_start_string = info.startStr; // variable "globale" | 44 | selected_start_string = info.startStr; // variable "globale" |
| @@ -220,7 +223,7 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
| 220 | color: event_color | 223 | color: event_color |
| 221 | }; | 224 | }; |
| 222 | 225 | ||
| 223 | fetch('../src/post-ajax.php', { | 226 | fetch('index.php?action=new_event', { |
| 224 | method: 'POST', | 227 | method: 'POST', |
| 225 | headers: { | 228 | headers: { |
| 226 | 'Content-Type': 'application/json', | 229 | 'Content-Type': 'application/json', |
| @@ -255,7 +258,7 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
| 255 | color: event_color | 258 | color: event_color |
| 256 | }; | 259 | }; |
| 257 | 260 | ||
| 258 | fetch('../src/post-ajax.php', { | 261 | fetch('index.php?action=update_event', { |
| 259 | method: 'POST', | 262 | method: 'POST', |
| 260 | headers: { | 263 | headers: { |
| 261 | 'Content-Type': 'application/json', | 264 | 'Content-Type': 'application/json', |
| @@ -318,12 +321,12 @@ document.addEventListener('DOMContentLoaded', function(){ | |||
| 318 | const event_id = document.getElementById('event_id').value; | 321 | const event_id = document.getElementById('event_id').value; |
| 319 | const event = calendar.getEventById(event_id); | 322 | const event = calendar.getEventById(event_id); |
| 320 | 323 | ||
| 321 | fetch('../src/post-ajax.php', { | 324 | fetch('index.php?action=remove_event', { |
| 322 | method: 'POST', | 325 | method: 'POST', |
| 323 | headers: { | 326 | headers: { |
| 324 | 'Content-Type': 'application/json', | 327 | 'Content-Type': 'application/json', |
| 325 | }, | 328 | }, |
| 326 | body: JSON.stringify(event_id), | 329 | body: JSON.stringify({'id': event_id}), |
| 327 | }) | 330 | }) |
| 328 | .then(response => response.json()) | 331 | .then(response => response.json()) |
| 329 | .then(data => { | 332 | .then(data => { |
