/** * Given an issue and journal id, return whether the current user can view the issue in the journal * @param $issue object The issue to display * @param $journalId int The id of the journal */ function _isVisibleIssue($issue, $journalId) { if (isset($issue) && ($issue->getPublished() || Validation::isEditor($journalId) || Validation::isLayoutEditor($journalId) || Validation::isProofreader($journalId)) && $issue->getJournalId() == $journalId) { return true; } else { return false; } }
/** * Validate that user is an editor in the selected journal and if the issue id is valid * Redirects to issue create issue page if not properly authenticated. * NOTE: As of OJS 2.2, Layout Editors are allowed if specified in args. */ function validate($issueId = null, $allowLayoutEditor = false) { $issue = null; $journal =& Request::getJournal(); if (!isset($journal)) { Validation::redirectLogin(); } if (isset($issueId)) { $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue = $issueDao->getIssueById($issueId, $journal->getJournalId()); if (!$issue) { Request::redirect(null, null, 'createIssue'); } } if (!Validation::isEditor($journal->getJournalId())) { if (isset($journal) && $allowLayoutEditor && Validation::isLayoutEditor($journal->getJournalId())) { // We're a Layout Editor. If specified, make sure that the issue is not published. if ($issue && !$issue->getPublished()) { Validation::redirectLogin(); } } else { Validation::redirectLogin(); } } return $issue; }
/** * Validate that user is a layout editor in the selected journal. * Redirects to user index page if not properly authenticated. */ function validate() { parent::validate(); $journal =& Request::getJournal(); if (!isset($journal) || !Validation::isLayoutEditor($journal->getJournalId())) { Validation::redirectLogin(); } }
/** * Given an issue, set up the template with all the required variables for * issues/view.tpl to function properly (i.e. current issue and view issue). * @param $issue object The issue to display * @param $showToc boolean iff false and a custom cover page exists, * the cover page will be displayed. Otherwise table of contents * will be displayed. */ function _setupIssueTemplate($request, $issue, $showToc = false) { $journal =& $request->getJournal(); $journalId = $journal->getId(); $templateMgr =& TemplateManager::getManager(); if (isset($issue) && ($issue->getPublished() || Validation::isEditor($journalId) || Validation::isLayoutEditor($journalId) || Validation::isProofreader($journalId)) && $issue->getJournalId() == $journalId) { $issueHeadingTitle = $issue->getIssueIdentification(false, true); $issueCrumbTitle = $issue->getIssueIdentification(false, true); $locale = AppLocale::getLocale(); import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $coverPagePath = $request->getBaseUrl() . '/'; $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/'; $templateMgr->assign('coverPagePath', $coverPagePath); $templateMgr->assign('locale', $locale); if (!$showToc && $issue->getFileName($locale) && $issue->getShowCoverPage($locale) && !$issue->getHideCoverPageCover($locale)) { $templateMgr->assign('fileName', $issue->getFileName($locale)); $templateMgr->assign('width', $issue->getWidth($locale)); $templateMgr->assign('height', $issue->getHeight($locale)); $templateMgr->assign('coverPageAltText', $issue->getCoverPageAltText($locale)); $templateMgr->assign('originalFileName', $issue->getOriginalFileName($locale)); $showToc = false; } else { // Issue galleys $issueGalleyDao =& DAORegistry::getDAO('IssueGalleyDAO'); $issueGalleys =& $issueGalleyDao->getGalleysByIssue($issue->getId()); $templateMgr->assign_by_ref('issueGalleys', $issueGalleys); // Published articles $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles =& $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true); $publicFileManager = new PublicFileManager(); $templateMgr->assign_by_ref('publishedArticles', $publishedArticles); $showToc = true; } $templateMgr->assign('showToc', $showToc); $templateMgr->assign_by_ref('issue', $issue); // Subscription Access import('classes.issue.IssueAction'); $subscriptionRequired = IssueAction::subscriptionRequired($issue); $subscribedUser = IssueAction::subscribedUser($journal); $subscribedDomain = IssueAction::subscribedDomain($journal); $subscriptionExpiryPartial = $journal->getSetting('subscriptionExpiryPartial'); if ($showToc && $subscriptionRequired && !$subscribedUser && !$subscribedDomain && $subscriptionExpiryPartial) { $templateMgr->assign('subscriptionExpiryPartial', true); // Partial subscription expiry for issue $partial = IssueAction::subscribedUser($journal, $issue->getId()); if (!$partial) { IssueAction::subscribedDomain($journal, $issue->getId()); } $templateMgr->assign('issueExpiryPartial', $partial); // Partial subscription expiry for articles $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticlesTemp =& $publishedArticleDao->getPublishedArticles($issue->getId()); $articleExpiryPartial = array(); foreach ($publishedArticlesTemp as $publishedArticle) { $partial = IssueAction::subscribedUser($journal, $issue->getId(), $publishedArticle->getId()); if (!$partial) { IssueAction::subscribedDomain($journal, $issue->getId(), $publishedArticle->getId()); } $articleExpiryPartial[$publishedArticle->getId()] = $partial; } $templateMgr->assign_by_ref('articleExpiryPartial', $articleExpiryPartial); } $templateMgr->assign('subscriptionRequired', $subscriptionRequired); $templateMgr->assign('subscribedUser', $subscribedUser); $templateMgr->assign('subscribedDomain', $subscribedDomain); $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks')); import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); if ($paymentManager->onlyPdfEnabled()) { $templateMgr->assign('restrictOnlyPdf', true); } if ($paymentManager->purchaseArticleEnabled()) { $templateMgr->assign('purchaseArticleEnabled', true); } } else { $issueCrumbTitle = __('archive.issueUnavailable'); $issueHeadingTitle = __('archive.issueUnavailable'); } if ($styleFileName = $issue->getStyleFileName()) { import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $templateMgr->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/' . $styleFileName); } $templateMgr->assign('pageCrumbTitleTranslated', $issueCrumbTitle); $templateMgr->assign('issueHeadingTitle', $issueHeadingTitle); }
/** * Gather information about a user's role within a journal. * @param $userId int * @param $journalId int * @param $submissionsCount array reference * @param $isValid array reference */ function _getRoleDataForJournal($userId, $journalId, &$submissionsCount, &$isValid) { if (Validation::isJournalManager($journalId)) { $journalDao =& DAORegistry::getDAO('JournalDAO'); $isValid["JournalManager"][$journalId] = true; } if (Validation::isSubscriptionManager($journalId)) { $isValid["SubscriptionManager"][$journalId] = true; } if (Validation::isAuthor($journalId)) { $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $submissionsCount["Author"][$journalId] = $authorSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Author"][$journalId] = true; } if (Validation::isCopyeditor($journalId)) { $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO'); $submissionsCount["Copyeditor"][$journalId] = $copyeditorSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Copyeditor"][$journalId] = true; } if (Validation::isLayoutEditor($journalId)) { $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO'); $submissionsCount["LayoutEditor"][$journalId] = $layoutEditorSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["LayoutEditor"][$journalId] = true; } if (Validation::isEditor($journalId)) { $editorSubmissionDao =& DAORegistry::getDAO('EditorSubmissionDAO'); $submissionsCount["Editor"][$journalId] = $editorSubmissionDao->getEditorSubmissionsCount($journalId); $isValid["Editor"][$journalId] = true; } if (Validation::isSectionEditor($journalId)) { $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO'); $submissionsCount["SectionEditor"][$journalId] = $sectionEditorSubmissionDao->getSectionEditorSubmissionsCount($userId, $journalId); $isValid["SectionEditor"][$journalId] = true; } if (Validation::isProofreader($journalId)) { $proofreaderSubmissionDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO'); $submissionsCount["Proofreader"][$journalId] = $proofreaderSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Proofreader"][$journalId] = true; } if (Validation::isReviewer($journalId)) { $reviewerSubmissionDao =& DAORegistry::getDAO('ReviewerSubmissionDAO'); $submissionsCount["Reviewer"][$journalId] = $reviewerSubmissionDao->getSubmissionsCount($userId, $journalId); $isValid["Reviewer"][$journalId] = true; } }
/** * Given an issue, set up the template with all the required variables for * issues/view.tpl to function properly. * @param $issue object The issue to display * @param $showToc boolean iff false and a custom cover page exists, * the cover page will be displayed. Otherwise table of contents * will be displayed. */ function setupIssueTemplate(&$issue, $showToc = false) { $journal =& Request::getJournal(); $journalId = $journal->getId(); $templateMgr =& TemplateManager::getManager(); if (isset($issue) && ($issue->getPublished() || Validation::isEditor($journalId) || Validation::isLayoutEditor($journalId) || Validation::isProofreader($journalId)) && $issue->getJournalId() == $journalId) { $issueHeadingTitle = $issue->getIssueIdentification(false, true); $issueCrumbTitle = $issue->getIssueIdentification(false, true); $locale = Locale::getLocale(); import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $coverPagePath = Request::getBaseUrl() . '/'; $coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/'; $templateMgr->assign('coverPagePath', $coverPagePath); $templateMgr->assign('locale', $locale); if ($issue->getFileName($locale) && $issue->getShowCoverPage($locale) && !$issue->getHideCoverPageCover($locale)) { //%LP% show thumbnail version rather than full-size front cover $filename = $issue->getThumbFileName($issue->getFileName($locale)); $templateMgr->assign('fileName', $filename); $templateMgr->assign('coverPageAltText', $issue->getCoverPageAltText($locale)); $templateMgr->assign('originalFileName', $issue->getOriginalFileName($locale)); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles =& $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true); $publicFileManager = new PublicFileManager(); $templateMgr->assign('publishedArticles', $publishedArticles); } $templateMgr->assign('showToc', $showToc); $templateMgr->assign('issueId', $issue->getBestIssueId()); $templateMgr->assign('issue', $issue); // Subscription Access import('classes.issue.IssueAction'); $subscriptionRequired = IssueAction::subscriptionRequired($issue); $subscribedUser = IssueAction::subscribedUser($journal); $subscribedDomain = IssueAction::subscribedDomain($journal); $subscriptionExpiryPartial = $journal->getSetting('subscriptionExpiryPartial'); if ($showToc && $subscriptionRequired && !$subscribedUser && !$subscribedDomain && $subscriptionExpiryPartial) { $templateMgr->assign('subscriptionExpiryPartial', true); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticlesTemp =& $publishedArticleDao->getPublishedArticles($issue->getId()); $articleExpiryPartial = array(); foreach ($publishedArticlesTemp as $publishedArticle) { $partial = IssueAction::subscribedUser($journal, $issue->getId(), $publishedArticle->getId()); if (!$partial) { IssueAction::subscribedDomain($journal, $issue->getId(), $publishedArticle->getId()); } $articleExpiryPartial[$publishedArticle->getId()] = $partial; } $templateMgr->assign_by_ref('articleExpiryPartial', $articleExpiryPartial); } $templateMgr->assign('subscriptionRequired', $subscriptionRequired); $templateMgr->assign('subscribedUser', $subscribedUser); $templateMgr->assign('subscribedDomain', $subscribedDomain); $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks')); import('classes.payment.ojs.OJSPaymentManager'); $paymentManager =& OJSPaymentManager::getManager(); if ($paymentManager->onlyPdfEnabled()) { $templateMgr->assign('restrictOnlyPdf', true); } if ($paymentManager->purchaseArticleEnabled()) { $templateMgr->assign('purchaseArticleEnabled', true); } } else { $issueCrumbTitle = Locale::translate('archive.issueUnavailable'); $issueHeadingTitle = Locale::translate('archive.issueUnavailable'); } if ($styleFileName = $issue->getStyleFileName()) { import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/' . $styleFileName); } $articleDao =& DAORegistry::getDAO('ArticleDAO'); $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); //%CBP% get repository object information for download links $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO'); $issueObject = $CBPPlatformDao->getFedoraIssueObjectInformation($issue->getIssueId()); $objectPid = $issueObject['fedora_namespace'] . ":" . $issueObject['fedora_pid']; $objectDsid = $issueObject['fedora_dsid']; $templateMgr->assign_by_ref('repositoryObjectPid', $objectPid); $templateMgr->assign_by_ref('repositoryObjectDsid', $objectDsid); $locale = Config::getVar('i18n', 'locale'); //%LP% show associated artefacts (supplementary files) related to the submission foreach ($publishedArticles as $section) { foreach ($section['articles'] as $article) { $supplementaryFilesTemp[] = $article->getSuppFiles(); } } foreach ($supplementaryFilesTemp as $supplementaryFile) { if ($supplementaryFile[0]) { $suppFile = $supplementaryFile[0]; $article = $articleDao->getArticle($suppFile->getArticleId()); $title = $suppFile->getTitle(); if (stristr($title['en_US'], "Author Biography") == false) { // don't list author biographies $supplementaryFiles[] = array('title' => $title['en_US'], 'articleTitle' => $article->getArticleTitle(), 'articleId' => $article->getArticleId(), 'fileId' => $suppFile->getFileId()); } } } $templateMgr->assign_by_ref('supplementaryFiles', $supplementaryFiles); $atomistic = $templateMgr->_tpl_vars; $atomistic = $atomistic['atomistic']; $templateMgr->assign_by_ref('atomistic', $atomistic); //%CBP% show issue/book ISBN $isbn = $CBPPlatformDao->getIssueISBN($issue->getIssueId()); $templateMgr->assign_by_ref('isbn', $isbn); $templateMgr->assign('pageCrumbTitleTranslated', $issueCrumbTitle); $templateMgr->assign('issueHeadingTitle', $issueHeadingTitle); }