当前位置: 首页>>代码示例>>PHP>>正文


PHP PublicFileManager::removeJournalFile方法代码示例

本文整理汇总了PHP中PublicFileManager::removeJournalFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PublicFileManager::removeJournalFile方法的具体用法?PHP PublicFileManager::removeJournalFile怎么用?PHP PublicFileManager::removeJournalFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PublicFileManager的用法示例。


在下文中一共展示了PublicFileManager::removeJournalFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteCoverImage

 /**
  * An action to delete an article cover image.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function deleteCoverImage($args, $request)
 {
     assert(!empty($args['coverImage']) && !empty($args['submissionId']));
     $submission = $this->getSubmission();
     $submissionDao = Application::getSubmissionDAO();
     $file = $args['coverImage'];
     // Remove cover image and alt text from article settings
     $submission->setCoverImage('');
     $submission->setCoverImageAltText('');
     $submissionDao->updateObject($submission);
     // Remove the file
     $publicFileManager = new PublicFileManager();
     if ($publicFileManager->removeJournalFile($submission->getJournalId(), $file)) {
         $json = new JSONMessage(true);
         $json->setEvent('fileDeleted');
         return $json;
     } else {
         return new JSONMessage(false, __('editor.article.removeCoverImageFileNotFound'));
     }
 }
开发者ID:bkroll,项目名称:ojs,代码行数:26,代码来源:IssueEntryTabHandler.inc.php

示例2: removeCoverPage

 /**
  * Remove the cover page image for the book for review
  * @param $bookId int
  */
 function removeCoverPage($bookId, $locale)
 {
     $book = $this->getBookForReview($bookId);
     if ($book) {
         // Delete cover image file from the filesystem and settings
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $publicFileManager->removeJournalFile($book->getJournalId(), $book->getFileName($locale));
         $book->setFileName(null, $locale);
         $book->setWidth(null, $locale);
         $book->setHeight(null, $locale);
         $book->setOriginalFileName(null, $locale);
         $book->setCoverPageAltText(null, $locale);
         $this->updateObject($book);
     }
 }
开发者ID:utlib,项目名称:ojs,代码行数:20,代码来源:BookForReviewDAO.inc.php

