PHP Класс PKPSubmissionFileDAO, pkp-lib

Наследование: extends PKPFileDAO
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_delegates a private list of delegates that provide operations for different SubmissionFile implementations.

Открытые методы

Метод Описание
__construct ( ) Constructor
assignRevisionToReviewRound ( $fileId, $revision, $reviewRound ) Assign file to a review round.
baseQueryForFileSelection ( ) : string Return the basic join over all file class tables.
changePubId ( $fileId, $pubIdType, $pubId )
deleteAllPubIds ( $contextId, $pubIdType )
deleteAllRevisionsByAssocId ( $assocType, $assocId, $fileStage = null ) : integer Retrieve all files associated to a certain object.
deleteAllRevisionsById ( $fileId, $fileStage = null, $submissionId = null ) : integer Delete all revisions of a file, optionally restricted to a given file stage.
deleteAllRevisionsByReviewRound ( $reviewRoundId ) Remove all file assignements for the given review round.
deleteAllRevisionsBySubmissionId ( $submissionId, $fileStage = null ) : integer Delete all revisions of all files of a submission, optionally restricted to a given file stage.
deleteLatestRevisionById ( $fileId, $fileStage = null, $submissionId = null ) : integer Delete the latest revision of a submission file by id.
deletePubId ( $fileId, $pubIdType )
deleteReviewRoundAssignment ( $submissionId, $stageId, $fileId, $revision ) Remove a specific file assignment from a review round.
deleteRevision ( $submissionFile ) : integer Delete a specific revision of a submission file.
deleteRevisionById ( $fileId, $revision, $fileStage = null, $submissionId = null ) : integer Delete a specific revision of a submission file by id.
fromRow ( $row, $fileImplementation ) : SubmissionFile Internal function to return a SubmissionFile object from a row.
getAllFileStages ( ) : array Return all file stages.
getAllRevisions ( $fileId, $fileStage = null, $submissionId = null, $rangeInfo = null ) : array | null Retrieve all revisions of a submission file.
getAllRevisionsByAssocId ( $assocType, $assocId, $fileStage = null, $rangeInfo = null ) : array | null Retrieve all files associated to a certain object.
getByBestId ( $fileId, $submissionId ) : SubmissionFile | null Retrieve file by public ID or, failing that, internal file ID and revision; public ID takes precedence.
getByPubId ( $pubIdType, $pubId, $submissionId = null, $contextId = null ) : SubmissionFile | null Retrieve file by public file ID
getBySubmissionId ( $submissionId, $rangeInfo = null ) : array Retrieve all submission files & revisions for a submission.
getDelegateClassNames ( ) : array Return the available delegates mapped by lower case class names.
getFileIdsBySetting ( $settingName, $settingValue, $submissionId = null, $contextId = null ) : array Find file IDs by querying file settings.
getGenreCategoryMapping ( ) : array Return the mapping of genre categories to the lower case class name of file implementation.
getLatestRevision ( $fileId, $fileStage = null, $submissionId = null ) : SubmissionFile | null Retrieve the latest revision of a file.
getLatestRevisionNumber ( $fileId ) : integer | null Retrieve the current revision number for a file.
getLatestRevisions ( $submissionId, $fileStage = null, $rangeInfo = null ) : array | null Retrieve a list of current revisions.
getLatestRevisionsByAssocId ( $assocType, $assocId, $submissionId = null, $fileStage = null, $rangeInfo = null ) : array | null Retrieve the latest revision of all files associated to a certain object.
getLatestRevisionsByReviewRound ( $reviewRound, $fileStage = null ) : array Get the latest revisions of all files that are in the specified review round.
getRevision ( $fileId, $revision, $fileStage = null, $submissionId = null ) : SubmissionFile | null Retrieve a specific revision of a file.
getRevisionsByReviewRound ( $reviewRound, $fileStage = null, $uploaderUserId = null, $uploaderUserGroupId = null ) : array | null Get all file revisions assigned to the given review round.
insertObject ( $submissionFile, $sourceFile, $isUpload = false ) : SubmissionFile Insert a new SubmissionFile.
newDataObjectByGenreId ( $genreId ) : SubmissionFile Construct a new data object corresponding to this DAO.
pubIdExists ( $pubIdType, $pubId, $fileId, $contextId )
setAsLatestRevision ( $revisedFileId, $newFileId, $submissionId, $fileStage ) : SubmissionFile Set the latest revision of a file as the latest revision of another file.
transferOwnership ( $oldUserId, $newUserId ) Transfer the ownership of the submission files of one user to another.
updateObject ( $updatedFile, $previousFileId = null, $previousRevision = null ) : SubmissionFile Update an existing submission file.

