本文整理汇总了PHP中ArticleFileManager类的典型用法代码示例。如果您正苦于以下问题:PHP ArticleFileManager类的具体用法?PHP ArticleFileManager怎么用?PHP ArticleFileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArticleFileManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getHTMLContents
/**
* Return string containing the contents of the HTML file.
* This function performs any necessary filtering, like image URL replacement.
* @param $baseImageUrl string base URL for image references
* @return string
*/
function getHTMLContents()
{
import('classes.file.ArticleFileManager');
$fileManager = new ArticleFileManager($this->getArticleId());
$contents = $fileManager->readFile($this->getFileId());
$journal =& Request::getJournal();
// Replace media file references
$images =& $this->getImageFiles();
foreach ($images as $image) {
$imageUrl = Request::url(null, 'article', 'viewFile', array($this->getArticleId(), $this->getBestGalleyId($journal), $image->getFileId()));
$pattern = preg_quote(rawurlencode($image->getOriginalFileName()));
$contents = preg_replace('/([Ss][Rr][Cc]|[Hh][Rr][Ee][Ff]|[Dd][Aa][Tt][Aa])\\s*=\\s*"([^"]*' . $pattern . ')"/', '\\1="' . $imageUrl . '"', $contents);
// Replacement for Flowplayer
$contents = preg_replace('/[Uu][Rr][Ll]\\s*\\:\\s*\'(' . $pattern . ')\'/', 'url:\'' . $imageUrl . '\'', $contents);
// Replacement for other players (ested with odeo; yahoo and google player won't work w/ OJS URLs, might work for others)
$contents = preg_replace('/[Uu][Rr][Ll]=([^"]*' . $pattern . ')/', 'url=' . $imageUrl, $contents);
}
// Perform replacement for ojs://... URLs
$contents = String::regexp_replace_callback('/(<[^<>]*")[Oo][Jj][Ss]:\\/\\/([^"]+)("[^<>]*>)/', array(&$this, '_handleOjsUrl'), $contents);
// Perform variable replacement for journal, issue, site info
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueByArticleId($this->getArticleId());
$journal =& Request::getJournal();
$site =& Request::getSite();
$paramArray = array('issueTitle' => $issue ? $issue->getIssueIdentification() : Locale::translate('editor.article.scheduleForPublication.toBeAssigned'), 'journalTitle' => $journal->getLocalizedTitle(), 'siteTitle' => $site->getLocalizedTitle(), 'currentUrl' => Request::getRequestUrl());
foreach ($paramArray as $key => $value) {
$contents = str_replace('{$' . $key . '}', $value, $contents);
}
return $contents;
}
开发者ID:JovanyJeff,项目名称:hrp,代码行数:36,代码来源:ArticleHTMLGalley.inc.php
示例2: testNativeDoiImport
public function testNativeDoiImport()
{
$testfile = 'tests/functional/plugins/importexport/native/testissue.xml';
$args = array('import', $testfile, 'test', 'admin');
$result = $this->executeCli('NativeImportExportPlugin', $args);
self::assertRegExp('/##plugins.importexport.native.import.success.description##/', $result);
$daos = array('Issue' => 'IssueDAO', 'PublishedArticle' => 'PublishedArticleDAO', 'Galley' => 'ArticleGalleyDAO', 'SuppFile' => 'SuppFileDAO');
$articelId = null;
foreach ($daos as $objectType => $daoName) {
$dao = DAORegistry::getDAO($daoName);
$pubObject = call_user_func(array($dao, "get{$objectType}ByPubId"), 'doi', $this->expectedDois[$objectType]);
self::assertNotNull($pubObject, "Error while testing {$objectType}: object or DOI has not been imported.");
$pubObjectByURN = call_user_func(array($dao, "get{$objectType}ByPubId"), 'other::urn', $this->expectedURNs[$objectType]);
self::assertNotNull($pubObjectByURN, "Error while testing {$objectType}: object or URN has not been imported.");
if ($objectType == 'PublishedArticle') {
$articelId = $pubObject->getId();
}
}
// Trying to import the same file again should lead to an error.
$args = array('import', $testfile, 'test', 'admin');
$result = $this->executeCli('NativeImportExportPlugin', $args);
self::assertRegExp('/##plugins.importexport.native.import.error.duplicatePubId##/', $result);
// Delete inserted article files from the filesystem.
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articelId);
$articleFileManager->deleteArticleTree();
}
开发者ID:utlib,项目名称:ojs,代码行数:27,代码来源:FunctionalNativeImportTestCase.php
示例3: getFilePath
/**
* Return absolute path to the file on the host filesystem.
* @return string
*/
function getFilePath()
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($this->getArticleId());
$journalId = $article->getJournalId();
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->getArticleId());
return Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles/' . $this->getArticleId() . '/' . $articleFileManager->fileStageToPath($this->getFileStage()) . '/' . $this->getFileName();
}
开发者ID:yuricampos,项目名称:ojs,代码行数:13,代码来源:ArticleFile.inc.php
示例4: deleteSubmission
/**
* Delete a submission.
*/
function deleteSubmission($args)
{
$articleId = isset($args[0]) ? (int) $args[0] : 0;
$this->validate($articleId);
$authorSubmission =& $this->submission;
$this->setupTemplate(true);
// If the submission is incomplete, allow the author to delete it.
if ($authorSubmission->getSubmissionProgress() != 0) {
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteArticleTree();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$articleDao->deleteArticleById($args[0]);
}
Request::redirect(null, null, 'index');
}
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:19,代码来源:TrackSubmissionHandler.inc.php
示例5: 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)) {
// 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;
}
}
开发者ID:master3395,项目名称:CBPPlatform,代码行数:21,代码来源:AuthorSubmitStep3Form.inc.php
示例6: updateFileIndex
/**
* Add a file to the search index.
* @param $articleId int
* @param $type int
* @param $fileId int
*/
function updateFileIndex($articleId, $type, $fileId)
{
import('classes.file.ArticleFileManager');
$fileMgr = new ArticleFileManager($articleId);
$file =& $fileMgr->getFile($fileId);
if (isset($file)) {
$parser =& SearchFileParser::fromFile($file);
}
if (isset($parser)) {
if ($parser->open()) {
$searchDao =& DAORegistry::getDAO('ArticleSearchDAO');
$objectId = $searchDao->insertObject($articleId, $type, $fileId);
$position = 0;
while (($text = $parser->read()) !== false) {
ArticleSearchIndex::indexObjectKeywords($objectId, $text, $position);
}
$parser->close();
}
}
}
开发者ID:JovanyJeff,项目名称:hrp,代码行数:26,代码来源:ArticleSearchIndex.inc.php
示例7: deleteSubmission
/**
* Delete a submission.
* @param $args array
* @param $request PKPRequest
*/
function deleteSubmission($args, $request)
{
$articleId = (int) array_shift($args);
$this->validate($request, $articleId);
$authorSubmission =& $this->submission;
$this->setupTemplate($request, true);
// If the submission is incomplete, allow the author to delete it.
if ($authorSubmission->getSubmissionProgress() != 0) {
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteArticleTree();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$articleDao->deleteArticleById($articleId);
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleDeleted($articleId);
$articleSearchIndex->articleChangesFinished();
}
$request->redirect(null, null, 'index');
}
开发者ID:yuricampos,项目名称:ojs,代码行数:25,代码来源:TrackSubmissionHandler.inc.php
示例8: execute
/**
* Delete submission data and associated files
*/
function execute()
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
foreach ($this->parameters as $articleId) {
$article =& $articleDao->getArticle($articleId);
if (isset($article)) {
// remove files first, to prevent orphans
$articleFileManager = new ArticleFileManager($articleId);
if (!file_exists($articleFileManager->filesDir)) {
printf("Warning: no files found for submission {$articleId}.\n");
} else {
if (!is_writable($articleFileManager->filesDir)) {
printf("Error: Skipping submission {$articleId}. Can't delete files in " . $articleFileManager->filesDir . "\n");
continue;
} else {
$articleFileManager->deleteArticleTree();
}
}
$articleDao->deleteArticleById($articleId);
continue;
}
printf("Error: Skipping {$articleId}. Unknown submission.\n");
}
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:27,代码来源:deleteSubmissions.php
示例9: uploadCopyeditVersion
/**
* Upload the copyedited version of an article.
* @param $copyeditorSubmission object
* @param $copyeditStage string
* @param $request object
*/
function uploadCopyeditVersion($copyeditorSubmission, $copyeditStage, $request)
{
import('classes.file.ArticleFileManager');
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
if ($copyeditStage == 'initial') {
$signoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId());
} else {
if ($copyeditStage == 'final') {
$signoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $copyeditorSubmission->getId());
}
}
// Only allow an upload if they're in the initial or final copyediting
// stages.
if ($copyeditStage == 'initial' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
return;
} else {
if ($copyeditStage == 'final' && ($signoff->getDateNotified() == null || $signoff->getDateCompleted() != null)) {
return;
} else {
if ($copyeditStage != 'initial' && $copyeditStage != 'final') {
return;
}
}
}
$articleFileManager = new ArticleFileManager($copyeditorSubmission->getId());
$user =& $request->getUser();
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
HookRegistry::call('CopyeditorAction::uploadCopyeditVersion', array(&$copyeditorSubmission));
if ($signoff->getFileId() != null) {
$fileId = $articleFileManager->uploadCopyeditFile($fileName, $copyeditorSubmission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL', true));
} else {
$fileId = $articleFileManager->uploadCopyeditFile($fileName);
}
}
if (isset($fileId) && $fileId != 0) {
$signoff->setFileId($fileId);
$signoff->setFileRevision($articleFileDao->getRevisionNumber($fileId));
$signoffDao->updateObject($signoff);
// Add log
import('classes.article.log.ArticleLog');
ArticleLog::logEvent($request, $copyeditorSubmission, ARTICLE_LOG_COPYEDITOR_FILE, 'log.copyedit.copyeditorFile', array('copyeditorName' => $user->getFullName(), 'fileId' => $fileId));
}
}
开发者ID:ramonsodoma,项目名称:ojs,代码行数:52,代码来源:CopyeditorAction.inc.php
示例10: isset
//.........这里部分代码省略.........
XMLCustomWriter::createChildWithText($doc, $issueNode, 'issueno', $issue->getNumber(), false);
$pubNode =& XMLCustomWriter::createElement($doc, 'pub');
XMLCustomWriter::appendChild($issueNode, $pubNode);
XMLCustomWriter::createChildWithText($doc, $pubNode, 'year', $issue->getYear());
$digPubNode =& XMLCustomWriter::createElement($doc, 'digpub');
XMLCustomWriter::appendChild($issueNode, $digPubNode);
if ($issue->getDatePublished()) {
XMLCustomWriter::createChildWithText($doc, $digPubNode, 'date', EruditExportDom::formatDate($issue->getDatePublished()));
}
/* --- Publisher & DTD --- */
$publisherInstitution =& $journal->getSetting('publisherInstitution');
$publisherNode =& XMLCustomWriter::createElement($doc, 'publisher');
XMLCustomWriter::setAttribute($publisherNode, 'id', 'ojs-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId());
XMLCustomWriter::appendChild($adminNode, $publisherNode);
$publisherInstitution = $unavailableString;
if (empty($publisherInstitution)) {
$publisherInstitution = $unavailableString;
}
XMLCustomWriter::createChildWithText($doc, $publisherNode, 'orgname', $publisherInstitution);
$digprodNode =& XMLCustomWriter::createElement($doc, 'digprod');
XMLCustomWriter::createChildWithText($doc, $digprodNode, 'orgname', $publisherInstitution);
XMLCustomWriter::setAttribute($digprodNode, 'id', 'ojs-prod-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId());
XMLCustomWriter::appendChild($adminNode, $digprodNode);
$digdistNode =& XMLCustomWriter::createElement($doc, 'digdist');
XMLCustomWriter::createChildWithText($doc, $digdistNode, 'orgname', $publisherInstitution);
XMLCustomWriter::setAttribute($digdistNode, 'id', 'ojs-dist-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId());
XMLCustomWriter::appendChild($adminNode, $digdistNode);
$dtdNode =& XMLCustomWriter::createElement($doc, 'dtd');
XMLCustomWriter::appendChild($adminNode, $dtdNode);
XMLCustomWriter::setAttribute($dtdNode, 'name', 'Erudit Article');
XMLCustomWriter::setAttribute($dtdNode, 'version', '3.0.0');
/* --- copyright --- */
$copyright = $journal->getLocalizedSetting('copyrightNotice');
XMLCustomWriter::createChildWithText($doc, $adminNode, 'copyright', empty($copyright) ? $unavailableString : $copyright);
/* --- frontmatter --- */
$frontMatterNode =& XMLCustomWriter::createElement($doc, 'frontmatter');
XMLCustomWriter::appendChild($root, $frontMatterNode);
$titleGroupNode =& XMLCustomWriter::createElement($doc, 'titlegr');
XMLCustomWriter::appendChild($frontMatterNode, $titleGroupNode);
XMLCustomWriter::createChildWithText($doc, $titleGroupNode, 'title', strip_tags($article->getLocalizedTitle()));
/* --- authorgr --- */
$authorGroupNode =& XMLCustomWriter::createElement($doc, 'authorgr');
XMLCustomWriter::appendChild($frontMatterNode, $authorGroupNode);
$authorNum = 1;
foreach ($article->getAuthors() as $author) {
$authorNode =& XMLCustomWriter::createElement($doc, 'author');
XMLCustomWriter::appendChild($authorGroupNode, $authorNode);
XMLCustomWriter::setAttribute($authorNode, 'id', 'ojs-' . $journal->getId() . '-' . $issue->getId() . '-' . $article->getId() . '-' . $galley->getId() . '-' . $authorNum);
$persNameNode =& XMLCustomWriter::createElement($doc, 'persname');
XMLCustomWriter::appendChild($authorNode, $persNameNode);
XMLCustomWriter::createChildWithText($doc, $persNameNode, 'firstname', $author->getFirstName());
XMLCustomWriter::createChildWithText($doc, $persNameNode, 'middlename', $author->getMiddleName(), false);
XMLCustomWriter::createChildWithText($doc, $persNameNode, 'familyname', $author->getLastName());
if ($author->getLocalizedAffiliation() != '') {
$affiliationNode =& XMLCustomWriter::createElement($doc, 'affiliation');
XMLCustomWriter::appendChild($authorNode, $affiliationNode);
XMLCustomWriter::createChildWithText($doc, $affiliationNode, 'blocktext', $author->getLocalizedAffiliation(), false);
}
$authorNum++;
}
/* --- abstract and keywords --- */
foreach ((array) $article->getAbstract(null) as $locale => $abstract) {
$abstract = strip_tags($abstract);
$abstractNode =& XMLCustomWriter::createElement($doc, 'abstract');
XMLCustomWriter::setAttribute($abstractNode, 'lang', $locale);
XMLCustomWriter::appendChild($frontMatterNode, $abstractNode);
XMLCustomWriter::createChildWithText($doc, $abstractNode, 'blocktext', $abstract);
unset($abstractNode);
}
if ($keywords = $article->getLocalizedSubject()) {
$keywordGroupNode =& XMLCustomWriter::createElement($doc, 'keywordgr');
XMLCustomWriter::setAttribute($keywordGroupNode, 'lang', ($language = $article->getLanguage()) ? $language : 'en');
foreach (explode(';', $keywords) as $keyword) {
XMLCustomWriter::createChildWithText($doc, $keywordGroupNode, 'keyword', trim($keyword), false);
}
XMLCustomWriter::appendChild($frontMatterNode, $keywordGroupNode);
}
/* --- body --- */
$bodyNode =& XMLCustomWriter::createElement($doc, 'body');
XMLCustomWriter::appendChild($root, $bodyNode);
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($article->getId());
$file =& $articleFileManager->getFile($galley->getFileId());
$parser =& SearchFileParser::fromFile($file);
if (isset($parser)) {
if ($parser->open()) {
// File supports text indexing.
$textNode =& XMLCustomWriter::createElement($doc, 'text');
XMLCustomWriter::appendChild($bodyNode, $textNode);
while (($line = $parser->read()) !== false) {
$line = trim($line);
if ($line != '') {
XMLCustomWriter::createChildWithText($doc, $textNode, 'blocktext', $line, false);
}
}
$parser->close();
}
}
return $root;
}
开发者ID:master3395,项目名称:CBPPlatform,代码行数:101,代码来源:EruditExportDom.inc.php
示例11: log
/**
* Save the email in the article email log.
*/
function log()
{
import('classes.article.log.ArticleEmailLogEntry');
import('classes.article.log.ArticleLog');
$entry = new ArticleEmailLogEntry();
$article =& $this->article;
// Log data
$entry->setEventType($this->eventType);
$entry->setAssocType($this->assocType);
$entry->setAssocId($this->assocId);
// Email data
$entry->setSubject($this->getSubject());
$entry->setBody($this->getBody());
$entry->setFrom($this->getFromString(false));
$entry->setRecipients($this->getRecipientString());
$entry->setCcs($this->getCcString());
$entry->setBccs($this->getBccString());
// Add log entry
$logEntryId = ArticleLog::logEmailEntry($article->getId(), $entry);
// Add attachments
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($article->getId());
foreach ($this->getAttachmentFiles() as $attachment) {
$articleFileManager->temporaryFileToArticleFile($attachment, ARTICLE_FILE_ATTACHMENT, $logEntryId);
}
}
开发者ID:elavaud,项目名称:hrp_ct,代码行数:29,代码来源:ArticleMailTemplate.inc.php
示例12: uploadReviewForReviewer
/**
* Upload a review on behalf of its reviewer.
* @param $reviewId int
*/
function uploadReviewForReviewer($reviewId, $article, $request)
{
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$user =& $request->getUser();
$reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
$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($reviewAssignment->getSubmissionId());
// 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)) {
if ($reviewAssignment->getReviewerFileId() != null) {
$fileId = $articleFileManager->uploadReviewFile($fileName, $reviewAssignment->getReviewerFileId());
} else {
$fileId = $articleFileManager->uploadReviewFile($fileName);
}
}
}
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');
ArticleLog::logEvent($request, $article, ARTICLE_LOG_REVIEW_FILE_BY_PROXY, 'log.review.reviewFileByProxy', array('reviewerName' => $reviewer->getFullName(), 'round' => $reviewAssignment->getRound(), 'userName' => $user->getFullName(), 'reviewId' => $reviewAssignment->getId()));
}
}
开发者ID:yuricampos,项目名称:ojs,代码行数:43,代码来源:SectionEditorAction.inc.php
示例13: execute
/**
* Save changes to the report file.
* @return int the report file ID
*/
function execute($fileName = null)
{
$sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
$articleDao =& DAORegistry::getDAO('ArticleDAO');
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->article->getArticleId());
$fileName = isset($fileName) ? $fileName : 'uploadReportFile';
$lastDecision = $this->article->getLastSectionDecision();
$lastDecisionDecision = $lastDecision->getDecision();
$lastDecisionType = $lastDecision->getReviewType();
// Ensure to start a new round of review when needed, and if the file to upload is correct
if (($lastDecisionDecision == SUBMISSION_SECTION_DECISION_APPROVED || $lastDecisionDecision == SUBMISSION_SECTION_DECISION_EXEMPTED || $lastDecisionType == REVIEW_TYPE_SAE && ($lastDecisionDecision == SUBMISSION_SECTION_DECISION_INCOMPLETE || $lastDecisionDecision == SUBMISSION_SECTION_DECISION_RESUBMIT)) && $articleFileManager->uploadedFileExists($fileName)) {
$this->fileId = $articleFileManager->uploadSAEFile($fileName);
} else {
$this->fileId = 0;
}
if ($this->fileId && $this->fileId > 0) {
$sectionDecision =& new SectionDecision();
$sectionDecision->setSectionId($lastDecision->getSectionId());
$sectionDecision->setDecision(0);
$sectionDecision->setDateDecided(date(Core::getCurrentDate()));
$sectionDecision->setArticleId($this->article->getArticleId());
$sectionDecision->setReviewType(REVIEW_TYPE_SAE);
if ($lastDecisionType == $sectionDecision->getReviewType()) {
$lastRound = (int) $lastDecision->getRound();
$sectionDecision->setRound($lastRound + 1);
} else {
$sectionDecision->setRound(1);
}
$sectionDecisionDao->insertSectionDecision($sectionDecision);
$articleDao->changeArticleStatus($this->article->getArticleId(), STATUS_QUEUED);
}
// Notifications
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$journal =& Request::getJournal();
$url = Request::url($journal->getPath(), 'sectionEditor', 'submission', array($this->article->getArticleId(), 'submissionReview'));
$sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
$sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $lastDecision->getSectionId());
foreach ($sectionEditors as $sectionEditor) {
$notificationSectionEditors[] = array('id' => $sectionEditor->getId());
}
foreach ($notificationSectionEditors as $userRole) {
$notificationManager->createNotification($userRole['id'], 'notification.type.sae', $this->article->getProposalId(), $url, 1, NOTIFICATION_TYPE_METADATA_MODIFIED);
}
return $this->fileId;
}
开发者ID:elavaud,项目名称:hrp_ct,代码行数:51,代码来源:SAEFileForm.inc.php
示例14: 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));
}
开发者ID:yuricampos,项目名称:ojs,代码行数:22,代码来源:SubmitHandler.inc.php
示例15: import
/**
* Retrieve all article files for a type and assoc ID.
* @param $assocId int
* @param $type int
* @return array ArticleFiles
*/
function &getArticleFilesByAssocId($assocId, $type)
{
import('file.ArticleFileManager');
$articleFiles = array();
$result =& $this->retrieve('SELECT * FROM article_files WHERE assoc_id = ? AND type = ?', array($assocId, ArticleFileManager::typeToPath($type)));
while (!$result->EOF) {
$articleFiles[] =& $this->_returnArticleFileFromRow($result->GetRowAssoc(false));
$result->moveNext();
}
$result->Close();
unset($result);
return $articleFiles;
}
开发者ID:Jouper,项目名称:jouper,代码行数:19,代码来源:ArticleFileDAO.inc.php
示例16: deleteSubmission
/**
* Delete a submission.
*/
function deleteSubmission($args, $request)
{
$articleId = (int) array_shift($args);
$this->validate($articleId);
parent::setupTemplate(true);
$journal =& $request->getJournal();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($articleId);
$status = $article->getStatus();
if ($article->getJournalId() == $journal->getId() && ($status == STATUS_DECLINED || $status == STATUS_ARCHIVED)) {
// Delete article files
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteArticleTree();
// Delete article database entries
$articleDao->deleteArticleById($articleId);
}
$request->redirect(null, null, 'submissions', 'submissionsArchives');
}
开发者ID:yuricampos,项目名称:ojs,代码行数:22,代码来源:EditorHandler.inc.php
示例17: uploadCopyeditVersion
/**
* Upload the revised version of a copyedit file.
* @param $authorSubmission object
* @param $copyeditStage string
*/
function uploadCopyeditVersion($authorSubmission, $copyeditStage)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($authorSubmission->getId());
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$articleFileDao =& DAORegistry::getDAO('ArticleFileDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
// Authors cannot upload if the assignment is not active, i.e.
// they haven't been notified or the assignment is already complete.
$authorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $authorSubmission->getId());
if (!$authorSignoff->getDateNotified() || $authorSignoff->getDateCompleted()) {
return;
}
$fileName = 'upload';
if ($articleFileManager->uploadedFileExists($fileName)) {
HookRegistry::call('AuthorAction::uploadCopyeditVersion', array(&$authorSubmission, &$copyeditStage));
if ($authorSignoff->getFileId() != null) {
$fileId = $articleFileManager->uploadCopyeditFile($fileName, $authorSignoff->getFileId());
} else {
$fileId = $articleFileManager->uploadCopyeditFile($fileName);
}
}
$authorSignoff->setFileId($fileId);
if ($copyeditStage == 'author') {
$authorSignoff->setFileRevision($articleFileDao->getRevisionNumber($fileId));
}
$signoffDao->updateObject($authorSignoff);
}
开发者ID:jasonzou,项目名称:OJS-2.4.6,代码行数:33,代码来源:AuthorAction.inc.php
示例18: execute
/**
* Save changes to the supplementary file.
* @return int the supplementary file ID
*/
function execute($fileName = null)
{
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($this->article->getArticleId());
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$fileName = isset($fileName) ? $fileName : 'uploadSuppFile';
if (isset($this->suppFile)) {
parent::execute();
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileId = $this->suppFile->getFileId();
if ($fileId != 0) {
$articleFileManager->uploadSuppFile($fileName, $fileId);
} else {
$fileId = $articleFileManager->uploadSuppFile($fileName);
$this->suppFile->setFileId($fileId);
}
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
}
// Index metadata
ArticleSearchIndex::indexSuppFileMetadata($this->suppFile);
// Update existing supplementary file
$this->setSuppFileData($this->suppFile);
$suppFileDao->updateSuppFile($this->suppFile);
} else {
// Upload file, if file selected.
if ($articleFileManager->uploadedFileExists($fileName)) {
$fileId = $articleFileManager->uploadSuppFile($fileName);
import('classes.search.ArticleSearchIndex');
ArticleSearchIndex::updateFileIndex($this->article->getArticleId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $fileId);
} else {
$fileId = 0;
}
// Insert new supplementary file
$this->suppFile = new SuppFile();
$this->suppFile->setArticleId($this->article->getArticleId());
$this->suppFile->setFileId($fileId);
parent::execute();
$this->setSuppFileData($this->suppFile);
$suppFileDao->insertSuppFile($this->suppFile);
$this->suppFileId = $this->suppFile->getId();
}
return $this->suppFileId;
}
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:49,代码来源:SuppFileForm.inc.php
示例19: importArticles
function importArticles()
{
assert($this->xml->name == 'articles');
$articleDAO =& DAORegistry::getDAO('ArticleDAO');
$articles = $articleDAO->getArticlesByJournalId($this->journal->getId());
$journalFileManager = new JournalFileManager($this->journal);
$publicFileManager =& new PublicFileManager();
$this->nextElement();
while ($this->xml->name == 'article') {
$articleXML = $this->getCurrentElementAsDom();
$article = new Article();
$article->setJournalId($this->journal->getId());
$article->setUserId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $articleXML->userId));
$article->setSectionId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_SECTION, (int) $articleXML->sectionId));
$article->setLocale((string) $articleXML->locale);
$article->setLanguage((string) $articleXML->language);
$article->setCommentsToEditor((string) $articleXML->commentsToEditor);
$article->setCitations((string) $articleXML->citations);
$article->setDateSubmitted((string) $articleXML->dateSubmitted);
$article->setDateStatusModified((string) $articleXML->dateStatusModified);
$article->setLastModified((string) $articleXML->lastModified);
$article->setStatus((int) $articleXML->status);
$article->setSubmissionProgress((int) $articleXML->submissionProgress);
$article->setCurrentRound((int) $articleXML->currentRound);
$article->setPages((string) $articleXML->pages);
$article->setFastTracked((int) $articleXML->fastTracked);
$article->setHideAuthor((int) $articleXML->hideAuthor);
$article->setCommentsStatus((int) $articleXML->commentsStatus);
$articleDAO->insertArticle($article);
$oldArticleId = (int) $articleXML->oldId;
$this->restoreDataObjectSettings($articleDAO, $articleXML->settings, 'article_settings', 'article_id', $article->getId());
$article =& $articleDAO->getArticle($article->getId());
// Reload article with restored settings
$covers = $article->getFileName(null);
if ($covers) {
foreach ($covers as $locale => $oldCoverFileName) {
$sourceFile = $this->publicFolderPath . '/' . $oldCoverFileName;
$extension = $publicFileManager->getExtension($oldCoverFileName);
$destFile = 'cover_issue_' . $article->getId() . "_{$locale}.{$extension}";
$publicFileManager->copyJournalFile($this->journal->getId(), $sourceFile, $destFile);
unlink($sourceFile);
$article->setFileName($destFile, $locale);
$articleDAO->updateArticle($article);
}
}
$articleFileManager = new ArticleFileManager($article->getId());
$authorDAO =& DAORegistry::getDAO('AuthorDAO');
foreach ($articleXML->author as $authorXML) {
$author = new Author();
$author->setArticleId($article->getId());
$author->setFirstName((string) $authorXML->firstName);
$author->setMiddleName((string) $authorXML->middleName);
$author->setLastName((string) $authorXML->lastName);
$author->setSuffix((string) $authorXML->suffix);
$author->setCountry((string) $authorXML->country);
$author->setEmail((string) $authorXML->email);
$author->setUrl((string) $authorXML->url);
$author->setUserGroupId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_GROUP, (int) $authorXML->userGroupId));
$author->setPrimaryContact((int) $authorXML->primaryContact);
$author->setSequence((int) $authorXML->sequence);
$authorDAO->insertAuthor($author);
$this->restoreDataObjectSettings($authorDAO, $authorXML->settings, 'author_settings', 'author_id', $author->getId());
unset($author);
}
$articleEmailLogDAO =& DAORegistry::getDAO('ArticleEmailLogDAO');
$emailLogsXML = array();
foreach ($articleXML->emailLogs->emailLog as $emailLogXML) {
array_unshift($emailLogsXML, $emailLogXML);
}
foreach ($emailLogsXML as $emailLogXML) {
$emailLog = new ArticleEmailLogEntry();
$emailLog->setAssocType(ASSOC_TYPE_ARTICLE);
$emailLog->setAssocId($article->getId());
$emailLog->setSenderId($this->idTranslationTable->resolve(INTERNAL_TRANSFER_OBJECT_USER, (int) $emailLogXML->senderId));
$emailLog->setDateSent((string) $emailLogXML->dateSent);
$emailLog->setIPAddress((string) $emailLogXML->IPAddress);
$emailLog->setEventType((int) $emailLogXML->eventType);
$emailLog->setFrom((string) $emailLogXML->from);
$emailLog->setRecipients((string) $emailLogXML->recipients);
$emailLog->setCcs((string) $emailLogXML->ccs);
$emailLog->setBccs((string) $emailLogXML->bccs);
$emailLog->setSubject((string) $emailLogXML->subject);
$emailLog->setBody((string) $emailLogXML->body);
$articleEmailLogDAO->insertObject($emailLog);
$this->idTranslationTable->register(INTERNAL_TRANSFER_OBJECT_ARTICLE_EMAIL_LOG, (int) $emailLo
|
请发表评论