2012-04-12 1 views
0

현재 API를 사용하여 Google 캘리 나다 데이터에 액세스해야하는 프로젝트에서 일하고 있습니다. 모든 것이 잘 작동하지만 이벤트 시작 시간/종료 시간을 알 수 없습니다. 가장 중요한 정보입니다.Zend_Gdata를 사용하여 Google 캘린더 일정 시작을 얻는 방법?

내가 젠드 프레임 워크와 Zend_Gdata 라이브러리를 사용하고, 불행하게도 젠드의 문서는

방법이 필요 얻을 수있는 이벤트 데이터 자세한 아닌가요? 아니면 다른 라이브러리를 사용해야합니까? 내가 이벤트 정보를 얻기 위해 노력하고있어

public function getEvents($future_only = TRUE,$force_refresh = FALSE) { 

    if (($this->events != NULL) && $force_refresh == FALSE) { 
     return $this->events; 
    } else { 
     if ($this->getService() != NULL) { 
      $service = $this->getService(); 
      try { 

       $query = $service->newEventQuery($this->url); 
       $query->setUser(null); 
       $query->setProjection(null); 
       $query->setVisibility(null); 
       $query->setOrderby('starttime'); 
       if ($future_only) { 
        $query->setFutureevents('true'); 
       } else { 
        $query->setFutureevents('false'); 
       } 

       $event_feed = $service->getCalendarEventFeed($query); 

       $this->events = $event_feed; 

       return $event_feed; 
      } catch (Exception $exc) { 
       . 
       . 
       . 
       return NULL; 
      } 
     } else { 
      return NULL; 
       } 
      } 
     } 

및 샘플 테스트 코드 : 여기

이벤트 피드를 받고 내 기능입니다

 $gcalendar = new Common_Model_GoogleCalendar(); 

      $events = $gcalendar->getEvents(); 

      if($events){ 

      foreach ($events as $evt) { 
       echo $evt->title.'<br />'; 
       echo $evt->id.'<br />'; 
       echo $evt->published.'<br />'; 
       Zend_Debug::dump($evt->getWhen());  //returns empty array 

      } 
      } 

답변

5

확실하지 당신은 지금이 분류했지만, @ 애슐리의 기여뿐만 아니라,이 일을 getWhen()을 얻는 방법 인 경우

$when = $evt->getWhen(); 
echo $when[0]->getStartTime(); 
echo $when[0]->getEndTime(); 
0

Zend_Gdata_Calendar_EventEntry 귀하의 변수 $events 될 것입니다 인스턴스 이것은 getWhen 함수를 상속 한 Zend_Gdata_Kind_EventEntry을 상속합니다.

예 :

$when = $evt->getWhen();

http://framework.zend.com/manual/en/zend.gdata.calendar.html

+0

불행히도 내가 지금하고있는 일이고 작동하지 않는 것 같습니다. 내 견본 테스트 코드를보십시오. – stawek