OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki


How to show the view times to the visitors?

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, michael, jheckman, barbarah, btbell, bdgregg, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

How to show the view times to the visitors?

Postby mer » Mon Feb 18, 2013 1:56 am

The editor can see the view times in the editing section. But how to show the view times to any
visitors?
mer
 
Posts: 3
Joined: Thu Jan 31, 2013 5:03 am

Re: How to show the view times to the visitors?

Postby alirezaaa » Sun Mar 31, 2013 10:49 pm

Hello mer,
I managed to do this by making these changes in the article class files. This function displays how many times the PDF galley file is downloaded.
If you need to find out the abstract views, you should change the SQL query a little.
First create a backup from each file, then make these necessary changes. You can change the function names as you wish.

1- add this function to /classes/article/PublishedArticleDAO.inc.php
Code: Select all
function getGalleysCountNum($Id)
         {
      $result =& $this->retrieve(
         'SELECT views
         FROM article_galleys
         WHERE label= "PDF" AND article_id = ?',$Id
      );
               return $result;
        }


2- add this function to /classes/article/PublishedArticle.inc.php
Code: Select all
function findGalleyVisitCount($Id)
       {
              $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
              $count = $publishedArticleDao->getGalleysCountNum($Id);
              return $count;
       }


3- now you can call this function in /templates/article/article.tpl
Code: Select all
{$article->findGalleyVisitCount($article->getId())}


I Hope it helps.
Best,
Ali
Last edited by alirezaaa on Mon Apr 01, 2013 2:34 am, edited 1 time in total.
alirezaaa
 
Posts: 25
Joined: Sat Jul 09, 2011 9:54 am

Re: How to show the view times to the visitors?

Postby Garant » Mon Apr 01, 2013 2:06 am

Hi, alirezaaa!
It works :)
Thank you!
Garant
 
Posts: 97
Joined: Wed May 30, 2012 8:53 am


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 2 guests