2

根据

https://fullcalendar.io/docs/rrule-plugin

rrule 插件应该在 events 模块中

我的事件模块正在使用从数据库源加载

<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, until)。

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']
            );


}
4

1 回答 1

1
'rrule' => array('dtstart' => $row['startdatetimeother'],
'freq' => $row['repeatevent'] )

, 'duration'=>$row['durationevent'] 

事件的持续时间必须放在 rrule 数组之外

于 2019-04-03T22:32:55.870 回答