diff --git a/private/lib/dao/MediaHandlerInterface.php b/private/lib/dao/MediaHandlerInterface.php new file mode 100644 index 0000000..465f820 --- /dev/null +++ b/private/lib/dao/MediaHandlerInterface.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/private/lib/dao/MediaModelHtml5.php b/private/lib/dao/MediaModelHtml5.php new file mode 100644 index 0000000..27c115f --- /dev/null +++ b/private/lib/dao/MediaModelHtml5.php @@ -0,0 +1,16 @@ +link = $link; + } + +} +?> \ No newline at end of file diff --git a/private/lib/dao/MediaModelImage.php b/private/lib/dao/MediaModelImage.php new file mode 100644 index 0000000..43d5752 --- /dev/null +++ b/private/lib/dao/MediaModelImage.php @@ -0,0 +1,30 @@ +path = $origin; + $this->destination = $config->paths->media; + $this->destination .= $this->_id; + } + + public function onSave(){ + try{ + if(!is_dir($this->destination)){ + SFSManager::createDirectory($this->destination); + } + SFSManager::copyFile($this->path, $this->destination.=$this->_id); + + }catch(SFSException $ex){ + throw new CoreException("Error while saving model with id '".$this->_id. "' ".$ex->getMessage()); + } + } +} +?> \ No newline at end of file diff --git a/private/lib/dao/MediaModelLocalVideo.php b/private/lib/dao/MediaModelLocalVideo.php new file mode 100644 index 0000000..d472e96 --- /dev/null +++ b/private/lib/dao/MediaModelLocalVideo.php @@ -0,0 +1,30 @@ +path = $origin; + $this->destination = $config->paths->media; + $this->destination .= $this->_id; + } + + public function onSave(){ + try{ + if(!is_dir($this->destination)){ + SFSManager::createDirectory($this->destination); + } + SFSManager::copyFile($this->path, $this->destination.=$this->_id); + + }catch(SFSException $ex){ + throw new CoreException("Error while saving model with id '".$this->_id. "' ".$ex->getMessage()); + } + } +} +?> \ No newline at end of file diff --git a/private/lib/dao/MediaModelPdf.php b/private/lib/dao/MediaModelPdf.php new file mode 100644 index 0000000..72edbe3 --- /dev/null +++ b/private/lib/dao/MediaModelPdf.php @@ -0,0 +1,30 @@ +path = $origin; + $this->destination = $config->paths->media; + $this->destination .= $this->_id; + } + + public function onSave(){ + try{ + if(!is_dir($this->destination)){ + SFSManager::createDirectory($this->destination); + } + SFSManager::copyFile($this->path, $this->destination.=$this->_id); + + }catch(SFSException $ex){ + throw new CoreException("Error while saving model with id '".$this->_id. "' ".$ex->getMessage()); + } + } +} +?> \ No newline at end of file diff --git a/private/lib/dao/MediaModelYoutube.php b/private/lib/dao/MediaModelYoutube.php new file mode 100644 index 0000000..6ca3bdc --- /dev/null +++ b/private/lib/dao/MediaModelYoutube.php @@ -0,0 +1,16 @@ +link = $link; + } + +} +?> \ No newline at end of file diff --git a/private/lib/dao/models/MediaHandlerModel.php b/private/lib/dao/models/MediaHandlerModel.php new file mode 100644 index 0000000..d27052c --- /dev/null +++ b/private/lib/dao/models/MediaHandlerModel.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/private/lib/dao/models/MediaModel.php b/private/lib/dao/models/MediaModel.php new file mode 100644 index 0000000..dffcde1 --- /dev/null +++ b/private/lib/dao/models/MediaModel.php @@ -0,0 +1,36 @@ +array("label"=>"Youtube"), + self::TYPE_IMAGE=>array("label"=>"Image"), + self::TYPE_HTML5=>array("label"=>"Html5"), + self::TYPE_PDF=>array("label"=>"Pdf"), + self::TYPE_LOCALVIDEO=>array("label"=>"Local Video") + ); + + public function __construct($mediaType){ + if(array_key_exists($mediaType, self::$MEDIA_TYPES)){ + $this->type = $mediaType; + } + else{ + throw new MediaException("Invalid media type for Media; mediatype '".$mediaType."'"); + } + } + + + abstract public function onSave(); + +} + +?> \ No newline at end of file diff --git a/private/lib/lib.inclusions.php b/private/lib/lib.inclusions.php index 7d822d4..464bd6d 100644 --- a/private/lib/lib.inclusions.php +++ b/private/lib/lib.inclusions.php @@ -26,7 +26,7 @@ require_once(dirname(__FILE__)."/system/lib.inclusion.php"); require_once(dirname(__FILE__)."/dao/lib.inclusion.php"); - +require_once(dirname(__FILE__)."/media/lib.inclusion.php"); // require_once(dirname(__FILE__)."/Status.php"); diff --git a/private/lib/media/Media.php b/private/lib/media/Media.php new file mode 100644 index 0000000..03395ee --- /dev/null +++ b/private/lib/media/Media.php @@ -0,0 +1,31 @@ +type = $mediaType; + } + else{ + throw new MediaException("Invalid media type for Media; mediatype '".$mediaType."'"); + } + } + + abstract public function asText(); + + public function renderMedia(){ + echo $this->asText(); + } + + public function getType(){ + return $this->type; + } + + public function getTitle(){ + return $this->details; + } +} +?> \ No newline at end of file diff --git a/private/lib/media/MediaException.php b/private/lib/media/MediaException.php new file mode 100644 index 0000000..e48e8ee --- /dev/null +++ b/private/lib/media/MediaException.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/private/lib/media/MediaInterface.php b/private/lib/media/MediaInterface.php new file mode 100644 index 0000000..54b9531 --- /dev/null +++ b/private/lib/media/MediaInterface.php @@ -0,0 +1,28 @@ +array("label"=>"Youtube"), + self::TYPE_IMAGE=>array("label"=>"Image"), + self::TYPE_HTML5=>array("label"=>"Html5"), + self::TYPE_PDF=>array("label"=>"Pdf"), + self::TYPE_LOCALVIDEO=>array("label"=>"Local Video") + ); + + public function asText(); + + public function renderMedia(); + + public function getType(); + + public function getTitle(); + +}*/ +?> \ No newline at end of file diff --git a/private/lib/media/lib.inclusion.php b/private/lib/media/lib.inclusion.php new file mode 100644 index 0000000..926bd8f --- /dev/null +++ b/private/lib/media/lib.inclusion.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/private/lib/media/mediaTypes/MediaHtml5.php b/private/lib/media/mediaTypes/MediaHtml5.php new file mode 100644 index 0000000..57309ee --- /dev/null +++ b/private/lib/media/mediaTypes/MediaHtml5.php @@ -0,0 +1,15 @@ +code = $code; + } + + public function asText(){ + echo $this->code; + } +} +?> \ No newline at end of file diff --git a/private/lib/media/mediaTypes/MediaImage.php b/private/lib/media/mediaTypes/MediaImage.php new file mode 100644 index 0000000..ad2c050 --- /dev/null +++ b/private/lib/media/mediaTypes/MediaImage.php @@ -0,0 +1,14 @@ +path = $path; + } + + public function asText(){ + echo $this->path; + } +} +?> \ No newline at end of file diff --git a/private/lib/media/mediaTypes/MediaPdf.php b/private/lib/media/mediaTypes/MediaPdf.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/private/lib/media/mediaTypes/MediaPdf.php @@ -0,0 +1 @@ +link = $link; + } + + public function asText(){ + echo "iframe ".$this->link; + } +} +?> \ No newline at end of file