fullcalendar v5でgooglecalendar側にイベントの追加ができません
fullcalendarには予定追加できるのに反映がされません
※実際にはAPIとgooglecalendar idは入力されています
<?php session_start(); require_once '../classes/UserLogic.php'; require_once '../functions.php'; //ログインしているか判定し、していなければ新規登録画面へ返す $result = UserLogic::checkLogin(); if(!$result) { $_SESSION['login_err'] = 'ユーザを登録してログインしてください'; header('Location: signup_form.php'); return; } $login_user =$_SESSION['login_user']; if(isset($_POST['keep'])) { $keep = $_POST['keep']; echo $keep; } ?> <!DOCTYPE html> <html> <head> <title>カレンダー</title> <meta charset='utf-8' /> <link href='../lib/main.css' rel='stylesheet' /> <script src='../lib/main.js'></script> <script> document.addEventListener('DOMContentLoaded', function() { var calendarEl = document.getElementById('calendar'); var calendar = new FullCalendar.Calendar(calendarEl, { headerToolbar: { left: 'prev,next today', center: 'title', right: 'dayGridMonth,listYear' }, navLinks: true, // can click day/week names to navigate views selectable: true, selectMirror: true, select: function(arg) { var title = prompt('Event Title:'); if (title) { calendar.addEvent({ title: title, start: arg.start, end: arg.end, allDay: arg.allDay }) } calendar.unselect() }, displayEventTime: false, // don't show the time column in list view // THIS KEY WON'T WORK IN PRODUCTION!!! // To make your own Google API key, follow the directions here: // http://fullcalendar.io/docs/google_calendar/ googleCalendarApiKey: 'apiキー', // US Holidays events: 'googlecalendar id', eventClick: function(arg) { // opens events in a popup window window.open(arg.event.url, 'google-calendar-event', 'width=700,height=600'); arg.jsEvent.preventDefault() // don't navigate in main tab if (confirm('Are you sure you want to delete this event?')) { arg.event.remove() } }, editable: true, dayMaxEvents: true, loading: function(bool) { document.getElementById('loading').style.display = bool ? 'block' : 'none'; } }); calendar.render(); }); </script> <style> body { margin: 40px 10px; padding: 0; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; font-size: 14px; } #loading { display: none; position: absolute; top: 10px; right: 10px; } #calendar { max-width: 1100px; margin: 0 auto; } </style> </head> <body> <div id='loading'>loading...</div> <div id='calendar'></div> <form action="logout.php" method="POST"> <input type="submit" name="logout" value="ログアウト"> </form> </body> </html>
あなたの回答
tips
プレビュー