Open Journal Systems  2.4.4
 All Classes Namespaces Functions Variables Groups Pages
ArticleFileManager Class Reference
Inheritance diagram for ArticleFileManager:
FileManager

Public Member Functions

 ArticleFileManager ($articleId)
 
 copyAndRenameFile ($sourceFileId, $sourceRevision, $fileStage, $destFileId=null)
 
 copyAttachmentFile ($url, $mimeType, $fileId=null, $overwrite=true, $assocId=null)
 
 copyPublicFile ($url, $mimeType, $fileId=null, $overwrite=true)
 
 copySuppFile ($url, $mimeType, $fileId=null, $overwrite=true)
 
 copyToCopyeditFile ($fileId, $revision=null)
 
 copyToEditorFile ($fileId, $revision=null, $destFileId=null)
 
 copyToLayoutFile ($fileId, $revision=null)
 
 copyToReviewFile ($fileId, $revision=null, $destFileId=null)
 
 deleteArticleTree ()
 
 deleteFile ($fileId, $revision=null)
 
 downloadFile ($fileId, $revision=null, $inline=false)
 
 fileStageToAbbrev ($fileStage)
 
 fileStageToPath ($fileStage)
 
generateDummyFile (&$article)
 
 generateFilename (&$articleFile, $fileStage, $originalName)
 
getFile ($fileId, $revision=null)
 
 handleCopy ($url, $mimeType, $fileStage, $fileId=null, $overwrite=false)
 
 handleUpload ($fileName, $fileStage, $fileId=null, $overwrite=false)
 
 handleWrite ($fileName, &$contents, $mimeType, $fileStage, $fileId=null, $overwrite=false)
 
 readFile ($fileId, $revision=null, $output=false)
 
 removePriorRevisions ($fileId, $revision)
 
 temporaryFileToArticleFile (&$temporaryFile, $fileStage, $assocId=null)
 
 uploadCopyeditFile ($fileName, $fileId=null)
 
 uploadEditorDecisionFile ($fileName, $fileId=null)
 
 uploadLayoutFile ($fileName, $fileId=null, $overwrite=true)
 
 uploadPublicFile ($fileName, $fileId=null, $overwrite=true)
 
 uploadReviewFile ($fileName, $fileId=null)
 
 uploadSubmissionFile ($fileName, $fileId=null, $overwrite=false)
 
 uploadSubmissionNoteFile ($fileName, $fileId=null, $overwrite=true)
 
 uploadSuppFile ($fileName, $fileId=null, $overwrite=true)
 
 writePublicFile ($fileName, &$contents, $mimeType, $fileId=null, $overwrite=true)
 
 writeSuppFile ($fileName, &$contents, $mimeType, $fileId=null, $overwrite=true)
 
- Public Member Functions inherited from FileManager
 copyDir ($source, $dest)
 
 copyFile ($source, $dest)
 
 deleteFile ($filePath)
 
 downloadFile ($filePath, $mediaType=null, $inline=false, $fileName=null)
 
 fileExists ($filePath, $type= 'file')
 
 FileManager ()
 
 getDocumentExtension ($type)
 
 getDocumentType ($type)
 
 getExtension ($fileName)
 
 getImageExtension ($type)
 
 getNiceFileSize ($size)
 
 getUploadedFileName ($fileName)
 
 getUploadedFilePath ($fileName)
 
 getUploadedFileType ($fileName)
 
 mkdir ($dirPath, $perms=null)
 
 mkdirtree ($dirPath, $perms=null)
 
 parseFileExtension ($fileName)
 
readFile ($filePath, $output=false)
 
 rmdir ($dirPath)
 
 rmtree ($file)
 
 setMode ($path, $mask)
 
 truncateFileName ($fileName, $length=127)
 
 uploadedFileExists ($fileName)
 
 uploadError ($fileName)
 
 uploadFile ($fileName, $destFileName)
 
 writeFile ($dest, &$contents)
 

Detailed Description

Class defining operations for article file management.

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

Definition at line 32 of file ArticleFileManager.inc.php.

Member Function Documentation

ArticleFileManager::ArticleFileManager (   $articleId)

Constructor. Create a manager for handling article file uploads.

Parameters
$articleIdint

Definition at line 48 of file ArticleFileManager.inc.php.

References DAORegistry\getDAO(), and Config\getVar().

ArticleFileManager::copyAndRenameFile (   $sourceFileId,
  $sourceRevision,
  $fileStage,
  $destFileId = null 
)

