- Please, How To Direct Single Journal To Web Root (https://jinabs.com) instead of (http://jinabs.com?index.php/ojs)
- How to remove index.php in ojs
by dev
by dev
ThemePlugin.ini.php
public function init() {
// Load language selection - #most read#
HookRegistry::register ('TemplateManager::display', array($this, 'loadTemplateData'));
}
public function loadTemplateData($hookName, $args) {
$templateMgr = $args[0];
$template = $args[1];
$request = Application::getRequest();
$site = $request->getSite();
$issueDao = DAORegistry::getDAO('IssueDAO');
$journalDao = DAORegistry::getDAO('JournalDAO');
// Start Language selector
$templateMgr->assign('isPostRequest', $request->isPost());
if (!defined('SESSION_DISABLE_INIT')) {
$locales = $site->getSupportedLocales();
} else {
$locales = AppLocale::getAllLocales();
$templateMgr->assign('languageToggleNoUser', true);
}
if (isset($locales) && count($locales) > 1) {
$templateMgr->assign('enableLanguageToggle', true);
$templateMgr->assign('languageToggleLocales', $locales);
}
// End Language selector
// Start Latest issues
$issues = array();
$issueList = array();
$volLabel = __('issue.vol');
$numLabel = __('issue.no');
$result = $issueDao->retrieve("SELECT issue_id FROM issues WHERE published = '1' AND access_status= '1' AND year != '0' ORDER BY date_published DESC LIMIT 6");
while (!$result->EOF) {
$resultRow = $result->GetRowAssoc(false);
$issues[$resultRow['issue_id']] = $issueDao->getById($resultRow['issue_id']);
$result->MoveNext();
}
$result->Close();
foreach($issues as $issueId => $issue){
$journal = $journalDao->getById($issue->getJournalId());
$issueList[$issueId]['journal'] = $journal->getLocalizedName();
$issueList[$issueId]['journalPath'] = $journal->getPath();
if ($issue->getLocalizedCoverImageUrl()){
$issueList[$issueId]['cover'] = $issue->getLocalizedCoverImageUrl();
$issueList[$issueId]['contain'] = true;
}
else{
$issueList[$issueId]['cover'] = $request->getBaseUrl()."/plugins/themes/tsvSite/images/journalfi_default_cover.png";
}
$issueList[$issueId]['path'] = $issue->getBestIssueId();
$volume = $issue->getVolume();
$number = $issue->getNumber();
$year = $issue->getyear();
$issueIdentification = "";
if ($year != "") $issueIdentification = "(".$year.")".$issueIdentification;
if ($number != "0") $issueIdentification = $numLabel." ".$number." ".$issueIdentification;
if ($volume != "0") $issueIdentification = $volLabel." ".$volume." ".$issueIdentification;
$issueList[$issueId]['identification'] = $issueIdentification;
}
$templateMgr->assign('issueList', $issueList);
// End Latest issues
// Start Most read
$metricsDao = DAORegistry::getDAO('MetricsDAO');
$cacheManager =& CacheManager::getManager();
$cache =& $cacheManager->getCache('mostreadsite', 0, array($this, '_cacheMiss'));
$daysToStale = 1;
$cachedMetrics = false;
if (time() - $cache->getCacheTime() > 60 * 60 * 24 * $daysToStale) {
$cachedMetrics = $cache->getContents();
$cache->flush();
}
$resultMetrics = $cache->getContents();
if (!$resultMetrics && $cachedMetrics) {
$resultMetrics = $cachedMetrics;
$cache->setEntireCache($cachedMetrics);
} elseif (!$resultMetrics) {
$cache->flush();
}
$templateMgr->assign('resultMetrics', $resultMetrics);
// End Most read
}
function _cacheMiss($cache) {
$metricsDao = DAORegistry::getDAO('MetricsDAO');
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$journalDao = DAORegistry::getDAO('JournalDAO');
$currentDate = date('Ymd');
$weekAgo = date('Ymd', strtotime("-1 month"));
$result = $metricsDao->retrieve("SELECT submission_id, SUM(metric) AS metric FROM metrics WHERE (day BETWEEN $weekAgo AND $currentDate) AND (assoc_type='515' AND submission_id IS NOT NULL) GROUP BY submission_id ORDER BY metric DESC LIMIT 4");
while (!$result->EOF) {
$resultRow = $result->GetRowAssoc(false);
$article = $publishedArticleDao->getById($resultRow['submission_id']);
$journal = $journalDao->getById($article->getJournalId());
$articles[$resultRow['submission_id']]['journalPath'] = $journal->getPath();
$articles[$resultRow['submission_id']]['journalName'] = $journal->getLocalizedName();
$articles[$resultRow['submission_id']]['articleId'] = $article->getBestArticleId();
$articles[$resultRow['submission_id']]['articleTitle'] = $article->getLocalizedTitle();
$articles[$resultRow['submission_id']]['articleAuthors'] = $article->getAuthorString();
$articles[$resultRow['submission_id']]['datePublished'] = $article->getDatePublished();
$articles[$resultRow['submission_id']]['metric'] = $resultRow['metric'];
$result->MoveNext();
}
$result->Close();
$cache->setEntireCache($articles);
return $result;
}
indexjournal.tpl
<ul class="most_read">
{foreach from=$resultMetrics item=article}
<li class="most_read_article">
<p><em>Open Access</em></p>
<div class="most_read_article_title"><a href="{url journal=$article.journalPath page="article" op="view" path=$article.articleId}">{$article.articleTitle}</a></div>
<div class="most_read_article_authors">
{$article.articleAuthors}
</div>
<div class="most-read-footer">
<div class="most_read_article_journal"><em>Read in the last month:</em> {$article.metric} times</div>
<div class="most_read_article_published"><strong>Published:</strong> <span>{$article.datePublished}</span></div>
</div>
</li>
{/foreach}
</ul>
by dev
Steps to increase Google Scholar citation count
by dev
Checklists
select count(*) from metrics where context_id=1
If there are no metrics, your instance may not be set up to process the usage stats logs.
select * from scheduled_tasks;
You should see a listing for plugins.generic.usageStats.UsageStatsLoader. If you do have that listing, your instance may not be running its scheduled tasks and may not have the correct plugins installed.
select journal_id from journals where path="JOURNALPATH";
select * from metrics where context_id=1 and load_id="usage_events_20221113.log" limit 10;
If there are no entries for that, open up usageStats/archive/usage_events_20201113.log and see if there are any entries for the JOURNALPATH journal.
A quick test. Copy an old usageStats/archive log file into usagestats/stage and run:
php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasks.xml
Check the metrics table in the database. A new record should be added to the metrics table.
by dev
It is not hard to integrate Dimension Badge in OJS. Under /templates/frontend/object/ find and open article_detail.tpl and enter bellow code where you want to the badge.
<span class="__dimensions_badge_embed__" data-doi="{$pubId}" data-legend="always" data-style="small_circle"></span><script async src="https://badge.dimensions.ai/badge.js" charset="utf-8"></script>
You can find more details at https://badge.dimensions.ai/
You can register your journals (free or paid) at Dimensions Badges and Metrics API at https://www.dimensions.ai/metricssignup/