Inheritances
Files
Overview
FRAMES
NO FRAMES

Class Zend_Gdata_Docs

Zend_Gdata
|-Zend_Gdata_Docs
|- class Zend_Gdata_Docs extends Zend_Gdata
Defined in line 49 of file Gdata/Docs.php.
Service class for interacting with the Google Document List data API
Linkhttp://code.google.com/apis/documents/
CategoryZend
PackageZend_Gdata
SubpackageDocs
CopyrightCopyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
Licensehttp://framework.zend.com/license/new-bsd New BSD License

Overview

Summary

Class constants
DOCUMENTS_LIST_FEED_URI
AUTH_SERVICE_NAME
Static fields
- $SUPPORTED_FILETYPES
Instance fields
# $_defaultPostUri
Static methods
+ lookupMimeType() Looks up the mime type based on the file name extension
Instance methods
+ __construct() Create Gdata_Docs object
+ getDoc() Retreive entry object representing a single document.
+ getDocument() Retreive entry object for the desired word processing document
+ getDocumentListEntry() Retreive entry object representing a single document
+ getDocumentListFeed() Retreive feed object containing entries for the user's documents
+ getPresentation() Retreive entry object for the desired presentation
+ getSpreadsheet() Retreive entry object for the desired spreadsheet
+ insertDocument() Inserts an entry to a given URI and returns the response as an Entry
+ uploadFile() Upload a local file to create a new Google Document entry

Details

Class constants

DOCUMENTS_LIST_FEED_URI
const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents/private/full'
AUTH_SERVICE_NAME
const AUTH_SERVICE_NAME = 'writely'

Static fields

$SUPPORTED_FILETYPES
private static $SUPPORTED_FILETYPES = array( 'CSV'=>'text/csv', 'DOC'=>'application/msword', 'ODS'=>'application/vnd.oasis.opendocument.spreadsheet', 'ODT'=>'application/vnd.oasis.opendocument.text', 'RTF'=>'application/rtf', 'SXW'=>'application/vnd.sun.xml.writer', 'TXT'=>'text/plain', 'XLS'=>'application/vnd.ms-excel')

Instance fields

$_defaultPostUri
protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI

Static methods

lookupMimeType()
public static function lookupMimeType( $fileExtension)
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.
Parameters
string $fileExtension
Returns string The mime type to be sent to the server to tell it how the
multipart mime data should be interpreted.

Instance methods

__construct()
public function __construct( $client = null
$applicationId = 'MyCompany-MyApp-1.0'
)
Create Gdata_Docs object
Parameters
Zend_Http_Client $client (optional) The HTTP client to use when
when communicating with the Google servers.
string $applicationId The identity of the app in the form of Company-AppName-Version
getDoc()
public function getDoc( $docId
$docType
)
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.
Parameters
string $docId The URL key for the document. Examples:
dcmg89gw_62hfjj8m, pKq0CzjiF3YmGd0AIlHKqeg
string $docType The type of the document as used in the Google
Document List URLs. Examples: document, spreadsheet, presentation
getDocument()
public function getDocument( $id)
Retreive entry object for the desired word processing document.
Parameters
string $id The URL id for the document. Example:
dcmg89gw_62hfjj8m
getDocumentListEntry()
public function getDocumentListEntry( $location = null)
Retreive entry object representing a single document.
Parameters
mixed $location The location for the entry, as a URL or Query
getDocumentListFeed()
public function getDocumentListFeed( $location = null)
Retreive feed object containing entries for the user's documents.
Parameters
mixed $location The location for the feed, as a URL or Query
getPresentation()
public function getPresentation( $id)
Retreive entry object for the desired presentation.
Parameters
string $id The URL id for the document. Example:
dcmg89gw_21gtrjcn
getSpreadsheet()
public function getSpreadsheet( $id)
Retreive entry object for the desired spreadsheet.
Parameters
string $id The URL id for the document. Example:
pKq0CzjiF3YmGd0AIlHKqeg
insertDocument()
public function insertDocument( $data
$uri
$className = 'Zend_Gdata_Docs_DocumentListEntry'
)
Inserts an entry to a given URI and returns the response as an Entry.
Parameters
mixed $data 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.
string $uri POST URI
string $className (optional) The class of entry to be returned.
The default is a 'Zend_Gdata_Docs_DocumentListEntry'.
Returns Zend_Gdata_Docs_DocumentListEntry The entry returned by the
service after insertion.
uploadFile()
public function uploadFile( $fileLocation
$title = null
$mimeType = null
$uri = null
)
Upload a local file to create a new Google Document entry.
Parameters
string $fileLocation The full or relative path of the file to
be uploaded.
string $title 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'.
string $mimeType 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.
string $uri (optional) The URL to which the upload should be
made.
Example: 'http://docs.google.com/feeds/documents/private/full'.
Returns Zend_Gdata_Docs_DocumentListEntry The entry for the newly
created Google Document.