Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Gdata/App/MediaEntry.php
Go to the documentation of this file.
00001 <?php
00002 
00027 require_once 'Zend/Gdata/App/Entry.php';
00028 
00032 require_once 'Zend/Gdata/App/MediaSource.php';
00033 
00037 require_once 'Zend/Gdata/MediaMimeStream.php';
00038 
00048 class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
00049 {
00055     protected $_mediaSource = null;
00056 
00064     public function __construct($element = null, $mediaSource = null)
00065     {
00066         parent::__construct($element);
00067         $this->_mediaSource = $mediaSource;
00068     }
00069 
00077     public function encode()
00078     {
00079         $xmlData = $this->saveXML();
00080         $mediaSource = $this->getMediaSource();
00081         if ($mediaSource === null) {
00082             // No attachment, just send XML for entry
00083             return $xmlData;
00084         } else {
00085             return new Zend_Gdata_MediaMimeStream($xmlData,
00086                 $mediaSource->getFilename(), $mediaSource->getContentType());
00087         }
00088     }
00089 
00096     public function getMediaSource()
00097     {
00098         return $this->_mediaSource;
00099     }
00100 
00107     public function setMediaSource($value)
00108     {
00109         if ($value instanceof Zend_Gdata_App_MediaSource) {
00110             $this->_mediaSource = $value;
00111         } else {
00112             require_once 'Zend/Gdata/App/InvalidArgumentException.php';
00113             throw new Zend_Gdata_App_InvalidArgumentException(
00114                     'You must specify the media data as a class that conforms to Zend_Gdata_App_MediaSource.');
00115         }
00116         return $this;
00117     }
00118 
00119 }
 All Data Structures Namespaces Files Functions Variables Enumerations