Inheritance: extends Gdn_Plugin
Example #1
0
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr PKPTemplateManager
  * @param $request PKPRequest
  * @return String
  */
 function getContents(&$templateMgr, $request = null)
 {
     if ($request->getRequestedPage() . '/' . $request->getRequestedOp() !== 'record/view') {
         return '';
     }
     return parent::getContents($templateMgr, $request);
 }
 function getContents(&$templateMgr)
 {
     if (Request::getRequestedPage() . '/' . Request::getRequestedOp() !== 'record/view') {
         return '';
     }
     return parent::getContents($templateMgr);
 }
 /**
  * Determine the plugin sequence. Overrides parent so that
  * the plugin will be displayed during install.
  */
 function getSeq()
 {
     if (!Config::getVar('general', 'installed')) {
         return 0;
     }
     return parent::getSeq();
 }
 function getContents(&$templateMgr)
 {
     $pressDao =& DAORegistry::getDAO('PressDAO');
     $presses =& $pressDao->getPresses();
     $presses =& $presses->toArray();
     $templateMgr->assign_by_ref('presses', $presses);
     return parent::getContents($templateMgr);
 }
Example #5
0
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         $this->addLocaleData();
     }
     return $success;
 }
 function getContents(&$templateMgr)
 {
     if (!defined('SESSION_DISABLE_INIT')) {
         $session =& Request::getSession();
         $templateMgr->assign_by_ref('userSession', $session);
         $templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
     }
     return parent::getContents($templateMgr);
 }
Example #7
0
 /**
  * @see BlockPlugin::getContents
  */
 function getContents($templateMgr, $request = null)
 {
     $journal = $request->getJournal();
     if (!$journal) {
         return '';
     }
     $templateMgr->assign(array('forReaders' => $journal->getLocalizedSetting('readerInformation'), 'forAuthors' => $journal->getLocalizedSetting('authorInformation'), 'forLibrarians' => $journal->getLocalizedSetting('librarianInformation')));
     return parent::getContents($templateMgr, $request);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $conference =& Request::getConference();
     if (!$conference) {
         return '';
     }
     $templateMgr->assign('forReaders', $conference->getLocalizedSetting('readerInformation'));
     $templateMgr->assign('forAuthors', $conference->getLocalizedSetting('authorInformation'));
     return parent::getContents($templateMgr);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     // Only show the block for article pages.
     switch (Request::getRequestedPage() . '/' . Request::getRequestedOp()) {
         case 'article/view':
             return parent::getContents($templateMgr);
         default:
             return '';
     }
 }
