2

According to

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

The rrule plugin should be in the events module

My events module is being loaded form a database source using

<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>

I source the (id , title , start , end) from the following phpcode , but how do i also source the rrule parameters (freq,interval, dstart, until) from within the same module.

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


}
ADyson
  • 57,178
  • 14
  • 51
  • 63
Ryan
  • 159
  • 11
  • 2
    `$json[] = array ( 'id' => $row['id'], 'title' => $row['title'], // 'eventtype'=> $row['eventtype'], 'start'=> $row['startdatetimeother'], 'end'=> $row['enddatetimeother'], 'color'=> "#ff9999", 'rrule' => array( 'freq' => $row['repeatevent'], 'interval' => $repeatinterval, 'dtstart' => $row['startdatetimeother'], 'until' => $row['enddatetimeother'] ));` - something like that? – ADyson Apr 01 '19 at 17:08
  • Thanks ADyson , had to change up the code a bit to get it working . 'rrule' => array('dtstart' => $row['startdatetimeother'], 'freq' => $row['repeatevent'] ), 'duration'=>$row['durationevent'] – Ryan Apr 02 '19 at 20:20
  • 1
    If you fixed it and found the final solution that's great - please add it as an Answer so others can benefit from it (and potentially upvote it!) – ADyson Apr 02 '19 at 21:01

1 Answers1

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

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

The duration of the event has to be placed outside of the rrule array

Ryan
  • 159
  • 11