Open Monograph Press  3.3.0
PKPPublicFileManager.inc.php
1 <?php
2 
17 import('lib.pkp.classes.file.FileManager');
18 
19 abstract class PKPPublicFileManager extends FileManager {
20 
25  public function getSiteFilesPath() {
26  return Config::getVar('files', 'public_files_dir') . '/site';
27  }
28 
35  abstract public function getContextFilesPath($contextId);
36 
44  public function uploadContextFile($contextId, $fileName, $destFileName) {
45  return $this->uploadFile($fileName, $this->getContextFilesPath($contextId) . '/' . $destFileName);
46  }
47 
55  public function writeContextFile($contextId, $destFileName, $contents) {
56  return $this->writeFile($this->getContextFilesPath($contextId) . '/' . $destFileName, $contents);
57  }
58 
65  public function uploadSiteFile($fileName, $destFileName) {
66  return $this->uploadFile($fileName, $this->getSiteFilesPath() . '/' . $destFileName);
67  }
68 
76  public function copyContextFile($contextId, $sourceFile, $destFileName) {
77  return $this->copyFile($sourceFile, $this->getContextFilesPath($contextId) . '/' . $destFileName);
78  }
79 
86  public function removeContextFile($contextId, $fileName) {
87  return $this->deleteByPath($this->getContextFilesPath($contextId) . '/' . $fileName);
88  }
89 
95  public function removeSiteFile($fileName) {
96  return $this->deleteByPath($this->getSiteFilesPath() . '/' . $fileName);
97  }
98 }
99 
100 
PKPPublicFileManager\uploadContextFile
uploadContextFile($contextId, $fileName, $destFileName)
Definition: PKPPublicFileManager.inc.php:44
FileManager\deleteByPath
deleteByPath($filePath)
Definition: FileManager.inc.php:291
FileManager\copyFile
copyFile($source, $dest)
Definition: FileManager.inc.php:174
FileManager\writeFile
writeFile($dest, &$contents)
Definition: FileManager.inc.php:152
PKPPublicFileManager\writeContextFile
writeContextFile($contextId, $destFileName, $contents)
Definition: PKPPublicFileManager.inc.php:55
PKPPublicFileManager\getSiteFilesPath
getSiteFilesPath()
Definition: PKPPublicFileManager.inc.php:25
PKPPublicFileManager\removeSiteFile
removeSiteFile($fileName)
Definition: PKPPublicFileManager.inc.php:95
Config\getVar
static getVar($section, $key, $default=null)
Definition: Config.inc.php:35
PKPPublicFileManager
Wrapper class for uploading files to a site/journal's public directory.
Definition: PKPPublicFileManager.inc.php:19
PKPPublicFileManager\removeContextFile
removeContextFile($contextId, $fileName)
Definition: PKPPublicFileManager.inc.php:86
FileManager\uploadFile
uploadFile($fileName, $destFileName)
Definition: FileManager.inc.php:134
FileManager
Class defining basic operations for file management.
Definition: FileManager.inc.php:35
PKPPublicFileManager\copyContextFile
copyContextFile($contextId, $sourceFile, $destFileName)
Definition: PKPPublicFileManager.inc.php:76
PKPPublicFileManager\uploadSiteFile
uploadSiteFile($fileName, $destFileName)
Definition: PKPPublicFileManager.inc.php:65
PKPPublicFileManager\getContextFilesPath
getContextFilesPath($contextId)