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

Public Member Functions

 _handleUpload ($fileName, $contentType, $fileId=null, $overwrite=false)
 
 contentTypeToAbbrev ($contentType)
 
 contentTypeToPath ($contentType)
 
 deleteFile ($fileId)
 
 deleteIssueTree ()
 
 downloadFile ($fileId, $inline=false)
 
 getFilesDir ()
 
 getIssueId ()
 
 IssueFileManager ($issueId)
 
 setFilesDir ($filesDir)
 
 setIssueId ($issueId)
 
 uploadPublicFile ($fileName, $fileId=null)
 
- 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 issue file management.

Issue directory structure: [issue id]/public

Definition at line 22 of file IssueFileManager.inc.php.

Member Function Documentation

IssueFileManager::_handleUpload (   $fileName,
  $contentType,
  $fileId = null,
  $overwrite = false 
)

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

Parameters
$fileNamestring index into the $_FILES array
$contentTypeint Issue file content type
$fileIdint ID of an existing file to update
$overwriteboolean overwrite previous version of the file
Returns
int the file ID

Definition at line 163 of file IssueFileManager.inc.php.

References HookRegistry\call(), contentTypeToAbbrev(), contentTypeToPath(), Core\getCurrentDate(), DAORegistry\getDAO(), getFilesDir(), getIssueId(), FileManager\getUploadedFileName(), FileManager\getUploadedFileType(), FileManager\parseFileExtension(), FileManager\truncateFileName(), and FileManager\uploadFile().

Referenced by uploadPublicFile().

IssueFileManager::contentTypeToAbbrev (   $contentType)

Return abbreviation based on issue content type (used for naming files).

Parameters
$contentTypeint
Returns
string

Definition at line 149 of file IssueFileManager.inc.php.

Referenced by _handleUpload().

IssueFileManager::contentTypeToPath (   $contentType)

Return directory path based on issue content type (used for naming files).

Parameters
$contentTypeint
Returns
string

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

Referenced by _handleUpload(), deleteFile(), and downloadFile().

IssueFileManager::deleteFile (   $fileId)

Delete an issue file by ID.

Parameters
$fileIdint
Returns
boolean if successful

Definition at line 93 of file IssueFileManager.inc.php.

References contentTypeToPath(), DAORegistry\getDAO(), and getFilesDir().

IssueFileManager::deleteIssueTree ( )

Delete the entire tree of files belonging to an issue.

Definition at line 108 of file IssueFileManager.inc.php.

References getFilesDir().

IssueFileManager::downloadFile (   $fileId,
  $inline = false 
)

Download a file.

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

Definition at line 118 of file IssueFileManager.inc.php.

References contentTypeToPath(), DAORegistry\getDAO(), and getFilesDir().

Referenced by IssueHandler\_showIssueGalley().

IssueFileManager::getFilesDir ( )

Get the issue files directory.

Returns
string

Definition at line 50 of file IssueFileManager.inc.php.

Referenced by _handleUpload(), deleteFile(), deleteIssueTree(), and downloadFile().

IssueFileManager::getIssueId ( )

Get the issue ID.

Returns
int

Definition at line 66 of file IssueFileManager.inc.php.

Referenced by _handleUpload().

IssueFileManager::IssueFileManager (   $issueId)

Constructor. Create a manager for handling issue file uploads.

Parameters
$issueIdint

Definition at line 35 of file IssueFileManager.inc.php.

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

IssueFileManager::setFilesDir (   $filesDir)

Set the issue files directory.

Parameters
$filesDirstring

Definition at line 58 of file IssueFileManager.inc.php.

Referenced by IssueFileManager().

IssueFileManager::setIssueId (   $issueId)

Set the issue ID.

Parameters
$issueIdint

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

Referenced by IssueFileManager().

IssueFileManager::uploadPublicFile (   $fileName,
  $fileId = null 
)

Upload a public issue file.

Parameters
$fileNamestring the name of the file used in the POST form
$fileIdint
Returns
int file ID

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

References _handleUpload().


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