30 lines
682 B
PHP
30 lines
682 B
PHP
<?php
|
|
/*
|
|
Author: Lorenzo Giacomelli
|
|
Creation Date: 08/gen/2016
|
|
*/
|
|
|
|
class MediaModelPdf extends MediaModel{
|
|
private $path;
|
|
private $destination;
|
|
|
|
public function __construct($origin){
|
|
parent::__construct(self::TYPE_PDF);
|
|
$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());
|
|
}
|
|
}
|
|
}
|
|
?>
|