Inheritance: extends Smarty
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request)
 {
     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).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $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, STYLE_SEQUENCE_LAST);
         }
         if (isset($context)) {
             $this->assign('currentPress', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('alternateLocales', $context->getSetting('alternateLocales'));
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getPageHeaderLogo());
             $this->assign('alternatePageHeader', $context->getLocalizedSetting('pageHeader'));
             $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'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath(ASSOC_TYPE_PRESS, $context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
             }
             // 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('pageFooter'));
         } 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());
         }
     }
 }
 /**
  * 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');
         }
     }
 }
Esempio n. 3
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'));
     }
 }
Esempio n. 4
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request)
 {
     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).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $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, STYLE_SEQUENCE_LAST);
         }
         $this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
         if (isset($context)) {
             $this->assign('currentJournal', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $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('displayPageHeaderLogoAltText', $context->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $context->getLocalizedFavicon());
             $this->assign('faviconDir', $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
             $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('contextSettings', $context->getSettingsDAO()->getSettings($context->getId()));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('journalStyleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $router = $request->getRouter();
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'journal'));
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $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());
             $this->assign('primaryLocale', $site->getPrimaryLocale());
         }
     }
 }
Esempio n. 5
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');
         }
     }
 }
Esempio n. 6
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);
         }
     }
 }
Esempio n. 7
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function __construct($request)
 {
     parent::__construct($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).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $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('siteStylesheet', $request->getBaseUrl() . '/' . $siteStyleFilename, array('priority' => STYLE_SEQUENCE_LATE));
         }
         // Pass app-specific details to template
         $this->assign(array('brandImage' => 'templates/images/ojs_brand.png', 'packageKey' => 'common.openJournalSystems', 'pkpLink' => 'http://pkp.sfu.ca/ojs'));
         // Get a count of unread tasks.
         if ($user = $request->getUser()) {
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             // Exclude certain tasks, defined in the notifications grid handler
             import('lib.pkp.controllers.grid.notifications.TaskNotificationsGridHandler');
             $this->assign('unreadNotificationCount', $notificationDao->getNotificationCount(false, $user->getId(), null, NOTIFICATION_LEVEL_TASK));
         }
         if (isset($context)) {
             $this->assign(array('currentJournal' => $context, 'siteTitle' => $context->getLocalizedName(), 'publicFilesDir' => $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()), 'primaryLocale' => $context->getPrimaryLocale(), 'supportedLocales' => $context->getSupportedLocaleNames(), 'displayPageHeaderTitle' => $context->getLocalizedPageHeaderTitle(), 'displayPageHeaderLogo' => $context->getLocalizedPageHeaderLogo(), 'displayPageHeaderLogoAltText' => $context->getLocalizedSetting('pageHeaderLogoImageAltText'), 'numPageLinks' => $context->getSetting('numPageLinks'), 'itemsPerPage' => $context->getSetting('itemsPerPage'), 'enableAnnouncements' => $context->getSetting('enableAnnouncements'), 'contextSettings' => $context->getSettingsDAO()->getSettings($context->getId()), 'disableUserReg' => $context->getSetting('disableUserReg')));
             // Assign meta tags
             $favicon = $context->getLocalizedFavicon();
             if (!empty($favicon)) {
                 $faviconDir = $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId());
                 $this->addHeader('favicon', '<link rel="icon" href="' . $faviconDir . '/' . $favicon['uploadName'] . '">');
             }
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet('contextStylesheet', $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()) . '/' . $contextStyleSheet['uploadName'], array('priority' => STYLE_SEQUENCE_LATE));
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'journal'));
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $context->getLocalizedSetting('pageFooter'));
         } else {
             // Check if registration is open for any contexts
             $contextDao = Application::getContextDAO();
             $contexts = $contextDao->getAll(true)->toArray();
             $contextsForRegistration = array();
             foreach ($contexts as $context) {
                 if (!$context->getSetting('disableUserReg')) {
                     $contextsForRegistration[] = $context;
                 }
             }
             $this->assign(array('contexts' => $contextsForRegistration, 'disableUserReg' => empty($contextsForRegistration), 'displayPageHeaderTitle' => $site->getLocalizedPageHeaderTitle(), 'displayPageHeaderLogo' => $site->getLocalizedSetting('pageHeaderTitleImage'), 'siteTitle' => $site->getLocalizedTitle(), 'primaryLocale' => $site->getPrimaryLocale(), 'supportedLocales' => $site->getSupportedLocaleNames(), 'pageFooter' => $site->getLocalizedSetting('pageFooter')));
         }
     }
 }
Esempio n. 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)
 {
     // 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');
         }
     }
 }
Esempio n. 9
0
 /**
  * Initialize the template manager.
  */
 function initialize()
 {
     // Add uncompilable styles
     $this->addStyleSheet($this->request->getBaseUrl() . '/styles/lib.css', STYLE_SEQUENCE_CORE);
     parent::initialize();
 }
