From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 24 Feb 2014 16:42:14 +0100 Subject: init --- .../manual/core/en/zend.gdata.docs.html | 266 +++++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 zend/documentation/manual/core/en/zend.gdata.docs.html (limited to 'zend/documentation/manual/core/en/zend.gdata.docs.html') diff --git a/zend/documentation/manual/core/en/zend.gdata.docs.html b/zend/documentation/manual/core/en/zend.gdata.docs.html new file mode 100644 index 0000000..f219a46 --- /dev/null +++ b/zend/documentation/manual/core/en/zend.gdata.docs.html @@ -0,0 +1,266 @@ + + + + + Using Google Documents List Data API - Zend Framework Manual + + + + + + + + +
+ + + + + + + + +
+ Using Google Calendar + + + + +
+
+

Using Google Documents List Data API

+ + +

+ The Google Documents List Data API allows client applications to + upload documents to Google Documents and list them in the form of + Google Data API ("GData") feeds. Your client application can request + a list of a user's documents, and query the content in an existing + document. +

+ +

+ See » http://code.google.com/apis/documents/overview.html + for more information about the Google Documents List API. +

+ +

Get a List of Documents

+ + +

+ You can get a list of the Google Documents for a particular user by using + the getDocumentListFeed() method of the docs + service. The service will return a + Zend_Gdata_Docs_DocumentListFeed object + containing a list of documents associated with the authenticated + user. +

+ +
  1. $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
  2. +
  3. $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
  4. +
  5. $docs = new Zend_Gdata_Docs($client);
  6. +
  7. $feed = $docs->getDocumentListFeed();
+ + +

+ The resulting Zend_Gdata_Docs_DocumentListFeed object + represents the response from the server. This feed contains a list of + Zend_Gdata_Docs_DocumentListEntry objects + ($feed->entries), each of which represents a single + Google Document. +

+
+ +

Upload a Document

+ + +

+ You can create a new Google Document by uploading a word + processing document, spreadsheet, or presentation. This example + is from the interactive Docs.php sample which comes with the + library. It demonstrates uploading a file and printing + information about the result from the server. +

+ +
  1. /**
  2. +
  3. * Upload the specified document
  4. +
  5. *
  6. +
  7. * @param Zend_Gdata_Docs $docs The service object to use for communicating
  8. +
  9. *     with the Google Documents server.
  10. +
  11. * @param boolean $html True if output should be formatted for display in a
  12. +
  13. *     web browser.
  14. +
  15. * @param string $originalFileName The name of the file to be uploaded. The
  16. +
  17. *     MIME type of the file is determined from the extension on this file
  18. +
  19. *     name. For example, test.csv is uploaded as a comma separated volume
  20. +
  21. *     and converted into a spreadsheet.
  22. +
  23. * @param string $temporaryFileLocation (optional) The file in which the
  24. +
  25. *     data for the document is stored. This is used when the file has been
  26. +
  27. *     uploaded from the client's machine to the server and is stored in
  28. +
  29. *     a temporary file which does not have an extension. If this parameter
  30. +
  31. *     is null, the file is read from the originalFileName.
  32. +
  33. */
  34. +
  35. function uploadDocument($docs, $html, $originalFileName,
  36. +
  37.                         $temporaryFileLocation) {
  38. +
  39.   $fileToUpload = $originalFileName;
  40. +
  41.   if ($temporaryFileLocation) {
  42. +
  43.     $fileToUpload = $temporaryFileLocation;
  44. +
  45.   }
  46. +
  47.  
  48. +
  49.   // Upload the file and convert it into a Google Document. The original
  50. +
  51.   // file name is used as the title of the document and the MIME type
  52. +
  53.   // is determined based on the extension on the original file name.
  54. +
  55.   $newDocumentEntry = $docs->uploadFile($fileToUpload, $originalFileName,
  56. +
  57.       null, Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI);
  58. +
  59.  
  60. +
  61.   echo "New Document Title: ";
  62. +
  63.  
  64. +
  65.   if ($html) {
  66. +
  67.       // Find the URL of the HTML view of this document.
  68. +
  69.       $alternateLink = '';
  70. +
  71.       foreach ($newDocumentEntry->link as $link) {
  72. +
  73.           if ($link->getRel() === 'alternate') {
  74. +
  75.               $alternateLink = $link->getHref();
  76. +
  77.           }
  78. +
  79.       }
  80. +
  81.       // Make the title link to the document on docs.google.com.
  82. +
  83.       echo "<a href=\"$alternateLink\">\n";
  84. +
  85.   }
  86. +
  87.   echo $newDocumentEntry->title."\n";
  88. +
  89.   if ($html) {echo "</a>\n";}
  90. +
  91. }
+ +
+ +

Searching the documents feed

+ + +

+ You can search the Document List using some of the » standard + Google Data API query parameters. Categories are used to + restrict the + type of document (word processor document, spreadsheet) returned. + The full-text query string is used to search the content of all + the documents. More detailed information on parameters specific + to the Documents List can be found in the » Documents List + Data API Reference Guide. +

+ +

Get a List of Word Processing Documents

+ + +

+ You can also request a feed containing all of your documents of a specific type. For + example, to see a list of your work processing documents, you would perform a + category query as follows. +

+ +
  1. $feed = $docs->getDocumentListFeed(
  2. +
  3.     'http://docs.google.com/feeds/documents/private/full/-/document');
+ +
+ +

Get a List of Spreadsheets

+ + +

+ To request a list of your Google Spreadsheets, use the following category query: +

+ +
  1. $feed = $docs->getDocumentListFeed(
  2. +
  3.     'http://docs.google.com/feeds/documents/private/full/-/spreadsheet');
+ +
+ +

Performing a text query

+ + +

+ You can search the content of documents by using a + Zend_Gdata_Docs_Query in your request. A Query object + can be used to construct the query URI, with the search term + being passed in as a parameter. Here is an example method which queries + the documents list for documents which contain the search string: +

+ +
  1. $docsQuery = new Zend_Gdata_Docs_Query();
  2. +
  3. $docsQuery->setQuery($query);
  4. +
  5. $feed = $client->getDocumentListFeed($docsQuery);
+ +
+
+
+
+ + + + + + + + + +
+ Using Google Calendar + + + + +
+
+ +
+ + \ No newline at end of file -- cgit v1.2.3