当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata_Calendar::getCalendarEventFeed方法代码示例

本文整理汇总了PHP中Zend_Gdata_Calendar::getCalendarEventFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Calendar::getCalendarEventFeed方法的具体用法?PHP Zend_Gdata_Calendar::getCalendarEventFeed怎么用?PHP Zend_Gdata_Calendar::getCalendarEventFeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Gdata_Calendar的用法示例。


在下文中一共展示了Zend_Gdata_Calendar::getCalendarEventFeed方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFeeds

function getFeeds($startdate, $enddate)
{
    global $dayinseconds;
    $feeds = array();
    $calendars = array('facultyadmin@communityhigh.net', 'en.usa%23holiday@group.v.calendar.google.com', 'communityhigh.net_cqt4f59nci2gvtftuqseal396o%40group.calendar.google.com', 'communityhigh.net_5d3b9b97gj76hqmk9ir4s2usm8%40group.calendar.google.com');
    foreach ($calendars as $user) {
        /* @var $service Zend_Gdata_Calendar */
        $service = new Zend_Gdata_Calendar();
        /* @var $query Zend_Gdata_Calendar_EventQuery */
        $query = $service->newEventQuery();
        $query->setUser($user);
        $query->setOrderby('starttime');
        $query->setSortOrder('ascending');
        $query->setMaxResults(100000);
        //get days events: event: name, description
        $query->setStartMin(date(DATE_RFC3339, $startdate));
        $query->setStartMax(date(DATE_RFC3339, $enddate + 6 * $dayinseconds));
        try {
            $feeds[] = $service->getCalendarEventFeed($query);
            //foreach($eventFeed as $event)
            // var_dump($event->when);
        } catch (Zend_Gdata_App_Exception $e) {
            echo "Error: " . $e->getMessage();
        }
    }
    return $feeds;
}
开发者ID:safiayonker,项目名称:custom-planner,代码行数:27,代码来源:functions.php

示例2: isset

// various copy includes
require_once "../../config.gen.inc.php";
require_once "data/data.inc.php";
// records stats
require_once "../page_builder/page_header.php";
// sets up google calendar classes
require_once "lib/google_calendar.init.php";
// libs
require_once "lib/calendar.lib.php";
require_once "lib/textformat.lib.php";
$search_terms = $_REQUEST['filter'];
$search_options = SearchOptions::get_options();
$timeframe = isset($_REQUEST['timeframe']) ? $_REQUEST['timeframe'] : 0;
$dates = SearchOptions::search_dates($timeframe);
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
// predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($username . '@gmail.com', $password, $service);
$gdataCal = new Zend_Gdata_Calendar($client);
$query = $gdataCal->newEventQuery();
$query->setUser($calendars['all']['user']);
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setSortorder('a');
$query->setStartMin($dates['start']);
$query->setStartMax($dates['end']);
$query->setmaxresults('50');
$query->setQuery($search_terms);
$eventFeed = $gdataCal->getCalendarEventFeed($query);
require "templates/{$prefix}/search.html";
$page->output();
开发者ID:brownell,项目名称:get311,代码行数:31,代码来源:search.php

示例3: gCalendar


