Google日历活动未获得更新/同步

时间:2018-06-12 10:52:23

标签: javascript php css html5

我已经通过URL创建了一个Calendar,我有一个用于创建新事件的调度程序和一个生成Ical文件的generate_icalfile.php页面。 现在,当我将Ical文件导入我的Google日历时,它不会在我的Gmail Google日历中显示最近添加的事件。 我尝试了很多不同的方法: 好吧,似乎谷歌在24小时后自动同步,但它没有在我的情况下同步。 删除日历并再次添加和检查 - 仍然没有帮助。 在URL中添加了?nocache1 - 仍然没有帮助。 我也使用私人窗口。 这是我的generate_icalfile,但主要问题是事件同步。 请帮忙谢谢。

<?php

ob_start();

if (session_id() == "")
    session_start();

include_once('Application.class.php');
include_once('ICS.class.php');
include_once('BusinessLogic/Business/Schedule.class.php');
include_once('BusinessLogic/Schedule/AppointmentEvents.class.php');

if (isset($application) == false)
    $application = new Application;

include_once('Configuration.class.php'); 

$con = new Configuration();
$business_schedule = new Schedule();

$schedules = $business_schedule->GetAllSchedulesByBusinessID($_GET['busid']);
//pr($schedules);exit;
function getTime($date) {
    $mas = explode('-',$date);
    if($mas[0] == 9999) { 
        return "99990201T000000";
    } else {
        return date("Ymd\THis",strtotime($date));
    }
}

foreach($schedules as $schedules_data){
    // pr($schedules_data);
    $getEvent = new AppointmentEvents;

    $getsch_Event = $getEvent->GetbySchedule_ID($schedules_data['id']);

    $str = "BEGIN:VCALENDAR\n";
    $str .= "VERSION:2.0\n";
    $str .= "PRODID:-//book//Scheduler v2.2//EN\n";
    $str .= "X-WR-CALNAME:Book Calender Sync Testing";
    $str .= "METHOD:PUBLISH\n";

    foreach($getsch_Event as $events)
    {

        $str .= "BEGIN:VEVENT\n";
        $str .= "SUMMARY:".$events['event_name']."\n";
        $str .= "UID:".$events['event_id']."\n";
        $str .= "SEQUENCE:0\n";
        $str .= "DTSTART:".getTime($events['start_date'])."\n";
        $str .= "DTEND:".getTime($events['end_date'])."\n";
        $str .= "DTSTAMP:".date("Ymd\THis\Z");
        $str .= "\nLOCATION:".$events['location_name']."\n";
        $str .= "DESCRIPTION:".$events['admin_notes']."\n";
        $str .= "PRIORITY:1\n";	
        $str .= "CLASS:PUBLIC\n";	
        $str .= "END:VEVENT\n";	
    }

    $str .= "END:VCALENDAR";	
    //$ical ="BEGIN:VCALENDAR\nVERSION:2.0\nMETHOD:PUBLISH\nBEGIN:VEVENT\nDTSTART:".date("Ymd\THis\Z",strtotime($start))."\nDTEND:".date("Ymd\THis\Z",strtotime($end))."\nLOCATION:".$location."\nTRANSP: OPAQUE\nSEQUENCE:0\nUID:\nDTSTAMP:".date("Ymd\THis\Z")."\nSUMMARY:".$name."\nDESCRIPTION:".$description."\nPRIORITY:1\nCLASS:PUBLIC\nBEGIN:VALARM\nTRIGGER:-PT10080M\nACTION:DISPLAY\nDESCRIPTION:Reminder\nEND:VALARM\nEND:VEVENT\nEND:VCALENDAR\n";   

    $schedule_name = $_GET['busid']."_".$schedules_data['id']."_".preg_replace('/\s+/', '_', $schedules_data['name']);
    $event = new ICS($str,$schedule_name);
    $event->save();
}

?>

0 个答案:

没有答案