Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Gdata/Gbase.php
Go to the documentation of this file.
00001 <?php
00002 
00027 require_once 'Zend/Gdata.php';
00028 
00032 require_once 'Zend/Gdata/Gbase/ItemFeed.php';
00033 
00037 require_once 'Zend/Gdata/Gbase/ItemEntry.php';
00038 
00042 require_once 'Zend/Gdata/Gbase/SnippetEntry.php';
00043 
00047 require_once 'Zend/Gdata/Gbase/SnippetFeed.php';
00048 
00060 class Zend_Gdata_Gbase extends Zend_Gdata
00061 {
00062 
00066     const GBASE_ITEM_FEED_URI = 'http://www.google.com/base/feeds/items';
00067 
00071     const GBASE_SNIPPET_FEED_URI = 'http://www.google.com/base/feeds/snippets';
00072 
00076     const AUTH_SERVICE_NAME = 'gbase';
00077 
00083     protected $_defaultPostUri = self::GBASE_ITEM_FEED_URI;
00084 
00090     public static $namespaces = array(
00091         array('g', 'http://base.google.com/ns/1.0', 1, 0),
00092         array('batch', 'http://schemas.google.com/gdata/batch', 1, 0)
00093     );
00094 
00102     public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
00103     {
00104         $this->registerPackage('Zend_Gdata_Gbase');
00105         $this->registerPackage('Zend_Gdata_Gbase_Extension');
00106         parent::__construct($client, $applicationId);
00107         $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
00108     }
00109 
00116     public function getGbaseItemFeed($location = null)
00117     {
00118         if ($location === null) {
00119             $uri = self::GBASE_ITEM_FEED_URI;
00120         } else if ($location instanceof Zend_Gdata_Query) {
00121             $uri = $location->getQueryUrl();
00122         } else {
00123             $uri = $location;
00124         }
00125         return parent::getFeed($uri, 'Zend_Gdata_Gbase_ItemFeed');
00126     }
00127 
00134     public function getGbaseItemEntry($location = null)
00135     {
00136         if ($location === null) {
00137             require_once 'Zend/Gdata/App/InvalidArgumentException.php';
00138             throw new Zend_Gdata_App_InvalidArgumentException(
00139                     'Location must not be null');
00140         } else if ($location instanceof Zend_Gdata_Query) {
00141             $uri = $location->getQueryUrl();
00142         } else {
00143             $uri = $location;
00144         }
00145         return parent::getEntry($uri, 'Zend_Gdata_Gbase_ItemEntry');
00146     }
00147 
00155     public function insertGbaseItem($entry, $dryRun = false)
00156     {
00157         if ($dryRun == false) {
00158             $uri = $this->_defaultPostUri;
00159         } else {
00160             $uri = $this->_defaultPostUri . '?dry-run=true';
00161         }
00162         $newitem = $this->insertEntry($entry, $uri, 'Zend_Gdata_Gbase_ItemEntry');
00163         return $newitem;
00164     }
00165 
00173     public function updateGbaseItem($entry, $dryRun = false)
00174     {
00175         $returnedEntry = $entry->save($dryRun);
00176         return $returnedEntry;
00177     }
00178 
00186     public function deleteGbaseItem($entry, $dryRun = false)
00187     {
00188         $entry->delete($dryRun);
00189         return $this;
00190     }
00191 
00198     public function getGbaseSnippetFeed($location = null)
00199     {
00200         if ($location === null) {
00201             $uri = self::GBASE_SNIPPET_FEED_URI;
00202         } else if ($location instanceof Zend_Gdata_Query) {
00203             $uri = $location->getQueryUrl();
00204         } else {
00205             $uri = $location;
00206         }
00207         return parent::getFeed($uri, 'Zend_Gdata_Gbase_SnippetFeed');
00208     }
00209 }
 All Data Structures Namespaces Files Functions Variables Enumerations