本文整理汇总了PHP中Zend_Gdata_Calendar::newListEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Calendar::newListEntry方法的具体用法?PHP Zend_Gdata_Calendar::newListEntry怎么用?PHP Zend_Gdata_Calendar::newListEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_Calendar
的用法示例。
在下文中一共展示了Zend_Gdata_Calendar::newListEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
function export_google_calendar() {
ajx_current("empty");
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$users = ExternalCalendarUsers::findByContactId();
if($users){
if($users->getSync() == 1){
$sql = "SELECT ec.* FROM `".TABLE_PREFIX."external_calendars` ec,`".TABLE_PREFIX."external_calendar_users` ecu
WHERE ec.calendar_feng = 1 AND ecu.contact_id = ".logged_user()->getId();
$calendar_feng = DB::executeOne($sql);
$events = ProjectEvents::findNoSync();
$user = $users->getAuthUser();
$pass = $users->getAuthPass();
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
try
{
$client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$service);
$gdataCal = new Zend_Gdata_Calendar($client);
if ($calendar_feng){
foreach ($events as $event){
$calendarUrl = 'http://www.google.com/calendar/feeds/'.$calendar_feng['calendar_user'].'/private/full';
$newEvent = $gdataCal->newEventEntry();
$newEvent->title = $gdataCal->newTitle($event->getObjectName());
$newEvent->content = $gdataCal->newContent($event->getDescription());
$star_time = explode(" ",$event->getStart()->format("Y-m-d H:i:s"));
$end_time = explode(" ",$event->getDuration()->format("Y-m-d H:i:s"));
if($event->getTypeId() == 2){
$when = $gdataCal->newWhen();
$when->startTime = $star_time[0];
$when->endTime = $end_time[0];
$newEvent->when = array($when);
}else{
$when = $gdataCal->newWhen();
$when->startTime = $star_time[0]."T".$star_time[1].".000-00:00";
$when->endTime = $end_time[0]."T".$end_time[1].".000-00:00";
$newEvent->when = array($when);
}
// insert event
$createdEvent = $gdataCal->insertEvent($newEvent, $calendarUrl);
$event_id = explode("/",$createdEvent->id->text);
$special_id = end($event_id);
$event->setSpecialID($special_id);
$event->setUpdateSync(ProjectEvents::date_google_to_sql($createdEvent->updated));
$event->setExtCalId($calendar_feng['id']);
$event->save();
}
}else{
$appCalUrl = '';
$calFeed = $gdataCal->getCalendarListFeed();
foreach ($calFeed as $calF){
$instalation = explode("/", ROOT_URL);
$instalation_name = end($instalation);
if($calF->title->text == lang('feng calendar',$instalation_name)){
$appCalUrl = $calF->content->src;
$t_calendario = $calF->title->text;
}
}
if($appCalUrl != ""){
$title_cal = $t_calendario;
}else{
$instalation = explode("/", ROOT_URL);
$instalation_name = end($instalation);
$appCal = $gdataCal -> newListEntry();
$appCal -> title = $gdataCal-> newTitle(lang('feng calendar',$instalation_name));
$own_cal = "http://www.google.com/calendar/feeds/default/owncalendars/full";
$new_cal = $gdataCal->insertEvent($appCal, $own_cal);
$title_cal = $new_cal->title->text;
$appCalUrl = $new_cal->content->src;
}
$cal_src = explode("/",$appCalUrl);
array_pop($cal_src);
$calendar_visibility = end($cal_src);
array_pop($cal_src);
$calendar_user = end($cal_src);
$calendar = new ExternalCalendar();
$calendar->setCalendarUser($calendar_user);
$calendar->setCalendarVisibility($calendar_visibility);
$calendar->setCalendarName($title_cal);
$calendar->setExtCalUserId($users->getId());
$calendar->setCalendarFeng(1);
$calendar->save();
//.........这里部分代码省略.........
示例2: apologize
if ($result === false) {
apologize("Your subscription to this club could not be added to the database.");
}
$gdataCal = new Zend_Gdata_Calendar($_SESSION["client"]);
//Get list of existing calendars
$calFeed = $gdataCal->getCalendarListFeed();
$levels = query("SELECT * FROM privacy");
$num = count($levels);
for ($i = 1; $i <= $num; $i++) {
// ensure that when POST variables are extracted during loops, the abbr is not incorrect
$abbreviation = strtoupper($abbreviation);
if (isset($_POST["abbreviation"]) && $abbreviation == "") {
$abbreviation = strtoupper($_POST[name]);
}
// I actually had to guess this method based on Google API's "magic" factory
$appCal = $gdataCal->newListEntry();
// I only set the title, other options like color are available.
$appCal->title = $gdataCal->newTitle($abbreviation . $i);
//This is the right URL to post to for new calendars...
//Notice that the user's info is nowhere in there
$own_cal = "http://www.google.com/calendar/feeds/default/owncalendars/full";
//And here's the payoff.
//Use the insertEvent method, set the second optional var to the right URL
$gdataCal->insertEvent($appCal, $own_cal);
$calFeed = $gdataCal->getCalendarListFeed();
foreach ($calFeed as $calendar) {
if ($calendar->title->text == $abbreviation . $i) {
//This is the money, you need to use '->content-src'
//Anything else and you have to manipulate it to get it right.
$appCalUrl = $calendar->content->src;
}