本文整理汇总了PHP中PublicFileManager::getJournalFilesPath方法的典型用法代码示例。如果您正苦于以下问题:PHP PublicFileManager::getJournalFilesPath方法的具体用法?PHP PublicFileManager::getJournalFilesPath怎么用?PHP PublicFileManager::getJournalFilesPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PublicFileManager
的用法示例。
在下文中一共展示了PublicFileManager::getJournalFilesPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTinyMCE
/**
* Add the tinyMCE script for editing sidebar blocks with a WYSIWYG editor
*/
function addTinyMCE()
{
$journalId = $this->journalId;
$plugin =& $this->plugin;
$templateMgr =& TemplateManager::getManager();
// Enable TinyMCE with specific params
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
import('classes.file.JournalFileManager');
$publicFileManager = new PublicFileManager();
$tinyMCE_script = '
<script language="javascript" type="text/javascript" src="' . Request::getBaseUrl() . '/' . TINYMCE_JS_PATH . '/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
plugins : "style,paste",
theme : "advanced",
theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,|,cleanup,help,code,",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "left",
content_css : "' . Request::getBaseUrl() . '/styles/common.css",
relative_urls : false,
document_base_url : "' . Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/",
extended_valid_elements : "span[*], div[*]"
});
</script>';
$templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $tinyMCE_script);
}
示例2: viewBookForReview
/**
* Public view book for review details.
*/
function viewBookForReview($args = array(), &$request)
{
$this->setupTemplate(true);
$journal =& $request->getJournal();
$journalId = $journal->getId();
$bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
$bookId = !isset($args) || empty($args) ? null : (int) $args[0];
$bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
// Ensure book for review is valid and for this journal
if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
$book =& $bfrDao->getBookForReview($bookId);
$bfrPlugin->import('classes.BookForReview');
// Ensure book is still available
if ($book->getStatus() == BFR_STATUS_AVAILABLE) {
$isAuthor = Validation::isAuthor();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = $request->getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('coverPagePath', $coverPagePath);
$templateMgr->assign('locale', AppLocale::getLocale());
$templateMgr->assign_by_ref('bookForReview', $book);
$templateMgr->assign('isAuthor', $isAuthor);
$templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl');
}
}
$request->redirect(null, 'booksForReview');
}
示例3: getStylesheetPath
/**
* Get the file path to this plugin's stylesheet.
* @return String stylesheet path
*/
function getStylesheetPath()
{
$journal =& Request::getJournal();
if ($this->getSetting($journal->getId(), 'customThemePerJournal')) {
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
return $fileManager->getJournalFilesPath($journal->getId());
} else {
return $this->getPluginPath();
}
}
示例4: getStyleSheetFile
/**
* Get the filename of the CSS stylesheet for this plugin.
*/
function getStyleSheetFile()
{
$journal =& Request::getJournal();
$journalId = $journal ? $journal->getId() : 0;
$styleSheet = $this->getSetting($journalId, 'externalFeedStyleSheet');
if (empty($styleSheet)) {
return $this->getDefaultStyleSheetFile();
} else {
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
return $fileManager->getJournalFilesPath($journalId) . '/' . $styleSheet['uploadName'];
}
}
示例5: getPageSocialMetaTags
/**
* Get pages social meta tags
* @return social tags string
*/
function getPageSocialMetaTags()
{
$journal = Request::getJournal();
$title = $journal->getLocalizedTitle();
$type = 'webpage';
$url = Request::url();
$description = str_replace('"', '', $journal->getLocalizedDescription());
$description = strip_tags($description);
$description = $this->truncate($description, 140);
if ($journal->getLocalizedPageHeaderLogo()) {
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = Request::getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
$pageHeaderLogo = $journal->getLocalizedPageHeaderLogo();
$journalImage = $coverPagePath . $pageHeaderLogo['uploadName'];
} elseif ($journal->getLocalizedPageHeaderTitle()) {
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = Request::getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
$pageHeaderTitle = $journal->getLocalizedPageHeaderTitle();
$journalImage = $coverPagePath . $pageHeaderTitle['uploadName'];
} else {
$journalImage = NULL;
}
$tagsStr = "\n\n<!-- Open Graph -->\n";
$tagsStr .= '<meta property="og:title" content="' . $title . '" />' . "\n";
$tagsStr .= '<meta property="og:type" content="' . $type . '" />' . "\n";
$tagsStr .= '<meta property="og:url" content="' . $url . '" />' . "\n";
$tagsStr .= '<meta property="og:description" content="' . $description . '" />' . "\n";
if ($journalImage) {
$tagsStr .= '<meta property="og:image" content="' . $journalImage . '" />' . "\n";
}
$tagsStr .= "\n\n<!-- Twitter Cards -->\n";
$tagsStr .= '<meta name="twitter:card" content="summary" />' . "\n";
$tagsStr .= '<meta name="twitter:title" content="' . str_replace('"', '', $title) . '" />' . "\n";
$tagsStr .= '<meta name="twitter:description" content="' . $description . '" />' . "\n";
if ($journalImage) {
$tagsStr .= '<meta name="twitter:image" content="' . $journalImage . '" />' . "\n";
}
return $tagsStr;
}
示例6: display
/**
* Display the form
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
$additionalHeadData .= '<script type="text/javascript" src="' . Request::getBaseUrl() . '/plugins/themes/custom/picker.js"></script>' . "\n";
$templateMgr->addStyleSheet(Request::getBaseUrl() . '/plugins/themes/custom/picker.css');
$templateMgr->assign('additionalHeadData', $additionalHeadData);
$stylesheetFilePluginLocation = $this->plugin->getPluginPath() . '/' . $this->plugin->getStylesheetFilename();
if (!$this->_canUsePluginPath() || $this->plugin->getSetting($this->journalId, 'customThemePerJournal')) {
if (!$this->_canUsePluginPath()) {
$templateMgr->assign('disablePluginPath', true);
$templateMgr->assign('stylesheetFilePluginLocation', $stylesheetFilePluginLocation);
}
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
$stylesheetFileLocation = $fileManager->getJournalFilesPath($this->journalId) . '/' . $this->plugin->getStylesheetFilename();
} else {
$stylesheetFileLocation = $stylesheetFilePluginLocation;
}
$templateMgr->assign('canSave', $this->_is_writable($stylesheetFileLocation));
$templateMgr->assign('stylesheetFileLocation', $stylesheetFileLocation);
return parent::display();
}
示例7: getLocalizedCoverImageUrl
/**
* Get a full URL to the localized cover image
*
* @return string
*/
function getLocalizedCoverImageUrl()
{
$coverImage = $this->getLocalizedCoverImage();
if (!$coverImage) {
return '';
}
$request = Application::getRequest();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
return $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($this->getContextId()) . '/' . $coverImage;
}
示例8: deleteContext
/**
* Delete a journal.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function deleteContext($args, $request)
{
// Identify the journal Id.
$journalId = $request->getUserVar('rowId');
$journalDao = DAORegistry::getDAO('JournalDAO');
$journal = $journalDao->getById($journalId);
if ($journal) {
$journalDao->deleteById($journalId);
// Delete journal file tree
// FIXME move this somewhere better.
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager($journalId);
$journalPath = Config::getVar('files', 'files_dir') . '/journals/' . $journalId;
$fileManager->rmtree($journalPath);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$publicFileManager->rmtree($publicFileManager->getJournalFilesPath($journalId));
return DAO::getDataChangedEvent($journalId);
}
return new JSONMessage(false);
}
示例9: execute
/**
* Save changes to article.
* @param $request PKPRequest
* @return int the article ID
*/
function execute(&$request)
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$authorDao =& DAORegistry::getDAO('AuthorDAO');
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$citationDao =& DAORegistry::getDAO('CitationDAO');
/* @var $citationDao CitationDAO */
$article =& $this->article;
// Retrieve the previous citation list for comparison.
$previousRawCitationList = $article->getCitations();
// Update article
$article->setTitle($this->getData('title'), null);
// Localized
$section =& $sectionDao->getSection($article->getSectionId());
$article->setAbstract($this->getData('abstract'), null);
// Localized
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
if ($publicFileManager->uploadedFileExists(COVER_PAGE_IMAGE_NAME)) {
$journal = Request::getJournal();
$originalFileName = $publicFileManager->getUploadedFileName(COVER_PAGE_IMAGE_NAME);
$type = $publicFileManager->getUploadedFileType(COVER_PAGE_IMAGE_NAME);
$newFileName = 'cover_article_' . $this->article->getId() . '_' . $this->getFormLocale() . $publicFileManager->getImageExtension($type);
$publicFileManager->uploadJournalFile($journal->getId(), COVER_PAGE_IMAGE_NAME, $newFileName);
$article->setOriginalFileName($publicFileManager->truncateFileName($originalFileName, 127), $this->getFormLocale());
$article->setFileName($newFileName, $this->getFormLocale());
// Store the image dimensions.
list($width, $height) = getimagesize($publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $newFileName);
$article->setWidth($width, $this->getFormLocale());
$article->setHeight($height, $this->getFormLocale());
}
$article->setCoverPageAltText($this->getData('coverPageAltText'), null);
// Localized
$showCoverPage = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('showCoverPage'));
foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
if (!array_key_exists($locale, $showCoverPage)) {
$showCoverPage[$locale] = 0;
}
}
$article->setShowCoverPage($showCoverPage, null);
// Localized
$hideCoverPageToc = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageToc'));
foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageToc)) {
$hideCoverPageToc[$locale] = 0;
}
}
$article->setHideCoverPageToc($hideCoverPageToc, null);
// Localized
$hideCoverPageAbstract = array_map(create_function('$arrayElement', 'return (int)$arrayElement;'), (array) $this->getData('hideCoverPageAbstract'));
foreach (array_keys($this->getData('coverPageAltText')) as $locale) {
if (!array_key_exists($locale, $hideCoverPageAbstract)) {
$hideCoverPageAbstract[$locale] = 0;
}
}
$article->setHideCoverPageAbstract($hideCoverPageAbstract, null);
// Localized
$article->setDiscipline($this->getData('discipline'), null);
// Localized
$article->setSubjectClass($this->getData('subjectClass'), null);
// Localized
$article->setSubject($this->getData('subject'), null);
// Localized
$article->setCoverageGeo($this->getData('coverageGeo'), null);
// Localized
$article->setCoverageChron($this->getData('coverageChron'), null);
// Localized
$article->setCoverageSample($this->getData('coverageSample'), null);
// Localized
$article->setType($this->getData('type'), null);
// Localized
$article->setLanguage($this->getData('language'));
// Localized
$article->setSponsor($this->getData('sponsor'), null);
// Localized
$article->setCitations($this->getData('citations'));
if ($this->isEditor) {
$article->setHideAuthor($this->getData('hideAuthor') ? $this->getData('hideAuthor') : 0);
}
// consider the additional field names from the public identifer plugins
import('classes.plugins.PubIdPluginHelper');
$pubIdPluginHelper = new PubIdPluginHelper();
$pubIdPluginHelper->execute($this, $article);
// Update authors
$authors = $this->getData('authors');
for ($i = 0, $count = count($authors); $i < $count; $i++) {
if ($authors[$i]['authorId'] > 0) {
// Update an existing author
$author =& $authorDao->getAuthor($authors[$i]['authorId'], $article->getId());
$isExistingAuthor = true;
} else {
// Create a new author
if (checkPhpVersion('5.0.0')) {
// *5488* PHP4 Requires explicit instantiation-by-reference
$author = new Author();
//.........这里部分代码省略.........
示例10: view
/**
* View Article. (Either article landing page or galley view.)
* @param $args array
* @param $request Request
*/
function view($args, $request)
{
$articleId = array_shift($args);
$galleyId = array_shift($args);
$fileId = array_shift($args);
$journal = $request->getJournal();
$issue = $this->issue;
$article = $this->article;
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign(array('issue' => $issue, 'article' => $article, 'fileId' => $fileId));
$this->setupTemplate($request);
if (!$this->userCanViewGalley($request, $articleId, $galleyId)) {
fatalError('Cannot view galley.');
}
// Fetch and assign the section to the template
$sectionDao = DAORegistry::getDAO('SectionDAO');
$section = $sectionDao->getById($article->getSectionId(), $journal->getId(), true);
$templateMgr->assign('section', $section);
// Fetch and assign the galley to the template
$galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
if ($journal->getSetting('enablePublicGalleyId')) {
$galley = $galleyDao->getByBestGalleyId($galleyId, $article->getId());
} else {
$galley = $galleyDao->getById($galleyId, $article->getId());
}
if ($galley && $galley->getRemoteURL()) {
$request->redirectUrl($galley->getRemoteURL());
}
$templateMgr->assign('galley', $galley);
// Copyright and license info
if ($journal->getSetting('includeCopyrightStatement') && $journal->getLocalizedSetting('copyrightNotice')) {
$templateMgr->assign(array('copyright' => $journal->getLocalizedSetting('copyrightNotice'), 'copyrightHolder' => $journal->getLocalizedSetting('copyrightHolder'), 'copyrightYear' => $journal->getSetting('copyrightYear')));
}
if ($journal->getSetting('includeLicense') && $article->getLicenseURL()) {
$templateMgr->assign(array('licenseUrl' => $article->getLicenseURL(), 'ccLicenseBadge' => Application::getCCLicenseBadge($article->getLicenseURL())));
}
// Keywords
$submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO');
$templateMgr->assign('keywords', $submissionKeywordDao->getKeywords($article->getId(), array(AppLocale::getLocale())));
// Consider public identifiers
$pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
$templateMgr->assign('pubIdPlugins', $pubIdPlugins);
if (!$galley) {
// No galley: Prepare the article landing page.
// Get the subscription status if displaying the abstract;
// if access is open, we can display links to the full text.
import('classes.issue.IssueAction');
// The issue may not exist, if this is an editorial user
// and scheduling hasn't been completed yet for the article.
$issueAction = new IssueAction();
$subscriptionRequired = false;
if ($issue) {
$subscriptionRequired = $issueAction->subscriptionRequired($issue);
}
$subscribedUser = $issueAction->subscribedUser($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null);
$subscribedDomain = $issueAction->subscribedDomain($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null);
$templateMgr->assign('showGalleyLinks', !$subscriptionRequired || $journal->getSetting('showGalleyLinks'));
$templateMgr->assign('hasAccess', !$subscriptionRequired || isset($article) && $article->getAccessStatus() == ARTICLE_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);
}
// Article cover page.
if (isset($article) && $article->getLocalizedFileName() && $article->getLocalizedShowCoverPage() && !$article->getLocalizedHideCoverPageAbstract()) {
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$templateMgr->assign(array('coverPagePath' => $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/', 'coverPageFileName' => $article->getLocalizedFileName(), 'width' => $article->getLocalizedWidth(), 'height' => $article->getLocalizedHeight(), 'coverPageAltText' => $article->getLocalizedCoverPageAltText()));
}
if (!HookRegistry::call('ArticleHandler::view', array(&$request, &$issue, &$article))) {
return $templateMgr->display('frontend/pages/article.tpl');
}
} else {
// Galley: Prepare the galley file download.
if (!HookRegistry::call('ArticleHandler::view::galley', array(&$request, &$issue, &$galley, &$article))) {
$request->redirect(null, null, 'download', array($articleId, $galleyId));
}
}
}
示例11: viewObjectForReview
/**
* Public view object for review details.
* @param $args array
* @param $request PKPRequest
*/
function viewObjectForReview($args, &$request)
{
// Ensure the args (object ID) exists
$objectId = array_shift($args);
if (!$objectId) {
$request->redirect(null, 'objectsForReview');
}
$journal =& $request->getJournal();
$journalId = $journal->getId();
// Ensure the object exists
$ofrDao =& DAORegistry::getDAO('ObjectForReviewDAO');
$objectForReview =& $ofrDao->getById($objectId, $journalId);
if (!isset($objectForReview)) {
$request->redirect(null, 'objectsForReview');
}
// If object is available
if ($objectForReview->getAvailable()) {
// Get all metadata for the objects for review
$reviewObjectTypeDao =& DAORegistry::getDAO('ReviewObjectTypeDAO');
$allTypes =& $reviewObjectTypeDao->getTypeIdsAlphabetizedByContext($journalId);
$reviewObjectMetadataDao =& DAORegistry::getDAO('ReviewObjectMetadataDAO');
$allReviewObjectsMetadata = array();
foreach ($allTypes as $type) {
$typeId = $type['typeId'];
$typeMetadata = $reviewObjectMetadataDao->getArrayByReviewObjectTypeId($typeId);
$allReviewObjectsMetadata[$typeId] = $typeMetadata;
}
// If the user is an author get her/his assignments
$isAuthor = Validation::isAuthor();
if ($isAuthor) {
$user =& $request->getUser();
$ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
$authorAssignments = $ofrAssignmentDao->getObjectIds($user->getId());
}
$this->setupTemplate($request, true);
$templateMgr =& TemplateManager::getManager($request);
$templateMgr->assign('objectForReview', $objectForReview);
$templateMgr->assign('allReviewObjectsMetadata', $allReviewObjectsMetadata);
$templateMgr->assign('isAuthor', $isAuthor);
$templateMgr->assign('authorAssignments', $authorAssignments);
// Cover page path
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = $request->getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
$templateMgr->assign('coverPagePath', $coverPagePath);
$ofrPlugin =& $this->_getObjectsForReviewPlugin();
$ofrPlugin->import('classes.ReviewObjectMetadata');
$templateMgr->assign('multipleOptionsTypes', ReviewObjectMetadata::getMultipleOptionsTypes());
$templateMgr->assign('locale', AppLocale::getLocale());
$templateMgr->assign('ofrListing', false);
$templateMgr->assign('ofrTemplatePath', $ofrPlugin->getTemplatePath());
$templateMgr->display($ofrPlugin->getTemplatePath() . 'objectForReview.tpl');
} else {
$request->redirect(null, 'objectsForReview');
}
}
示例12: displayArticleCoverPageAbstract
/**
* Display book for review cover page in article abstract.
*/
function displayArticleCoverPageAbstract($hookName, $params)
{
if ($this->getEnabled()) {
$smarty =& $params[1];
$output =& $params[2];
$journal =& Request::getJournal();
if ($journal) {
$journalId = $journal->getId();
} else {
return false;
}
$article =& $smarty->get_template_vars('article');
if ($article) {
$articleId = $article->getId();
} else {
return false;
}
$bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
$book =& $bfrDao->getSubmittedBookForReviewByArticle($journalId, $articleId);
if ($book) {
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$baseCoverPagePath = Request::getBaseUrl() . '/';
$baseCoverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
$smarty->assign('baseCoverPagePath', $baseCoverPagePath);
$smarty->assign('locale', AppLocale::getLocale());
$smarty->assign('book', $book);
$output .= $smarty->fetch($this->getTemplatePath() . 'coverPageAbstract.tpl');
} else {
return false;
}
}
return false;
}
示例13: view
/**
* View Article.
* @param $args array
* @param $request Request
*/
function view($args, &$request)
{
$router =& $request->getRouter();
$articleId = isset($args[0]) ? $args[0] : 0;
$galleyId = isset($args[1]) ? $args[1] : 0;
$this->validate($request, $articleId, $galleyId);
$journal =& $this->journal;
$issue =& $this->issue;
$article =& $this->article;
$this->setupTemplate();
$rtDao =& DAORegistry::getDAO('RTDAO');
$journalRt = $rtDao->getJournalRTByJournal($journal);
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$section =& $sectionDao->getSection($article->getSectionId(), $journal->getJournalid(), true);
$version = null;
if ($journalRt->getVersion() != null && $journalRt->getDefineTerms()) {
// Determine the "Define Terms" context ID.
$version = $rtDao->getVersion($journalRt->getVersion(), $journalRt->getJournalId(), true);
if ($version) {
foreach ($version->getContexts() as $context) {
if ($context->getDefineTerms()) {
$defineTermsContextId = $context->getContextId();
break;
}
}
}
}
$commentDao =& DAORegistry::getDAO('CommentDAO');
$enableComments = $journal->getSetting('enableComments');
if ($article->getEnableComments() && ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_UNAUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS)) {
$comments =& $commentDao->getRootCommentsByArticleId($article->getId());
}
$galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
if ($journal->getSetting('enablePublicGalleyId')) {
$galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $article->getId());
} else {
$galley =& $galleyDao->getGalley($galleyId, $article->getId());
}
if ($galley && !$galley->isHtmlGalley() && !$galley->isPdfGalley()) {
if ($galley->isInlineable()) {
$this->viewFile(array($galley->getArticleId(), $galley->getId()), $request);
} else {
$this->download(array($galley->getArticleId(), $galley->getId()), $request);
}
}
$templateMgr =& TemplateManager::getManager();
if (!$galley) {
// Get the subscription status if displaying the abstract;
// if access is open, we can display links to the full text.
import('issue.IssueAction');
// The issue may not exist, if this is an editorial user
// and scheduling hasn't been completed yet for the article.
if ($issue) {
$templateMgr->assign('subscriptionRequired', IssueAction::subscriptionRequired($issue));
}
$templateMgr->assign('subscribedUser', IssueAction::subscribedUser($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
$templateMgr->assign('subscribedDomain', IssueAction::subscribedDomain($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
$templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
import('payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
if ($paymentManager->onlyPdfEnabled()) {
$templateMgr->assign('restrictOnlyPdf', true);
}
if ($paymentManager->purchaseArticleEnabled()) {
$templateMgr->assign('purchaseArticleEnabled', true);
}
// Article cover page.
$locale = Locale::getLocale();
if (isset($article) && $article->getLocalizedFileName() && $article->getLocalizedShowCoverPage() && !$article->getLocalizedHideCoverPageAbstract($locale)) {
import('file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = $request->getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
$templateMgr->assign('coverPagePath', $coverPagePath);
$templateMgr->assign('coverPageFileName', $article->getLocalizedFileName());
$templateMgr->assign('width', $article->getLocalizedWidth());
$templateMgr->assign('height', $article->getLocalized());
$templateMgr->assign('coverPageAltText', $article->getLocalizedCoverPageAltText());
}
// Increment the published article's abstract views count
if (!$request->isBot()) {
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticleDao->incrementViewsByArticleId($article->getId());
}
} else {
if (!$request->isBot()) {
// Increment the galley's views count
$galleyDao->incrementViews($galley->getId());
}
// Use the article's CSS file, if set.
if ($galley->isHTMLGalley() && ($styleFile =& $galley->getStyleFile())) {
$templateMgr->addStyleSheet($router->url($request, null, 'article', 'viewFile', array($article->getId(), $galley->getBestGalleyId($journal), $styleFile->getFileId())));
}
}
// Add font sizer js and css if not already in header
//.........这里部分代码省略.........
示例14: addTinyMCE
function addTinyMCE()
{
$journalId = $this->journalId;
$plugin =& $this->plugin;
$templateMgr =& TemplateManager::getManager();
// Enable TinyMCE with specific params
$additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
import('classes.file.JournalFileManager');
$publicFileManager = new PublicFileManager();
$tinyMCE_script = '
<script language="javascript" type="text/javascript" src="' . Request::getBaseUrl() . '/' . TINYMCE_JS_PATH . '/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,",
theme_advanced_buttons1_add : "fontsizeselect",
theme_advanced_buttons2_add : "separator,preview,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "media,separator",
theme_advanced_buttons4 : "cut,copy,paste,pastetext,pasteword,separator,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,print,separator",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
relative_urls : false,
document_base_url : "' . Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/",
theme : "advanced",
theme_advanced_layout_manager : "SimpleLayout",
extended_valid_elements : "span[*], div[*]",
spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
});
</script>';
$templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $tinyMCE_script);
}
示例15: import
/**
* 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);
}