예제 #1
0
파일: index.php 프로젝트: Albertopf/prueba
if (count($listofextcals)) {
    require_once DOL_DOCUMENT_ROOT . '/comm/action/class/ical.class.php';
    foreach ($listofextcals as $extcal) {
        $url = $extcal['src'];
        // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics
        $namecal = $extcal['name'];
        $offsettz = $extcal['offsettz'];
        $colorcal = $extcal['color'];
        $buggedfile = $extcal['buggedfile'];
        //print "url=".$url." namecal=".$namecal." colorcal=".$colorcal." buggedfile=".$buggedfile;
        $ical = new ICal();
        $ical->parse($url);
        // After this $ical->cal['VEVENT'] contains array of events, $ical->cal['DAYLIGHT'] contains daylight info, $ical->cal['STANDARD'] contains non daylight info, ...
        //var_dump($ical->cal); exit;
        $icalevents = array();
        if (is_array($ical->get_event_list())) {
            $icalevents = array_merge($icalevents, $ical->get_event_list());
        }
        // Add $ical->cal['VEVENT']
        if (is_array($ical->get_freebusy_list())) {
            $icalevents = array_merge($icalevents, $ical->get_freebusy_list());
        }
        // Add $ical->cal['VFREEBUSY']
        if (count($icalevents) > 0) {
            // Duplicate all repeatable events into new entries
            $moreicalevents = array();
            foreach ($icalevents as $icalevent) {
                if (isset($icalevent['RRULE']) && is_array($icalevent['RRULE'])) {
                    //if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
                    //if ($event->date_end_in_calendar > $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow-1);
                    if ($icalevent['DTSTART;VALUE=DATE']) {