Esempio n. 1
0
 /**
  * Returns an instance of class.
  *
  * @return BOL_FileDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Esempio n. 2
0
 /**
  * Get path to file in file system
  *
  * @param int $id
  *
  * @return string
  */
 public function getFilePath($id)
 {
     $userfilesDir = OW::getPluginManager()->getPlugin('base')->getUserFilesDir();
     $file = $this->fileDao->findById($id);
     return $userfilesDir . $id . $file->filename;
 }
Esempio n. 3
0
 public function moveTemporaryFile($tmpId, $desc)
 {
     $tmp = $this->fileTemporaryDao->findById($tmpId);
     if (!$tmp) {
         return false;
     }
     $tmpFilePath = $this->getTemporaryFilePath($tmp->id);
     $fileService = BOL_FileService::getInstance();
     $file = new BOL_File();
     $file->description = htmlspecialchars(trim($desc));
     $file->addDatetime = time();
     $file->filename = $tmp->filename;
     $file->userId = $tmp->userId;
     BOL_FileDao::getInstance()->save($file);
     try {
         copy($tmpFilePath, $fileService->getFilePath($file->id));
     } catch (Exception $e) {
         $photo = null;
     }
     return $file;
 }