Open Journal Systems  3.3.0
SubmissionFileManager Class Reference
Inheritance diagram for SubmissionFileManager:
BaseSubmissionFileManager ContextFileManager PrivateFileManager FileManager

Public Member Functions

 __construct ($contextId, $submissionId)
 
 _getFile ($fileId, $revision=null)
 
 _handleCopy ($filePath, $fileStage, $copyUserId, $revisedFileId=null, $genreId=null, $assocType=null, $assocId=null)
 
 _handleUpload ($fileName, $fileStage, $uploaderUserId, $revisedFileId=null, $genreId=null, $assocType=null, $assocId=null)
 
 _instantiateSubmissionFile ($sourceFilePath, $fileStage, $revisedFileId=null, $genreId=null, $assocType=null, $assocId=null)
 
 copyFileToFileStage ($sourceFileId, $sourceRevision, $newFileStage, $destFileId=null, $viewable=false)
 
 copySubmissionFile ($filePath, $fileStage, $copyUserId, $revisedFileId=null, $genreId=null, $assocType=null, $assocId=null)
 
 deleteById ($fileId, $revision=null)
 
 downloadById ($fileId, $revision=null, $inline=false, $filename=null)
 
 recordView ($submissionFile)
 
 uploadSubmissionFile ($fileName, $fileStage, $uploaderUserId, $revisedFileId=null, $genreId=null, $assocType=null, $assocId=null)
 
- Public Member Functions inherited from BaseSubmissionFileManager
 getBasePath ()
 
 getSubmissionId ()
 
- Public Member Functions inherited from ContextFileManager
 __construct ($contextId)
 
- Public Member Functions inherited from PrivateFileManager
 __construct ()
 
- Public Member Functions inherited from FileManager
 compressFile ($filePath)
 
 copyDir ($source, $dest)
 
 copyFile ($source, $dest)
 
 decompressFile ($filePath)
 
 deleteByPath ($filePath)
 
 downloadByPath ($filePath, $mediaType=null, $inline=false, $fileName=null)
 
 fileExists ($filePath, $type='file')
 
 getDocumentExtension ($type)
 
 getDocumentType ($type)
 
 getExtension ($fileName)
 
 getFirstUploadedPostName ()
 
 getImageExtension ($type)
 
 getNiceFileSize ($size)
 
 getUploadedFileName ($fileName)
 
 getUploadedFilePath ($fileName)
 
 getUploadedFileType ($fileName)
 
 getUploadErrorCode ($fileName)
 
 mkdir ($dirPath, $perms=null)
 
 mkdirtree ($dirPath, $perms=null)
 
 parseFileExtension ($fileName)
 
 readFileFromPath ($filePath, $output=false)
 
 rmdir ($dirPath)
 
 rmtree ($file)
 
 setMode ($path, $mask)
 
 truncateFileName ($fileName, $length=127)
 
 uploadedFileExists ($fileName)
 
 uploadError ($fileName)
 
 uploadFile ($fileName, $destFileName)
 
 writeFile ($dest, &$contents)
 

Additional Inherited Members

- Data Fields inherited from BaseSubmissionFileManager
 $_submissionId
 
- Data Fields inherited from ContextFileManager
 $contextId
 
- Data Fields inherited from PrivateFileManager
 $filesDir
 

Detailed Description

Helper class for database-backed submission file management tasks.

Submission directory structure: [submission id]/note [submission id]/public [submission id]/submission [submission id]/submission/original [submission id]/submission/review [submission id]/submission/review/attachment [submission id]/submission/editor [submission id]/submission/copyedit [submission id]/submission/layout [submission id]/attachment

Definition at line 30 of file SubmissionFileManager.inc.php.

Constructor & Destructor Documentation

◆ __construct()

SubmissionFileManager::__construct (   $contextId,
  $submissionId 
)

Constructor.

Parameters
$contextIdint
$submissionIdint

Reimplemented from BaseSubmissionFileManager.

Definition at line 36 of file SubmissionFileManager.inc.php.

References ContextFileManager\$contextId.

Member Function Documentation

◆ _getFile()

SubmissionFileManager::_getFile (   $fileId,
  $revision = null 
)

Internal helper method to retrieve file information by file ID.

Parameters
$fileIdinteger
$revisioninteger
Returns
SubmissionFile

Definition at line 388 of file SubmissionFileManager.inc.php.

References DAORegistry\getDAO().

Referenced by deleteById(), and downloadById().

◆ _handleCopy()

SubmissionFileManager::_handleCopy (   $filePath,
  $fileStage,
  $copyUserId,
  $revisedFileId = null,
  $genreId = null,
  $assocType = null,
  $assocId = null 
)

Copy a file and add it to the database.

Parameters
$filePathstring full path to file on the file system
$fileStageint submission file stage (one of the SUBMISSION_FILE_* constants)
$copyUserIdint The id of the user that is copying the file.
$revisedFileIdint ID of an existing file to revise
$genreIdint foreign key into genres table (e.g. manuscript, etc.)
$assocTypeint
$assocIdint
Returns
SubmissionFile the submission file or null if an error occured.

Definition at line 245 of file SubmissionFileManager.inc.php.

