Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Service class for interacting with the Google Document List data API

$SUPPORTED_FILETYPES= 'array(
'TXT'=>'text/plain''
array(
'TXT'=>'text/plain'
Details
__construct(
\Zend_Http_Client $client
=
null, string $applicationId
=
'MyCompany-MyApp-1.0'
)
:
void
Create Gdata_Docs object
Name | Type | Description |
---|---|---|
$client | \Zend_Http_Client | (optional) The HTTP client to use when when communicating with the Google servers. |
$applicationId | string | The identity of the app in the form of Company-AppName-Version |

createFolder(
string $folderName, string|null $folderResourceId
=
null
)
:
\Zend_Gdata_Entry
Creates a new folder in Google Docs
Name | Type | Description |
---|---|---|
$folderName | string | The folder name to create |
$folderResourceId | string|null | The parent folder to create it in ("folder%3Amy_parent_folder") |
Type | Description |
---|---|
\Zend_Gdata_Entry | The folder entry created. |

getDoc(
string $docId, string $docType
)
:
\Zend_Gdata_Docs_DocumentListEntry
Retreive entry object representing a single document.
This method builds the URL where this item is stored using the type and the id of the document.
Name | Type | Description |
---|---|---|
$docId | string | The URL key for the document. Examples: dcmg89gw_62hfjj8m, pKq0CzjiF3YmGd0AIlHKqeg |
$docType | string | The type of the document as used in the Google Document List URLs. Examples: document, spreadsheet, presentation |
Type | Description |
---|---|
\Zend_Gdata_Docs_DocumentListEntry |

getDocument(
string $id
)
:
void
Retreive entry object for the desired word processing document.
Name | Type | Description |
---|---|---|
$id | string | The URL id for the document. Example: dcmg89gw_62hfjj8m |

getDocumentListEntry(
mixed $location
=
null
)
:
\Zend_Gdata_Docs_DocumentListEntry
Retreive entry object representing a single document.
Name | Type | Description |
---|---|---|
$location | mixed | The location for the entry, as a URL or Query |
Type | Description |
---|---|
\Zend_Gdata_Docs_DocumentListEntry |

getDocumentListFeed(
mixed $location
=
null
)
:
\Zend_Gdata_Docs_DocumentListFeed
Retreive feed object containing entries for the user's documents.
Name | Type | Description |
---|---|---|
$location | mixed | The location for the feed, as a URL or Query |
Type | Description |
---|---|
\Zend_Gdata_Docs_DocumentListFeed |

getPresentation(
string $id
)
:
void
Retreive entry object for the desired presentation.
Name | Type | Description |
---|---|---|
$id | string | The URL id for the document. Example: dcmg89gw_21gtrjcn |

getSpreadsheet(
string $id
)
:
void
Retreive entry object for the desired spreadsheet.
Name | Type | Description |
---|---|---|
$id | string | The URL id for the document. Example: pKq0CzjiF3YmGd0AIlHKqeg |

insertDocument(
mixed $data, string $uri, string $className
=
'Zend_Gdata_Docs_DocumentListEntry'
)
:
\Zend_Gdata_Docs_DocumentListEntry
Inserts an entry to a given URI and returns the response as an Entry.
Name | Type | Description |
---|---|---|
$data | mixed | The Zend_Gdata_Docs_DocumentListEntry or media source to post. If it is a DocumentListEntry, the mediaSource should already have been set. If $data is a mediaSource, it should have the correct slug header and mime type. |
$uri | string | POST URI |
$className | string | (optional) The class of entry to be returned. The default is a 'Zend_Gdata_Docs_DocumentListEntry'. |
Type | Description |
---|---|
\Zend_Gdata_Docs_DocumentListEntry | The entry returned by the service after insertion. |

lookupMimeType(
string $fileExtension
)
:
string
Looks up the mime type based on the file name extension. For example, calling this method with 'csv' would return 'text/comma-separated-values'. The Mime type is sent as a header in the upload HTTP POST request.
Name | Type | Description |
---|---|---|
$fileExtension | string |
Type | Description |
---|---|
string | The mime type to be sent to the server to tell it how the multipart mime data should be interpreted. |

uploadFile(
string $fileLocation, string $title
=
null, string $mimeType
=
null, string $uri
=
null
)
:
\Zend_Gdata_Docs_DocumentListEntry
Upload a local file to create a new Google Document entry.
Name | Type | Description |
---|---|---|
$fileLocation | string | The full or relative path of the file to be uploaded. |
$title | string | The name that this document should have on the server. If set, the title is used as the slug header in the POST request. If no title is provided, the location of the file will be used as the slug header in the request. If no mimeType is provided, this method attempts to determine the mime type based on the slugHeader by looking for .doc, .csv, .txt, etc. at the end of the file name. Example value: 'test.doc'. |
$mimeType | string | Describes the type of data which is being sent to the server. This must be one of the accepted mime types which are enumerated in SUPPORTED_FILETYPES. |
$uri | string | (optional) The URL to which the upload should be made. Example: 'https://docs.google.com/feeds/documents/private/full'. |
Type | Description |
---|---|
\Zend_Gdata_Docs_DocumentListEntry | The entry for the newly created Google Document. |