来自源代码的Fullcalendar 4 rrule插件var

时间:2019-03-31 12:13:18

标签: javascript php fullcalendar rrule fullcalendar-4

根据

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


}

1 个答案:

答案 0 :(得分:1)

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

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

事件的持续时间必须置于rrule数组之外