根据
https://fullcalendar.io/docs/rrule-plugin
rrule插件应位于事件模块中
我的事件模块正在使用以下方式从数据库源加载
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
calendar = new FullCalendar.Calendar(calendarEl, {
plugins: ['bootstrap','interaction', 'dayGrid', 'timeGrid', 'list',
'rrulePlugin' ],
header: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
},
Duration: '00:15:00',
nowIndicator: true,
defaultDate: new Date(),
editable: true,
eventLimit: true, // allow "more" link when too many events
events:
{
url: 'renderevent.php',
method: 'POST',
rrule: { }
}
});
calendar.render();
});
</script>
我从下面的phpcode中获取(id,title,start,end),但是我又如何从同一模块中获取rrule参数(freq,interval,dstart和直到)。
while( $row = mysqli_fetch_array($resultset) ) {
if (($row['eventtype'] ==1) && ($row['repeatevent']=="never" )){
$json[] = array (
'id' => $row['id'],
'title' => $row['title'],
// 'eventtype'=> $row['eventtype'],
'start'=> $row['startdatetimeother'],
'end'=> $row['enddatetimeother'],
'color'=> "#ff9999",
'freq' => $row['repeatevent'],
);
}
if (($row['eventtype'] ==1) && ($row['repeatevent']!="never" )){
$json[] = array (
'id' => $row['id'],
'title' => $row['title'],
// 'eventtype'=> $row['eventtype'],
'start'=> $row['startdatetimeother'],
'end'=> $row['enddatetimeother'],
'color'=> "#ff9999",
'freq' => $row['repeatevent'],
'interval' => $repeatinterval,
'dtstart' => $row['startdatetimeother'],
'until' => $row['enddatetimeother']
);
}
答案 0 :(得分:1)
'rrule' => array('dtstart' => $row['startdatetimeother'],
'freq' => $row['repeatevent'] )
, 'duration'=>$row['durationevent']
事件的持续时间必须置于rrule数组之外