Esempio n. 10
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request)
 {
     parent::PKPTemplateManager($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
     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 = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $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, STYLE_SEQUENCE_LAST);
         }
         if (isset($context)) {
             $this->assign('currentPress', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('alternateLocales', $context->getSetting('alternateLocales'));
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getPageHeaderLogo());
             $this->assign('alternatePageHeader', $context->getLocalizedSetting('pageHeader'));
             $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'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath(ASSOC_TYPE_PRESS, $context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
             }
             // Get context info for use in primary navigation items
             import('pages.about.AboutContextHandler');
             if (in_array('IAboutContextInfoProvider', class_implements('AboutContextHandler'))) {
                 $this->assign('contextInfo', AboutContextHandler::getAboutInfo($context));
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $router = $request->getRouter();
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'press'));
             // 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('pageFooter'));
         } 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());
         }
     }
 }
Esempio n. 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);
         }
     }
 }
Esempio n. 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());
         }
     }
 }
Esempio n. 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);
         }
     }
 }
Esempio n. 14
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function __construct($request)
 {
     parent::__construct($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
     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 = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $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('siteStylesheet', $request->getBaseUrl() . '/' . $siteStyleFilename, array('priority' => STYLE_SEQUENCE_LAST));
         }
         // Pass app-specific details to template
         $this->assign(array('brandImage' => 'templates/images/omp_brand.png', 'packageKey' => 'common.openMonographPress', 'pkpLink' => 'http://pkp.sfu.ca/omp'));
         // Get a count of unread tasks.
         if ($user = $request->getUser()) {
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             // Exclude certain tasks, defined in the notifications grid handler
             import('lib.pkp.controllers.grid.notifications.TaskNotificationsGridHandler');
             $this->assign('unreadNotificationCount', $notificationDao->getNotificationCount(false, $user->getId(), null, NOTIFICATION_LEVEL_TASK));
         }
         if (isset($context)) {
             $this->assign('currentPress', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('supportedLocales', $context->getSupportedLocaleNames());
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getPageHeaderLogo());
             $this->assign('numPageLinks', $context->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
             $this->assign('disableUserReg', $context->getSetting('disableUserReg'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet('contextStylesheet', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath(ASSOC_TYPE_PRESS, $context->getId()) . '/' . $contextStyleSheet['uploadName'], array('priority' => STYLE_SEQUENCE_LAST));
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'press'));
             $this->assign('pageFooter', $context->getLocalizedSetting('pageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $site->getLocalizedSetting('pageHeaderTitleImage'));
             $this->assign('siteTitle', $site->getLocalizedTitle());
             $this->assign('primaryLocale', $site->getPrimaryLocale());
             $this->assign('supportedLocales', $site->getSupportedLocaleNames());
             // Check if registration is open for any contexts
             $contextDao = Application::getContextDAO();
             $contexts = $contextDao->getAll(true)->toArray();
             $contextsForRegistration = array();
             foreach ($contexts as $context) {
                 if (!$context->getSetting('disableUserReg')) {
                     $contextsForRegistration[] = $context;
                 }
             }
             $this->assign('contexts', $contextsForRegistration);
             $this->assign('disableUserReg', empty($contextsForRegistration));
         }
     }
 }