2012-05-03 3 views
0

Google 문서 도구 API Zend Gdata 클라이언트를 사용하여 문서 사본을 만드는 방법을 결정하려고합니다.Zend Gdata를 사용하여 문서 복사 Google 문서 도구

나는 DocumentList에 액세스하는 다음 코드를 사용하여 개별 항목을 검색 할 수 있습니다.

$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME; 

$sourceClient = Zend_Gdata_ClientLogin::getHttpClient($sourceUser, $sourcePass, $service); 

$sourceDocs = new Zend_Gdata_Docs($sourceClient); 

$entry = new Zend_Gdata_Docs_DocumentListEntry(); 

$docfeed = $sourceDocs->getDocumentListFeed(); 

foreach ($docfeed->entries as $entry) 
{ 
     $entry->getTitleValue(); 
} 

나는 그것을 다운로드 한 다음 다시 업로드 할 필요없이 특정 문서 항목의 복사본을 만들 수있는 방법을 결정하기 위해 노력하고 있습니다. 나는 그것이 API 문서를 기반으로 할 수 있다는 것을 알고 있지만,이 예제는 .NET으로 제공되며, 이는 PHP로 잘 번역되지 않는 것으로 보인다. 내가 그것을 어떻게

Google 문서 도구 API 링크는 여기 https://developers.google.com/google-apps/documents-list/#copying_documents

답변

0

은 다음과 같습니다 (스프레드 시트)

그것 뿐이다
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME; 
$sourceClient = Zend_Gdata_ClientLogin::getHttpClient($sourceUser, $sourcePass, $service); 
$connection = new Zend_Gdata_Spreadsheets($sourceClient); 

// Get the Id of a sheet you want to copy [ensure its an object] 
$titleOfSheetToCopy = 'CopyMe'; 
$feed = $connection->getSpreadsheetFeed(); 
foreach($feed as $entry) { 
    if($entry->getTitle() == $titleOfSheetToCopy) { 
    // this is a url string so you need to clean it 
    $data = (string)$entry->getId(); 
    $data = explode("/",$data); 
    $id = array_pop($data); 
    } 
} 

// Create blank Entry Object  
$blankEntry = new Zend_Gdata_Spreadsheets_SpreadsheetEntry(); 

// Set title 
$blankEntry->setTitle(new Zend_Gdata_App_Extension_Title("My new spreadsheet", null)); 

// Set the id to the id of the sheet you want to copy (we got that above) 
$blankEntry->setId(new Zend_Gdata_App_Extension_Id($id); 

이 - 나를 위해 작품! 영감을 받아 How to create an empty spreadsheet using Zend GData [gaetan-frenoy]