References _instantiateSubmissionFile(), FileManager\fileExists(), DAORegistry\getDAO(), PKPString\mime_content_type(), and FileManager\truncateFileName().

Referenced by copySubmissionFile().

◆ _handleUpload()

SubmissionFileManager::_handleUpload (   $fileName,
  $fileStage,
  $uploaderUserId,
  $revisedFileId = null,
  $genreId = null,
  $assocType = null,
  $assocId = null 
)

Upload the file and add it to the database.

Parameters
$fileNamestring index into the $_FILES array
$fileStageint submission file stage (one of the SUBMISSION_FILE_* constants)
$uploaderUserIdint The id of the user that uploaded the file.
$revisedFileIdint ID of an existing file to revise
$genreIdint foreign key into genres table (e.g. manuscript, etc.)
$assocTypeint
$assocIdint
Returns
SubmissionFile the uploaded submission file or null if an error occured.

Definition at line 202 of file SubmissionFileManager.inc.php.

References _instantiateSubmissionFile(), DAORegistry\getDAO(), FileManager\getUploadedFileName(), FileManager\getUploadedFilePath(), FileManager\getUploadedFileType(), FileManager\truncateFileName(), and FileManager\uploadedFileExists().

Referenced by uploadSubmissionFile().

◆ _instantiateSubmissionFile()

SubmissionFileManager::_instantiateSubmissionFile (   $sourceFilePath,
  $fileStage,
  $revisedFileId = null,
  $genreId = null,
  $assocType = null,
  $assocId = null 
)

Routine to instantiate and pre-populate a new submission file.

Parameters
$sourceFilePathstring
$fileStageinteger SUBMISSION_FILE_...
$revisedFileIdinteger optional
$genreIdinteger optional
$assocIdinteger optional
$assocTypeinteger optional
Returns
SubmissionFile returns the instantiated submission file or null if an error occurs.

Definition at line 283 of file SubmissionFileManager.inc.php.

References fatalError(), Core\getCurrentDate(), DAORegistry\getDAO(), and BaseSubmissionFileManager\getSubmissionId().

Referenced by _handleCopy(), and _handleUpload().

◆ copyFileToFileStage()

SubmissionFileManager::copyFileToFileStage (   $sourceFileId,
  $sourceRevision,
  $newFileStage,
  $destFileId = null,
  $viewable = false 
)

Copies an existing SubmissionFile and renames it.

Parameters
$sourceFileIdint
$sourceRevisionint
$fileStageint
$destFileIdint (optional)
$viewableboolean (optional)
Returns
array? array(file_id, revision) on success; null on failure

Definition at line 147 of file SubmissionFileManager.inc.php.

References HookRegistry\call(), Core\getCurrentDate(), and DAORegistry\getDAO().

◆ copySubmissionFile()

SubmissionFileManager::copySubmissionFile (   $filePath,
  $fileStage,
  $copyUserId,
  $revisedFileId = null,
  $genreId = null,
  $assocType = null,
  $assocId = null 
)

Copy a submission file.

Parameters
$filePathstring the path of the file on the file system
$fileStageint submission file workflow stage
$copyUserIdint The id of the user that originates the file copy
$revisedFileIdint
$genreIdint (e.g. Manuscript, Appendix, etc.)
Returns
SubmissionFile

Definition at line 70 of file SubmissionFileManager.inc.php.

References _handleCopy().

◆ deleteById()

SubmissionFileManager::deleteById (   $fileId,
  $revision = null 
)

Delete a file.

Parameters
$fileIdinteger
$revisionIdinteger
Returns
boolean returns true if successful

Definition at line 84 of file SubmissionFileManager.inc.php.

References _getFile().

◆ downloadById()

SubmissionFileManager::downloadById (   $fileId,
  $revision = null,
  $inline = false,
  $filename = null 
)

Download a file.

Parameters
$fileIdint the file id of the file to download
$revisionint the revision of the file to download
$inlineboolean print file as inline instead of attachment, optional
$filenamestring The client-side download filename (optional)
Returns
boolean

Definition at line 101 of file SubmissionFileManager.inc.php.

References _getFile(), fatalError(), and recordView().

◆ recordView()

SubmissionFileManager::recordView (   $submissionFile)

Record a file view in database.

Parameters
$submissionFileSubmissionFile

Definition at line 124 of file SubmissionFileManager.inc.php.

References DAORegistry\getDAO(), and SessionManager\getManager().

Referenced by downloadById().

◆ uploadSubmissionFile()

SubmissionFileManager::uploadSubmissionFile (   $fileName,
  $fileStage,
  $uploaderUserId,
  $revisedFileId = null,
  $genreId = null,
  $assocType = null,
  $assocId = null 
)

Upload a submission file.

Parameters
$fileNamestring the name of the file used in the POST form
$fileStageint submission file workflow stage
$uploaderUserIdint The id of the user that uploaded the file.
$revisedFileIdint
$genreIdint (e.g. Manuscript, Appendix, etc.)
Returns
SubmissionFile

Definition at line 53 of file SubmissionFileManager.inc.php.

References _handleUpload().


The documentation for this class was generated from the following file: