كيف يمكنني استرجاع جميع الأحداث المحدثة مؤخرا في تقويم Google؟

StackOverflow https://stackoverflow.com/questions/1291458

  •  18-09-2019
  •  | 
  •  

سؤال

أنا أعمل حاليا على ميزة مزامنة تقويم Google من المفترض أن مزامنة من خلال تطبيق التقويم الخاص بنا وإلى تطبيق تقويم Google. الآن أحتاج إلى تحديد التغييرات الأخيرة في تقويم Google حتى أتمكن من نسخ هذه الأحداث في تطبيق التقويم الخاص بنا. أنا استخدم zend gdata ولكن أي فكرة سأكون ممتنا.

هل كانت مفيدة؟

المحلول

(تعديل من http://framework.zend.com/manual/en/zend.gdata.calendar.html.)

$query = $service->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setFutureevents('true');

// Subtract time frame for when you want to detect
// updated events, for example, in the past 24 hrs
$refresh = time() - 60*60*24;
$refresh_date = date('Y-m-dTH:i:sP', $refresh);

$query->setUpdatedMin($refresh_date);


// Retrieve the event list from the calendar server
try {
    $eventFeed = $service->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getMessage();
}

// Iterate through the list of events, outputting them as an HTML list
echo "<ul>";
foreach ($eventFeed as $event) {
    echo "<li>" . $event->title . " (Event ID: " . $event->id . ")</li>";
}
echo "</ul>";
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top