本文整理汇总了PHP中IssueAction::subscribedUser方法的典型用法代码示例。如果您正苦于以下问题:PHP IssueAction::subscribedUser方法的具体用法?PHP IssueAction::subscribedUser怎么用?PHP IssueAction::subscribedUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IssueAction
的用法示例。
在下文中一共展示了IssueAction::subscribedUser方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setupIssueTemplate
/**
* 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);
}
示例2: array
/**
* 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;
}
示例3: userCanViewGalley
/**
* 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;
}
示例4: authors
/**
* 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');
}
}
示例5: import
/**
* 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);
}
}
示例6: validate
/**
* 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);
}
示例7: validate
/**
* 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;
}
示例8: import
/**
* 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);
}
}
示例9: setupIssueTemplate
/**
* 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);
}
示例10: formatResults
/**
* 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;
}
示例11: setupIssueTemplate
/**
* 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) {
//.........这里部分代码省略.........