예제 #1
0
 /**
  * Register the article's metadata with the SWORD deposit.
  */
 function setMetadata()
 {
     $this->package->setCustodian($this->journal->getSetting('contactName'));
     $this->package->setTitle(html_entity_decode($this->article->getTitle($this->journal->getPrimaryLocale()), ENT_QUOTES, 'UTF-8'));
     $this->package->setAbstract(html_entity_decode(strip_tags($this->article->getAbstract($this->journal->getPrimaryLocale())), ENT_QUOTES, 'UTF-8'));
     $this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale()));
     // The article can be published or not. Support either.
     if (is_a($this->article, 'PublishedArticle')) {
         $doi = $this->article->getPubId('doi');
         if ($doi !== null) {
             $this->package->setIdentifier($doi);
         }
     }
     foreach ($this->article->getAuthors() as $author) {
         $creator = $author->getFullName(true);
         $affiliation = $author->getAffiliation($this->journal->getPrimaryLocale());
         if (!empty($affiliation)) {
             $creator .= "; {$affiliation}";
         }
         $this->package->addCreator($creator);
     }
     // The article can be published or not. Support either.
     if (is_a($this->article, 'PublishedArticle')) {
         $plugin =& PluginRegistry::loadPlugin('citationFormats', 'bibtex');
         $this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal)), ENT_QUOTES, 'UTF-8'));
     }
 }
예제 #2
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     // FIXME: for backwards compatibility only - remove
     if (!isset($request)) {
         // FIXME: Trigger a deprecation warning when enough instances of this
         // call have been fixed to not clutter the error log.
         $request =& Registry::get('request');
     }
     assert(is_a($request, 'PKPRequest'));
     parent::PKPTemplateManager($request);
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $site =& $request->getSite();
         $siteFilesDir = $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         $this->assign('isAdmin', Validation::isSiteAdmin());
         // assign an empty home context
         $this->assign('homeContext', array());
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         // Load and apply theme plugin, if chosen
         $themePluginPath = $site->getSetting('theme');
         if (!empty($themePluginPath)) {
             // Load and activate the theme
             $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
             if ($themePlugin) {
                 $themePlugin->activate($this);
             }
         }
         // Add the site-wide logo, if set for this locale or the primary locale
         $this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
         $customLogo = $site->getSetting('customLogo');
         if ($customLogo) {
             $this->assign('displayPageHeaderLogo', $customLogo);
         }
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $this->assign('enableSubmit', $site->getSetting('enableSubmit'));
         // Add java script for notifications
         $user =& $request->getUser();
         if ($user) {
             $this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
         }
     }
 }