Copies an existing ArticleFile and renames it.

Parameters
$sourceFileIdint
$sourceRevisionint
$fileStageint
$destFileIdint (optional)

Definition at line 370 of file ArticleFileManager.inc.php.

References HookRegistry\call(), FileManager\fileExists(), fileStageToAbbrev(), fileStageToPath(), Core\getCurrentDate(), DAORegistry\getDAO(), FileManager\mkdirtree(), and FileManager\parseFileExtension().

Referenced by copyToCopyeditFile(), copyToEditorFile(), copyToLayoutFile(), and copyToReviewFile().

ArticleFileManager::copyAttachmentFile (   $url,
  $mimeType,
  $fileId = null,
  $overwrite = true,
  $assocId = null 
)

Copy an attachment file.

Parameters
$urlstring The source URL/filename
$mimeTypestring The mime type of the original file
$fileIdint
$overwriteboolean

Definition at line 195 of file ArticleFileManager.inc.php.

References handleCopy().

ArticleFileManager::copyPublicFile (   $url,
  $mimeType,
  $fileId = null,
  $overwrite = true 
)

Copy a public file.

Parameters
$urlstring The source URL/filename
$mimeTypestring The mime type of the original file
$fileIdint
$overwriteboolean

Definition at line 161 of file ArticleFileManager.inc.php.

References handleCopy().

Referenced by EditorAction\expediteSubmission().

ArticleFileManager::copySuppFile (   $url,
  $mimeType,
  $fileId = null,
  $overwrite = true 
)

Copy a supplemental file.

Parameters
$urlstring The source URL/filename
$mimeTypestring The mime type of the original file
$fileIdint
$overwriteboolean

Definition at line 184 of file ArticleFileManager.inc.php.

References handleCopy().

ArticleFileManager::copyToCopyeditFile (   $fileId,
  $revision = null 
)

Copies an existing file to create a copyedit file.

Parameters
$fileIdint the file id of the editor file.
$revisionint the revision of the editor file.
Returns
int the file id of the new file.

Definition at line 311 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager::copyToEditorFile (   $fileId,
  $revision = null,
  $destFileId = null 
)

Copies an existing file to create an editor decision file.

Parameters
$fileIdint the file id of the review file.
$revisionint the revision of the review file.
$destFileIdint file ID to copy to
Returns
int the file id of the new file.

Definition at line 301 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager::copyToLayoutFile (   $fileId,
  $revision = null 
)

Copies an existing file to create a layout file.

Parameters
$fileIdint the file id of the copyedit file.
$revisionint the revision of the copyedit file.
Returns
int the file id of the new file.

Definition at line 321 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager::copyToReviewFile (   $fileId,
  $revision = null,
  $destFileId = null 
)

Copies an existing file to create a review file.

Parameters
$originalFileIdint the file id of the original file.
$originalRevisionint the revision of the original file.
$destFileIdint the file id of the current review file
Returns
int the file id of the new file.

Definition at line 290 of file ArticleFileManager.inc.php.

References copyAndRenameFile().

ArticleFileManager::deleteArticleTree ( )

Delete the entire tree of files belonging to an article.

Definition at line 259 of file ArticleFileManager.inc.php.

ArticleFileManager::deleteFile (   $fileId,
  $revision = null 
)

Delete a file by ID. If no revision is specified, all revisions of the file are deleted.

Parameters
$fileIdint
$revisionint (optional)
Returns
int number of files removed

Definition at line 233 of file ArticleFileManager.inc.php.

References fileStageToPath(), and DAORegistry\getDAO().

Referenced by SectionEditorAction\deleteArticleFile(), LayoutEditorAction\deleteArticleImage(), SectionEditorAction\deleteArticleImage(), LayoutEditorAction\deleteGalley(), ReviewerAction\deleteReviewerVersion(), LayoutEditorAction\deleteSuppFile(), and removePriorRevisions().

ArticleFileManager::downloadFile (   $fileId,
  $revision = null,
  $inline = false 
)

Download a file.

Parameters
$fileIdint the file id of the file to download
$revisionint the revision of the file to download
$inlineprint file as inline instead of attachment, optional
Returns
boolean

Definition at line 270 of file ArticleFileManager.inc.php.

References fileStageToPath(), and getFile().

Referenced by ArticleHandler\download(), and ArticleHandler\downloadSuppFile().

ArticleFileManager::fileStageToAbbrev (   $fileStage)