//.........这里部分代码省略.........
                        'gAccessLevel' => $newAccessLevelString);
                    $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
                    ModUtil::apiFunc('IWagendas', 'admin', 'editAgenda', array('daid' => $gIds["$id"]['daid'],
                        'items' => $items,
                        'sv' => $sv));
                }
            }
        }
        // Get data from google for 2 months ago and 4 future months more or less
        $time = time();
        $beginDate = $time - 2 * 30 * 24 * 60 * 60;
        $endDate = $time + 4 * 30 * 24 * 60 * 60;
        $beginOndate = date('Y-m-d', $beginDate);
        $endOnDate = date('Y-m-d', $endDate);
        //get all the google notes
        $gCalendarNotes = ModUtil::apiFunc('IWagendas', 'user', 'getAllGCalendarNotes', array('beginDate' => $beginDate,
                    'endDate' => $endDate,
                    'gIds' => $gIds));
        foreach ($calFeed as $calendar) {
            $id = $calendar->id;
            $query = $gdataCal->newEventQuery();
            $calFeed = $gdataCal->getCalendarListFeed();
            $gUser = str_replace(Zend_Gdata_Calendar::CALENDAR_FEED_URI . '/default/', "", $id); // kind of dirty way to get the info, nut it lokks working :)
            $query->setUser($gUser);
            $query->setVisibility('private');
            $query->setProjection('full');
            $query->setOrderby('starttime');
            $query->setStartMin($beginOndate);
            $query->setStartMax($endOnDate);
            $eventFeed = array();
            if ($calendar->accessLevel->value == 'owner' ||
                    $calendar->accessLevel->value == 'editor' ||
                    $calendar->accessLevel->value == 'read') {
                $eventFeed = $gdataCal->getCalendarEventFeed($query);
            }
            foreach ($eventFeed as $event) {
                foreach ($event->when as $when) {
                    $startTime = $when->startTime;
                    $day = substr($startTime, 8, 2);
                    $month = substr($startTime, 5, 2);
                    $year = substr($startTime, 0, 4);
                    $hour = substr($startTime, 11, 2);
                    $minute = substr($startTime, 14, 2);
                    $startTime = gmmktime($hour, $minute, 0, $month, $day, $year);
                    $day = date('d', $startTime);
                    $month = date('m', $startTime);
                    $year = date('Y', $startTime);
                    $hour = date('H', $startTime);
                    $minute = date('i', $startTime);
                    $endTime = $when->endTime;
                    $dayEnd = substr($endTime, 8, 2);
                    $monthEnd = substr($endTime, 5, 2);
                    $yearEnd = substr($endTime, 0, 4);
                    $hourEnd = substr($endTime, 11, 2);
                    $minuteEnd = substr($endTime, 14, 2);
                    $endTime = gmmktime($hourEnd, $minuteEnd, 0, $monthEnd, $dayEnd, $yearEnd);
                    $dayEnd = date('d', $endTime);
                    $monthEnd = date('m', $endTime);
                    $yearEnd = date('Y', $endTime);
                    $hourEnd = date('H', $endTime);
                    $minuteEnd = date('i', $endTime);
                    $allDay = (($minute == '' || $minute == '00') && ($hour == '' || $hour == '23') && ($minuteEnd == '' || $minuteEnd == '00') && ($hourEnd == '' || $hourEnd == '00')) ? 1 : 0;
                    $end = ($allDay == 0) ? $this->__('Foreseen time to finish') . ': ' . $hourEnd . ':' . $minuteEnd : $this->__('All day');
                    if (!array_key_exists("$event->id", $gCalendarNotes)) {
                        //create item
                        $lid = ModUtil::apiFunc('IWagendas', 'user', 'crear', array('dia' => $day,
开发者ID:projectesIF,项目名称:Sirius,代码行数:67,代码来源:User.php

示例4: outputCalendarByFullTextQuery

/**
 * Outputs an HTML unordered list (ul), with each list item representing an
 * event on the authenticated user's calendar which matches the search string
 * specified as the $fullTextQuery parameter
 * 
 * @param  Zend_Http_Client $client        The authenticated client object
 * @param  string           $fullTextQuery The string for which you are searching
 * @return void
 */
function outputCalendarByFullTextQuery(Zend_Http_Client $client, $fullTextQuery = 'tennis')
{
    $gdataCal = new Zend_Gdata_Calendar($client);
    $query = $gdataCal->newEventQuery();
    $query->setUser('default');
    $query->setVisibility('private');
    $query->setProjection('full');
    $query->setQuery($fullTextQuery);
    $eventFeed = $gdataCal->getCalendarEventFeed($query);
    echo "<ul>\n";
    foreach ($eventFeed as $event) {
        echo "\t<li>" . $event->title->text . " (" . $event->id->text . ")\n";
        echo "\t\t<ul>\n";
        foreach ($event->when as $when) {
            echo "\t\t\t<li>Starts: " . $when->startTime . "</li>\n";
            echo "\t\t</ul>\n";
            echo "\t</li>\n";
        }
    }
    echo "</ul>\n";
}
开发者ID:jon9872,项目名称:zend-framework,代码行数:30,代码来源:Calendar-expanded.php

示例5: calFullTextQuery

 /**
  * List events matching a full text query. Full text query searches
  * both title and event description for matches
  *
  * @param String $client - Access token
  * @param String $eventQuery - Query in string form
  * @return list of matching events in array form
  */
 function calFullTextQuery($client, $eventQuery)
 {
     $gdataCal = new Zend_Gdata_Calendar($client);
     $query = $gdataCal->newEventQuery();
     $query->setUser('default');
     $query->setVisibility('private');
     $query->setProjection('full');
     $query->setQuery($eventQuery);
     $eventFeed = $gdataCal->getCalendarEventFeed($query);
     return $eventFeed;
 }
开发者ID:abdullahbutt,项目名称:Codeigniter-Gcal,代码行数:19,代码来源:Gcal.php

示例6: GoogleCalendarSync

function GoogleCalendarSync()
{
    require_once 'modules/GoogleSync/GoogleSync.php';
    global $timedate;
    GoogleSync::init();
    $usr = new User();
    $users = $usr->get_full_list();
    foreach ($users as $user) {
        $client = GoogleSync::getClient($user);
        if ($client != false) {
            $service = new Zend_Gdata_Calendar($client);
            try {
                $listFeed = $service->getCalendarEventFeed();
                foreach ($listFeed as $calendar) {
                    $id = $calendar->id;
                    $googleSync = new GoogleSync();
                    $list = $googleSync->get_list('', "{$googleSync->table_name}.google_id='{$id}'");
                    if ($list['row_count'] > 0) {
                        $event = BeanFactory::getBean($list['list'][0]->parent_name);
                        $event->retrieve($list['list'][0]->parent_id);
                        $event->name = $calendar->title->text;
                        if (!preg_match('/event.private$/', $calendar->visibility->value)) {
                            $event->description = $calendar->content->text;
                        }
                        GoogleSync::setDates($event, $calendar->when[0]->startTime, 0);
                        switch ($event->module_dir) {
                            case 'Calls':
                                $event->name = preg_replace('/^Звонок: /ui', '', $calendar->title->text);
                                GoogleSync::setReminder($event, $calendar->when[0]->reminders[0]);
                                GoogleSync::setDuration(&$event, $calendar->when[0]->startTime, $calendar->when[0]->endTime);
                                break;
                            case 'Meetings':
                                $event->name = preg_replace('/^Звонок: /ui', '', $calendar->title->text);
                                GoogleSync::setReminder($event, $calendar->when[0]->reminders[0]);
                                GoogleSync::setDuration(&$event, $calendar->when[0]->startTime, $calendar->when[0]->endTime);
                                $event->location = $calendar->where[0]->valueString;
                                break;
                            case 'Tasks':
                                $event->name = preg_replace('/^Задача: /ui', '', $calendar->title->text);
                                GoogleSync::setDates($event, $calendar->when[0]->endTime, 1);
                                break;
                        }
                        $event->from_where = 'GOOGLE';
                        $event->save();
                    } else {
                        if (preg_match('/^Звонок/ui', $calendar->title->text)) {
                            $event = new Call();
                            $event->name = preg_replace('/^Звонок: /ui', '', $calendar->title->text);
                            GoogleSync::setReminder($event, $calendar->when[0]->reminders[0]);
                            GoogleSync::setDuration(&$event, $calendar->when[0]->startTime, $calendar->when[0]->endTime);
                        } elseif (preg_match('/^Встреча/ui', $calendar->title->text)) {
                            $event = new Meeting();
                            $event->name = preg_replace('/^Встреча: /ui', '', $calendar->title->text);
                            GoogleSync::setReminder($event, $calendar->when[0]->reminders[0]);
                            GoogleSync::setDuration(&$event, $calendar->when[0]->startTime, $calendar->when[0]->endTime);
                            $event->location = $calendar->where[0]->valueString;
                        } elseif (preg_match('/^Задача/ui', $calendar->title->text)) {
                            $event = new Task();
                            $event->name = preg_replace('/^Задача: /ui', '', $calendar->title->text);
                            GoogleSync::setDates($event, $calendar->when[0]->endTime, 1);
                        }
                        if (isset($event)) {
                            if (!preg_match('/event.private$/', $calendar->visibility->value)) {
                                $event->description = $calendar->content->text;
                            }
                            GoogleSync::setDates($event, $calendar->when[0]->startTime, 0);
                            $event->from_where = 'GOOGLE';
                            $event->assigned_user_id = $user->id;
                            $event_id = $event->save();
                            $googleSync->parent_name = $event->module_dir;
                            $googleSync->parent_id = $event_id;
                            $googleSync->google_id = $id;
                            $googleSync->user_id = $user->id;
                            $googleSync->save();
                        }
                    }
                }
            } catch (Zend_Gdata_App_Exception $e) {
            }
        }
    }
    return true;
}
开发者ID:omusico,项目名称:sugar_work,代码行数:83,代码来源:_AddJobsHere.php

示例7: foreach

        function import_google_calendar() {
                ajx_current("empty");
                $users = ExternalCalendarUsers::findByContactId();  
                if($users){
                    $calendars = ExternalCalendars::findByExtCalUserId($users->getId());

                    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');

                    $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);

                            //update or insert events for calendars                        
                            foreach ($calendars as $calendar){

                                //check the deleted calendars
                                $delete_calendar = false;
                                $calFeed = $gdataCal->getCalendarListFeed();        
                                foreach ($calFeed as $calF){
                                    $cal_src = explode("/",$calF->content->src);
                                    array_pop($cal_src);
                                    $calendar_visibility = end($cal_src);
                                    array_pop($cal_src);
                                    $calendar_user = end($cal_src); 

                                    if($calendar_user == $calendar->getCalendarUser()){
                                        $delete_calendar = true;
                                    }
                                }

                                if($delete_calendar){
                                    $calendar_user = $calendar->getCalendarUser();
                                    $calendar_visibility = $calendar->getCalendarVisibility();
                                    $start_sel = date('Y-m-d', strtotime('-1 week'));
                                    $end_sel = date('Y-m-d', strtotime('+2 year'));

                                    $query = $gdataCal->newEventQuery();
                                    $query->setUser($calendar_user);
                                    $query->setVisibility($calendar_visibility);
                                    $query->setSingleEvents(true);
                                    $query->setProjection('full');
                                    $query->setOrderby('starttime');
                                    $query->setSortOrder('ascending'); 
                                    $query->setStartMin($start_sel);
                                    $query->setStartMax($end_sel);
                                    $query->setMaxResults(50);
                                    // execute and get results
                                    $event_list = $gdataCal->getCalendarEventFeed($query);

                                    $array_events_google = array();
                                    foreach ($event_list as $event){                                        
                                        $event_id = explode("/",$event->id->text);
                                        $special_id = end($event_id); 
                                        $event_name = lang("untitle event");
                                        if($event->title->text != ""){
                                            $event_name = $event->title->text;
                                        }
                                        $array_events_google[] = $special_id;
                                        $new_event = ProjectEvents::findBySpecialId($special_id);
                                        if($new_event){
                                            if(strtotime(ProjectEvents::date_google_to_sql($event->updated)) > $new_event->getUpdateSync()->getTimestamp()){
                                                $start = strtotime(ProjectEvents::date_google_to_sql($event->when[0]->startTime));
                                                $fin = strtotime(ProjectEvents::date_google_to_sql($event->when[0]->endTime));
                                                if(($fin - $start) == 86400){
                                                    $new_event->setStart(date("Y-m-d H:i:s",$start));
                                                    $new_event->setDuration(date("Y-m-d H:i:s",$start));
                                                    $new_event->setTypeId(2);
                                                }elseif(($fin - $start) > 86400){                                                
                                                    $t_s = explode(' ', date("Y-m-d H:i:s",$start));
                                                    $t_f = explode(' ', date("Y-m-d H:i:s",$fin));

                                                    $date_s = new DateTimeValue(strtotime($t_s[0]."00:00:00") - logged_user()->getTimezone() * 3600);
                                                    $date_f = new DateTimeValue(strtotime($t_f[0]."23:59:59 -1 day") - logged_user()->getTimezone() * 3600);

                                                    $new_event->setStart(date("Y-m-d H:i:s",$date_s->getTimestamp()));
                                                    $new_event->setDuration(date("Y-m-d H:i:s",$date_f->getTimestamp()));
                                                    $new_event->setTypeId(2);
                                                }else{
                                                    $new_event->setStart(ProjectEvents::date_google_to_sql($event->when[0]->startTime));
                                                    $new_event->setDuration(ProjectEvents::date_google_to_sql($event->when[0]->endTime));
                                                }

                                                $new_event->setObjectName($event_name);
                                                $new_event->setDescription($event->content->text);
                                                $new_event->setUpdateSync(ProjectEvents::date_google_to_sql($event->updated));
                                                $new_event->setExtCalId($calendar->getId());
                                                $new_event->save(); 
                                            }
                                        }else{
                                            $new_event = new ProjectEvent();
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:EventController.class.php

示例8: process


//.........这里部分代码省略.........
         $path = get_include_path();
         require_once 'Zend/Loader.php';
         Zend_Loader::loadClass('Zend_Gdata');
         /* Won't need these loaded until we add sync'ing events back to Google
          * Zend_Loader::loadClass('Zend_Gdata_AuthSub');
          * Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
          */
         Zend_Loader::loadClass('Zend_Gdata_Calendar');
         // See if they want to sync to gcal, and provided a login
         $gcal_sync_upload = $params->get('gcal_sync_upload_events', 'from');
         if ($gcal_sync_upload == 'both' || $gcal_sync_upload == 'to') {
             Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
             $email = $params->get('gcal_sync_login', '');
             $passwd = $params->get('gcal_sync_passwd', '');
             try {
                 $client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, 'cl');
             } catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
                 echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n";
                 echo 'Token ID: ' . $cre->getCaptchaToken() . "\n";
                 return;
             } catch (Zend_Gdata_App_AuthException $ae) {
                 echo 'Problem authenticating: ' . $ae->exception() . "\n";
                 return;
             }
             $gdataCal = new Zend_Gdata_Calendar($client);
         } else {
             $gdataCal = new Zend_Gdata_Calendar();
         }
         // Set up and execute the call to grab the feed from google
         $query = $gdataCal->newEventQuery();
         $query->setUser($gcal_user);
         $query->setVisibility($gcal_visibility);
         $query->setProjection($gcal_projection);
         $eventFeed = $gdataCal->getCalendarEventFeed($query);
         // Build an array of the events from the feed, indexed by the Google ID
         $event_ids = array();
         foreach ($eventFeed as $key => $event) {
             $short_id = $this->_getGcalShortId($event->id->text);
             $gcal_event_ids[$short_id] = $eventFeed[$key];
         }
         /* Run through our table data, and build an array of our events indexed by the Google ID
          * (of course not all events may have a Google ID)
          */
         $our_event_ids = array();
         $our_upload_ids = array();
         foreach ($mydata as $gkey => $group) {
             if (is_array($group)) {
                 foreach ($group as $rkey => $row) {
                     if ($row->{$gcal_id_element}) {
                         $our_event_ids[$row->{$gcal_id_element}] = $mydata[$gkey][$rkey];
                     } else {
                         $our_upload_ids[] = $mydata[$gkey][$rkey];
                     }
                 }
             }
         }
         // Now go through the google events id's, and process the ones which aren't in our table.
         $our_event_adds = array();
         foreach ($gcal_event_ids as $id => $event) {
             if (!array_key_exists($id, $our_event_ids)) {
                 // we don't have the ID, so add the event to our table
                 $row = array();
                 $row[$gcal_start_date_element] = strftime('%Y-%m-%d %H:%M:%S', strtotime($event->when[0]->startTime));
                 $row[$gcal_end_date_element] = strftime('%Y-%m-%d %H:%M:%S', strtotime($event->when[0]->endTime));
                 $row[$gcal_label_element] = $event->title->text;
                 $row[$gcal_desc_element] = $event->content->text;
开发者ID:rogeriocc,项目名称:fabrik,代码行数:67,代码来源:gcalsync.php

示例9: outputCalendarByDateRange

 function outputCalendarByDateRange($client, $startDate = '2011-05-01', $endDate = '2011-06-01')
 {
     $gdataCal = new Zend_Gdata_Calendar($client);
     $query = $gdataCal->newEventQuery();
     $query->setUser('default');
     $query->setVisibility('private');
     $query->setProjection('full');
     $query->setOrderby('starttime');
     $query->setStartMin($startDate);
     $query->setStartMax($endDate);
     $eventFeed = $gdataCal->getCalendarEventFeed($query);
     return $eventFeed;
 }
开发者ID:josuesperb,项目名称:sipesq,代码行数:13,代码来源:googlecalendar.php

示例10: catch

 $query = $service->newEventQuery();
 $query->setUser('default');
 // MagicCookie 認証の場合は
 // $query->setVisibility('private-magicCookieValue') とします
 $query->setVisibility('private');
 $query->setProjection('full');
 $query->setOrderby('starttime');
 $query->setFutureevents('false');
 $query->setStartMin($_GET[s]);
 $query->setStartMax($_GET[e]);
 //$query->setStartMin('2009-05-01');
 //$query->setStartMax('2009-06-01');
 $query->setmaxResults(999);
 // カレンダーサーバからイベントの一覧を取得します
 try {
     $eventFeed = $service->getCalendarEventFeed($query);
 } catch (Zend_Gdata_App_Exception $e) {
     echo "エラー: " . $e->getMessage();
 }
 echo "<h1>" . $eventFeed->title . "</h1>";
 echo $eventFeed->totalResults . "event(s) found.<p/>";
 echo "<a href ='./gact.php'>再ログイン</a>";
 // リストの内容を順に取得し、HTML のリストとして出力します
 echo "<table>";
 echo "<tr><th>プロジェクト</th><th>タスク</th><th>日付</th><th>時間帯A</th><th>時間帯B</th><th>分割警告</th><th>開始時刻</th><th>終了時刻</th>";
 echo "</tr>";
 foreach ($eventFeed as $event) {
     $starttemp = strtotime($event->when[0]->startTime);
     $endtemp = strtotime($event->when[0]->endTime);
     $startdate = date('Y/m/d', strtotime($event->when[0]->startTime));
     $startTime = date('H:i', strtotime($event->when[0]->startTime));
开发者ID:junju,项目名称:gact,代码行数:31,代码来源:gact.php

示例11: loadEventsFromFeed

 function loadEventsFromFeed()
 {
     // Create the Calendar client
     $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
     try {
         $client = Zend_Gdata_ClientLogin::getHttpClient($this->user, $this->password, $service);
     } catch (Exception $ex) {
         $this->log("Error: Caught this creating a Gdata client (pi.googlecal_events) : " . $ex->getMessage());
         return;
     }
     $calendar = new Zend_Gdata_Calendar($client);
     $query = $calendar->newEventQuery();
     $query->setVisibility('private');
     $query->setProjection('composite');
     $query->setStartMin($this->calendar_start_date);
     $query->setStartMax($this->calendar_end_date);
     $this->events = array();
     foreach ($this->google_calendars as $google_calendar) {
         $query->setUser($google_calendar);
         try {
             $eventFeed = $calendar->getCalendarEventFeed($query);
         } catch (Exception $ex) {
             $this->log("Error: Caught this retrieving the Google Calendar feed (pi.googlecal_events) : " . $ex->getMessage());
             return;
         }
         $newEvents = $this->parseEventFeed($eventFeed);
         $this->events = array_merge($this->events, $newEvents);
     }
     // Sort the list of events
     usort($this->events, "eventCmp");
 }
开发者ID:swartzrock,项目名称:brs.googlecal_events.ee_addon,代码行数:31,代码来源:pi.googlecal_events.php

示例12: getCalendar

 /**
  * Pull the events from google
  * @param <object> $SyncState
  * @return <array> google Records
  */
 public function getCalendar($SyncState)
 {
     $calendars = new Zend_Gdata_Calendar($this->apiInstance);
     $query = $calendars->newEventQuery($query);
     $query->setVisibility('private');
     $query->setMaxResults($this->maxResults);
     $query->setStartIndex(1);
     $query->setOrderBy('lastmodified');
     $query->setsortorder('ascending');
     if (Google_Utils_Helper::getSyncTime('Calendar')) {
         $query->setUpdatedMin(Google_Utils_Helper::getSyncTime('Calendar'));
     }
     $feed = $calendars->getCalendarEventFeed($query);
     $this->totalRecords = $feed->totalResults->text;
     $calendarRecords = array();
     if (count($feed->entry) > 0) {
         $maxModifiedTime = date('Y-m-d H:i:s', strtotime(Google_Contacts_Model::vtigerFormat(end($feed->entry)->updated->text)) + 1);
         if ($this->totalRecords > $this->maxResults) {
             if (!Google_Utils_Helper::getSyncTime('Calendar')) {
                 $query->setUpdatedMin(date('Y-m-d H:i:s', strtotime(Google_Contacts_Model::vtigerFormat(end($feed->entry)->updated->text))));
                 $query->setStartIndex($this->maxResults);
             }
             $query->setMaxResults(500);
             $query->setUpdatedMax($maxModifiedTime);
             $extendedFeed = $calendars->getCalendarEventFeed($query);
             $calendarRecords = array_merge($feed->entry, $extendedFeed->entry);
         } else {
             $calendarRecords = $feed->entry;
         }
     }
     $googleRecords = array();
     foreach ($calendarRecords as $i => $calendar) {
         $recordModel = Google_Calendar_Model::getInstanceFromValues(array('entity' => $calendar));
         $deleted = false;
         if (end(explode('.', $calendar->eventstatus->value)) == 'canceled') {
             $deleted = true;
         }
         if (!$deleted) {
             $recordModel->setType($this->getSynchronizeController()->getSourceType())->setMode(WSAPP_SyncRecordModel::WSAPP_UPDATE_MODE);
         } else {
             $recordModel->setType($this->getSynchronizeController()->getSourceType())->setMode(WSAPP_SyncRecordModel::WSAPP_DELETE_MODE);
         }
         $googleRecords[$calendar->id->text] = $recordModel;
     }
     $this->createdRecords = count($googleRecords);
     if (isset($maxModifiedTime)) {
         Google_Utils_Helper::updateSyncTime('Calendar', $maxModifiedTime);
     } else {
         Google_Utils_Helper::updateSyncTime('Calendar');
     }
     return $googleRecords;
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:57,代码来源:Calendar.php

示例13: outputCalendarByDateRange

/**
 * Iterate through all the Google Calendars and create a JSON encoded array of events.
 *
 * @return array of events in JSON format
 */
function outputCalendarByDateRange($client, $startDate, $endDate, $idsofcal, $gcalobj)
{
    $gdataCal = new Zend_Gdata_Calendar($client);
    $rows = array();
    $idsofcal = explode(',', $idsofcal);
    $calFeed = $gdataCal->getCalendarListFeed();
    foreach ($idsofcal as $idofcal) {
        if ($idofcal != '') {
            $query = $gdataCal->newEventQuery();
            $query->setUser(substr($idofcal, strrpos($idofcal, "/") + 1));
            $query->setVisibility('private');
            $query->setProjection('full');
            $query->setOrderby('starttime');
            $query->setStartMin($startDate);
            $query->setStartMax($endDate);
            $eventFeed = $gdataCal->getCalendarEventFeed($query);
            $color = CALENDAR_DEF_COLOR;
            $accesslevl = true;
            foreach ($calFeed as $calendar) {
                if (strpos($idofcal, $calendar->id->text) !== false) {
                    $color = $calendar->color->value;
                    if ($calendar->accesslevel->value == 'read') {
                        $accesslevl = false;
                    }
                }
            }
            foreach ($eventFeed as $event) {
                foreach ($event->when as $when) {
                    $startD = substr($when->startTime, 0, 19);
                    $startD = str_replace('T', ' ', $startD);
                    $endD = substr($when->endTime, 0, 19);
                    $endD = str_replace('T', ' ', $endD);
                    /*
                     * If both start time and end time are different and their time parts differ then allDay is false
                     */
                    if ($startD != $endD && substr($startD, 0, 10) == substr($endD, 0, 10)) {
                        $allDay = "false";
                    } else {
                        $allDay = "true";
                    }
                    $row = array();
                    $row["title"] = $event->title->text;
                    $row["id"] = $event->id->text;
                    $row["editable"] = $accesslevl;
                    $row["start"] = $startD;
                    $row["end"] = $endD;
                    $row["allDay"] = $allDay;
                    $row["color"] = $color;
                    $row["textColor"] = "white";
                    $row["calendar"] = "Google Calendar event";
                    array_push($rows, $row);
                }
            }
        }
    }
    //Encode in JSON format.
    $str = json_encode($rows);
    //Replace "true","false" with true,false for javascript.
    $str = str_replace('"true"', 'true', $str);
    $str = str_replace('"false"', 'false', $str);
    //Return the events in the JSON format.
    echo $str;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:68,代码来源:json-events-gcal.php


注:本文中的Zend_Gdata_Calendar::getCalendarEventFeed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。