예제 #3
0
 /**
  * Register the article's metadata with the SWORD deposit.
  */
 function setMetadata()
 {
     $this->package->setCustodian($this->journal->getSetting('contactName'));
     $this->package->setTitle($this->article->getTitle($this->journal->getPrimaryLocale()));
     $this->package->setAbstract($this->article->getAbstract($this->journal->getPrimaryLocale()));
     $this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale()));
     $doi = $this->article->getDOI();
     if ($doi !== null) {
         $this->package->setIdentifier($doi);
     }
     foreach ($this->article->getAuthors() as $author) {
         $this->package->addCreator($author->getFullName());
     }
     $plugin =& PluginRegistry::loadPlugin('citationFormats', 'bibtex');
     $this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal))));
 }
 /**
  * @copydoc PKPHandler::initialize()
  */
 function initialize($request)
 {
     parent::initialize($request);
     // Basic grid configuration.
     $this->setTitle('plugins.importexport.common.export.issues');
     // Load submission-specific translations.
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_EDITOR, LOCALE_COMPONENT_APP_MANAGER);
     $pluginCategory = $request->getUserVar('category');
     $pluginPathName = $request->getUserVar('plugin');
     $this->_plugin = PluginRegistry::loadPlugin($pluginCategory, $pluginPathName);
     assert(isset($this->_plugin));
     // Fetch the authorized roles.
     $authorizedRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
     // Grid columns.
     $cellProvider = new PubIdExportIssuesListGridCellProvider($this->_plugin, $authorizedRoles);
     $this->addColumn(new GridColumn('identification', 'issue.issue', null, null, $cellProvider, array('html' => true, 'alignment' => COLUMN_ALIGNMENT_LEFT)));
     $this->addColumn(new GridColumn('published', 'editor.issues.published', null, null, $cellProvider, array('html' => true, 'alignment' => COLUMN_ALIGNMENT_LEFT)));
     $this->addColumn(new GridColumn('pubId', null, $this->_plugin->getPubIdDisplayType(), null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 15)));
     $this->addColumn(new GridColumn('status', 'common.status', null, null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 10)));
 }
 /**
  * @copydoc PKPHandler::initialize()
  */
 function initialize($request)
 {
     parent::initialize($request);
     $context = $request->getContext();
     // Basic grid configuration.
     $this->setTitle('plugins.importexport.common.export.articles');
     // Load submission-specific translations.
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_MANAGER);
     $pluginCategory = $request->getUserVar('category');
     $pluginPathName = $request->getUserVar('plugin');
     $this->_plugin = PluginRegistry::loadPlugin($pluginCategory, $pluginPathName);
     assert(isset($this->_plugin));
     // Grid columns.
     $cellProvider = $this->getGridCellProvider();
     $this->addColumn(new GridColumn('id', null, __('common.id'), 'controllers/grid/gridCell.tpl', $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 10)));
     $this->addColumn(new GridColumn('title', 'grid.submission.itemTitle', null, null, $cellProvider, array('html' => true, 'alignment' => COLUMN_ALIGNMENT_LEFT)));
     $this->addColumn(new GridColumn('issue', 'issue.issue', null, null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 20)));
     if (method_exists($this, 'addAdditionalColumns')) {
         $this->addAdditionalColumns($cellProvider);
     }
     $this->addColumn(new GridColumn('status', 'common.status', null, null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 10)));
 }
예제 #6
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::PKPTemplateManager();
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $site =& Request::getSite();
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         $this->assign('isAdmin', Validation::isSiteAdmin());
         // assign an empty home context
         $this->assign('homeContext', array());
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         // Load and apply theme plugin, if chosen
         $themePluginPath = $site->getSetting('theme');
         if (!empty($themePluginPath)) {
             // Load and activate the theme
             $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
             if ($themePlugin) {
                 $themePlugin->activate($this);
             }
         }
         // Add the site-wide logo, if set for this locale or the primary locale
         $this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
         $customLogo = $site->getSetting('customLogo');
         if ($customLogo) {
             $this->assign('useCustomLogo', $customLogo);
         }
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $this->assign('enableSubmit', $site->getSetting('enableSubmit'));
     }
 }
 /**
  * @copydoc PKPHandler::initialize()
  */
 function initialize($request)
 {
     parent::initialize($request);
     $context = $request->getContext();
     // Basic grid configuration.
     $this->setTitle('plugins.importexport.common.export.articles');
     // Load submission-specific translations.
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_MANAGER);
     $pluginCategory = $request->getUserVar('category');
     $pluginPathName = $request->getUserVar('plugin');
     $this->_plugin = PluginRegistry::loadPlugin($pluginCategory, $pluginPathName);
     assert(isset($this->_plugin));
     // Fetch the authorized roles.
     $authorizedRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES);
     // Grid columns.
     $cellProvider = new PubIdExportRepresentationsListGridCellProvider($this->_plugin, $authorizedRoles);
     $this->addColumn(new GridColumn('id', null, __('common.id'), 'controllers/grid/gridCell.tpl', $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 10)));
     $this->addColumn(new GridColumn('title', 'grid.submission.itemTitle', null, null, $cellProvider, array('html' => true, 'alignment' => COLUMN_ALIGNMENT_LEFT)));
     $this->addColumn(new GridColumn('issue', 'issue.issue', null, null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 20)));
     $this->addColumn(new GridColumn('galley', 'submission.layout.galleyLabel', null, null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 20)));
     $this->addColumn(new GridColumn('pubId', null, $this->_plugin->getPubIdDisplayType(), null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 15)));
     $this->addColumn(new GridColumn('status', 'common.status', null, null, $cellProvider, array('alignment' => COLUMN_ALIGNMENT_LEFT, 'width' => 10)));
 }