Приватные методы

Метод Описание
_buildFileSelectionFilter ( $submissionId, $fileStage, $fileId, $revision, $assocType, $assocId, $stageId, $uploaderUserId, $uploaderUserGroupId, $reviewRoundId ) : array Build an SQL where clause to select submissions based on the given filter information.
_castToDatabase ( $submissionFile ) : SubmissionFile Make sure that a file's implementation corresponds to the way it is saved in the database.
_castToGenre ( $submissionFile ) : SubmissionFile Make sure that the genre of the file and its file implementation are compatible.
_checkAndReturnRevision ( $revisions ) : SubmissionFile Check whether the given array contains exactly zero or one revisions and return it.
_deleteInternally ( $submissionId = null, $fileStage = null, $fileId = null, $revision = null, $assocType = null, $assocId = null, $stageId = null, $uploaderUserId = null, $uploaderUserGroupId = null, $latestOnly = false ) : boolean | integer Private method to delete submission file revisions according to the given filters.
_getDaoDelegate ( $fileImplementation ) : SubmissionFileDAODelegate Return the requested SubmissionFileDAODelegate.
_getDaoDelegateForGenreId ( $genreId ) : SubmissionFileDAODelegate Instantiates an approprate SubmissionFileDAODelegate based on the given genre identifier.
_getDaoDelegateForObject ( $object ) : SubmissionFileDAODelegate Instantiates an appropriate SubmissionFileDAODelegate based on the given SubmissionFile.
_getFileImplementationForGenreId ( $genreId ) : string Map a genre to the corresponding file implementation.
_getInternally ( $submissionId = null, $fileStage = null, $fileId = null, $revision = null, $assocType = null, $assocId = null, $stageId = null, $uploaderUserId = null, $uploaderUserGroupId = null, $reviewRoundId = null, $latestOnly = false, $rangeInfo = null ) : array Private method to retrieve submission file revisions according to the given filters.

Описание методов

__construct() публичный Метод

Constructor
public __construct ( )

assignRevisionToReviewRound() публичный Метод

Assign file to a review round.
public assignRevisionToReviewRound ( $fileId, $revision, $reviewRound )
$fileId int The file to be assigned.
$revision int The revision of the file to be assigned.
$reviewRound ReviewRound

baseQueryForFileSelection() публичный Метод

Return the basic join over all file class tables.
public baseQueryForFileSelection ( ) : string
Результат string

changePubId() публичный Метод

public changePubId ( $fileId, $pubIdType, $pubId )

deleteAllPubIds() публичный Метод

public deleteAllPubIds ( $contextId, $pubIdType )

deleteAllRevisionsByAssocId() публичный Метод

Retrieve all files associated to a certain object.
public deleteAllRevisionsByAssocId ( $assocType, $assocId, $fileStage = null ) : integer
$assocType int ASSOC_TYPE_...
$assocId int ID corresponding to specified assocType.
$fileStage int (optional) further restricts the selection to a given file stage.
Результат integer the number of deleted file revisions.

deleteAllRevisionsById() публичный Метод

Delete all revisions of a file, optionally restricted to a given file stage.
public deleteAllRevisionsById ( $fileId, $fileStage = null, $submissionId = null ) : integer
$fileId int File ID.
$fileStage int (optional) further restricts the selection to a given file stage.
$submissionId int (optional) for validation purposes only
Результат integer the number of deleted file revisions

deleteAllRevisionsByReviewRound() публичный Метод

Remove all file assignements for the given review round.
public deleteAllRevisionsByReviewRound ( $reviewRoundId )
$reviewRoundId int The review round ID.

deleteAllRevisionsBySubmissionId() публичный Метод

Delete all revisions of all files of a submission, optionally restricted to a given file stage.
public deleteAllRevisionsBySubmissionId ( $submissionId, $fileStage = null ) : integer
$submissionId int Submission ID.
$fileStage int (optional) further restricts the selection to a given file stage.
Результат integer the number of deleted file revisions

deleteLatestRevisionById() публичный Метод

Delete the latest revision of a submission file by id.
public deleteLatestRevisionById ( $fileId, $fileStage = null, $submissionId = null ) : integer
$fileId int File ID.
$fileStage int (optional) further restricts the selection to a given file stage.
$submissionId int (optional) for validation purposes only
Результат integer the number of deleted file revisions

