Files
fdn2/private/lib/dao/MediaModelLocalVideo.php
T

30 lines
696 B
PHP

<?php
/*
Author: Lorenzo Giacomelli
Creation Date: 08/gen/2016
*/
class MediaModelLocalVideo extends MediaModel{
private $path;
private $destination;
public function __construct($origin){
parent::__construct(self::TYPE_LOCALVIDEO);
$this->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());
}
}
}
?>