/** * Display the form. */ function display() { $request = $this->request; $templateMgr = TemplateManager::getManager($request); $user = $request->getUser(); $journal = $request->getJournal(); $formLocale = $this->getFormLocale(); $templateMgr->assign('journal', $journal); $sectionDao = DAORegistry::getDAO('SectionDAO'); $sections = $sectionDao->getByJournalId($journal->getId()); $sectionTitles = $sectionAbstractsRequired = array(); while ($section = $sections->next()) { $sectionTitles[$section->getId()] = $section->getLocalizedTitle(); $sectionAbstractsRequired[(int) $section->getId()] = (int) (!$section->getAbstractsNotRequired()); unset($section); } $templateMgr->assign('sectionOptions', array('0' => __('author.submit.selectSection')) + $sectionTitles); $templateMgr->assign('sectionAbstractsRequired', $sectionAbstractsRequired); $countryDao = DAORegistry::getDAO('CountryDAO'); $templateMgr->assign('countries', $countryDao->getCountries()); import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $templateMgr->assign('issueOptions', $issueAction->getIssueOptions()); import('lib.pkp.classes.file.TemporaryFileManager'); $temporaryFileManager = new TemporaryFileManager(); $tempFileId = $this->getData('tempFileId'); if (isset($tempFileId[$formLocale]) && $tempFileId[$formLocale] > 0) { $submissionFile = $temporaryFileManager->getFile($tempFileId[$formLocale], $user->getId()); $templateMgr->assign('submissionFile', $submissionFile); } if ($request->getUserVar('addAuthor') || $request->getUserVar('delAuthor') || $request->getUserVar('moveAuthor')) { $templateMgr->assign('scrollToAuthor', true); } if ($request->getUserVar('destination') == 'queue') { $templateMgr->assign('publishToIssue', false); } else { $templateMgr->assign('issueNumber', $request->getUserVar('issueId')); $templateMgr->assign('publishToIssue', true); } $templateMgr->assign('enablePageNumber', $journal->getSetting('enablePageNumber')); parent::display(); }
/** * Fetch the HTML contents of the form. * @param $request PKPRequest * return string */ function fetch($request) { $context = $request->getContext(); $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('submissionId', $this->getSubmission()->getId()); $templateMgr->assign('stageId', $this->getStageId()); $templateMgr->assign('formParams', $this->getFormParams()); $templateMgr->assign('context', $context); $journalSettingsDao = DAORegistry::getDAO('JournalSettingsDAO'); $enablePublicArticleId = $journalSettingsDao->getSetting($context->getId(), 'enablePublicArticleId'); $templateMgr->assign('enablePublicArticleId', $enablePublicArticleId); $enablePageNumber = $journalSettingsDao->getSetting($context->getId(), 'enablePageNumber'); $templateMgr->assign('enablePageNumber', $enablePageNumber); // include issue possibilities import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $templateMgr->assign('issueOptions', $issueAction->getIssueOptions()); $publishedArticle = $this->getPublishedArticle(); if ($publishedArticle) { $templateMgr->assign('publishedArticle', $publishedArticle); $issueDao = DAORegistry::getDAO('IssueDAO'); $issue = $issueDao->getById($publishedArticle->getIssueId()); if ($issue) { $templateMgr->assign('issueAccess', $issue->getAccessStatus()); $templateMgr->assign('accessOptions', array(ARTICLE_ACCESS_ISSUE_DEFAULT => __('editor.issues.default'), ARTICLE_ACCESS_OPEN => __('editor.issues.open'))); } } // include payment information // Set up required Payment Related Information import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); $completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO'); $publicationFeeEnabled = $paymentManager->publicationEnabled(); $templateMgr->assign('publicationFeeEnabled', $publicationFeeEnabled); if ($publicationFeeEnabled) { $templateMgr->assign('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment($context->getId(), $subission->getId())); } return parent::fetch($request); }
/** * Display the form. */ function display() { $templateMgr =& TemplateManager::getManager(); $request =& $this->request; $user =& $request->getUser(); $journal =& $request->getJournal(); $formLocale = $this->getFormLocale(); $templateMgr->assign('journal', $journal); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $sections =& $sectionDao->getJournalSections($journal->getId()); $sectionTitles = $sectionAbstractsRequired = array(); while ($section =& $sections->next()) { $sectionTitles[$section->getId()] = $section->getTitle($journal->getPrimaryLocale()); $sectionAbstractsRequired[(int) $section->getId()] = (int) (!$section->getAbstractsNotRequired()); unset($section); } $templateMgr->assign('sectionOptions', array('0' => __('author.submit.selectSection')) + $sectionTitles); $templateMgr->assign('sectionAbstractsRequired', $sectionAbstractsRequired); $countryDao =& DAORegistry::getDAO('CountryDAO'); $countries =& $countryDao->getCountries(); $templateMgr->assign_by_ref('countries', $countries); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); import('classes.file.TemporaryFileManager'); $temporaryFileManager = new TemporaryFileManager(); $tempFileId = $this->getData('tempFileId'); if (isset($tempFileId[$formLocale]) && $tempFileId[$formLocale] > 0) { $submissionFile = $temporaryFileManager->getFile($tempFileId[$formLocale], $user->getId()); $templateMgr->assign_by_ref('submissionFile', $submissionFile); } if ($request->getUserVar('addAuthor') || $request->getUserVar('delAuthor') || $request->getUserVar('moveAuthor')) { $templateMgr->assign('scrollToAuthor', true); } if ($request->getUserVar('destination') == 'queue') { $templateMgr->assign('publishToIssue', false); } else { $templateMgr->assign('issueNumber', $request->getUserVar('issueId')); $templateMgr->assign('publishToIssue', true); } $templateMgr->assign('enablePageNumber', $journal->getSetting('enablePageNumber')); // Provide available submission languages. (Convert the array // of locale symbolic names xx_XX into an associative array // of symbolic names => readable names.) $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); if (empty($supportedSubmissionLocales)) { $supportedSubmissionLocales = array($journal->getPrimaryLocale()); } $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(AppLocale::getAllLocales()), $supportedSubmissionLocales))); parent::display(); }
/** * Display the form. */ function display() { $templateMgr =& TemplateManager::getManager(); $user =& Request::getUser(); $journal =& Request::getJournal(); $formLocale = $this->getFormLocale(); $templateMgr->assign('journal', $journal); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId())); $countryDao =& DAORegistry::getDAO('CountryDAO'); $countries =& $countryDao->getCountries(); $templateMgr->assign_by_ref('countries', $countries); import('issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); import('file.TemporaryFileManager'); $temporaryFileManager = new TemporaryFileManager(); $tempFileId = $this->getData('tempFileId'); if ($tempFileId[$formLocale] > 0) { $submissionFile = $temporaryFileManager->getFile($tempFileId[$formLocale], $user->getId()); $templateMgr->assign_by_ref('submissionFile', $submissionFile); } if (Request::getUserVar('addAuthor') || Request::getUserVar('delAuthor') || Request::getUserVar('moveAuthor')) { $templateMgr->assign('scrollToAuthor', true); } $jqueryPlugin =& PluginRegistry::getPlugin('generic', 'JQueryPlugin'); if ($jqueryPlugin->isJQueryInstalled()) { $templateMgr->assign('jqueryPath', $jqueryPlugin->getScriptPath()); $templateMgr->assign('addAuthorUrl', $jqueryPlugin->getScriptPath()); } if (Request::getUserVar('destination') == 'queue') { $templateMgr->assign('publishToIssue', false); } else { $templateMgr->assign('issueNumber', Request::getUserVar('issueId')); $templateMgr->assign('publishToIssue', true); } parent::display(); }
/** * @see OAIMetadataFormat#toXml * TODO: * <copyright-holder> * In Isabelle's mapping document: * Article order in the issue's Table of Contents */ function toXml(&$record, $format = null) { $article =& $record->getData('article'); $journal =& $record->getData('journal'); $section =& $record->getData('section'); $issue =& $record->getData('issue'); $galleys =& $record->getData('galleys'); $articleId = $article->getId(); // Cache issue ordering information. static $issueId; static $sectionSeq; if (!isset($issueId) || $issueId != $issue->getId()) { $sectionDao = DAORegistry::getDAO('SectionDAO'); $issueId = $issue->getId(); $sections = $sectionDao->getByIssueId($issueId); $sectionSeq = array(); $i = 0; foreach ($sections as $thisSection) { $sectionSeq[$thisSection->getId()] = $i++; } unset($sections); } $abbreviation = $journal->getLocalizedSetting('abbreviation'); $printIssn = $journal->getSetting('printIssn'); $onlineIssn = $journal->getSetting('onlineIssn'); $primaryLocale = $article->getLanguage() != '' ? $article->getLanguage() : $journal->getPrimaryLocale(); $publisherInstitution = $journal->getSetting('publisherInstitution'); $datePublished = $article->getDatePublished(); if (!$datePublished) { $datePublished = $issue->getDatePublished(); } if ($datePublished) { $datePublished = strtotime($datePublished); } $response = "<article\n" . "\txmlns=\"http://dtd.nlm.nih.gov/publishing/2.3\"\n" . "\txmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" . "\txmlns:mml=\"http://www.w3.org/1998/Math/MathML\"\n" . "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" . "\txsi:schemaLocation=\"http://dtd.nlm.nih.gov/publishing/2.3\n" . "\thttp://dtd.nlm.nih.gov/publishing/2.3/xsd/journalpublishing.xsd\"\n" . (($s = $section->getLocalizedIdentifyType()) != '' ? "\tarticle-type=\"" . htmlspecialchars(Core::cleanVar($s)) . "\"" : '') . "\txml:lang=\"" . strtoupper(substr($primaryLocale, 0, 2)) . "\">\n" . "\t<front>\n" . "\t\t<journal-meta>\n" . "\t\t\t<journal-id journal-id-type=\"other\">" . htmlspecialchars(Core::cleanVar(($s = Config::getVar('oai', 'nlm_journal_id')) != '' ? $s : $journal->getPath())) . "</journal-id>\n" . "\t\t\t<journal-title>" . htmlspecialchars(Core::cleanVar($journal->getLocalizedName())) . "</journal-title>\n"; // Include translated journal titles foreach ($journal->getName(null) as $locale => $title) { if ($locale == $primaryLocale) { continue; } $response .= "\t\t\t<trans-title xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">" . htmlspecialchars(Core::cleanVar($title)) . "</trans-title>\n"; } $response .= (!empty($onlineIssn) ? "\t\t\t<issn pub-type=\"epub\">" . htmlspecialchars(Core::cleanVar($onlineIssn)) . "</issn>" : '') . (!empty($printIssn) ? "\t\t\t<issn pub-type=\"ppub\">" . htmlspecialchars(Core::cleanVar($printIssn)) . "</issn>" : '') . ($publisherInstitution != '' ? "\t\t\t<publisher><publisher-name>" . htmlspecialchars(Core::cleanVar($publisherInstitution)) . "</publisher-name></publisher>\n" : '') . "\t\t</journal-meta>\n" . "\t\t<article-meta>\n" . "\t\t\t<article-id pub-id-type=\"other\">" . htmlspecialchars(Core::cleanVar($article->getBestArticleId())) . "</article-id>\n" . (($s = $article->getPubId('doi')) ? "\t\t\t<article-id pub-id-type=\"doi\">" . htmlspecialchars(Core::cleanVar($s)) . "</article-id>\n" : '') . "\t\t\t<article-categories><subj-group subj-group-type=\"heading\"><subject>" . htmlspecialchars(Core::cleanVar($section->getLocalizedTitle())) . "</subject></subj-group></article-categories>\n" . "\t\t\t<title-group>\n" . "\t\t\t\t<article-title>" . htmlspecialchars(Core::cleanVar(strip_tags($article->getLocalizedTitle()))) . "</article-title>\n"; // Include translated journal titles foreach ($article->getTitle(null) as $locale => $title) { if ($locale == $primaryLocale) { continue; } $response .= "\t\t\t\t<trans-title xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">" . htmlspecialchars(Core::cleanVar(strip_tags($title))) . "</trans-title>\n"; } $response .= "\t\t\t</title-group>\n" . "\t\t\t<contrib-group>\n"; // Include authors foreach ($article->getAuthors() as $author) { $response .= "\t\t\t\t<contrib " . ($author->getPrimaryContact() ? 'corresp="yes" ' : '') . "contrib-type=\"author\">\n" . "\t\t\t\t\t<name name-style=\"western\">\n" . "\t\t\t\t\t\t<surname>" . htmlspecialchars(Core::cleanVar($author->getLastName())) . "</surname>\n" . "\t\t\t\t\t\t<given-names>" . htmlspecialchars(Core::cleanVar($author->getFirstName()) . (($s = $author->getMiddleName()) != '' ? " {$s}" : '')) . "</given-names>\n" . "\t\t\t\t\t</name>\n" . (($s = $author->getLocalizedAffiliation()) != '' ? "\t\t\t\t\t<aff>" . htmlspecialchars(Core::cleanVar($s)) . "</aff>\n" : '') . "\t\t\t\t\t<email>" . htmlspecialchars(Core::cleanVar($author->getEmail())) . "</email>\n" . (($s = $author->getUrl()) != '' ? "\t\t\t\t\t<uri>" . htmlspecialchars(Core::cleanVar($s)) . "</uri>\n" : '') . "\t\t\t\t</contrib>\n"; } // Include editorships (optimized) $response .= $this->getEditorialInfo($journal->getId()); $response .= "\t\t\t</contrib-group>\n"; if ($datePublished) { $response .= "\t\t\t<pub-date pub-type=\"epub\">\n" . "\t\t\t\t<day>" . strftime('%d', $datePublished) . "</day>\n" . "\t\t\t\t<month>" . strftime('%m', $datePublished) . "</month>\n" . "\t\t\t\t<year>" . strftime('%Y', $datePublished) . "</year>\n" . "\t\t\t</pub-date>\n"; } $response .= ($issue->getShowYear() ? "\t\t\t<pub-date pub-type=\"collection\"><year>" . htmlspecialchars(Core::cleanVar($issue->getYear())) . "</year></pub-date>\n" : '') . ($issue->getShowVolume() ? "\t\t\t<volume>" . htmlspecialchars(Core::cleanVar($issue->getVolume())) . "</volume>\n" : '') . ($issue->getShowNumber() ? "\t\t\t<issue seq=\"" . htmlspecialchars(Core::cleanVar($sectionSeq[$section->getId()] * 100 + $article->getSequence())) . "\">" . htmlspecialchars(Core::cleanVar($issue->getNumber())) . "</issue>\n" : '') . "\t\t\t<issue-id pub-id-type=\"other\">" . htmlspecialchars(Core::cleanVar($issue->getBestIssueId())) . "</issue-id>\n" . ($issue->getShowTitle() ? "\t\t\t<issue-title>" . htmlspecialchars(Core::cleanVar($issue->getLocalizedTitle())) . "</issue-title>\n" : ''); // Include page info, if available and parseable. $matches = null; if (PKPString::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\\d+)$/', $article->getPages(), $matches)) { $matchedPage = htmlspecialchars(Core::cleanVar($matches[1])); $response .= "\t\t\t\t<fpage>{$matchedPage}</fpage><lpage>{$matchedPage}</lpage>\n"; $pageCount = 1; } elseif (PKPString::regexp_match_get('/^[Pp][Pp]?[.]?[ ]?(\\d+)[ ]?(-|–)[ ]?([Pp][Pp]?[.]?[ ]?)?(\\d+)$/', $article->getPages(), $matches)) { $matchedPageFrom = htmlspecialchars(Core::cleanVar($matches[1])); $matchedPageTo = htmlspecialchars(Core::cleanVar($matches[4])); $response .= "\t\t\t\t<fpage>{$matchedPageFrom}</fpage>\n" . "\t\t\t\t<lpage>{$matchedPageTo}</lpage>\n"; $pageCount = $matchedPageTo - $matchedPageFrom + 1; } $response .= "\t\t\t<permissions>\n" . "\t\t\t\t<copyright-statement>" . htmlspecialchars(__('submission.copyrightStatement', array('copyrightYear' => $article->getCopyrightYear(), 'copyrightHolder' => $article->getLocalizedCopyrightHolder()))) . "</copyright-statement>\n" . ($datePublished ? "\t\t\t\t<copyright-year>" . $article->getCopyrightYear() . "</copyright-year>\n" : '') . "\t\t\t\t<license xlink:href=\"" . $article->getLicenseURL() . "\">\n" . (($s = Application::getCCLicenseBadge($article->getLicenseURL())) ? "\t\t\t\t\t<license-p>" . strip_tags($s) . "</license-p>\n" : '') . "\t\t\t\t</license>\n" . "\t\t\t</permissions>\n" . "\t\t\t<self-uri xlink:href=\"" . htmlspecialchars(Core::cleanVar(Request::url($journal->getPath(), 'article', 'view', $article->getBestArticleId()))) . "\" />\n"; // Include galley links foreach ($article->getGalleys() as $galley) { $response .= "\t\t\t<self-uri content-type=\"" . htmlspecialchars(Core::cleanVar($galley->getFileType())) . "\" xlink:href=\"" . htmlspecialchars(Core::cleanVar(Request::url($journal->getPath(), 'article', 'view', array($article->getBestArticleId(), $galley->getId())))) . "\" />\n"; } // Include abstract(s) $abstract = htmlspecialchars(Core::cleanVar(strip_tags($article->getLocalizedAbstract()))); if (!empty($abstract)) { $abstract = "<p>{$abstract}</p>"; // $abstract = '<p>' . PKPString::regexp_replace('/\n+/', '</p><p>', $abstract) . '</p>'; $response .= "\t\t\t<abstract xml:lang=\"" . strtoupper(substr($primaryLocale, 0, 2)) . "\">{$abstract}</abstract>\n"; } if (is_array($article->getAbstract(null))) { foreach ($article->getAbstract(null) as $locale => $abstract) { if ($locale == $primaryLocale || empty($abstract)) { continue; } $abstract = htmlspecialchars(Core::cleanVar(strip_tags($abstract))); if (empty($abstract)) { continue; } $abstract = "<p>{$abstract}</p>"; //$abstract = '<p>' . PKPString::regexp_replace('/\n+/', '</p><p>', $abstract) . '</p>'; $response .= "\t\t\t<abstract-trans xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">{$abstract}</abstract-trans>\n"; } } $subjects = array(); if (is_array($article->getSubject(null))) { foreach ($article->getSubject(null) as $locale => $subject) { $s = array_map('trim', explode(';', Core::cleanVar($subject))); if (!empty($s)) { $subjects[$locale] = $s; } } } if (!empty($subjects)) { foreach ($subjects as $locale => $s) { $response .= "\t\t\t<kwd-group xml:lang=\"" . strtoupper(substr($locale, 0, 2)) . "\">\n"; foreach ($s as $subject) { $response .= "\t\t\t\t<kwd>" . htmlspecialchars($subject) . "</kwd>\n"; } $response .= "\t\t\t</kwd-group>\n"; } } $response .= (isset($pageCount) ? "\t\t\t<counts><page-count count=\"" . (int) $pageCount . "\" /></counts>\n" : '') . "\t\t</article-meta>\n" . "\t</front>\n"; // Include body text (for search indexing only) import('classes.search.ArticleSearchIndex'); $text = ''; $galleys = $article->getGalleys(); // Give precedence to HTML galleys, as they're quickest to parse usort($galleys, create_function('$a, $b', 'return $a->getFileType()==\'text/html\')?-1:1;')); // Determine any access limitations. If there are, do not // provide the full-text. import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $subscriptionRequired = $issueAction->subscriptionRequired($issue); $isSubscribedDomain = $issueAction->subscribedDomain($journal, $issue->getId(), $article->getId()); if (!$subscriptionRequired || $isSubscribedDomain) { foreach ($galleys as $galley) { $parser =& SearchFileParser::fromFile($galley); if ($parser && $parser->open()) { while (($s = $parser->read()) !== false) { $text .= $s; } $parser->close(); } if ($galley->getFileType() == 'text/html') { $text = strip_tags($text); } unset($galley); // Use the first parseable galley. if (!empty($text)) { break; } } } if (!empty($text)) { $response .= "\t<body><p>" . htmlspecialchars(Core::cleanVar(Core::cleanVar($text))) . "</p></body>\n"; } // Add NLM citation info $filterDao = DAORegistry::getDAO('FilterDAO'); /* @var $filterDao FilterDAO */ $nlmFilters = $filterDao->getObjectsByGroup('submission=>nlm23-article-xml'); assert(count($nlmFilters) == 1); $nlmFilter = array_pop($nlmFilters); $nlmXmlDom = new DOMDocument(); $nlmXmlDom->loadXML($nlmFilter->execute($article)); $documentElement =& $nlmXmlDom->documentElement; // Work-around for hasChildNodes being stupid about whitespace. $hasChildren = false; if (isset($documentElement->childNodes)) { foreach ($documentElement->childNodes as $c) { if ($c->nodeType == XML_ELEMENT_NODE) { $hasChildren = true; } } } // If there were any citations, include them. if ($hasChildren) { $innerXml = $nlmXmlDom->saveXML($documentElement); $response .= "<back>{$innerXml}</back>\n"; } $response .= "</article>"; return $response; }
/** * Show index of published articles by author. * @param $args array * @param $request PKPRequest */ function authors($args, &$request) { $this->validate(); $this->setupTemplate($request, true); $journal =& $request->getJournal(); $authorDao =& DAORegistry::getDAO('AuthorDAO'); if (isset($args[0]) && $args[0] == 'view') { // View a specific author $firstName = $request->getUserVar('firstName'); $middleName = $request->getUserVar('middleName'); $lastName = $request->getUserVar('lastName'); $affiliation = $request->getUserVar('affiliation'); $country = $request->getUserVar('country'); $publishedArticles = $authorDao->getPublishedArticlesForAuthor($journal ? $journal->getId() : null, $firstName, $middleName, $lastName, $affiliation, $country); // Load information associated with each article. $journals = array(); $issues = array(); $sections = array(); $issuesUnavailable = array(); $issueDao =& DAORegistry::getDAO('IssueDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); foreach ($publishedArticles as $article) { $articleId = $article->getId(); $issueId = $article->getIssueId(); $sectionId = $article->getSectionId(); $journalId = $article->getJournalId(); if (!isset($issues[$issueId])) { import('classes.issue.IssueAction'); $issue =& $issueDao->getIssueById($issueId); $issues[$issueId] =& $issue; $issuesUnavailable[$issueId] = IssueAction::subscriptionRequired($issue) && (!IssueAction::subscribedUser($journal, $issueId, $articleId) && !IssueAction::subscribedDomain($journal, $issueId, $articleId)); } if (!isset($journals[$journalId])) { $journals[$journalId] =& $journalDao->getById($journalId); } if (!isset($sections[$sectionId])) { $sections[$sectionId] =& $sectionDao->getSection($sectionId, $journalId, true); } } if (empty($publishedArticles)) { $request->redirect(null, $request->getRequestedPage()); } $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('publishedArticles', $publishedArticles); $templateMgr->assign_by_ref('issues', $issues); $templateMgr->assign('issuesUnavailable', $issuesUnavailable); $templateMgr->assign_by_ref('sections', $sections); $templateMgr->assign_by_ref('journals', $journals); $templateMgr->assign('firstName', $firstName); $templateMgr->assign('middleName', $middleName); $templateMgr->assign('lastName', $lastName); $templateMgr->assign('affiliation', $affiliation); $countryDao =& DAORegistry::getDAO('CountryDAO'); $country = $countryDao->getCountry($country); $templateMgr->assign('country', $country); $templateMgr->display('search/authorDetails.tpl'); } else { // Show the author index $searchInitial = $request->getUserVar('searchInitial'); $rangeInfo = $this->getRangeInfo('authors'); $authors =& $authorDao->getAuthorsAlphabetizedByJournal(isset($journal) ? $journal->getId() : null, $searchInitial, $rangeInfo); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('searchInitial', $request->getUserVar('searchInitial')); $templateMgr->assign('alphaList', explode(' ', __('common.alphaList'))); $templateMgr->assign_by_ref('authors', $authors); $templateMgr->display('search/authorIndex.tpl'); } }
/** * Display the table of contents */ function issueToc($args, $request) { $issueId = (int) array_shift($args); $this->validate($issueId, true); $issue =& $this->issue; $this->setupTemplate(EDITOR_SECTION_ISSUES); $templateMgr =& TemplateManager::getManager(); $journal =& $request->getJournal(); $journalId = $journal->getId(); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $enablePublicArticleId = $journalSettingsDao->getSetting($journalId, 'enablePublicArticleId'); $templateMgr->assign('enablePublicArticleId', $enablePublicArticleId); $enablePageNumber = $journalSettingsDao->getSetting($journalId, 'enablePageNumber'); $templateMgr->assign('enablePageNumber', $enablePageNumber); $templateMgr->assign('customSectionOrderingExists', $customSectionOrderingExists = $sectionDao->customSectionOrderingExists($issueId)); $templateMgr->assign('issueId', $issueId); $templateMgr->assign_by_ref('issue', $issue); $templateMgr->assign('unpublished', !$issue->getPublished()); $templateMgr->assign('issueAccess', $issue->getAccessStatus()); // get issue sections and articles $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId); $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO'); $proofedArticleIds = $layoutEditorSubmissionDao->getProofedArticlesByIssueId($issueId); $templateMgr->assign('proofedArticleIds', $proofedArticleIds); $currSection = 0; $counter = 0; $sections = array(); $sectionCount = 0; $sectionDao =& DAORegistry::getDAO('SectionDAO'); foreach ($publishedArticles as $article) { $sectionId = $article->getSectionId(); if ($currSection != $sectionId) { $lastSectionId = $currSection; $sectionCount++; if ($lastSectionId !== 0) { $sections[$lastSectionId][5] = $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $sectionId) : $sectionCount; } // Store next custom order $currSection = $sectionId; $counter++; $sections[$sectionId] = array($sectionId, $article->getSectionTitle(), array($article), $counter, $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $lastSectionId) : $sectionCount - 1, null); } else { $sections[$article->getSectionId()][2][] = $article; } } $templateMgr->assign_by_ref('sections', $sections); $templateMgr->assign('accessOptions', array(ARTICLE_ACCESS_ISSUE_DEFAULT => AppLocale::Translate('editor.issues.default'), ARTICLE_ACCESS_OPEN => AppLocale::Translate('editor.issues.open'))); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); $templateMgr->assign('helpTopicId', 'publishing.tableOfContents'); $templateMgr->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.tablednd.js'); $templateMgr->addJavaScript('lib/pkp/js/functions/tablednd.js'); $templateMgr->display('editor/issues/issueToc.tpl'); }
/** * Check whether access to the given article * is authorized to the requesting party (i.e. the * Solr server). * * @param $article Article * @return boolean True if authorized, otherwise false. */ function _isArticleAccessAuthorized(&$article) { // Did we get a published article? if (!is_a($article, 'PublishedArticle')) { return false; } // Get the article's journal. $journal = $this->_getJournal($article->getJournalId()); if (!is_a($journal, 'Journal')) { return false; } // Get the article's issue. $issue = $this->_getIssue($article->getIssueId(), $journal->getId()); if (!is_a($issue, 'Issue')) { return false; } // Only index published articles. if (!$issue->getPublished() || $article->getStatus() != STATUS_PUBLISHED) { return false; } // Make sure the requesting party is authorized to acces the article/issue. import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $subscriptionRequired = $issueAction->subscriptionRequired($issue, $journal); if ($subscriptionRequired) { $isSubscribedDomain = $issueAction->subscribedDomain($journal, $issue->getId(), $article->getId()); if (!$isSubscribedDomain) { return false; } } // All checks passed successfully - allow access. return true; }
/** * See SubmissionSearch::formatResults() * * @return array An array with the articles, published articles, * issue, journal, section and the issue availability. */ static function formatResults(&$results) { $articleDao = DAORegistry::getDAO('ArticleDAO'); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $issueDao = DAORegistry::getDAO('IssueDAO'); $journalDao = DAORegistry::getDAO('JournalDAO'); $sectionDao = DAORegistry::getDAO('SectionDAO'); $publishedArticleCache = array(); $articleCache = array(); $issueCache = array(); $issueAvailabilityCache = array(); $journalCache = array(); $sectionCache = array(); $returner = array(); foreach ($results as $articleId) { // Get the article, storing in cache if necessary. if (!isset($articleCache[$articleId])) { $publishedArticleCache[$articleId] = $publishedArticleDao->getPublishedArticleByArticleId($articleId); $articleCache[$articleId] = $articleDao->getById($articleId); } $article = $articleCache[$articleId]; $publishedArticle = $publishedArticleCache[$articleId]; if ($publishedArticle && $article) { $sectionId = $article->getSectionId(); if (!isset($sectionCache[$sectionId])) { $sectionCache[$sectionId] = $sectionDao->getById($sectionId); } // Get the journal, storing in cache if necessary. $journalId = $article->getJournalId(); if (!isset($journalCache[$journalId])) { $journalCache[$journalId] = $journalDao->getById($journalId); } // Get the issue, storing in cache if necessary. $issueId = $publishedArticle->getIssueId(); if (!isset($issueCache[$issueId])) { $issue = $issueDao->getById($issueId); $issueCache[$issueId] = $issue; import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $issueAvailabilityCache[$issueId] = !$issueAction->subscriptionRequired($issue) || $issueAction->subscribedUser($journalCache[$journalId], $issueId, $articleId) || $issueAction->subscribedDomain($journalCache[$journalId], $issueId, $articleId); } // Only display articles from published issues. if (!$issueCache[$issueId]->getPublished()) { continue; } // Store the retrieved objects in the result array. $returner[] = array('article' => $article, 'publishedArticle' => $publishedArticleCache[$articleId], 'issue' => $issueCache[$issueId], 'journal' => $journalCache[$journalId], 'issueAvailable' => $issueAvailabilityCache[$issueId], 'section' => $sectionCache[$sectionId]); } } return $returner; }
/** * Given an issue, set up the template with all the required variables for * frontend/objects/issue_toc.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(); $templateMgr = TemplateManager::getManager($request); // Determine pre-publication access // FIXME: Do that. (Bug #8278) if (!$issue) { $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE); } $templateMgr->assign(array('issueIdentification' => $issue->getIssueIdentification(), 'issueTitle' => $issue->getLocalizedTitle(), 'issueSeries' => $issue->getIssueIdentification(array('showTitle' => false)))); $locale = AppLocale::getLocale(); import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $templateMgr->assign(array('coverPagePath' => $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/', 'locale' => $locale)); if (!$showToc && $issue->getFileName($locale) && $issue->getShowCoverPage($locale) && !$issue->getHideCoverPageCover($locale)) { $templateMgr->assign(array('fileName' => $issue->getFileName($locale), 'width' => $issue->getWidth($locale), 'height' => $issue->getHeight($locale), 'coverPageAltText' => $issue->getCoverPageAltText($locale), 'originalFileName' => $issue->getOriginalFileName($locale), 'originalFileName' => $issue->getOriginalFileName($locale))); } else { $issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO'); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $templateMgr->assign(array('issueGalleys' => $issueGalleyDao->getByIssueId($issue->getId()), 'publishedArticles' => $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true))); $showToc = true; } $templateMgr->assign(array('showToc' => $showToc, 'issue' => $issue)); // Subscription Access import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $subscriptionRequired = $issueAction->subscriptionRequired($issue); $subscribedUser = $issueAction->subscribedUser($journal); $subscribedDomain = $issueAction->subscribedDomain($journal); if ($showToc && $subscriptionRequired && !$subscribedUser && !$subscribedDomain) { $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('articleExpiryPartial', $articleExpiryPartial); } $templateMgr->assign(array('showGalleyLinks' => !$subscriptionRequired || $journal->getSetting('showGalleyLinks'), 'hasAccess' => !$subscriptionRequired || $issue->getAccessStatus() == ISSUE_ACCESS_OPEN || $subscribedUser || $subscribedDomain)); import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); if ($paymentManager->onlyPdfEnabled()) { $templateMgr->assign('restrictOnlyPdf', true); } if ($paymentManager->purchaseArticleEnabled()) { $templateMgr->assign('purchaseArticleEnabled', true); } if ($styleFileName = $issue->getStyleFileName()) { import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); $templateMgr->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $styleFileName); } }
function submissionEditing($args) { $articleId = isset($args[0]) ? (int) $args[0] : 0; list($journal, $submission) = SubmissionEditHandler::validate($articleId, SECTION_EDITOR_ACCESS_EDIT); parent::setupTemplate(true, $articleId); $useCopyeditors = $journal->getSetting('useCopyeditors'); $useLayoutEditors = $journal->getSetting('useLayoutEditors'); $useProofreaders = $journal->getSetting('useProofreaders'); // check if submission is accepted $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound(); $editorDecisions = $submission->getDecisions($round); $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null; $submissionAccepted = $lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT ? true : false; $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('submission', $submission); $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile()); $templateMgr->assign_by_ref('copyeditFile', $submission->getCopyeditFile()); $templateMgr->assign_by_ref('initialCopyeditFile', $submission->getInitialCopyeditFile()); $templateMgr->assign_by_ref('editorAuthorCopyeditFile', $submission->getEditorAuthorCopyeditFile()); $templateMgr->assign_by_ref('finalCopyeditFile', $submission->getFinalCopyeditFile()); $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles()); $templateMgr->assign_by_ref('copyeditor', $submission->getCopyeditor()); $roleDao =& DAORegistry::getDAO('RoleDAO'); $user =& Request::getUser(); $templateMgr->assign('isEditor', $roleDao->roleExists($journal->getJournalId(), $user->getUserId(), ROLE_ID_EDITOR)); import('issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId()); $templateMgr->assign_by_ref('publishedArticle', $publishedArticle); $templateMgr->assign('useCopyeditors', $useCopyeditors); $templateMgr->assign('useLayoutEditors', $useLayoutEditors); $templateMgr->assign('useProofreaders', $useProofreaders); $templateMgr->assign_by_ref('proofAssignment', $submission->getProofAssignment()); $templateMgr->assign_by_ref('layoutAssignment', $submission->getLayoutAssignment()); $templateMgr->assign('submissionAccepted', $submissionAccepted); // Set up required Payment Related Information import('payment.ojs.OJSPaymentManager'); $paymentManager =& OJSPaymentManager::getManager(); $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO'); $publicationFeeEnabled = $paymentManager->publicationEnabled(); $templateMgr->assign('publicatonFeeEnabled', $publicationFeeEnabled); if ($publicationFeeEnabled) { $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDAO->getPublicationCompletedPayment($journal->getJournalId(), $articleId)); } $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.editing'); $templateMgr->display('sectionEditor/submissionEditing.tpl'); }
/** * View the submission editing page. * @param $args array * @param $request PKPRequest */ function submissionEditing($args, $request) { $articleId = isset($args[0]) ? (int) $args[0] : 0; $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT); $journal =& $request->getJournal(); $submission =& $this->submission; $this->setupTemplate(true, $articleId); $useCopyeditors = $journal->getSetting('useCopyeditors'); $useLayoutEditors = $journal->getSetting('useLayoutEditors'); $useProofreaders = $journal->getSetting('useProofreaders'); // check if submission is accepted $round = isset($args[1]) ? $args[1] : $submission->getCurrentRound(); $editorDecisions = $submission->getDecisions($round); $lastDecision = count($editorDecisions) >= 1 ? $editorDecisions[count($editorDecisions) - 1]['decision'] : null; $submissionAccepted = $lastDecision == SUBMISSION_EDITOR_DECISION_ACCEPT ? true : false; $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('submission', $submission); $templateMgr->assign_by_ref('submissionFile', $submission->getSubmissionFile()); $templateMgr->assign_by_ref('copyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL')); $templateMgr->assign_by_ref('initialCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_INITIAL')); $templateMgr->assign_by_ref('editorAuthorCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_AUTHOR')); $templateMgr->assign_by_ref('finalCopyeditFile', $submission->getFileBySignoffType('SIGNOFF_COPYEDITING_FINAL')); $templateMgr->assign_by_ref('suppFiles', $submission->getSuppFiles()); $templateMgr->assign_by_ref('copyeditor', $submission->getUserBySignoffType('SIGNOFF_COPYEDITING_INITIAL')); $roleDao =& DAORegistry::getDAO('RoleDAO'); $user =& Request::getUser(); $templateMgr->assign('isEditor', $roleDao->userHasRole($journal->getId(), $user->getId(), ROLE_ID_EDITOR)); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getId()); $templateMgr->assign_by_ref('publishedArticle', $publishedArticle); $templateMgr->assign('useCopyeditors', $useCopyeditors); $templateMgr->assign('useLayoutEditors', $useLayoutEditors); $templateMgr->assign('useProofreaders', $useProofreaders); $templateMgr->assign('submissionAccepted', $submissionAccepted); $templateMgr->assign('templates', $journal->getSetting('templates')); // Set up required Payment Related Information import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO'); $publicationFeeEnabled = $paymentManager->publicationEnabled(); $templateMgr->assign('publicationFeeEnabled', $publicationFeeEnabled); if ($publicationFeeEnabled) { $templateMgr->assign_by_ref('publicationPayment', $completedPaymentDao->getPublicationCompletedPayment($journal->getId(), $articleId)); } $templateMgr->assign('helpTopicId', 'editorial.sectionEditorsRole.editing'); $templateMgr->display('sectionEditor/submissionEditing.tpl'); }
/** * Validation * @param $request PKPRequest * @param $articleId int */ function validate(&$request, $articleId) { parent::validate(); $journal =& $request->getJournal(); $journalId = $journal->getId(); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $article =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); // Bring in comment constants $commentDao =& DAORegistry::getDAO('CommentDAO'); $enableComments = $journal->getSetting('enableComments'); if (!Validation::isLoggedIn() && $journalSettingsDao->getSetting($journalId, 'restrictArticleAccess') || $article && !$article->getEnableComments() || $enableComments != COMMENTS_ANONYMOUS && $enableComments != COMMENTS_AUTHENTICATED && $enableComments != COMMENTS_UNAUTHENTICATED) { Validation::redirectLogin(); } // Subscription Access $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueByArticleId($articleId); if (isset($issue) && isset($article)) { import('classes.issue.IssueAction'); $subscriptionRequired = IssueAction::subscriptionRequired($issue); $subscribedUser = IssueAction::subscribedUser($journal, $issue->getId(), $articleId); if (!(!$subscriptionRequired || $article->getAccessStatus() == ARTICLE_ACCESS_OPEN || $subscribedUser)) { $request->redirect(null, 'index'); } } else { $request->redirect(null, 'index'); } $this->issue =& $issue; $this->article =& $article; return true; }
/** * Given an issue, set up the template with all the required variables for * frontend/objects/issue_toc.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(); $templateMgr = TemplateManager::getManager($request); // Determine pre-publication access // FIXME: Do that. (Bug #8278) if (!$issue) { $issue = $this->getAuthorizedContextObject(ASSOC_TYPE_ISSUE); } $templateMgr->assign(array('issueIdentification' => $issue->getIssueIdentification(), 'issueTitle' => $issue->getLocalizedTitle(), 'issueSeries' => $issue->getIssueIdentification(array('showTitle' => false)))); $locale = AppLocale::getLocale(); $templateMgr->assign(array('locale' => $locale)); $issueGalleyDao = DAORegistry::getDAO('IssueGalleyDAO'); $publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO'); $templateMgr->assign(array('issue' => $issue, 'issueGalleys' => $issueGalleyDao->getByIssueId($issue->getId()), 'publishedArticles' => $publishedArticleDao->getPublishedArticlesInSections($issue->getId(), true))); // Subscription Access import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $subscriptionRequired = $issueAction->subscriptionRequired($issue); $subscribedUser = $issueAction->subscribedUser($journal); $subscribedDomain = $issueAction->subscribedDomain($journal); if ($subscriptionRequired && !$subscribedUser && !$subscribedDomain) { $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('articleExpiryPartial', $articleExpiryPartial); } $templateMgr->assign(array('hasAccess' => !$subscriptionRequired || $issue->getAccessStatus() == ISSUE_ACCESS_OPEN || $subscribedUser || $subscribedDomain)); import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); if ($paymentManager->onlyPdfEnabled()) { $templateMgr->assign('restrictOnlyPdf', true); } if ($paymentManager->purchaseArticleEnabled()) { $templateMgr->assign('purchaseArticleEnabled', 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->getJournalId(); $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('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 { $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles =& $publishedArticleDao->getPublishedArticlesInSections($issue->getIssueId(), true); $publicFileManager =& new PublicFileManager(); $templateMgr->assign('publishedArticles', $publishedArticles); $showToc = true; } $templateMgr->assign('showToc', $showToc); $templateMgr->assign('issueId', $issue->getBestIssueId()); $templateMgr->assign('issue', $issue); // Subscription Access import('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->getIssueId(), null, true); $articleExpiryPartial = array(); foreach ($publishedArticlesTemp as $publishedArticle) { $partial = IssueAction::subscribedUser($journal, $issue->getIssueId(), $publishedArticle->getArticleId()); if (!$partial) { IssueAction::subscribedDomain($journal, $issue->getIssueId(), $publishedArticle->getArticleId()); } $articleExpiryPartial[$publishedArticle->getArticleId()] = $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('payment.ojs.OJSPaymentManager'); $paymentManager =& OJSPaymentManager::getManager(); if ($paymentManager->onlyPdfEnabled()) { $templateMgr->assign('restrictOnlyPdf', true); } } else { $issueCrumbTitle = Locale::translate('archive.issueUnavailable'); $issueHeadingTitle = Locale::translate('archive.issueUnavailable'); } if ($styleFileName = $issue->getStyleFileName()) { import('file.PublicFileManager'); $publicFileManager =& new PublicFileManager(); $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/' . $styleFileName); } $templateMgr->assign('pageCrumbTitleTranslated', $issueCrumbTitle); $templateMgr->assign('issueHeadingTitle', $issueHeadingTitle); }
/** * Display the form. */ function display($articleId) { $this->editArticleID = $articleId; //get the information of the article, which should be edited $user =& Request::getUser(); $journal =& Request::getJournal(); $formLocale = $this->getFormLocale(); $templateMgr =& TemplateManager::getManager(); //Author $authorDao =& DAORegistry::getDAO('AuthorDAO'); //authorsObjectsArray $authorObjects =& $authorDao->getAuthorsByArticle($articleId); $authors = array(); $n = 0; foreach ($authorObjects as $authorData) { $author = get_object_vars($authorData); $authors[$n] = $author["_data"]; $n++; } $templateMgr->assign('authors', $authors); //title, abstract, orig. journal/ conf. and date published $rpositoryDao =& DAORegistry::getDAO('RpositoryDAO'); $articleSettings = $rpositoryDao->getArtStatement($articleId); //title $title[$formLocale] = $articleSettings['sv1']; $templateMgr->assign('title', $title); //abstract $abstractAndOrigJournal = $articleSettings['sv2']; $patternAbstract = '/<p id="originalPub">(.*)/'; $abstract[$formLocale] = preg_replace($patternAbstract, '', $abstractAndOrigJournal); $templateMgr->assign('abstract', $abstract); //originalJournal $patternOrigJournal = '/(.*)<p id="originalPub">/'; $originalJournal = preg_replace($patternOrigJournal, '', $abstractAndOrigJournal); $originalJournal = preg_replace('/<\\/p>/', '', $originalJournal); if (preg_replace('/' . $originalJournal . '/', '', $abstractAndOrigJournal) == '') { $originalJournal = ''; } $templateMgr->assign('originalJournal', $originalJournal); //date published $datePublished = $articleSettings['date_published']; $templateMgr->assign('datePublished', $datePublished); //File $articleFileDao =& DAORegistry::getDAO('ArticleFileDAO'); $articleFileObjects =& $articleFileDao->getArticleFilesByArticle($articleId); foreach ($articleFileObjects as $articleFile) { $articleFileVars = get_object_vars($articleFile); if ($articleFileVars["_data"]["fileType"] != "txt/plain") { if ($articleFileVars["_data"]["type"] == "submission/original") { $templateMgr->assign('submissionFile', $articleFile); $templateMgr->assign('pastSubmissionFile', $articleFile); } if ($articleFileVars["_data"]["type"] == "supp") { $templateMgr->assign('supplementaryFile', $articleFile); $templateMgr->assign('pastSupplementaryFile', $articleFile); } } } //Indexing $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $articleDao->getArticle($articleId); /* $language = $article->getLanguage(); $templateMgr->assign('language', $language); */ //Sponsor $sponsor[$formLocale] = $article->getSponsor($formLocale); $templateMgr->assign('sponsor', $sponsor); /* //References $citation= $article->getCitations(); $templateMgr->assign('citations', $citation); */ //SectionId $articleSectionId = $article->getSectionId(); $templateMgr->assign('sectionId', $articleSectionId); $templateMgr->assign('journal', $journal); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $sections =& $sectionDao->getJournalSections($journal->getId()); $sectionTitles = $sectionAbstractsRequired = array(); while ($section =& $sections->next()) { $sectionTitles[$section->getId()] = $section->getLocalizedTitle(); $sectionAbstractsRequired[(int) $section->getId()] = (int) (!$section->getAbstractsNotRequired()); unset($section); } $templateMgr->assign('sectionOptions', array('0' => __('author.submit.selectSection')) + $sectionTitles); $templateMgr->assign('sectionAbstractsRequired', $sectionAbstractsRequired); $countryDao =& DAORegistry::getDAO('CountryDAO'); $countries =& $countryDao->getCountries(); $templateMgr->assign_by_ref('countries', $countries); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); import('classes.file.TemporaryFileManager'); $temporaryFileManager = new TemporaryFileManager(); $tempFileId = $this->getData('tempFileId'); if (isset($tempFileId[$formLocale]) && $tempFileId[$formLocale] > 0) { $submissionFile = $temporaryFileManager->getFile($tempFileId[$formLocale], $user->getId()); $templateMgr->assign_by_ref('submissionFile', $submissionFile); } $tempSupplFileId = $this->getData('tempSupplFileId'); if (isset($tempSupplFileId[$formLocale]) && $tempSupplFileId[$formLocale] > 0) { $supplementaryFile = $temporaryFileManager->getFile($tempSupplFileId[$formLocale], $user->getId()); $templateMgr->assign_by_ref('supplementaryFile', $supplementaryFile); } if (Request::getUserVar('addAuthor') || Request::getUserVar('delAuthor') || Request::getUserVar('moveAuthor')) { $templateMgr->assign('scrollToAuthor', true); } if (Request::getUserVar('destination') == 'queue') { $templateMgr->assign('publishToIssue', false); } else { $templateMgr->assign('issueNumber', Request::getUserVar('issueId')); $templateMgr->assign('publishToIssue', true); } $templateMgr->assign('enablePageNumber', $journal->getSetting('enablePageNumber')); parent::display(); }
/** * Checks if user has subscription * @return bool */ function subscribedUser(&$journal, $issueId = null, $articleId = null) { $user =& Request::getUser(); $subscriptionDao =& DAORegistry::getDAO('SubscriptionDAO'); $result = false; if (isset($user) && isset($journal)) { if (IssueAction::allowedPrePublicationAccess($journal)) { $result = true; } else { $result = $subscriptionDao->isValidSubscription(null, null, $user->getUserId(), $journal->getJournalId()); } // If no valid subscription, check if there is an expired subscription // that was valid during publication date of requested content if (!$result && $journal->getSetting('subscriptionExpiryPartial')) { if (isset($articleId)) { $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); if (isset($publishedArticle)) { import('subscription.SubscriptionDAO'); $result = $subscriptionDao->isValidSubscription(null, null, $user->getUserId(), $journal->getJournalId(), SUBSCRIPTION_DATE_END, $publishedArticle->getDatePublished()); } } else { if (isset($issueId)) { $issueDao =& DAORegistry::getDAO('IssueDAO'); $issue =& $issueDao->getIssueById($issueId); if (isset($issue) && $issue->getPublished()) { import('subscription.SubscriptionDAO'); $result = $subscriptionDao->isValidSubscription(null, null, $user->getUserId(), $journal->getJournalId(), SUBSCRIPTION_DATE_END, $issue->getDatePublished()); } } } } } HookRegistry::call('IssueAction::subscribedUser', array(&$journal, &$result)); return $result; }
/** * Validation */ function validate($articleId, $galleyId = null) { parent::validate(true); import('issue.IssueAction'); $journal =& Request::getJournal(); $journalId = $journal->getJournalId(); $article = $publishedArticle = $issue = null; $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); if ($journal->getSetting('enablePublicArticleId')) { $publishedArticle =& $publishedArticleDao->getPublishedArticleByBestArticleId($journalId, $articleId); } else { $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId((int) $articleId, $journalId); } $issueDao =& DAORegistry::getDAO('IssueDAO'); if (isset($publishedArticle)) { $issue =& $issueDao->getIssueByArticleId($publishedArticle->getArticleId(), $journalId); } else { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $articleDao->getArticle((int) $articleId, $journalId); } // If this is an editorial user who can view unpublished/unscheduled // articles, bypass further validation. if (($article || $publishedArticle) && IssueAction::allowedPrePublicationAccess($journal)) { return array($journal, $issue, $publishedArticle ? $publishedArticle : $article); } // Make sure the reader has rights to view the article/issue. if ($issue && $issue->getPublished()) { $subscriptionRequired = IssueAction::subscriptionRequired($issue); $isSubscribedDomain = IssueAction::subscribedDomain($journal, $issue->getIssueId(), $articleId); // Check if login is required for viewing. if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess') && isset($galleyId) && $galleyId != 0) { Validation::redirectLogin(); } // bypass all validation if subscription based on domain or ip is valid // or if the user is just requesting the abstract if (!$isSubscribedDomain && $subscriptionRequired && (isset($galleyId) && $galleyId != 0)) { // Subscription Access $subscribedUser = IssueAction::subscribedUser($journal, $issue->getIssueId(), $articleId); if (!(!$subscriptionRequired || $publishedArticle->getAccessStatus() || $subscribedUser)) { // if payment information is enabled, import('payment.ojs.OJSPaymentManager'); $paymentManager =& OJSPaymentManager::getManager(); if ($paymentManager->purchaseArticleEnabled() || $paymentManager->membershipEnabled()) { /* if only pdf files are being restricted, then approve all non-pdf galleys * and continue checking if it is a pdf galley */ if ($paymentManager->onlyPdfEnabled()) { $galleyDAO =& DAORegistry::getDAO('ArticleGalleyDAO'); $galley =& $galleyDAO->getGalley($galleyId, $articleId); if ($galley && !$galley->isPdfGalley()) { return array($journal, $issue, $publishedArticle); } } if (!Validation::isLoggedIn()) { Validation::redirectLogin("payment.loginRequired.forArticle"); } $user =& Request::getUser(); $userId = $user->getUserId(); /* if the article has been paid for then forget about everything else * and just let them access the article */ $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO'); if ($completedPaymentDAO->hasPaidPerViewArticle($userId, $articleId) || !is_null($user->getDateEndMembership()) && strtotime($user->getDateEndMembership()) > time()) { return array($journal, $issue, $publishedArticle); } else { $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_ARTICLE, $user->getUserId(), $articleId, $journal->getSetting('purchaseArticleFee')); $queuedPaymentId = $paymentManager->queuePayment($queuedPayment); $templateMgr =& TemplateManager::getManager(); $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment); exit; } } if (!isset($galleyId) || $galleyId) { if (!Validation::isLoggedIn()) { Validation::redirectLogin("reader.subscriptionRequiredLoginText"); } Request::redirect(null, 'about', 'subscriptions'); } } } } else { Request::redirect(null, 'index'); } return array($journal, $issue, $publishedArticle); }
/** * Display the table of contents */ function issueToc($args) { $issueId = isset($args[0]) ? $args[0] : 0; $issue = IssueManagementHandler::validate($issueId, true); IssueManagementHandler::setupTemplate(EDITOR_SECTION_ISSUES); $templateMgr =& TemplateManager::getManager(); $journal =& Request::getJournal(); $journalId = $journal->getJournalId(); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $enablePublicArticleId = $journalSettingsDao->getSetting($journalId, 'enablePublicArticleId'); $templateMgr->assign('enablePublicArticleId', $enablePublicArticleId); $enableSubscriptions = $journalSettingsDao->getSetting($journalId, 'enableSubscriptions'); $templateMgr->assign('enableSubscriptions', $enableSubscriptions); $enablePageNumber = $journalSettingsDao->getSetting($journalId, 'enablePageNumber'); $templateMgr->assign('enablePageNumber', $enablePageNumber); $templateMgr->assign('customSectionOrderingExists', $customSectionOrderingExists = $sectionDao->customSectionOrderingExists($issueId)); $templateMgr->assign('issueId', $issueId); $templateMgr->assign_by_ref('issue', $issue); $templateMgr->assign('unpublished', !$issue->getPublished()); $templateMgr->assign('issueAccess', $issue->getAccessStatus()); // get issue sections and articles $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId); $layoutAssignmentDao =& DAORegistry::getDAO('LayoutAssignmentDAO'); $proofedArticleIds = $layoutAssignmentDao->getProofedArticlesByIssueId($issueId); $templateMgr->assign('proofedArticleIds', $proofedArticleIds); $currSection = 0; $counter = 0; $sections = array(); $sectionCount = 0; $sectionDao =& DAORegistry::getDAO('SectionDAO'); foreach ($publishedArticles as $article) { $sectionId = $article->getSectionId(); if ($currSection != $sectionId) { $lastSectionId = $currSection; $sectionCount++; if ($lastSectionId !== 0) { $sections[$lastSectionId][5] = $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $sectionId) : $sectionCount; } // Store next custom order $currSection = $sectionId; $counter++; $sections[$sectionId] = array($sectionId, $article->getSectionTitle(), array($article), $counter, $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $lastSectionId) : $sectionCount - 1, null); } else { $sections[$article->getSectionId()][2][] = $article; } } $templateMgr->assign_by_ref('sections', $sections); $accessOptions[ISSUE_DEFAULT] = Locale::Translate('editor.issues.default'); $accessOptions[OPEN_ACCESS] = Locale::Translate('editor.issues.open'); $templateMgr->assign('accessOptions', $accessOptions); import('issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); $templateMgr->assign('helpTopicId', 'publishing.tableOfContents'); $templateMgr->display('editor/issues/issueToc.tpl'); }
/** * 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); }
/** * 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 (IssueHandler::_isVisibleIssue($issue, $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); $coverLocale = $issue->getFileName($locale) ? $locale : $journal->getPrimaryLocale(); if (!$showToc && $issue->getFileName($coverLocale) && $issue->getShowCoverPage($coverLocale) && !$issue->getHideCoverPageCover($coverLocale)) { $templateMgr->assign('fileName', $issue->getFileName($coverLocale)); $templateMgr->assign('width', $issue->getWidth($coverLocale)); $templateMgr->assign('height', $issue->getHeight($coverLocale)); $templateMgr->assign('coverPageAltText', $issue->getCoverPageAltText($coverLocale)); $templateMgr->assign('originalFileName', $issue->getOriginalFileName($coverLocale)); $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 ($issue && ($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); }
/** * Determines whether a user can view this article galley or not. * @param $request Request * @param $articleId string * @param $galleyId int or string */ function userCanViewGalley($request, $articleId, $galleyId = null) { import('classes.issue.IssueAction'); $issueAction = new IssueAction(); $journal = $request->getJournal(); $publishedArticle = $this->article; $issue = $this->issue; $journalId = $journal->getId(); $user = $request->getUser(); $userId = $user ? $user->getId() : 0; // If this is an editorial user who can view unpublished/unscheduled // articles, bypass further validation. Likewise for its author. if ($publishedArticle && $issueAction->allowedPrePublicationAccess($journal, $publishedArticle)) { return true; } // Make sure the reader has rights to view the article/issue. if ($issue && $issue->getPublished() && $publishedArticle->getStatus() == STATUS_PUBLISHED) { $subscriptionRequired = $issueAction->subscriptionRequired($issue); $isSubscribedDomain = $issueAction->subscribedDomain($journal, $issue->getId(), $publishedArticle->getId()); // Check if login is required for viewing. if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess') && isset($galleyId) && $galleyId) { Validation::redirectLogin(); } // bypass all validation if subscription based on domain or ip is valid // or if the user is just requesting the abstract if (!$isSubscribedDomain && $subscriptionRequired && (isset($galleyId) && $galleyId)) { // Subscription Access $subscribedUser = $issueAction->subscribedUser($journal, $issue->getId(), $publishedArticle->getId()); import('classes.payment.ojs.OJSPaymentManager'); $paymentManager = new OJSPaymentManager($request); $purchasedIssue = false; if (!$subscribedUser && $paymentManager->purchaseIssueEnabled()) { $completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO'); $purchasedIssue = $completedPaymentDao->hasPaidPurchaseIssue($userId, $issue->getId()); } if (!(!$subscriptionRequired || $publishedArticle->getAccessStatus() == ARTICLE_ACCESS_OPEN || $subscribedUser || $purchasedIssue)) { if ($paymentManager->purchaseArticleEnabled() || $paymentManager->membershipEnabled()) { /* if only pdf files are being restricted, then approve all non-pdf galleys * and continue checking if it is a pdf galley */ if ($paymentManager->onlyPdfEnabled()) { if ($this->galley && !$this->galley->isPdfGalley()) { $this->issue = $issue; $this->article = $publishedArticle; return true; } } if (!Validation::isLoggedIn()) { Validation::redirectLogin("payment.loginRequired.forArticle"); } /* if the article has been paid for then forget about everything else * and just let them access the article */ $completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO'); $dateEndMembership = $user->getSetting('dateEndMembership', 0); if ($completedPaymentDao->hasPaidPurchaseArticle($userId, $publishedArticle->getId()) || !is_null($dateEndMembership) && $dateEndMembership > time()) { $this->issue = $issue; $this->article = $publishedArticle; return true; } else { $queuedPayment = $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_ARTICLE, $user->getId(), $publishedArticle->getId(), $journal->getSetting('purchaseArticleFee')); $queuedPaymentId = $paymentManager->queuePayment($queuedPayment); $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment); exit; } } if (!isset($galleyId) || $galleyId) { if (!Validation::isLoggedIn()) { Validation::redirectLogin('reader.subscriptionRequiredLoginText'); } $request->redirect(null, 'about', 'subscriptions'); } } } } else { $request->redirect(null, 'search'); } return true; }
/** * See implementation of retrieveResults for a description of this * function. * Note that this function is also called externally to fetch * results for the title index, and possibly elsewhere. */ function &formatResults(&$results) { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $issueDao =& DAORegistry::getDAO('IssueDAO'); $journalDao =& DAORegistry::getDAO('JournalDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $publishedArticleCache = array(); $articleCache = array(); $issueCache = array(); $issueAvailabilityCache = array(); $journalCache = array(); $sectionCache = array(); $returner = array(); foreach ($results as $articleId) { // Get the article, storing in cache if necessary. if (!isset($articleCache[$articleId])) { $publishedArticleCache[$articleId] =& $publishedArticleDao->getPublishedArticleByArticleId($articleId); $articleCache[$articleId] =& $articleDao->getArticle($articleId); } unset($article); $article =& $articleCache[$articleId]; $publishedArticle =& $publishedArticleCache[$articleId]; $sectionId = $article->getSectionId(); if (!isset($sectionCache[$sectionId])) { $sectionCache[$sectionId] =& $sectionDao->getSection($sectionId); } if ($publishedArticle && $article) { // Get the journal, storing in cache if necessary. $journalId = $article->getJournalId(); if (!isset($journalCache[$journalId])) { $journalCache[$journalId] = $journalDao->getJournal($journalId); } // Get the issue, storing in cache if necessary. $issueId = $publishedArticle->getIssueId(); if (!isset($issueCache[$issueId])) { unset($issue); $issue =& $issueDao->getIssueById($issueId); $issueCache[$issueId] =& $issue; import('issue.IssueAction'); $issueAvailabilityCache[$issueId] = !IssueAction::subscriptionRequired($issue) || IssueAction::subscribedUser($journalCache[$journalId], $issueId, $articleId) || IssueAction::subscribedDomain($journalCache[$journalId], $issueId, $articleId); } // Store the retrieved objects in the result array. $returner[] = array('article' => &$article, 'publishedArticle' => &$publishedArticleCache[$articleId], 'issue' => &$issueCache[$issueId], 'journal' => &$journalCache[$journalId], 'issueAvailable' => $issueAvailabilityCache[$issueId], 'section' => &$sectionCache[$sectionId]); } } return $returner; }
/** * Display the table of contents */ function issueToc($args) { $issueId = isset($args[0]) ? $args[0] : 0; $this->validate($issueId, true); $issue =& $this->issue; $this->setupTemplate(EDITOR_SECTION_ISSUES); $templateMgr =& TemplateManager::getManager(); $journal =& Request::getJournal(); $journalId = $journal->getId(); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $enablePublicArticleId = $journalSettingsDao->getSetting($journalId, 'enablePublicArticleId'); $templateMgr->assign('enablePublicArticleId', $enablePublicArticleId); $enablePageNumber = $journalSettingsDao->getSetting($journalId, 'enablePageNumber'); $templateMgr->assign('enablePageNumber', $enablePageNumber); $templateMgr->assign('customSectionOrderingExists', $customSectionOrderingExists = $sectionDao->customSectionOrderingExists($issueId)); $templateMgr->assign('issueId', $issueId); $templateMgr->assign_by_ref('issue', $issue); $templateMgr->assign('unpublished', !$issue->getPublished()); $templateMgr->assign('issueAccess', $issue->getAccessStatus()); //%CBP% get CBP dao for required sections $CBPPlatformDao =& DAORegistry::getDAO('CBPPlatformDAO'); $requiredSections = $CBPPlatformDao->getRequiredSections($journalId); foreach ($requiredSections as $requiredSection) { $requiredSectionsArr[$requiredSection['title']] = 1; if ($requiredSection['delegated'] == "editor") { $requiredSectionsDisplay[$requiredSection['title']]['title'] = $requiredSection['title']; $requiredSectionsDisplay[$requiredSection['title']]['policy'] = $requiredSection['policy']; } } $templateMgr->assign_by_ref('requiredSections', $requiredSectionsArr); $templateMgr->assign_by_ref('requiredSectionsDisplay', $requiredSectionsDisplay); // get issue sections and articles $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO'); $publishedArticles = $publishedArticleDao->getPublishedArticles($issueId); $layoutEditorSubmissionDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO'); $proofedArticleIds = $layoutEditorSubmissionDao->getProofedArticlesByIssueId($issueId); $templateMgr->assign('proofedArticleIds', $proofedArticleIds); $currSection = 0; $counter = 0; $sections = array(); $sectionCount = 0; $sectionDao =& DAORegistry::getDAO('SectionDAO'); foreach ($publishedArticles as $article) { $sectionId = $article->getSectionId(); if ($currSection != $sectionId) { $lastSectionId = $currSection; $sectionCount++; if ($lastSectionId !== 0) { $sections[$lastSectionId][5] = $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $sectionId) : $sectionCount; } // Store next custom order $currSection = $sectionId; $counter++; $sections[$sectionId] = array($sectionId, $article->getSectionTitle(), array($article), $counter, $customSectionOrderingExists ? $sectionDao->getCustomSectionOrder($issueId, $lastSectionId) : $sectionCount - 1, null); } else { $sections[$article->getSectionId()][2][] = $article; } } $templateMgr->assign_by_ref('sections', $sections); $templateMgr->assign('accessOptions', array(ARTICLE_ACCESS_ISSUE_DEFAULT => Locale::Translate('editor.issues.default'), ARTICLE_ACCESS_OPEN => Locale::Translate('editor.issues.open'))); //%CBP% get comments for issue by reviewers and EIC $templateMgr->assign('user', DAORegistry::getDAO('UserDAO')); //$templateMgr->assign('issueComments', $CBPPlatformDao->getReviewerIssueComments($issueId)); import('classes.issue.IssueAction'); $templateMgr->assign('issueOptions', IssueAction::getIssueOptions()); $templateMgr->assign('helpTopicId', 'publishing.tableOfContents'); $templateMgr->addJavaScript('lib/pkp/js/jquery.tablednd_0_5.js'); $templateMgr->addJavaScript('lib/pkp/js/tablednd.js'); $templateMgr->display('editor/issues/issueToc.tpl'); }