本文整理汇总了PHP中ArticleFileManager::deleteFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleFileManager::deleteFile方法的具体用法?PHP ArticleFileManager::deleteFile怎么用?PHP ArticleFileManager::deleteFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleFileManager
的用法示例。
在下文中一共展示了ArticleFileManager::deleteFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteArticleFile
/**
* Delete an author file from a submission.
* @param $article object
* @param $fileId int
*/
function deleteArticleFile($article, $fileId)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($article->getId());
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$articleFile =& $articleFileDao->getArticleFile($fileId, $article->getId());
$authorSubmission = $authorSubmissionDao->getAuthorSubmission($article->getId());
if (isset($articleFile)) {
HookRegistry::call('AuthorAction::deleteArticleFile', array(&$articleFile));
$articleFileManager->deleteFile($articleFile->getFileId());
}
}
示例2: uploadSubmissionFile
/**
* Upload the submission file.
* @param $fileName string
* @return boolean
*/
function uploadSubmissionFile($fileName)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->articleId);
$articleDao =& DAORegistry::getDAO('ArticleDAO');
if ($articleFileManager->uploadedFileExists($fileName)) {
if ($this->article->getSubmissionFileId()) {
$articleFileManager->deleteFile($this->article->getSubmissionFileId());
}
// upload new submission file, overwriting previous if necessary
$submissionFileId = $articleFileManager->uploadSubmissionFile($fileName, $this->article->getSubmissionFileId(), true);
}
if (isset($submissionFileId)) {
$this->article->setSubmissionFileId($submissionFileId);
return $articleDao->updateArticle($this->article);
} else {
return false;
}
}
示例3: deleteArticleFile
/**
* Delete an author file from a submission.
* @param $article object
* @param $fileId int
* @param $revisionId int
*/
function deleteArticleFile($article, $fileId, $revisionId)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($article->getId());
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$articleFile =& $articleFileDao->getArticleFile($fileId, $revisionId, $article->getId());
$authorSubmission = $authorSubmissionDao->getAuthorSubmission($article->getId());
$authorRevisions = $authorSubmission->getAuthorFileRevisions();
// Ensure that this is actually an author file.
if (isset($articleFile)) {
HookRegistry::call('AuthorAction::deleteArticleFile', array(&$articleFile, &$authorRevisions));
foreach ($authorRevisions as $round) {
foreach ($round as $revision) {
if ($revision->getFileId() == $articleFile->getFileId() && $revision->getRevision() == $articleFile->getRevision()) {
$articleFileManager->deleteFile($articleFile->getFileId(), $articleFile->getRevision());
}
}
}
}
}
示例4: deleteSubmitSuppFile
/**
* Delete a supplementary file.
* @param $args array, the first parameter is the supplementary file to delete
* @param $request PKPRequest
*/
function deleteSubmitSuppFile($args, $request)
{
import('classes.file.ArticleFileManager');
$articleId = (int) $request->getUserVar('articleId');
$suppFileId = (int) array_shift($args);
$this->validate($request, $articleId, 4);
$article =& $this->article;
$this->setupTemplate($request, true);
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$suppFile = $suppFileDao->getSuppFile($suppFileId, $articleId);
$suppFileDao->deleteSuppFileById($suppFileId, $articleId);
if ($suppFile->getFileId()) {
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteFile($suppFile->getFileId());
}
$request->redirect(null, null, 'submit', '4', array('articleId' => $articleId));
}
示例5: clearAllSubmissionNotes
/**
* Clear All Submission Notes
* @param $articleId int
*/
function clearAllSubmissionNotes($articleId)
{
if (HookRegistry::call('SectionEditorAction::clearAllSubmissionNotes', array(&$articleId))) {
return;
}
import('classes.file.ArticleFileManager');
$noteDao =& DAORegistry::getDAO('NoteDAO');
$fileIds = $noteDao->getAllFileIds(ASSOC_TYPE_ARTICLE, $articleId);
if (!empty($fileIds)) {
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$articleFileManager = new ArticleFileManager($articleId);
foreach ($fileIds as $fileId) {
$articleFileManager->deleteFile($fileId);
}
}
$noteDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
}
示例6: deleteImage
/**
* Delete an image from an HTML galley.
* @param $imageId int the file ID of the image
*/
function deleteImage($imageId)
{
import('classes.file.ArticleFileManager');
$fileManager = new ArticleFileManager($this->articleId);
$galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
if (isset($this->galley)) {
$images =& $this->galley->getImageFiles();
if (isset($images)) {
for ($i = 0, $count = count($images); $i < $count; $i++) {
if ($images[$i]->getFileId() == $imageId) {
$fileManager->deleteFile($images[$i]->getFileId());
$galleyDao->deleteGalleyImage($this->galleyId, $imageId);
unset($images[$i]);
break;
}
}
}
}
}
示例7: deleteReviewerVersion
/**
* Delete an annotated version of an article.
* @param $reviewId int
* @param $fileId int
*/
function deleteReviewerVersion($reviewId, $fileId, $articleId)
{
import('classes.file.ArticleFileManager');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
if (!HookRegistry::call('ReviewerAction::deleteReviewerVersion', array(&$reviewAssignment, &$fileId))) {
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteFile($fileId);
//Send a notification to section editors
import('lib.pkp.classes.notification.NotificationManager');
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($articleId);
$notificationManager = new NotificationManager();
$notificationUsers = $article->getAssociatedUserIds(false, false);
$user =& Request::getUser();
$message = $article->getProposalId() . ':<br/>' . $user->getUsername();
foreach ($notificationUsers as $userRole) {
$url = Request::url(null, $userRole['role'], 'submission', array($article->getId(), 'submissionReview'), null, 'peerReview');
$notificationManager->createNotification($userRole['id'], 'notification.type.reviewerFileDeleted', $message, $url, 1, NOTIFICATION_TYPE_REVIEWER_COMMENT);
}
}
}
示例8: deleteArticleById
/**
* Delete an article by ID.
* @param $articleId int
*/
function deleteArticleById($articleId)
{
$this->authorDao->deleteAuthorsByArticle($articleId);
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticleDao->deletePublishedArticleByArticleId($articleId);
$commentDao =& DAORegistry::getDAO('CommentDAO');
$commentDao->deleteBySubmissionId($articleId);
$noteDao =& DAORegistry::getDAO('NoteDAO');
$noteDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$sectionEditorSubmissionDao->deleteDecisionsByArticle($articleId);
$sectionEditorSubmissionDao->deleteReviewRoundsByArticle($articleId);
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignmentDao->deleteBySubmissionId($articleId);
$editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
$editAssignmentDao->deleteEditAssignmentsByArticle($articleId);
// Delete copyedit, layout, and proofread signoffs
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$copyedInitialSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $articleId);
$copyedAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
$copyedFinalSignoffs = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $articleId);
$layoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
$proofreadAuthorSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $articleId);
$proofreadProofreaderSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
$proofreadLayoutSignoffs = $signoffDao->getBySymbolic('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
$signoffs = array($copyedInitialSignoffs, $copyedAuthorSignoffs, $copyedFinalSignoffs, $layoutSignoffs, $proofreadAuthorSignoffs, $proofreadProofreaderSignoffs, $proofreadLayoutSignoffs);
foreach ($signoffs as $signoff) {
if ($signoff) {
$signoffDao->deleteObject($signoff);
}
}
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
$articleCommentDao->deleteArticleComments($articleId);
$articleGalleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalleyDao->deleteGalleysByArticle($articleId);
$articleSearchDao =& DAORegistry::getDAO('ArticleSearchDAO');
$articleSearchDao->deleteArticleKeywords($articleId);
$articleEventLogDao =& DAORegistry::getDAO('ArticleEventLogDAO');
$articleEventLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
$articleEmailLogDao =& DAORegistry::getDAO('ArticleEmailLogDAO');
$articleEmailLogDao->deleteByAssoc(ASSOC_TYPE_ARTICLE, $articleId);
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$suppFileDao->deleteSuppFilesByArticle($articleId);
// Delete article files -- first from the filesystem, then from the database
import('classes.file.ArticleFileManager');
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$articleFiles =& $articleFileDao->getArticleFilesByArticle($articleId);
$articleFileManager = new ArticleFileManager($articleId);
foreach ($articleFiles as $articleFile) {
$articleFileManager->deleteFile($articleFile->getFileId());
}
$articleFileDao->deleteArticleFiles($articleId);
// Delete article citations.
$citationDao =& DAORegistry::getDAO('CitationDAO');
$citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $articleId);
$this->update('DELETE FROM article_settings WHERE article_id = ?', $articleId);
$this->update('DELETE FROM articles WHERE article_id = ?', $articleId);
$this->flushCache();
}
示例9: deleteSuppFile
/**
* Added by AIM Jan 30 2012
*
* Delete a supplementary file.
* @param $args array, the first parameter is the supplementary file to delete
*/
function deleteSuppFile($args)
{
import('classes.file.ArticleFileManager');
$articleId = (int) Request::getUserVar('articleId');
$suppFileId = isset($args[0]) ? (int) $args[0] : 0;
//$this->validate($articleId, 4);
$article =& $this->article;
//$this->setupTemplate(true);
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$suppFile = $suppFileDao->getSuppFile($suppFileId, $articleId);
$suppFileDao->deleteSuppFileById($suppFileId, $articleId);
if ($suppFile->getFileId()) {
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteFile($suppFile->getFileId());
}
Request::redirect(null, null, 'submission', $articleId);
}
示例10: deleteById
/**
* Delete an article by ID.
* @param $articleId int
*/
function deleteById($articleId)
{
parent::deleteById($articleId);
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticleDao->deletePublishedArticleByArticleId($articleId);
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalleyDao->deleteGalleysByArticle($articleId);
$articleSearchDao = DAORegistry::getDAO('ArticleSearchDAO');
$articleSearchDao->deleteSubmissionKeywords($articleId);
$commentDao = DAORegistry::getDAO('CommentDAO');
$commentDao->deleteBySubmissionId($submissionId);
// Delete article files -- first from the filesystem, then from the database
import('classes.file.ArticleFileManager');
$articleFileDao = DAORegistry::getDAO('ArticleFileDAO');
$articleFiles = $articleFileDao->getArticleFilesByArticle($articleId);
$articleFileManager = new ArticleFileManager($articleId);
foreach ($articleFiles as $articleFile) {
$articleFileManager->deleteFile($articleFile->getFileId());
}
$articleFileDao->deleteArticleFiles($articleId);
// Delete article citations.
$citationDao = DAORegistry::getDAO('CitationDAO');
$citationDao->deleteObjectsByAssocId(ASSOC_TYPE_ARTICLE, $articleId);
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleDeleted($articleId);
$articleSearchIndex->articleChangesFinished();
$this->flushCache();
}
示例11: deleteSuppFile
/**
* Delete a supplementary file.
* @param $article object
* @param $suppFileId int
*/
function deleteSuppFile($article, $suppFileId)
{
import('classes.file.ArticleFileManager');
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$suppFile =& $suppFileDao->getSuppFile($suppFileId, $article->getId());
if (isset($suppFile) && !HookRegistry::call('LayoutEditorAction::deleteSuppFile', array(&$article, &$suppFile))) {
if ($suppFile->getFileId()) {
$articleFileManager = new ArticleFileManager($article->getId());
$articleFileManager->deleteFile($suppFile->getFileId());
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::deleteTextIndex($article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId());
}
$suppFileDao->deleteSuppFile($suppFile);
}
}
示例12: clearAllSubmissionNotes
/**
* Clear All Submission Notes
* @param $articleId int
*/
function clearAllSubmissionNotes($articleId)
{
if (HookRegistry::call('SectionEditorAction::clearAllSubmissionNotes', array(&$articleId))) {
return;
}
import('file.ArticleFileManager');
$articleNoteDao =& DAORegistry::getDAO('ArticleNoteDAO');
$fileIds = $articleNoteDao->getAllArticleNoteFileIds($articleId);
if (!empty($fileIds)) {
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$articleFileManager = new ArticleFileManager($articleId);
foreach ($fileIds as $fileId) {
$articleFileManager->deleteFile($fileId);
}
}
$articleNoteDao->clearAllArticleNotes($articleId);
}
示例13: deleteReviewerVersion
/**
* Delete an annotated version of an article.
* @param $reviewId int
* @param $fileId int
* @param $revision int If null, then all revisions are deleted.
*/
function deleteReviewerVersion($reviewId, $fileId, $revision = null)
{
import('classes.file.ArticleFileManager');
$articleId = Request::getUserVar('articleId');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
if (!HookRegistry::call('ReviewerAction::deleteReviewerVersion', array(&$reviewAssignment, &$fileId, &$revision))) {
$articleFileManager = new ArticleFileManager($reviewAssignment->getSubmissionId());
$articleFileManager->deleteFile($fileId, $revision);
}
}
示例14: uploadReviewForReviewer
/**
* Upload a review on behalf of its reviewer.
* @param $reviewId int
*/
function uploadReviewForReviewer($reviewId)
{
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$user =& Request::getUser();
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
$sectionDecision =& $sectionDecisionDao->getSectionDecision($reviewAssignment->getDecisionId());
$article =& $articleDao->getArticle($sectionDecision->getArticleId());
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId(), true);
if (HookRegistry::call('SectionEditorAction::uploadReviewForReviewer', array(&$reviewAssignment, &$reviewer))) {
return;
}
// Upload the review file.
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($sectionDecision->getArticleId());
// Only upload the file if the reviewer has yet to submit a recommendation
if (($reviewAssignment->getRecommendation() === null || $reviewAssignment->getRecommendation() === '') && !$reviewAssignment->getCancelled()) {
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
// Check if file already uploaded
$reviewFile =& $reviewAssignment->getReviewerFile();
if ($reviewFile != null) {
$articleFileManager->deleteFile($reviewFile->getFileId());
}
if ($reviewAssignment->getReviewerFileId() != null) {
$fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId(), $reviewAssignment->getReviewerFileId());
} else {
$fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getDecisionId());
}
}
}
if (isset($fileId) && $fileId != 0) {
// Only confirm the review for the reviewer if
// he has not previously done so.
if ($reviewAssignment->getDateConfirmed() == null) {
$reviewAssignment->setDeclined(0);
$reviewAssignment->setDateConfirmed(Core::getCurrentDate());
}
$reviewAssignment->setReviewerFileId($fileId);
$reviewAssignment->stampModified();
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
// Add log
import('classes.article.log.ArticleLog');
import('classes.article.log.ArticleEventLogEntry');
Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON));
$entry = new ArticleEventLogEntry();
$entry->setArticleId($sectionDecision->getArticleId());
$entry->setUserId($user->getId());
$entry->setDateLogged(Core::getCurrentDate());
$entry->setEventType(ARTICLE_LOG_REVIEW_FILE_BY_PROXY);
$entry->setLogMessage('log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'articleId' => $article->getProposalId(), 'userName' => $user->getFullName()));
$entry->setAssocType(ARTICLE_LOG_TYPE_REVIEW);
$entry->setAssocId($reviewAssignment->getId());
ArticleLog::logEventEntry($sectionDecision->getArticleId(), $entry);
}
}
示例15: deleteOldFile
/**
* delete the old Files of the article which is going to be changed
*@param $fileTyp string, the type of File which should be deleted, possible values: "submission/copyedit", "submission/original" and "supp"
*/
function deleteOldFile($fileType, $articleId)
{
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$articleFiles =& $articleFileDao->getArticleFilesByArticle($articleId);
$articleFileManager = new ArticleFileManager($articleId);
foreach ($articleFiles as $articleFile) {
$articleFileVars = get_object_vars($articleFile);
if ($articleFileVars["_data"]["type"] == $fileType) {
$articleFileManager->deleteFile($articleFile->getFileId());
$articleFileDao->deleteArticleFile($articleFile);
}
}
}