PHP Class SubmissionFileManager, pkp-lib

Inheritance: extends BaseSubmissionFileManager
Datei anzeigen Open project: pkp/pkp-lib Class Usage Examples

Public Methods

Method Description
__construct ( $contextId, $submissionId ) Constructor.
_getFile ( $fileId, $revision = null ) : SubmissionFile Internal helper method to retrieve file information by file ID.
_handleUpload ( $fileName, $fileStage, $uploaderUserId, $uploaderUserGroupId, $revisedFileId = null, $genreId = null, $assocType = null, $assocId = null ) : SubmissionFile Upload the file and add it to the database.
_instantiateSubmissionFile ( $sourceFilePath, $fileStage, $revisedFileId = null, $genreId = null, $assocType = null, $assocId = null ) : SubmissionFile Routine to instantiate and pre-populate a new submission file.
copyFileToFileStage ( $sourceFileId, $sourceRevision, $newFileStage, $destFileId = null, $viewable = false ) Copies an existing ArticleFile and renames it.
deleteFile ( $fileId, $revision = null ) : boolean Delete a file.
downloadFile ( $fileId, $revision = null, $inline = false, $filename = null ) : boolean Download a file.
recordView ( $submissionFile ) Record a file view in database.
temporaryFileToSubmissionFile ( $temporaryFile, $fileStage, $uploaderUserId, $uploaderUserGroupId, $revisedFileId, $genreId, $assocType, $assocId ) : integer Copy a temporary file to a submission file.
uploadSubmissionFile ( $fileName, $fileStage, $uploaderUserId, $uploaderUserGroupId, $revisedFileId = null, $genreId = null, $assocType = null, $assocId = null ) : SubmissionFile Upload a submission file.

Method Details

__construct() public method

Constructor.
public __construct ( $contextId, $submissionId )
$contextId int
$submissionId int

_getFile() public method

Internal helper method to retrieve file information by file ID.
public _getFile ( $fileId, $revision = null ) : SubmissionFile
$fileId integer
$revision integer
return SubmissionFile

_handleUpload() public method

Upload the file and add it to the database.
public _handleUpload ( $fileName, $fileStage, $uploaderUserId, $uploaderUserGroupId, $revisedFileId = null, $genreId = null, $assocType = null, $assocId = null ) : SubmissionFile
$fileName string index into the $_FILES array
$fileStage int submission file stage (one of the SUBMISSION_FILE_* constants)
$uploaderUserId int The id of the user that uploaded the file.
$uploaderUserGroupId int The id of the user group that the uploader acted in when uploading the file.
$revisedFileId int ID of an existing file to revise
$genreId int foreign key into genres table (e.g. manuscript, etc.)
$assocType int
$assocId int
return SubmissionFile the uploaded submission file or null if an error occured.

_instantiateSubmissionFile() public method

Routine to instantiate and pre-populate a new submission file.
public _instantiateSubmissionFile ( $sourceFilePath, $fileStage, $revisedFileId = null, $genreId = null, $assocType = null, $assocId = null ) : SubmissionFile
$sourceFilePath string
$fileStage integer SUBMISSION_FILE_...
$revisedFileId integer optional
$genreId integer optional
$assocType integer optional
$assocId integer optional
return SubmissionFile returns the instantiated submission file or null if an error occurs.

copyFileToFileStage() public method

Copies an existing ArticleFile and renames it.
public copyFileToFileStage ( $sourceFileId, $sourceRevision, $newFileStage, $destFileId = null, $viewable = false )
$sourceFileId int
$sourceRevision int
$destFileId int (optional)
$viewable boolean (optional)

deleteFile() public method

Delete a file.
public deleteFile ( $fileId, $revision = null ) : boolean
$fileId integer
return boolean returns true if successful

downloadFile() public method

Download a file.
public downloadFile ( $fileId, $revision = null, $inline = false, $filename = null ) : boolean
$fileId int the file id of the file to download
$revision int the revision of the file to download
$inline boolean print file as inline instead of attachment, optional
$filename string The client-side download filename (optional)
return boolean

recordView() public method

Record a file view in database.
public recordView ( $submissionFile )
$submissionFile SubmissionFile

temporaryFileToSubmissionFile() public method

Copy a temporary file to a submission file.
public temporaryFileToSubmissionFile ( $temporaryFile, $fileStage, $uploaderUserId, $uploaderUserGroupId, $revisedFileId, $genreId, $assocType, $assocId ) : integer
$temporaryFile SubmissionFile
$fileStage integer
$assocType integer
$assocId integer
return integer the file ID (false if upload failed)

uploadSubmissionFile() public method

Upload a submission file.
public uploadSubmissionFile ( $fileName, $fileStage, $uploaderUserId, $uploaderUserGroupId, $revisedFileId = null, $genreId = null, $assocType = null, $assocId = null ) : SubmissionFile
$fileName string the name of the file used in the POST form
$fileStage int submission file workflow stage
$uploaderUserId int The id of the user that uploaded the file.
$uploaderUserGroupId int The id of the user group that the uploader acted in when uploading the file.
$revisedFileId int
$genreId int (e.g. Manuscript, Appendix, etc.)
return SubmissionFile