deletePubId() публичный Метод

public deletePubId ( $fileId, $pubIdType )

deleteReviewRoundAssignment() публичный Метод

Remove a specific file assignment from a review round.
public deleteReviewRoundAssignment ( $submissionId, $stageId, $fileId, $revision )
$submissionId int The submission id of the file
$stageId int The review round type.
$fileId int The file id.
$revision int The file revision.

deleteRevision() публичный Метод

Delete a specific revision of a submission file.
public deleteRevision ( $submissionFile ) : integer
$submissionFile SubmissionFile
Результат integer the number of deleted file revisions

deleteRevisionById() публичный Метод

Delete a specific revision of a submission file by id.
public deleteRevisionById ( $fileId, $revision, $fileStage = null, $submissionId = null ) : integer
$fileId int File ID.
$revision int File revision number.
$fileStage int (optional) further restricts the selection to a given file stage.
$submissionId int (optional) for validation purposes only
Результат integer the number of deleted file revisions

fromRow() публичный Метод

Internal function to return a SubmissionFile object from a row.
public fromRow ( $row, $fileImplementation ) : SubmissionFile
$row array
$fileImplementation string
Результат SubmissionFile

getAllFileStages() публичный Метод

Return all file stages.
public getAllFileStages ( ) : array
Результат array

getAllRevisions() публичный Метод

Retrieve all revisions of a submission file.
public getAllRevisions ( $fileId, $fileStage = null, $submissionId = null, $rangeInfo = null ) : array | null
$fileId int File ID.
$fileStage int (optional) further restricts the selection to a given file stage.
$submissionId int Optional submission ID for validation purposes only
$rangeInfo DBResultRange (optional)
Результат array | null a list of SubmissionFile instances

getAllRevisionsByAssocId() публичный Метод

Retrieve all files associated to a certain object.
public getAllRevisionsByAssocId ( $assocType, $assocId, $fileStage = null, $rangeInfo = null ) : array | null
$assocType int ASSOC_TYPE_...
$assocId int ID corresponding to specified assocType.
$fileStage int (optional) further restricts the selection to a given file stage.
$rangeInfo DBResultRange (optional)
Результат array | null a list of SubmissionFile instances

getByBestId() публичный Метод

Retrieve file by public ID or, failing that, internal file ID and revision; public ID takes precedence.
public getByBestId ( $fileId, $submissionId ) : SubmissionFile | null
$fileId string Either public ID or fileId-revision
$submissionId int
Результат SubmissionFile | null

getByPubId() публичный Метод

Retrieve file by public file ID
public getByPubId ( $pubIdType, $pubId, $submissionId = null, $contextId = null ) : SubmissionFile | null
$pubIdType string One of the NLM pub-id-type values or 'other::something' if not part of the official NLM list (see ).
$pubId string
$submissionId int optional
$contextId int optional
Результат SubmissionFile | null

getBySubmissionId() публичный Метод

Retrieve all submission files & revisions for a submission.
public getBySubmissionId ( $submissionId, $rangeInfo = null ) : array
$submissionId int Submission ID.
$rangeInfo DBResultRange (optional)
Результат array a list of SubmissionFile instances

getDelegateClassNames() публичный Метод

Return the available delegates mapped by lower case class names.
public getDelegateClassNames ( ) : array
Результат array a list of fully qualified class names indexed by the lower case class name of the file implementation they serve. NB: Be careful to order class names such that they can be called in the given order to delete files without offending foreign key constraints, i.e. place the sub-classes before the super-classes.

getFileIdsBySetting() публичный Метод

Find file IDs by querying file settings.
public getFileIdsBySetting ( $settingName, $settingValue, $submissionId = null, $contextId = null ) : array
$settingName string
$settingValue mixed
$submissionId int optional
$contextId int optional
Результат array The file IDs identified by setting.

getGenreCategoryMapping() публичный Метод

Return the mapping of genre categories to the lower case class name of file implementation.
public getGenreCategoryMapping ( ) : array
Результат array a list of lower case class names of file implementations.

getLatestRevision() публичный Метод

Retrieve the latest revision of a file.
public getLatestRevision ( $fileId, $fileStage = null, $submissionId = null ) : SubmissionFile | null
$fileId int File ID.
$fileStage int (optional) further restricts the selection to a given file stage.
$submissionId int (optional) for validation purposes only
Результат SubmissionFile | null

getLatestRevisionNumber() публичный Метод

