我一直致力于使用资源列开发 fullCalendar 拖放事件。现在,我已经对可拖动事件区域进行了硬编码;现在尝试从数据库中获取它。该数据库以前有两个表 - 资源和事件。事件被删除到日历后,会在事件表中更新。资源列是从数据库中获取的,为了添加新资源,我构建了一个房间按钮,它将新资源保存在资源表中。到目前为止,我的主文件中只有五个可拖动事件,但现在我也正在努力从数据库中获取这些事件。因此,我在数据库中又创建了一个名为draggableevents 的表。该表包含两列 id 和 EventName。
这是代码:
拖拽事件.php
<?php
require "connection.php";
$conn = DB::databaseConnection();
$conn->beginTransaction();
$sql = "Select * FROM DraggableEvents";
$stmt = $conn->prepare($sql);
if ($stmt->execute()) {
while($result = $stmt->fetch(PDO::FETCH_ASSOC));
return $result;
} else {
return null;
}
?>
表单.php
<head>
<link href='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.min.css' rel='stylesheet' />
<script src='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@fullcalendar/interaction@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<link href='https://unpkg.com/@fullcalendar/timeline@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@fullcalendar/resource-timeline@4.4.0/main.min.css' rel='stylesheet' />
<script src='https://unpkg.com/@fullcalendar/timeline@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@fullcalendar/resource-common@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@fullcalendar/resource-timeline@4.4.0/main.min.js'></script>
<link rel="stylesheet" href="css/main.css" media="all">
<link href="main.css" rel="stylesheet">
<script src='main.js'></script>
</head>
上面的代码会产生一个空白的可拖动事件区域。刷新页面时,draggableevents.php 文件似乎没有加载。我在网络面板中没有看到它,因此没有与之相关的错误。
皈依舞
相关分类