Example #10
0
 function getContents(&$templateMgr)
 {
     $navMenuItems = $templateMgr->get_template_vars('navMenuItems');
     foreach ($navMenuItems as $navMenuKey => $navMenuItem) {
         $navMenuItems[$navMenuKey] = array_filter($navMenuItem);
     }
     $navMenuItems = array_filter($navMenuItems);
     $templateMgr->assign('countNavMenuItems', count($navMenuItems));
     return parent::getContents($templateMgr);
 }
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     if (!$journal) {
         return '';
     }
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     $templateMgr->assign('donationEnabled', $paymentManager->donationEnabled());
     return parent::getContents($templateMgr);
 }
 function getContents(&$templateMgr)
 {
     $user =& Request::getUser();
     $journal =& Request::getJournal();
     if ($user && $journal) {
         $userId = $user->getId();
         $notificationDao =& DAORegistry::getDAO('NotificationDAO');
         $templateMgr->assign('unreadNotifications', $notificationDao->getUnreadNotificationCount($userId));
     }
     return parent::getContents($templateMgr);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @param $request PKPRequest
  * @return $string
  */
 function getContents(&$templateMgr, $request = null)
 {
     $user =& $request->getUser();
     $conference =& $request->getConference();
     if ($user && $conference) {
         $userId = $user->getId();
         $notificationDao = DAORegistry::getDAO('NotificationDAO');
         $templateMgr->assign('unreadNotifications', $notificationDao->getNotificationCount(false, $userId, $conference->getId()));
     }
     return parent::getContents($templateMgr, $request);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr, $request = null)
 {
     $press = $request->getPress();
     if (!$press) {
         return '';
     }
     $templateMgr->assign('forReaders', $press->getLocalizedSetting('readerInformation'));
     $templateMgr->assign('forAuthors', $press->getLocalizedSetting('authorInformation'));
     $templateMgr->assign('forLibrarians', $press->getLocalizedSetting('librarianInformation'));
     return parent::getContents($templateMgr);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     if (!$journal) {
         return '';
     }
     $templateMgr->assign('forReaders', $journal->getLocalizedSetting('readerInformation'));
     $templateMgr->assign('forAuthors', $journal->getLocalizedSetting('authorInformation'));
     $templateMgr->assign('forLibrarians', $journal->getLocalizedSetting('librarianInformation'));
     return parent::getContents($templateMgr);
 }
Example #16
0
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @param $request PKPRequest
  * @return $string
  */
 function getContents(&$templateMgr, $request = null)
 {
     if (!defined('SESSION_DISABLE_INIT')) {
         $session =& $request->getSession();
         $templateMgr->assign_by_ref('userSession', $session);
         $templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
         $loginUrl = $request->url(null, null, 'login', 'signIn');
         if (Config::getVar('security', 'force_login_ssl')) {
             $loginUrl = String::regexp_replace('/^http:/', 'https:', $loginUrl);
         }
         $templateMgr->assign('userBlockLoginUrl', $loginUrl);
     }
     return parent::getContents($templateMgr, $request);
 }
 function getContents(&$templateMgr)
 {
     if (!defined('SESSION_DISABLE_INIT')) {
         $session =& Request::getSession();
         $templateMgr->assign_by_ref('userSession', $session);
         $templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
         $loginUrl = Request::url(null, 'login', 'signIn');
         $templateMgr->assign('paperPackageUpPlugin', "/index.php/mr2/PaperPackageUpPlugin/view/");
         if (Config::getVar('security', 'force_login_ssl')) {
             $loginUrl = String::regexp_replace('/^http:/', 'https:', $loginUrl);
         }
         $templateMgr->assign('userBlockLoginUrl', $loginUrl);
     }
     return parent::getContents($templateMgr);
 }
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     $journal_id = $journal->getId();
     $templateMgr->assign('packageCount', 0);
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $resultFacotry =& $articleDao->getArticlesByJournalId($journal_id);
     $result = $resultFacotry->getCount();
     //	error_log('OJS - CountBlock: Was ist das Result ' . $result);
     //$result = $this->retrieve("select count(*) as c from published_articles WHERE date_published IS NOT NULL", array());
     $templateMgr->assign('packageCount', $result);
     //if(!$result->EOF){
     //  $templateMgr->assign('packageCount', intval($row['c']));
     //}
     return parent::getContents($templateMgr);
 }
 function getContents(&$templateMgr)
 {
     if (!defined('SESSION_DISABLE_INIT')) {
         $session =& Request::getSession();
         $templateMgr->assign_by_ref('userSession', $session);
         $templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
         $loginUrl = Request::url(null, 'login', 'signIn');
         // if the page is not ssl enabled, and force_login_ssl is set, this flag will present a link instead of the form
         $forceSSL = false;
         if (Config::getVar('security', 'force_login_ssl')) {
             if (Request::getProtocol() != 'https') {
                 $loginUrl = Request::url(null, 'login');
                 $forceSSL = true;
             }
             $loginUrl = String::regexp_replace('/^http:/', 'https:', $loginUrl);
         }
         $templateMgr->assign('userBlockLoginSSL', $forceSSL);
         $templateMgr->assign('userBlockLoginUrl', $loginUrl);
     }
     return parent::getContents($templateMgr);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     $cacheManager =& CacheManager::getManager();
     $cache =& $cacheManager->getFileCache('keywords_' . AppLocale::getLocale(), $journal->getId(), array(&$this, '_cacheMiss'));
     // If the cache is older than a couple of days, regenerate it
     if (time() - $cache->getCacheTime() > 60 * 60 * 24 * KEYWORD_BLOCK_CACHE_DAYS) {
         $cache->flush();
     }
     $keywords =& $cache->getContents();
     if (empty($keywords)) {
         return '';
     }
     // Get the max occurrences for all keywords
     $maxOccurs = array_shift(array_values($keywords));
     // Now sort the array alphabetically
     ksort($keywords);
     $templateMgr->assign_by_ref('cloudKeywords', $keywords);
     $templateMgr->assign_by_ref('maxOccurs', $maxOccurs);
     return parent::getContents($templateMgr);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @param $request PKPRequest
  * @return $string
  */
 function getContents(&$templateMgr, $request)
 {
     $journal =& $request->getJournal();
     $journalId = $journal ? $journal->getId() : null;
     if (!$journal) {
         return '';
     }
     if ($journal->getSetting('publishingMode') != PUBLISHING_MODE_SUBSCRIPTION) {
         return '';
     }
     $user =& $request->getUser();
     $userId = $user ? $user->getId() : null;
     $templateMgr->assign('userLoggedIn', isset($userId) ? true : false);
     if (isset($userId)) {
         $subscriptionDao =& DAORegistry::getDAO('IndividualSubscriptionDAO');
         $individualSubscription =& $subscriptionDao->getSubscriptionByUserForJournal($userId, $journalId);
         $templateMgr->assign_by_ref('individualSubscription', $individualSubscription);
     }
     // If no individual subscription or if not valid, check for institutional subscription
     if (!isset($individualSubscription) || !$individualSubscription->isValid()) {
         $ip = $request->getRemoteAddr();
         $domain = Request::getRemoteDomain();
         $subscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
         $subscriptionId = $subscriptionDao->isValidInstitutionalSubscription($domain, $ip, $journalId);
         if ($subscriptionId) {
             $institutionalSubscription =& $subscriptionDao->getSubscription($subscriptionId);
             $templateMgr->assign_by_ref('institutionalSubscription', $institutionalSubscription);
             $templateMgr->assign('userIP', $ip);
         }
     }
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager = new OJSPaymentManager($request);
     if (isset($individualSubscription) || isset($institutionalSubscription)) {
         $acceptSubscriptionPayments = $paymentManager->acceptSubscriptionPayments();
         $templateMgr->assign('acceptSubscriptionPayments', $acceptSubscriptionPayments);
     }
     $acceptGiftSubscriptionPayments = $paymentManager->acceptGiftSubscriptionPayments();
     $templateMgr->assign('acceptGiftSubscriptionPayments', $acceptGiftSubscriptionPayments);
     return parent::getContents($templateMgr, $request);
 }
 function getContents(&$templateMgr)
 {
     $templateMgr =& TemplateManager::getManager();
     $user =& Request::getUser();
     $locale = 'en_US';
     $articles = NULL;
     $templateMgr->assign('user', $user);
     if (isset($user)) {
         $userId = $user->getId();
         $articleDAO =& DAORegistry::getDAO('ArticleDAO');
         $articles =& $articleDAO->getArticlesByUserId($userId, $journalId = null);
         $titles = array();
         $authors = array();
         $articleIds = array();
         $n = 0;
         $templateMgr->assign('articles', $articles);
         $templateMgr->assign('locale', $locale);
         $templateMgr->assign('uploadLink', '/index.php/mr2/PaperPackageUpPlugin/view/');
         //$templateMgr->assign('uploadLink', '/index.php/mr2/generic/plugin/PaperPackageUpPlugin');
         $templateMgr->assign('viewLink', '/index.php/mr2/article/view/');
         $templateMgr->assign('editLink', '/index.php/mr2/PaperPackageEdPlugin/view/article=');
         //$templateMgr->assign('editLink', '/index.php/mr2/manager/importexport/plugin/PaperPackageEditPlugin/article=');
         return parent::getContents($templateMgr);
     }
 }
 /**
  * @see BlockPlugin::getContents()
  */
 function getContents(&$templateMgr, $request = null)
 {
     // Get facets from the parent plug-in.
     $plugin =& $this->_getLucenePlugin();
     $facets = $plugin->getFacets();
     // Check whether we got any facets to display.
     $hasFacets = false;
     if (is_array($facets)) {
         foreach ($facets as $facetCategory => $facetList) {
             if (count($facetList) > 0) {
                 $hasFacets = true;
                 break;
             }
         }
     }
     // Do not display the block if we got no facets.
     if (!$hasFacets) {
         return '';
     }
     $templateMgr->assign('facets', $facets);
     return parent::getContents($templateMgr, $request);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     if (!$journal) {
         return '';
     }
     $journalId = $journal->getId();
     $plugin =& $this->getExternalFeedPlugin();
     if (!$plugin->getEnabled()) {
         return '';
     }
     $requestedPage = Request::getRequestedPage();
     $externalFeedDao =& DAORegistry::getDAO('ExternalFeedDAO');
     $plugin->import('simplepie.SimplePie');
     $feeds =& $externalFeedDao->getExternalFeedsByJournalId($journal->getId());
     while ($currentFeed =& $feeds->next()) {
         $displayBlock = $currentFeed->getDisplayBlock();
         if ($displayBlock == EXTERNAL_FEED_DISPLAY_BLOCK_NONE || $displayBlock == EXTERNAL_FEED_DISPLAY_BLOCK_HOMEPAGE && !empty($requestedPage) && $requestedPage != 'index') {
             continue;
         }
         $feed =& new SimplePie();
         $feed->set_feed_url($currentFeed->getUrl());
         $feed->enable_order_by_date(false);
         $feed->set_cache_location(CacheManager::getFileCachePath());
         $feed->init();
         if ($currentFeed->getLimitItems()) {
             $recentItems = $currentFeed->getRecentItems();
         } else {
             $recentItems = 0;
         }
         $externalFeeds[] = array('title' => $currentFeed->getLocalizedTitle(), 'items' => $feed->get_items(0, $recentItems));
     }
     if (!isset($externalFeeds)) {
         return '';
     }
     $templateMgr->assign_by_ref('externalFeeds', $externalFeeds);
     return parent::getContents($templateMgr);
 }
 /**
  * Get the HTML contents of the browse block.
  * @param $templateMgr PKPTemplateManager
  * @return string
  */
 function getContents($templateMgr, $request = null)
 {
     $press = $request->getPress();
     $browseNewReleases = $this->getSetting($press->getId(), 'browseNewReleases');
     $templateMgr->assign('browseNewReleases', $browseNewReleases);
     $seriesDisplay = $this->getSetting($press->getId(), 'browseSeries');
     if ($seriesDisplay) {
         // Provide a list of series to browse
         $seriesDao = DAORegistry::getDAO('SeriesDAO');
         $series = $seriesDao->getByPressId($press->getId());
         $templateMgr->assign('browseSeriesFactory', $series);
     }
     $categoriesDisplay = $this->getSetting($press->getId(), 'browseCategories');
     if ($categoriesDisplay) {
         // Provide a list of categories to browse
         $categoryDao = DAORegistry::getDAO('CategoryDAO');
         $categories = $categoryDao->getByPressId($press->getId());
         $templateMgr->assign('browseCategoryFactory', $categories);
     }
     // If we're currently viewing a series or catalog, detect it
     // so that we can highlight the current selection in the
     // dropdown.
     $router = $request->getRouter();
     switch ($router->getRequestedOp($request)) {
         case 'category':
             $args = $router->getRequestedArgs($request);
             $templateMgr->assign('browseBlockSelectedCategory', reset($args));
             break;
         case 'series':
             $args = $router->getRequestedArgs($request);
             $templateMgr->assign('browseBlockSelectedSeries', reset($args));
             break;
     }
     return parent::getContents($templateMgr);
 }
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     return parent::getContents($templateMgr);
 }
 /**
  * Get the contents for this block.
  * @param $templateMgr object
  * @return string
  */
 function getContents(&$templateMgr)
 {
     $templateMgr->assign('articleSearchByOptions', array('' => 'search.allFields', ARTICLE_SEARCH_AUTHOR => 'search.author', ARTICLE_SEARCH_TITLE => 'article.title', ARTICLE_SEARCH_ABSTRACT => 'search.abstract', ARTICLE_SEARCH_INDEX_TERMS => 'search.indexTerms', ARTICLE_SEARCH_GALLEY_FILE => 'search.fullText'));
     return parent::getContents($templateMgr);
 }
 /**
  * @see BlockPlugin::getContents
  */
 function getContents(&$templateMgr, $request = null)
 {
     $journal = $request->getJournal();
     if (!$journal) {
         return '';
     }
     if (!$journal->getSetting('enableAnnouncements')) {
         return '';
     }
     $plugin =& $this->getAnnouncementFeedPlugin();
     $displayPage = $plugin->getSetting($journal->getId(), 'displayPage');
     $requestedPage = $request->getRequestedPage();
     if ($displayPage == 'all' || $displayPage == 'homepage' && (empty($requestedPage) || $requestedPage == 'index' || $requestedPage == 'announcement') || $displayPage == $requestedPage) {
         return parent::getContents($templateMgr, $request);
     } else {
         return '';
     }
 }
 /**
  * Get the HTML contents for this block.
  */
 function getContents(&$templateMgr)
 {
     $templateMgr->assign('isPostRequest', Request::isPost());
     if (!defined('SESSION_DISABLE_INIT')) {
         $journal =& Request::getJournal();
         if (isset($journal)) {
             $locales =& $journal->getSupportedLocaleNames();
         } else {
             $site =& Request::getSite();
             $locales =& $site->getSupportedLocaleNames();
         }
     } else {
         $locales =& AppLocale::getAllLocales();
         $templateMgr->assign('languageToggleNoUser', true);
     }
     if (isset($locales) && count($locales) > 1) {
         $templateMgr->assign('enableLanguageToggle', true);
         $templateMgr->assign('languageToggleLocales', $locales);
     }
     return parent::getContents($templateMgr);
 }
Example #30
0
 /**
  * Get the HTML contents for this block.
  * @param $templateMgr object
  * @return $string
  */
 function getContents(&$templateMgr)
 {
     $journal =& Request::getJournal();
     if (!$journal) {
         return '';
     }
     $plugin =& $this->getWebFeedPlugin();
     $displayPage = $plugin->getSetting($journal->getId(), 'displayPage');
     $requestedPage = Request::getRequestedPage();
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $currentIssue =& $issueDao->getCurrentIssue($journal->getId(), true);
     if ($currentIssue && ($displayPage == 'all' || $displayPage == 'homepage' && (empty($requestedPage) || $requestedPage == 'index' || $requestedPage == 'issue') || $displayPage == 'issue' && $displayPage == $requestedPage)) {
         return parent::getContents($templateMgr);
     } else {
         return '';
     }
 }