예제 #8
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router =& $this->request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $journal =& $router->getContext($this->request);
         $site =& $this->request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $this->request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($this->request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         $this->assign('homeContext', array());
         $this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
         if (isset($journal)) {
             $this->assign_by_ref('currentJournal', $journal);
             $journalTitle = $journal->getLocalizedTitle();
             $this->assign('siteTitle', $journalTitle);
             $this->assign('publicFilesDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
             $this->assign('primaryLocale', $journal->getPrimaryLocale());
             $this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $journal->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign journal page header
             $this->assign('displayPageHeaderTitle', $journal->getLocalizedPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $journal->getLocalizedPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $journal->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $journal->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $journal->getLocalizedFavicon());
             $this->assign('faviconDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
             $this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
             $this->assign('hideRegisterLink', !$journal->getSetting('allowRegReviewer') && !$journal->getSetting('allowRegReader') && !$journal->getSetting('allowRegAuthor'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $journal->getSetting('journalTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $journalStyleSheet = $journal->getSetting('journalStyleSheet');
             if ($journalStyleSheet) {
                 $this->addStyleSheet($this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $journalStyleSheet['uploadName']);
             }
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($this->request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
             // Load and apply theme plugin, if chosen
             $themePluginPath = $site->getSetting('siteTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
         // Add java script for notifications
         $user =& $this->request->getUser();
         if ($user) {
             $this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
         }
     }
 }
예제 #9
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     // FIXME: for backwards compatibility only - remove
     if (!isset($request)) {
         // FIXME: Trigger a deprecation warning when enough instances of this
         // call have been fixed to not clutter the error log.
         $request =& Registry::get('request');
     }
     assert(is_a($request, 'PKPRequest'));
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router =& $request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $press =& $router->getContext($request);
         $site =& $request->getSite();
         $siteFilesDir = $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by press
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         $this->assign('homeContext', array());
         if (isset($press)) {
             $this->assign_by_ref('currentPress', $press);
             $pressTitle = $press->getLocalizedName();
             $this->assign('siteTitle', $pressTitle);
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getPressFilesPath($press->getId()));
             $this->assign('primaryLocale', $press->getPrimaryLocale());
             $this->assign('alternateLocales', $press->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $press->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign press page header
             $this->assign('displayPageHeaderTitle', $press->getPressPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $press->getPressPageHeaderLogo());
             $this->assign('alternatePageHeader', $press->getLocalizedSetting('pressPageHeader'));
             $this->assign('metaSearchDescription', $press->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $press->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $press->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $press->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $press->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $press->getSetting('enableAnnouncements'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $press->getSetting('pressTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $pressStyleSheet = $press->getSetting('pressStyleSheet');
             if ($pressStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . PublicFileManager::getPressFilesPath($press->getId()) . '/' . $pressStyleSheet['uploadName']);
             }
             $this->assign('pageFooter', $press->getLocalizedSetting('pressPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherPresses', true);
         }
     }
 }
예제 #10
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     // FIXME: for backwards compatibility only - remove
     if (!isset($request)) {
         // FIXME: Trigger a deprecation warning when enough instances of this
         // call have been fixed to not clutter the error log.
         $request =& Registry::get('request');
     }
     assert(is_a($request, 'PKPRequest'));
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router =& $request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $conference =& $router->getContext($request, 1);
         $schedConf =& $router->getContext($request, 2);
         $site =& $request->getSite();
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $siteFilesDir = $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('homeContext', array('conference' => 'index', 'schedConf' => 'index'));
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($conference)) {
             $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
             $archivedSchedConfsExist = $schedConfDao->archivedSchedConfsExist($conference->getId());
             $currentSchedConfsExist = $schedConfDao->currentSchedConfsExist($conference->getId());
             $this->assign('archivedSchedConfsExist', $archivedSchedConfsExist);
             $this->assign('currentSchedConfsExist', $currentSchedConfsExist);
             $this->assign_by_ref('currentConference', $conference);
             $conferenceTitle = $conference->getConferenceTitle();
             $this->assign('numPageLinks', $conference->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $conference->getSetting('itemsPerPage'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $conference->getSetting('conferenceTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign additional navigation bar items
             $navMenuItems =& $conference->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('displayPageHeaderTitle', $conference->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $conference->getPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $conference->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $conference->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $conference->getLocalizedFavicon());
             $this->assign('faviconDir', $request->getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('alternatePageHeader', $conference->getLocalizedSetting('conferencePageHeader'));
             $this->assign('metaSearchDescription', $conference->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $conference->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $conference->getLocalizedSetting('customHeaders'));
             $this->assign('enableAnnouncements', $conference->getSetting('enableAnnouncements'));
             $this->assign('pageFooter', $conference->getLocalizedSetting('conferencePageFooter'));
             $this->assign('displayCreativeCommons', $conference->getSetting('postCreativeCommons'));
             if (isset($schedConf)) {
                 // This will be needed if inheriting public conference files from the scheduled conference.
                 $this->assign('publicSchedConfFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()));
                 $this->assign('primaryLocale', $conference->getSetting('primaryLocale'));
                 $this->assign('alternateLocales', $conference->getPrimaryLocale());
                 $this->assign_by_ref('currentSchedConf', $schedConf);
                 // Assign common sched conf vars:
                 $currentTime = time();
                 $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
                 $this->assign('submissionsCloseDate', $submissionsCloseDate);
                 $this->assign('schedConfPostTimeline', $schedConf->getSetting('postTimeline'));
                 $this->assign('schedConfPostOverview', $schedConf->getSetting('postOverview'));
                 $this->assign('schedConfPostTrackPolicies', $schedConf->getSetting('postTrackPolicies'));
                 $this->assign('schedConfPostPresentations', $schedConf->getSetting('postPresentations'));
                 $this->assign('schedConfPostAccommodation', $schedConf->getSetting('postAccommodation'));
                 $this->assign('schedConfPostSupporters', $schedConf->getSetting('postSupporters'));
                 $this->assign('schedConfPostPayment', $schedConf->getSetting('postPayment'));
                 // CFP displayed
                 $showCFPDate = $schedConf->getSetting('showCFPDate');
                 $postCFP = $schedConf->getSetting('postCFP');
                 if ($postCFP && $showCFPDate && $submissionsCloseDate && $currentTime > $showCFPDate && $currentTime < $submissionsCloseDate) {
                     $this->assign('schedConfShowCFP', true);
                 }
                 // Schedule displayed
                 $postScheduleDate = $schedConf->getSetting('postScheduleDate');
                 if ($postScheduleDate && $currentTime > $postScheduleDate && $schedConf->getSetting('postSchedule')) {
                     $this->assign('schedConfPostSchedule', true);
                 }
                 // Program
                 if ($schedConf->getSetting('postProgram') && ($schedConf->getSetting('program') || $schedConf->getSetting('programFile'))) {
                     $this->assign('schedConfShowProgram', true);
                 }
                 // Submissions open
                 $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
                 $postSubmission = $schedConf->getSetting('postProposalSubmission');
                 $this->assign('submissionsOpenDate', $submissionsOpenDate);
                 import('classes.payment.ocs.OCSPaymentManager');
                 $paymentManager =& OCSPaymentManager::getManager();
                 $this->assign('schedConfPaymentsEnabled', $paymentManager->isConfigured());
             }
             // Assign conference stylesheet and footer
             $conferenceStyleSheet = $conference->getSetting('conferenceStyleSheet');
             if ($conferenceStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()) . '/' . $conferenceStyleSheet['uploadName']);
             }
             // Assign scheduled conference stylesheet and footer (after conference stylesheet!)
             if ($schedConf) {
                 $schedConfStyleSheet = $schedConf->getSetting('schedConfStyleSheet');
                 if ($schedConfStyleSheet) {
                     $this->addStyleSheet($request->getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()) . '/' . $schedConfStyleSheet['uploadName']);
                 }
             }
         } else {
             // Not within conference context
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath());
         }
         // Add java script for notifications
         $user =& $request->getUser();
         if ($user) {
             $this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
         }
     }
 }
예제 #11
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::PKPTemplateManager();
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $journal =& Request::getJournal();
         $site =& Request::getSite();
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($journal)) {
             $this->assign_by_ref('currentJournal', $journal);
             $journalTitle = $journal->getJournalTitle();
             $this->assign('siteTitle', $journalTitle);
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()));
             $this->assign('primaryLocale', $journal->getPrimaryLocale());
             $this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $journal->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign journal page header
             $this->assign('displayPageHeaderTitle', $journal->getJournalPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $journal->getJournalPageHeaderLogo());
             $this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $journal->getSetting('journalTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $journalStyleSheet = $journal->getSetting('journalStyleSheet');
             if ($journalStyleSheet) {
                 $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()) . '/' . $journalStyleSheet['uploadName']);
             }
             import('payment.ojs.OJSPaymentManager');
             $paymentManager =& OJSPaymentManager::getManager();
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $this->assign('displayPageHeaderTitle', $site->getSitePageHeaderTitle());
             $this->assign('siteTitle', $site->getSiteTitle());
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
     }
 }
예제 #12
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::PKPTemplateManager();
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $conference =& Request::getConference();
         $schedConf =& Request::getSchedConf();
         $site =& Request::getSite();
         if (isset($schedConf)) {
             $this->assign('schedConfAcronym', $schedConf->getLocalizedSetting('acronym'));
         }
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('homeContext', array('conference' => 'index', 'schedConf' => 'index'));
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($conference)) {
             $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
             $archivedSchedConfsExist = $schedConfDao->archivedSchedConfsExist($conference->getId());
             $currentSchedConfsExist = $schedConfDao->currentSchedConfsExist($conference->getId());
             $this->assign('archivedSchedConfsExist', $archivedSchedConfsExist);
             $this->assign('currentSchedConfsExist', $currentSchedConfsExist);
             $this->assign_by_ref('currentConference', $conference);
             $conferenceTitle = $conference->getConferenceTitle();
             $this->assign('numPageLinks', $conference->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $conference->getSetting('itemsPerPage'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $conference->getSetting('conferenceTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign additional navigation bar items
             $navMenuItems =& $conference->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('displayPageHeaderTitle', $conference->getPageHeaderTitle());
             $this->assign('displayPageHeaderSubTitle', $conference->getLocalizedSetting('homeHeaderSubTitle'));
             $this->assign('displayPageHeaderLogo', $conference->getPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $conference->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $conference->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $conference->getLocalizedFavicon());
             $this->assign('faviconDir', Request::getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('alternatePageHeader', $conference->getLocalizedSetting('conferencePageHeader'));
             $this->assign('metaSearchDescription', $conference->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $conference->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $conference->getLocalizedSetting('customHeaders'));
             $this->assign('enableAnnouncements', $conference->getSetting('enableAnnouncements'));
             $this->assign('pageFooter', $conference->getLocalizedSetting('conferencePageFooter'));
             $this->assign('displayCreativeCommons', $conference->getSetting('postCreativeCommons'));
             $this->assign('analyticsTrackingID', $conference->getSetting('analyticsTrackingID'));
             $this->assign('currentConferenceHome', Request::url(null, $conference->getSetting("path"), 'index'));
             if (isset($schedConf)) {
                 // This will be needed if inheriting public conference files from the scheduled conference.
                 $this->assign('publicSchedConfFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()));
                 $this->assign('primaryLocale', $conference->getSetting('primaryLocale'));
                 $this->assign('alternateLocales', $conference->getPrimaryLocale());
                 $this->assign_by_ref('currentSchedConf', $schedConf);
                 // Assign common sched conf vars:
                 $currentTime = time();
                 $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
                 $this->assign('submissionsCloseDate', $submissionsCloseDate);
                 // ------------------------------------
                 $navMenuItemOrder = array();
                 $navMenuItemNavOrder = array();
                 $this->assign('schedConfPostOverview', $schedConf->getSetting('postOverview'));
                 $this->assign('schedConfPostOverviewOrder', $schedConf->getSetting('postOverviewOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Overview');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Overview');
                 $this->assign('schedConfPostAnnouncement', $schedConf->getSetting('postAnnouncement'));
                 $this->assign('schedConfPostAnnouncementOrder', $schedConf->getSetting('postAnnouncementOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Announcement');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Announcement');
                 $this->assign('schedConfPostTimeline', $schedConf->getSetting('postTimeline'));
                 $this->assign('schedConfPostTimelineOrder', $schedConf->getSetting('postTimelineOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Timeline');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Timeline');
                 // CFP displayed
                 $showCFPDate = $schedConf->getSetting('showCFPDate');
                 $postCFP = $schedConf->getSetting('postCFP');
                 if ($postCFP && $showCFPDate && $submissionsCloseDate && $currentTime > $showCFPDate && $currentTime < $submissionsCloseDate) {
                     $this->assign('schedConfShowCFP', true);
                     $this->assign('schedConfShowCFPOrder', $schedConf->getSetting('postCFPOrder'));
                     $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'CFP');
                     $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'CFP');
                 }
                 $this->assign('schedConfPostPayment', $schedConf->getSetting('postPayment'));
                 $this->assign('schedConfPostPaymentOrder', $schedConf->getSetting('postPaymentOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Payment');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Payment');
                 $this->assign('schedConfPostTrackPolicies', $schedConf->getSetting('postTrackPolicies'));
                 $this->assign('schedConfPostTrackPoliciesOrder', $schedConf->getSetting('postTrackPoliciesOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'TrackPolicies');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'TrackPolicies');
                 $this->assign('schedConfPostPresentations', $schedConf->getSetting('postPresentations'));
                 $this->assign('schedConfPostPresentationsOrder', $schedConf->getSetting('postPresentationsOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Presentations');
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Presentations');
                 $this->assign('schedConfPostLocation', $schedConf->getSetting('postLocation'));
                 $this->assign('schedConfPostLocationOrder', $schedConf->getSetting('postLocationOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Location');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Location');
                 $this->assign('schedConfPostAccommodation', $schedConf->getSetting('postAccommodation'));
                 $this->assign('schedConfPostAccommodationOrder', $schedConf->getSetting('postAccommodationOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Accommodation');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Accommodation');
                 $this->assign('schedConfPostSupporters', $schedConf->getSetting('postSupporters'));
                 $this->assign('schedConfPostSupportersOrder', $schedConf->getSetting('postSupportersOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Supporters');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Supporters');
                 // Schedule displayed
                 $postScheduleDate = $schedConf->getSetting('postScheduleDate');
                 if ($postScheduleDate && $currentTime > $postScheduleDate && $schedConf->getSetting('postSchedule')) {
                     $this->assign('schedConfPostSchedule', true);
                 }
                 // Program
                 //if ($schedConf->getSetting('postProgram') && ($schedConf->getSetting('program') || $schedConf->getSetting('programFile'))) {
                 $this->assign('schedConfShowProgram', true);
                 $this->assign('schedConfShowProgramOrder', $schedConf->getSetting('postProgramOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Program');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Program');
                 //}
                 // Contact & Contact Email
                 if ($schedConf->getSetting('postContact') && ($schedConf->getSetting('postContact') || $schedConf->getSetting('postContact'))) {
                     $this->assign('schedConfShowContact', true);
                     $this->assign('schedConfShowContactOrder', $schedConf->getSetting('postContactOrder'));
                     $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Contact');
                     $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Contact');
                 }
                 if ($schedConf->getSetting('contactEmail') && ($schedConf->getSetting('contactEmail') || $schedConf->getSetting('contactEmail'))) {
                     $this->assign('schedConfContactEmail', $schedConf->getSetting('contactEmail'));
                 }
                 // Submissions open
                 $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
                 $postSubmission = $schedConf->getSetting('postProposalSubmission');
                 $this->assign('submissionsOpenDate', $submissionsOpenDate);
                 $this->assign('schedConfShowProposalSubmissionOrder', $schedConf->getSetting('postProposalSubmissionOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'ProposalSubmission');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'ProposalSubmission');
                 import('payment.ocs.OCSPaymentManager');
                 $paymentManager =& OCSPaymentManager::getManager();
                 $this->assign('schedConfPaymentsEnabled', $paymentManager->isConfigured());
                 // 再加入 $navMenuItems
                 foreach ($navMenuItems as $navItemId => $navItem) {
                     $navItemOrder = 90;
                     if (isset($navItem["order"]) && trim($navItem["order"]) !== "") {
                         $navItemOrder = trim($navItem["order"]);
                     }
                     if (isset($navMenuItemOrder[$navItemOrder]) === FALSE || is_array($navMenuItemOrder[$navItemOrder]) === FALSE) {
                         $navMenuItemOrder[$navItemOrder] = array();
                     }
                     $navMenuItemOrder[$navItemOrder][] = 'schedConfNavItem' . $navItemId;
                     if (isset($navItem["navOrder"]) && trim($navItem["navOrder"]) !== "" && trim($navItem["navOrder"]) !== "0") {
                         $navItemOrder = trim($navItem["order"]);
                         if (isset($navMenuItemNavOrder[$navItemOrder]) === FALSE || is_array($navMenuItemNavOrder[$navItemOrder]) === FALSE) {
                             $navMenuItemNavOrder[$navItemOrder] = array();
                         }
                         $navMenuItemNavOrder[$navItemOrder][] = 'schedConfNavItem' . $navItemId;
                     }
                 }
                 ksort($navMenuItemOrder);
                 $this->assign('schedConfNavMenuItemOrder', $navMenuItemOrder);
                 ksort($navMenuItemNavOrder);
                 $this->assign('schedConfNavMenuItemNavOrder', $navMenuItemNavOrder);
                 //print_r($navMenuItemOrder);
             }
             //if (isset($schedConf)) {
             // Assign conference stylesheet and footer
             $conferenceStyleSheet = $conference->getSetting('conferenceStyleSheet');
             if ($conferenceStyleSheet) {
                 $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()) . '/' . $conferenceStyleSheet['uploadName']);
             }
             // Assign scheduled conference stylesheet and footer (after conference stylesheet!)
             if ($schedConf) {
                 $schedConfStyleSheet = $schedConf->getSetting('schedConfStyleSheet');
                 if ($schedConfStyleSheet) {
                     $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()) . '/' . $schedConfStyleSheet['uploadName']);
                 }
             }
         } else {
             // Not within conference context
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath());
         }
     }
 }
예제 #13
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request = null)
 {
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router = $this->request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $context = $router->getContext($this->request);
         $site = $this->request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $this->request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($this->request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         $this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
         if (isset($context)) {
             $this->assign('currentJournal', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('alternateLocales', $context->getSetting('alternateLocales'));
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getLocalizedPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getLocalizedPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $context->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $context->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $context->getLocalizedFavicon());
             $this->assign('faviconDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
             $this->assign('alternatePageHeader', $context->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $context->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $context->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $context->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $context->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
             $this->assign('hideRegisterLink', !$context->getSetting('allowRegReviewer') && !$context->getSetting('allowRegReader') && !$context->getSetting('allowRegAuthor'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('journalStyleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()) . '/' . $contextStyleSheet['uploadName']);
             }
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($this->request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             // Include footer links if they have been defined.
             $footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
             $footerCategories = $footerCategoryDao->getNotEmptyByContextId($context->getId());
             $this->assign('footerCategories', $footerCategories->toArray());
             $footerLinkDao = DAORegistry::getDAO('FooterLinkDAO');
             $this->assign('maxLinks', $footerLinkDao->getLargestCategoryTotalbyContextId($context->getId()));
             $this->assign('pageFooter', $context->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
             // Load and apply theme plugin, if chosen
             $themePluginPath = $site->getSetting('siteTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
     }
 }
예제 #14
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::Smarty();
     import('file.PublicFileManager');
     import('cache.CacheManager');
     // Set up Smarty configuration
     $baseDir = Core::getBaseDir();
     $cachePath = CacheManager::getFileCachePath();
     $this->template_dir = $baseDir . DIRECTORY_SEPARATOR . 'templates';
     $this->compile_dir = $cachePath . DIRECTORY_SEPARATOR . 't_compile';
     $this->config_dir = $cachePath . DIRECTORY_SEPARATOR . 't_config';
     $this->cache_dir = $cachePath . DIRECTORY_SEPARATOR . 't_cache';
     // Assign common variables
     $this->styleSheets = array();
     $this->assign_by_ref('stylesheets', $this->styleSheets);
     $this->cacheability = CACHEABILITY_NO_STORE;
     // Safe default
     $this->assign('defaultCharset', Config::getVar('i18n', 'client_charset'));
     $this->assign('baseUrl', Request::getBaseUrl());
     $this->assign('pageTitle', 'common.openJournalSystems');
     $this->assign('requestedPage', Request::getRequestedPage());
     $this->assign('currentUrl', Request::getCompleteUrl());
     $this->assign('dateFormatTrunc', Config::getVar('general', 'date_format_trunc'));
     $this->assign('dateFormatShort', Config::getVar('general', 'date_format_short'));
     $this->assign('dateFormatLong', Config::getVar('general', 'date_format_long'));
     $this->assign('datetimeFormatShort', Config::getVar('general', 'datetime_format_short'));
     $this->assign('datetimeFormatLong', Config::getVar('general', 'datetime_format_long'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     $locale = Locale::getLocale();
     $this->assign('currentLocale', $locale);
     if (!defined('SESSION_DISABLE_INIT')) {
         /* Kludge to make sure no code that tries to connect to the database is executed
          * (e.g., when loading installer pages). */
         $this->assign('isUserLoggedIn', Validation::isLoggedIn());
         $journal =& Request::getJournal();
         $site =& Request::getSite();
         $versionDAO =& DAORegistry::getDAO('VersionDAO');
         $currentVersion = $versionDAO->getCurrentVersion();
         $this->assign('currentVersionString', $currentVersion->getVersionString());
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($journal)) {
             $this->assign_by_ref('currentJournal', $journal);
             $journalTitle = $journal->getJournalTitle();
             $this->assign('siteTitle', $journalTitle);
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()));
             $this->assign('primaryLocale', $journal->getPrimaryLocale());
             $this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $journal->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign journal page header
             $this->assign('displayPageHeaderTitle', $journal->getJournalPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $journal->getJournalPageHeaderLogo());
             $this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $journal->getSetting('journalTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $journalStyleSheet = $journal->getSetting('journalStyleSheet');
             if ($journalStyleSheet) {
                 $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()) . '/' . $journalStyleSheet['uploadName']);
             }
             import('payment.ojs.OJSPaymentManager');
             $paymentManager =& OJSPaymentManager::getManager();
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $this->assign('displayPageHeaderTitle', $site->getSitePageHeaderTitle());
             $this->assign('siteTitle', $site->getSiteTitle());
             $this->assign('itemsPerPage', Config::getVar('interface', 'items_per_page'));
             $this->assign('numPageLinks', Config::getVar('interface', 'page_links'));
         }
         if (!$site->getJournalRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
     }
     // If there's a locale-specific stylesheet, add it.
     if (($localeStyleSheet = Locale::getLocaleStyleSheet($locale)) != null) {
         $this->addStyleSheet(Request::getBaseUrl() . '/' . $localeStyleSheet);
     }
     // Register custom functions
     $this->register_modifier('translate', array('Locale', 'translate'));
     $this->register_modifier('strip_unsafe_html', array('String', 'stripUnsafeHtml'));
     $this->register_modifier('String_substr', array('String', 'substr'));
     $this->register_modifier('to_array', array(&$this, 'smartyToArray'));
     $this->register_modifier('escape', array(&$this, 'smartyEscape'));
     $this->register_modifier('explode', array(&$this, 'smartyExplode'));
     $this->register_modifier('assign', array(&$this, 'smartyAssign'));
     $this->register_function('translate', array(&$this, 'smartyTranslate'));
     $this->register_function('flush', array(&$this, 'smartyFlush'));
     $this->register_function('call_hook', array(&$this, 'smartyCallHook'));
     $this->register_function('html_options_translate', array(&$this, 'smartyHtmlOptionsTranslate'));
     $this->register_block('iterate', array(&$this, 'smartyIterate'));
     $this->register_function('call_progress_function', array(&$this, 'smartyCallProgressFunction'));
     $this->register_function('page_links', array(&$this, 'smartyPageLinks'));
     $this->register_function('page_info', array(&$this, 'smartyPageInfo'));
     $this->register_function('get_help_id', array(&$this, 'smartyGetHelpId'));
     $this->register_function('icon', array(&$this, 'smartyIcon'));
     $this->register_function('help_topic', array(&$this, 'smartyHelpTopic'));
     $this->register_function('get_debug_info', array(&$this, 'smartyGetDebugInfo'));
     $this->register_function('assign_mailto', array(&$this, 'smartyAssignMailto'));
     $this->register_function('display_template', array(&$this, 'smartyDisplayTemplate'));
     $this->register_function('url', array(&$this, 'smartyUrl'));
     $this->initialized = false;
 }