Retrieve the current revision number for a file.
public getLatestRevisionNumber ( $fileId ) : integer | null
$fileId int File ID.
Результат integer | null

getLatestRevisions() публичный Метод

Retrieve a list of current revisions.
public getLatestRevisions ( $submissionId, $fileStage = null, $rangeInfo = null ) : array | null
$submissionId int Submission ID.
$fileStage int (optional) further restricts the selection to a given file stage.
$rangeInfo DBResultRange (optional)
Результат array | null a list of SubmissionFile instances

getLatestRevisionsByAssocId() публичный Метод

Retrieve the latest revision of all files associated to a certain object.
public getLatestRevisionsByAssocId ( $assocType, $assocId, $submissionId = null, $fileStage = null, $rangeInfo = null ) : array | null
$assocType int ASSOC_TYPE_...
$assocId int ID corresponding to specified assocType.
$fileStage int (optional) further restricts the selection to a given file stage.
$rangeInfo DBResultRange (optional)
Результат array | null a list of SubmissionFile instances

getLatestRevisionsByReviewRound() публичный Метод

Get the latest revisions of all files that are in the specified review round.
public getLatestRevisionsByReviewRound ( $reviewRound, $fileStage = null ) : array
$reviewRound ReviewRound
$fileStage int SUBMISSION_FILE_... (Optional)
Результат array A list of SubmissionFiles.

getRevision() публичный Метод

Retrieve a specific revision of a file.
public getRevision ( $fileId, $revision, $fileStage = null, $submissionId = null ) : SubmissionFile | null
$fileId int File ID.
$revision int File revision number.
$fileStage int (optional) further restricts the selection to a given file stage.
$submissionId int|null (optional) for validation purposes only
Результат SubmissionFile | null

getRevisionsByReviewRound() публичный Метод

Get all file revisions assigned to the given review round.
public getRevisionsByReviewRound ( $reviewRound, $fileStage = null, $uploaderUserId = null, $uploaderUserGroupId = null ) : array | null
$reviewRound ReviewRound
$fileStage int SUBMISSION_FILE_...
$uploaderUserId int Uploader's user ID
$uploaderUserGroupId int Uploader's user group ID
Результат array | null A list of SubmissionFiles.

insertObject() публичный Метод

Insert a new SubmissionFile.
public insertObject ( $submissionFile, $sourceFile, $isUpload = false ) : SubmissionFile
$submissionFile SubmissionFile
$sourceFile string The place where the physical file resides right now or the file name in the case of an upload. The file will be copied to its canonical target location.
$isUpload boolean set to true if the file has just been uploaded.
Результат SubmissionFile

newDataObjectByGenreId() публичный Метод

Construct a new data object corresponding to this DAO.
public newDataObjectByGenreId ( $genreId ) : SubmissionFile
$genreId integer The genre is required to identify the right file implementation.
Результат SubmissionFile

pubIdExists() публичный Метод

public pubIdExists ( $pubIdType, $pubId, $fileId, $contextId )

setAsLatestRevision() публичный Метод

Set the latest revision of a file as the latest revision of another file.
public setAsLatestRevision ( $revisedFileId, $newFileId, $submissionId, $fileStage ) : SubmissionFile
$revisedFileId integer the revised file
$newFileId integer the file that will become the latest revision of the revised file.
$submissionId integer the submission id the two files must belong to.
$fileStage integer the file stage the two files must belong to.
Результат SubmissionFile the new revision or null if something went wrong.

transferOwnership() публичный Метод

Transfer the ownership of the submission files of one user to another.
public transferOwnership ( $oldUserId, $newUserId )
$oldUserId int User ID of old user (to be deleted)
$newUserId int User ID of new user (to receive assets belonging to old user)

updateObject() публичный Метод

NB: We implement a delete + insert strategy to deal with various casting problems (e.g. file implementation/genre may change, file path may change, etc.).
public updateObject ( $updatedFile, $previousFileId = null, $previousRevision = null ) : SubmissionFile
$updatedFile SubmissionFile
$previousFileId integer The file id before the file was changed. Must only be given if the file id changed so that the previous file can be identified.
$previousRevision integer The revision before the file was changed. Must only be given if the revision changed so that the previous file can be identified.
Результат SubmissionFile The updated file. This file may be of a different file implementation than the file passed into the method if the genre of the file didn't fit its implementation.

Описание свойств

$_delegates публичное свойство

a private list of delegates that provide operations for different SubmissionFile implementations.
public $_delegates