Ejemplo n.º 1
0
function getEventsInRange($user, $cal, $start, $end)
{
    //get all events and their associated recurrence rules
    $events = getEvents($user, $cal);
    $recurrenceRules = array();
    foreach ($events as $e) {
        $sql = 'select r.freq, r.count, r.byDay, r.until, r.interval, r.byMonthDay' . 'from Events e join RecurrenceRules r on (r.eid = e.eid)' . 'where e.eid = ' . $e['e.eid'] . ';';
        $resultSet = $CI->db->query($sql);
        array_push($recurrenceRules, $resultSet->result_array());
    }
    //examine each event in conjunction with it's recurrence rule to determine if it is in range
    $eventsInRange = array();
    foreach ($events as $e) {
        $eInRange = expandEvent($e, $recurrenceRule[$count], $start, $end);
        foreach ($eInRange as $curr) {
            array_push($eventsInRange, $curr);
        }
    }
    return $eventsInRange;
}
Ejemplo n.º 2
0
<?php

include 'events_db.php';
$event['start'] = '2014-10-22T12:00:00';
$event['end'] = '2014-10-22T13:00:00';
$event['freq'] = 'MONTHLY';
$event['count'] = 4;
$event['until'] = null;
$event['interval'] = null;
$event['byDay'] = null;
$event['byMonthDay'] = 10;
$events = expandEvent($event, '2014-10-21T12:00:00', '2018-10-25T12:00:00');
foreach ($events as $e) {
    echo "\nstart: " . $e['start'] . "\nend: " . $e['end'] . "\n";
}