Return abbreviation associated with a file stage code (used for naming files).

Parameters
$fileStageint
Returns
string

Definition at line 349 of file ArticleFileManager.inc.php.

Referenced by copyAndRenameFile(), and generateFilename().

ArticleFileManager::fileStageToPath (   $fileStage)

Return path associated with a file stage code.

Parameters
$fileStageint
Returns
string

Definition at line 330 of file ArticleFileManager.inc.php.

Referenced by copyAndRenameFile(), deleteFile(), downloadFile(), handleCopy(), handleUpload(), handleWrite(), readFile(), and temporaryFileToArticleFile().

& ArticleFileManager::generateDummyFile ( $article)

PRIVATE routine to generate a dummy file. Used in handleUpload.

Parameters
$articleobject
Returns
object articleFile

Definition at line 434 of file ArticleFileManager.inc.php.

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

Referenced by handleCopy(), handleUpload(), handleWrite(), and temporaryFileToArticleFile().

ArticleFileManager::generateFilename ( $articleFile,
  $fileStage,
  $originalName 
)

PRIVATE routine to generate a filename for an article file. Sets the filename field in the articleFile to the generated value.

Parameters
$articleFileThe article to generate a filename for
$fileStageThe type of the article (e.g. as supplied to handleUpload)
$originalNameThe name of the original file

Definition at line 473 of file ArticleFileManager.inc.php.

References fileStageToAbbrev(), and FileManager\parseFileExtension().

Referenced by handleCopy(), handleUpload(), handleWrite(), and temporaryFileToArticleFile().

& ArticleFileManager::getFile (   $fileId,
  $revision = null 
)

Retrieve file information by file ID.

Returns
ArticleFile

Definition at line 203 of file ArticleFileManager.inc.php.

References DAORegistry\getDAO().

Referenced by downloadFile(), and readFile().

ArticleFileManager::handleCopy (   $url,
  $mimeType,
  $fileStage,
  $fileId = null,
  $overwrite = false 
)

PRIVATE routine to copy an article file and add it to the database.

Parameters
$urloriginal filename/url of the file
$mimeTypestring the mime type of the file
$fileStagestring identifying type
$fileIdint ID of an existing file to update
$overwriteboolean overwrite all previous revisions of the file (revision number is still incremented)
Returns
int the file ID (false if upload failed)

Definition at line 601 of file ArticleFileManager.inc.php.

References HookRegistry\call(), FileManager\copyFile(), fileStageToPath(), generateDummyFile(), generateFilename(), Core\getCurrentDate(), DAORegistry\getDAO(), removePriorRevisions(), and FileManager\truncateFileName().

Referenced by copyAttachmentFile(), copyPublicFile(), and copySuppFile().

ArticleFileManager::handleUpload (   $fileName,
  $fileStage,
  $fileId = null,
  $overwrite = false 
)

PRIVATE routine to upload the file and add it to the database.

Parameters
$fileNamestring index into the $_FILES array
$fileStageint identifying file stage (defined in ArticleFile)
$fileIdint ID of an existing file to update
$overwriteboolean overwrite all previous revisions of the file (revision number is still incremented)
Returns
int the file ID (false if upload failed)

Definition at line 488 of file ArticleFileManager.inc.php.

References HookRegistry\call(), fileStageToPath(), generateDummyFile(), generateFilename(), Core\getCurrentDate(), DAORegistry\getDAO(), FileManager\getUploadedFileName(), FileManager\getUploadedFileType(), removePriorRevisions(), FileManager\truncateFileName(), and FileManager\uploadFile().

Referenced by uploadCopyeditFile(), uploadEditorDecisionFile(), uploadLayoutFile(), uploadPublicFile(), uploadReviewFile(), uploadSubmissionFile(), uploadSubmissionNoteFile(), and uploadSuppFile().

ArticleFileManager::handleWrite (   $fileName,
$contents,
  $mimeType,
  $fileStage,
  $fileId = null,
  $overwrite = false 
)

PRIVATE routine to write an article file and add it to the database.

Parameters
$fileNameoriginal filename of the file
$contentsstring contents of the file to write
$mimeTypestring the mime type of the file
$fileStagestring identifying type
$fileIdint ID of an existing file to update
$overwriteboolean overwrite all previous revisions of the file (revision number is still incremented)
Returns
int the file ID (false if upload failed)

Definition at line 547 of file ArticleFileManager.inc.php.