示例3: removeArticleCoverPage

 /**
  * Remove cover page from article
  * @param $submission object
  * @param $formLocale string
  * @return boolean true iff ready for redirect
  */
 function removeArticleCoverPage($submission, $formLocale)
 {
     $journal =& Request::getJournal();
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $publicFileManager->removeJournalFile($journal->getId(), $submission->getFileName($formLocale));
     $submission->setFileName('', $formLocale);
     $submission->setOriginalFileName('', $formLocale);
     $submission->setWidth('', $formLocale);
     $submission->setHeight('', $formLocale);
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $articleDao->updateArticle($submission);
     return true;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:20,代码来源:SectionEditorAction.inc.php

示例4: removeArticleCoverPage

 /**
  * Remove cover page from article
  */
 function removeArticleCoverPage($args, &$request)
 {
     $articleId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($articleId);
     $formLocale = $args[1];
     if (!Locale::isLocaleValid($formLocale)) {
         $request->redirect(null, null, 'viewMetadata', $articleId);
     }
     $submission =& $this->submission;
     $journal =& $request->getJournal();
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $publicFileManager->removeJournalFile($journal->getId(), $submission->getFileName($formLocale));
     $submission->setFileName('', $formLocale);
     $submission->setOriginalFileName('', $formLocale);
     $submission->setWidth('', $formLocale);
     $submission->setHeight('', $formLocale);
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $articleDao->updateArticle($submission);
     $request->redirect(null, null, 'viewMetadata', $articleId);
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:24,代码来源:TrackSubmissionHandler.inc.php

示例5: deleteStyleSheet

 /**
  * Deletes a custom stylesheet.
  */
 function deleteStyleSheet()
 {
     $journalId = $this->journalId;
     $plugin =& $this->plugin;
     $settingName = 'externalFeedStyleSheet';
     $setting = $plugin->getSetting($journalId, $settingName);
     import('classes.file.PublicFileManager');
     $fileManager = new PublicFileManager();
     if ($fileManager->removeJournalFile($journalId, $setting['uploadName'])) {
         $plugin->updateSetting($journalId, $settingName, null);
         return true;
     } else {
         return false;
     }
 }
开发者ID:jalperin,项目名称:ojs,代码行数:18,代码来源:ExternalFeedSettingsForm.inc.php

示例6: removeStyleFile

 /**
  * Remove style file from issue
  */
 function removeStyleFile($args, $request)
 {
     $issueId = (int) array_shift($args);
     $this->validate($issueId, true);
     $issue =& $this->issue;
     import('classes.file.PublicFileManager');
     $journal =& $request->getJournal();
     $publicFileManager = new PublicFileManager();
     $publicFileManager->removeJournalFile($journal->getId(), $issue->getStyleFileName());
     $issue->setStyleFileName('');
     $issue->setOriginalStyleFileName('');
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issueDao->updateIssue($issue);
     $request->redirect(null, null, 'issueData', $issueId);
 }
开发者ID:reconciler,项目名称:ojs,代码行数:18,代码来源:IssueManagementHandler.inc.php

示例7: deleteObject

 /**
  * Delete issue. Deletes associated issue galleys, cover pages, and published articles.
  * @param $issue object issue
  */
 function deleteObject($issue)
 {
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $coverImage = $issue->getCoverImage();
     if (!empty($coverImage)) {
         $publicFileManager->removeJournalFile($issue->getJournalId(), $coverImage);
     }
     $issueId = $issue->getId();
     // Delete issue-specific ordering if it exists.
     $sectionDao = DAORegistry::getDAO('SectionDAO');
     $sectionDao->deleteCustomSectionOrdering($issueId);
     // Delete published issue galleys and issue files
     $issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO');
     $issueGalleyDao->deleteByIssueId($issueId);
     $issueFileDao = DAORegistry::getDAO('IssueFileDAO');
     $issueFileDao->deleteByIssueId($issueId);
     import('classes.file.IssueFileManager');
     $issueFileManager = new IssueFileManager($issueId);
     $issueFileManager->deleteIssueTree();
     // Delete published articles
     $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticleDao->deletePublishedArticlesByIssueId($issueId);
     // Delete issue settings and issue
     $this->update('DELETE FROM issue_settings WHERE issue_id = ?', (int) $issueId);
     $this->update('DELETE FROM issues WHERE issue_id = ?', (int) $issueId);
     $this->update('DELETE FROM custom_issue_orders WHERE issue_id = ?', (int) $issueId);
     $this->resequenceCustomIssueOrders($issue->getJournalId());
     $this->flushCache();
 }
开发者ID:bkroll,项目名称:ojs,代码行数:34,代码来源:IssueDAO.inc.php

示例8: deleteCoverImage

 /**
  * Delete an uploaded cover image.
  * @param $args array
  *   `coverImage` string Filename of the cover image to be deleted.
  *   `issueId` int Id of the issue this cover image is attached to
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function deleteCoverImage($args, $request)
 {
     assert(!empty($args['coverImage']) && !empty($args['issueId']));
     // Check if the passed filename matches the filename for this issue's
     // cover page.
     $issueDao = DAORegistry::getDAO('IssueDAO');
     $issue = $issueDao->getById((int) $args['issueId']);
     $locale = AppLocale::getLocale();
     if ($args['coverImage'] != $issue->getCoverImage($locale)) {
         return new JSONMessage(false, __('editor.issues.removeCoverImageFileNameMismatch'));
     }
     $file = $args['coverImage'];
     // Remove cover image and alt text from issue settings
     $issue->setCoverImage('', $locale);
     $issue->setCoverImageAltText('', $locale);
     $issueDao->updateObject($issue);
     // Remove the file
     $publicFileManager = new PublicFileManager();
     if ($publicFileManager->removeJournalFile($issue->getJournalId(), $file)) {
         $json = new JSONMessage(true);
         $json->setEvent('fileDeleted');
         return $json;
     } else {
         return new JSONMessage(false, __('editor.issues.removeCoverImageFileNotFound'));
     }
 }
开发者ID:pkp,项目名称:ojs,代码行数:34,代码来源:IssueGridHandler.inc.php

示例9: deleteImage

 /**
  * Deletes a journal image.
  * @param $settingName string setting key associated with the file
  * @param $locale string
  */
 function deleteImage($settingName, $locale = null)
 {
     $journal =& Request::getJournal();
     $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
     $setting = $settingsDao->getSetting($journal->getId(), $settingName);
     import('classes.file.PublicFileManager');
     $fileManager = new PublicFileManager();
     if ($fileManager->removeJournalFile($journal->getId(), $locale !== null ? $setting[$locale]['uploadName'] : $setting['uploadName'])) {
         $returner = $settingsDao->deleteSetting($journal->getId(), $settingName, $locale);
         // Ensure page header is refreshed
         if ($returner) {
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign(array('displayPageHeaderTitle' => $journal->getLocalizedPageHeaderTitle(), 'displayPageHeaderLogo' => $journal->getLocalizedPageHeaderLogo()));
         }
         return $returner;
     } else {
         return false;
     }
 }
开发者ID:jasonzou,项目名称:OJS-2.4.6,代码行数:24,代码来源:JournalSetupStep5Form.inc.php

示例10: deleteIssue

 /**
  * Delete issue. Deletes associated published articles and cover file.
  * @param $issue object issue
  */
 function deleteIssue(&$issue)
 {
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     if (is_array($issue->getFileName(null))) {
         foreach ($issue->getFileName(null) as $fileName) {
             if ($fileName != '') {
                 $publicFileManager->removeJournalFile($issue->getJournalId(), $fileName);
             }
         }
     }
     if (($fileName = $issue->getStyleFileName()) != '') {
         $publicFileManager->removeJournalFile($issue->getJournalId(), $fileName);
     }
     $issueId = $issue->getId();
     // Delete issue-specific ordering if it exists.
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionDao->deleteCustomSectionOrdering($issueId);
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticleDao->deletePublishedArticlesByIssueId($issueId);
     $this->update('DELETE FROM issue_settings WHERE issue_id = ?', $issueId);
     $this->update('DELETE FROM issues WHERE issue_id = ?', $issueId);
     $this->resequenceCustomIssueOrders($issue->getJournalId());
     $cache =& $this->_getCache('issues');
     $cache->flush();
     unset($cache);
     $cache =& $this->_getCache('current');
     $cache->flush();
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:33,代码来源:IssueDAO.inc.php

示例11: deleteIssue

 /**
  * Delete issue. Deletes associated issue galleys, cover pages, and published articles.
  * @param $issue object issue
  */
 function deleteIssue(&$issue)
 {
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     if (is_array($issue->getFileName(null))) {
         foreach ($issue->getFileName(null) as $fileName) {
             if ($fileName != '') {
                 $publicFileManager->removeJournalFile($issue->getJournalId(), $fileName);
             }
         }
     }
     if (($fileName = $issue->getStyleFileName()) != '') {
         $publicFileManager->removeJournalFile($issue->getJournalId(), $fileName);
     }
     $issueId = $issue->getId();
     // Delete issue-specific ordering if it exists.
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionDao->deleteCustomSectionOrdering($issueId);
     // Delete published issue galleys and issue files
     $issueGalleyDao =& DAORegistry::getDAO('IssueGalleyDAO');
     $issueGalleyDao->deleteGalleysByIssue($issueId);
     $issueFileDao =& DAORegistry::getDAO('IssueFileDAO');
     $issueFileDao->deleteIssueFiles($issueId);
     import('classes.file.IssueFileManager');
     $issueFileManager = new IssueFileManager($issueId);
     $issueFileManager->deleteIssueTree();
     // Delete published articles
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticleDao->deletePublishedArticlesByIssueId($issueId);
     // Delete issue settings and issue
     $this->update('DELETE FROM issue_settings WHERE issue_id = ?', (int) $issueId);
     $this->update('DELETE FROM issues WHERE issue_id = ?', (int) $issueId);
     $this->update('DELETE FROM custom_issue_orders WHERE issue_id = ?', (int) $issueId);
     $this->resequenceCustomIssueOrders($issue->getJournalId());
     $this->flushCache();
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:40,代码来源:IssueDAO.inc.php

示例12: deleteObject

 /**
  * Delete an object for review.
  * @param $objectForReview ObjectForReview
  */
 function deleteObject(&$objectForReview)
 {
     // Delete object
     $this->update('DELETE FROM objects_for_review WHERE object_id = ? AND context_id = ?', array((int) $objectForReview->getId(), (int) $objectForReview->getContextId()));
     if ($this->getAffectedRows()) {
         // Delete cover image files (for all locales) from the filesystem
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $coverPageSetting = $objectForReview->getCoverPage();
         $publicFileManager->removeJournalFile($objectForReview->getContextId(), $coverPageSetting['fileName']);
         // Delete settings
         $ofrSettingsDao =& DAORegistry::getDAO('ObjectForReviewSettingsDAO');
         $ofrSettingsDao->deleteSettings($objectForReview->getId());
         // Delete persons
         $this->objectForReviewPersonDao->deleteByObjectForReview($objectForReview->getId());
         // Delete assignments
         $ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
         $ofrAssignmentDao->deleteAllByObjectId($objectForReview->getId());
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:24,代码来源:ObjectForReviewDAO.inc.php

示例13: removeStyleFile

 /**
  * Remove style file from issue
  */
 function removeStyleFile($args)
 {
     $issueId = isset($args[0]) ? (int) $args[0] : 0;
     $this->validate($issueId, true);
     $issue =& $this->issue;
     import('file.PublicFileManager');
     $journal =& Request::getJournal();
     $publicFileManager = new PublicFileManager();
     $publicFileManager->removeJournalFile($journal->getId(), $issue->getStyleFileName());
     $issue->setStyleFileName('');
     $issue->setOriginalStyleFileName('');
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issueDao->updateIssue($issue);
     Request::redirect(null, null, 'issueData', $issueId);
 }
开发者ID:philschatz,项目名称:ojs,代码行数:18,代码来源:IssueManagementHandler.inc.php

示例14: removeObjectForReviewCoverPage

 /**
  * Remove object for review cover page image.
  * @param $args array
  * @param $request PKPRequest
  */
 function removeObjectForReviewCoverPage($args, &$request)
 {
     $objectId = array_shift($args);
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     if (!$this->_ensureObjectExists($objectId, $journalId)) {
         $request->redirect(null, 'editor', 'objectsForReview');
     }
     $ofrDao =& DAORegistry::getDAO('ObjectForReviewDAO');
     $objectForReview =& $ofrDao->getById($objectId, $journalId);
     $coverPageSetting = $objectForReview->getCoverPage();
     if ($coverPageSetting) {
         // Delete cover image file from the filesystem
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $publicFileManager->removeJournalFile($journalId, $coverPageSetting['fileName']);
         // Delete object for review setting
         $ofrPlugin =& $this->_getObjectsForReviewPlugin();
         $ofrPlugin->import('classes.ReviewObjectMetadata');
         $metadataId = $objectForReview->getMetadataId(REVIEW_OBJECT_METADATA_KEY_COVERPAGE);
         $ofrSettingsDao =& DAORegistry::getDAO('ObjectForReviewSettingsDAO');
         $ofrSettingsDao->deleteSetting($objectId, $metadataId);
     }
     $request->redirect(null, 'editor', 'editObjectForReview', $objectId, array('reviewObjectTypeId' => $objectForReview->getReviewObjectTypeId()));
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:30,代码来源:ObjectsForReviewEditorHandler.inc.php

示例15: localizeArticleCoverImages

    /**
     * Localize article cover images.
     * @return boolean True indicates success.
     */
    function localizeArticleCoverImages()
    {
        $articleDao = DAORegistry::getDAO('ArticleDAO');
        $publicFileManager = new PublicFileManager();
        // remove strange old cover images with array values in the DB - from 3.alpha or 3.beta?
        $articleDao->update('DELETE FROM submission_settings WHERE setting_name = \'coverImage\' AND setting_type = \'object\'');
        // remove empty 3.0 cover images
        $articleDao->update('DELETE FROM submission_settings WHERE setting_name = \'coverImage\' AND locale = \'\' AND setting_value = \'\'');
        $articleDao->update('DELETE FROM submission_settings WHERE setting_name = \'coverImageAltText\' AND locale = \'\' AND setting_value = \'\'');
        // get cover image duplicates, from 2.4.x and 3.0
        $result = $articleDao->retrieve('SELECT DISTINCT ss1.submission_id, ss1.setting_value, s.context_id
			FROM submission_settings ss1
			LEFT JOIN submissions s ON (s.submission_id = ss1.submission_id)
			JOIN submission_settings ss2 ON (ss2.submission_id = ss1.submission_id AND ss2.setting_name = \'coverImage\')
			WHERE ss1.setting_name = \'fileName\'');
        // remove the old 2.4.x cover images, for which a new cover image exists
        while (!$result->EOF) {
            $row = $result->GetRowAssoc(false);
            $submissionId = $row['submission_id'];
            $oldFileName = $row['setting_value'];
            if ($publicFileManager->fileExists($publicFileManager->getContextFilesPath(ASSOC_TYPE_JOURNAL, $row['context_id']) . '/' . $oldFileName)) {
                $publicFileManager->removeJournalFile($row['journal_id'], $oldFileName);
            }
            $articleDao->update('DELETE FROM submission_settings WHERE submission_id = ? AND setting_name = \'fileName\' AND setting_value = ?', array((int) $submissionId, $oldFileName));
            $result->MoveNext();
        }
        $result->Close();
        // retrieve names for unlocalized article cover images
        $result = $articleDao->retrieve('SELECT ss.submission_id, ss.setting_value, j.journal_id, j.primary_locale
			FROM submission_settings ss, submissions s, journals j
			WHERE ss.setting_name = \'coverImage\' AND ss.locale = \'\'
				AND s.submission_id = ss.submission_id AND j.journal_id = s.context_id');
        // for all unlocalized article cover images
        // rename (copy + remove) the cover images files in the public folder,
        // considereing the locale (using the journal primary locale)
        while (!$result->EOF) {
            $row = $result->GetRowAssoc(false);
            $oldFileName = $row['setting_value'];
            $newFileName = str_replace('.', '_' . $row['primary_locale'] . '.', $oldFileName);
            if ($publicFileManager->fileExists($publicFileManager->getContextFilesPath(ASSOC_TYPE_JOURNAL, $row['journal_id']) . '/' . $oldFileName)) {
                $publicFileManager->copyJournalFile($row['journal_id'], $publicFileManager->getContextFilesPath(ASSOC_TYPE_JOURNAL, $row['journal_id']) . '/' . $oldFileName, $newFileName);
                $publicFileManager->removeJournalFile($row['journal_id'], $oldFileName);
            }
            $result->MoveNext();
        }
        $result->Close();
        $driver = $articleDao->getDriver();
        switch ($driver) {
            case 'mysql':
            case 'mysqli':
                // Update cover image names in the submission_settings table
                $articleDao->update('UPDATE submission_settings ss, submissions s, journals j
					SET ss.locale = j.primary_locale, ss.setting_value = CONCAT(LEFT( ss.setting_value, LOCATE(\'.\', ss.setting_value) - 1 ), \'_\', j.primary_locale, \'.\', SUBSTRING_INDEX(ss.setting_value,\'.\',-1))
					WHERE ss.setting_name = \'coverImage\' AND ss.locale = \'\' AND s.submission_id = ss.submission_id AND j.journal_id = s.context_id');
                // Update cover image alt texts in the submission_settings table
                $articleDao->update('UPDATE submission_settings ss, submissions s, journals j
					SET ss.locale = j.primary_locale
					WHERE ss.setting_name = \'coverImageAltText\' AND ss.locale = \'\' AND s.submission_id = ss.submission_id AND j.journal_id = s.context_id');
                break;
            case 'postgres':
                // Update cover image names in the submission_settings table
                $articleDao->update('UPDATE submission_settings
					SET locale = j.primary_locale, setting_value = REGEXP_REPLACE(submission_settings.setting_value, \'[\\.]\', CONCAT(\'_\', j.primary_locale, \'.\'))
					FROM submissions s, journals j
					WHERE submission_settings.setting_name = \'coverImage\' AND submission_settings.locale = \'\' AND s.submission_id = submission_settings.submission_id AND j.journal_id = s.context_id');
                // Update cover image alt texts in the submission_settings table
                $articleDao->update('UPDATE submission_settings
					SET locale = j.primary_locale
					FROM submissions s, journals j
					WHERE submission_settings.setting_name = \'coverImageAltText\' AND submission_settings.locale = \'\' AND s.submission_id = submission_settings.submission_id AND j.journal_id = s.context_id');
                break;
            default:
                fatalError('Unknown database type!');
        }
        $articleDao->flushCache();
        return true;
    }
开发者ID:pkp,项目名称:ojs,代码行数:81,代码来源:Upgrade.inc.php


注:本文中的PublicFileManager::removeJournalFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。