References HookRegistry\call(), fileStageToPath(), generateDummyFile(), generateFilename(), Core\getCurrentDate(), DAORegistry\getDAO(), removePriorRevisions(), FileManager\truncateFileName(), and FileManager\writeFile().

Referenced by writePublicFile(), and writeSuppFile().

ArticleFileManager::readFile (   $fileId,
  $revision = null,
  $output = false 
)

Read a file's contents.

Parameters
$outputboolean output the file's contents instead of returning a string
Returns
boolean

Definition at line 214 of file ArticleFileManager.inc.php.

References fileStageToPath(), and getFile().

ArticleFileManager::removePriorRevisions (   $fileId,
  $revision 
)

PRIVATE routine to remove all prior revisions of a file.

Definition at line 456 of file ArticleFileManager.inc.php.

References deleteFile(), and DAORegistry\getDAO().

Referenced by handleCopy(), handleUpload(), handleWrite(), and temporaryFileToArticleFile().

ArticleFileManager::temporaryFileToArticleFile ( $temporaryFile,
  $fileStage,
  $assocId = null 
)

Copy a temporary file to an article file.

Parameters
TemporaryFile
Returns
int the file ID (false if upload failed)

Definition at line 652 of file ArticleFileManager.inc.php.

References HookRegistry\call(), FileManager\copyFile(), fileStageToPath(), generateDummyFile(), generateFilename(), DAORegistry\getDAO(), and removePriorRevisions().

Referenced by ArticleMailTemplate\log().

ArticleFileManager::uploadCopyeditFile (   $fileName,
  $fileId = null 
)

Upload a file to the copyedit file folder.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
Returns
int file ID, is false if failure

Definition at line 94 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager::uploadEditorDecisionFile (   $fileName,
  $fileId = null 
)

Upload a file to the editor decision file folder.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
Returns
int file ID, is false if failure

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

References handleUpload().

ArticleFileManager::uploadLayoutFile (   $fileName,
  $fileId = null,
  $overwrite = true 
)

Upload a section editor's layout editing file.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
$overwriteboolean
Returns
int file ID, is null if failure

Definition at line 105 of file ArticleFileManager.inc.php.

References handleUpload().

Referenced by LayoutEditorAction\uploadLayoutVersion(), and SectionEditorAction\uploadLayoutVersion().

ArticleFileManager::uploadPublicFile (   $fileName,
  $fileId = null,
  $overwrite = true 
)

Upload a public file.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
$overwriteboolean
Returns
int file ID, is false if failure

Definition at line 127 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager::uploadReviewFile (   $fileName,
  $fileId = null 
)

Upload a file to the review file folder.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
Returns
int file ID, is false if failure

Definition at line 74 of file ArticleFileManager.inc.php.

References handleUpload().

Referenced by SectionEditorAction\uploadReviewForReviewer().

ArticleFileManager::uploadSubmissionFile (   $fileName,
  $fileId = null,
  $overwrite = false 
)

Upload a submission file.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
Returns
int file ID, is false if failure

Definition at line 64 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager::uploadSubmissionNoteFile (   $fileName,
  $fileId = null,
  $overwrite = true 
)

Upload a note file.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
$overwriteboolean
Returns
int file ID, is false if failure

Definition at line 138 of file ArticleFileManager.inc.php.

References handleUpload().

ArticleFileManager::uploadSuppFile (   $fileName,
  $fileId = null,
  $overwrite = true 
)

Upload a supp file.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
$overwriteboolean
Returns
int file ID, is false if failure

Definition at line 116 of file ArticleFileManager.inc.php.

References handleUpload().

Referenced by SuppFileForm\execute().

ArticleFileManager::writePublicFile (   $fileName,
$contents,
  $mimeType,
  $fileId = null,
  $overwrite = true 
)

Write a public file.

Parameters
$fileNamestring The original filename
$contentsstring The contents to be written to the file
$mimeTypestring The mime type of the original file
$fileIdint
$overwriteboolean

Definition at line 150 of file ArticleFileManager.inc.php.

References handleWrite().

ArticleFileManager::writeSuppFile (   $fileName,
$contents,
  $mimeType,
  $fileId = null,
  $overwrite = true 
)

Write a supplemental file.

Parameters
$fileNamestring The original filename
$contentsstring The contents to be written to the file
$mimeTypestring The mime type of the original file
$fileIdint
$overwriteboolean

Definition at line 173 of file ArticleFileManager.inc.php.

References handleWrite().


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