OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



What .tpl file can I look this code?

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

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

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

What .tpl file can I look this code?

Postby darryl » Tue Nov 20, 2012 7:41 pm

Hi Good Day to All,

I am a newbies on Smarty codes;

I would like some of help to you, I am looking the .tpl file for this code <div class="homepageImage">.

First, I have the OJS Website, it published of all our journals here. We have many journals of published online here. I don't have problem yet, cause the all functionally and no error that encountered.

Second, I get some ideas to do in our Main Page of OJS. I want to changed the CSS or Add the CSS file for the inline post of our journals.

examples on this website, there journals are arrange in to inline posts.
http://ejournals.ph/

I want to be same on that view actually, Also we are published our journals there. Our Advancing and Asians Journals are published on that link above, We published our own journal also.
here is the link http://asianscientificjournals.com/publication/ I want my site to be the same features on that not at all..

third, Where can I see this code <div class="homepageImage">? or what .tpl file to put this code? I check the header.tpl and look this code, i can't see..

so When I check firebug add onns and Inspect elements, I saw this code.

Code: Select all
<div style="clear:left;">
<div class="homepageImage">
<a class="action" href="http://asianscientificjournals.com/publication/index.php/aleps">
<img alt="Page Header Logo" src="http://asianscientificjournals.com/publication/public/journals/11/homepageImage_en_US.jpg">
</a>
</div>
</div>
<h3>Advancing Law Enforcement and Public Safety Research</h3>
<p></p>
<p>
Discipline: Law Enforcement; Public Safety
<br>
Publisher:
<a target="_blank" href="http://www.liceo.edu.ph/" title="Liceo de Cagayan University">Liceo de Cagayan University</a>
</p>
<p>
<img width="25" height="25" alt="" src="/publication/resources/buttons/ched_gray.gif">
<img width="25" height="25" alt="" src="/publication/resources/buttons/iaaj_gray.gif">
<img width="25" height="25" alt="" src="/publication/resources/buttons/scopus_gray.gif">
<img width="25" height="25" alt="" src="/publication/resources/buttons/thomson_gray.gif">
<img width="25" height="25" alt="" src="/publication/resources/buttons/crossref.gif">
</p>
<p></p>
<p>
<a class="action" href="http://asianscientificjournals.com/publication/index.php/aleps">View Journal</a>
|
<a class="action" href="http://asianscientificjournals.com/publication/index.php/aleps/issue/current">Current Issue</a>
|
<a class="action" href="http://asianscientificjournals.com/publication/index.php/aleps/user/register">Register</a>
</p>


inlinepost.png
here is the image file, that I want to be same in our OJS. I'm looking .tpl file on this.
inlinepost.png (309.26 KiB) Viewed 4259 times
Attachments
line-to-line.png
here is our website that display the linear ..
line-to-line.png (120.38 KiB) Viewed 4258 times
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby springday » Thu Nov 29, 2012 2:36 pm

Hi Darryl,

the template file that you are looking for is located in /lib/pkp/templates/common/header.tpl.

Best regards,
Kai Weber
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: What .tpl file can I look this code?

Postby darryl » Fri Nov 30, 2012 5:50 pm

springday wrote:Hi Darryl,

the template file that you are looking for is located in /lib/pkp/templates/common/header.tpl.

Best regards,
Kai Weber


Hi Kai Weber,

I appreciate your response in this topic.

I checked the file you mean, but I can not see the Homepame Image.

Here is the header.tpl file
Code: Select all
{**
 * header.tpl
 *
 * Copyright (c) 2000-2012 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * Common site header.
 *}
{strip}
{if !$pageTitleTranslated}{translate|assign:"pageTitleTranslated" key=$pageTitle}{/if}
{if $pageCrumbTitle}
   {translate|assign:"pageCrumbTitleTranslated" key=$pageCrumbTitle}
{elseif !$pageCrumbTitleTranslated}
   {assign var="pageCrumbTitleTranslated" value=$pageTitleTranslated}
{/if}
{/strip}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset={$defaultCharset|escape}" />
   <title>{$pageTitleTranslated}</title>
   <meta name="description" content="{$metaSearchDescription|escape}" />
   <meta name="keywords" content="{$metaSearchKeywords|escape}" />
   <meta name="generator" content="{$applicationName} {$currentVersionString|escape}" />
   {$metaCustomHeaders}
   {if $displayFavicon}<link rel="icon" href="{$faviconDir}/{$displayFavicon.uploadName|escape:"url"}" />{/if}
   
   <link rel="stylesheet" href="{$baseUrl}/lib/pkp/styles/pkp.css" type="text/css" />
   <link rel="stylesheet" href="{$baseUrl}/lib/pkp/styles/common.css" type="text/css" />
   <link rel="stylesheet" href="{$baseUrl}/styles/common.css" type="text/css" />

   <!-- Base Jquery -->
   {if $allowCDN}<script type="text/javascript" src="http://www.google.com/jsapi"></script>
   <script type="text/javascript">{literal}
      // Provide a local fallback if the CDN cannot be reached
      if (typeof google == 'undefined') {
         document.write(unescape("%3Cscript src='{/literal}{$baseUrl}{literal}/lib/pkp/js/lib/jquery/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
         document.write(unescape("%3Cscript src='{/literal}{$baseUrl}{literal}/lib/pkp/js/lib/jquery/plugins/jqueryUi.min.js' type='text/javascript'%3E%3C/script%3E"));
      } else {
         google.load("jquery", "{/literal}{$smarty.const.CDN_JQUERY_VERSION}{literal}");
         google.load("jqueryui", "{/literal}{$smarty.const.CDN_JQUERY_UI_VERSION}{literal}");
      }
   {/literal}</script>
   {else}
   <script type="text/javascript" src="{$baseUrl}/lib/pkp/js/lib/jquery/jquery.min.js"></script>
   <script type="text/javascript" src="{$baseUrl}/lib/pkp/js/lib/jquery/plugins/jqueryUi.min.js"></script>
   {/if}

   {call_hook|assign:"leftSidebarCode" name="Templates::Common::LeftSidebar"}
   {call_hook|assign:"rightSidebarCode" name="Templates::Common::RightSidebar"}
   {if $leftSidebarCode || $rightSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/sidebar.css" type="text/css" />{/if}
   {if $leftSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/leftSidebar.css" type="text/css" />{/if}
   {if $rightSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/rightSidebar.css" type="text/css" />{/if}
   {if $leftSidebarCode && $rightSidebarCode}<link rel="stylesheet" href="{$baseUrl}/styles/bothSidebars.css" type="text/css" />{/if}

   {foreach from=$stylesheets item=cssUrl}
      <link rel="stylesheet" href="{$cssUrl}" type="text/css" />
   {/foreach}

   <script type="text/javascript" src="{$baseUrl}/lib/pkp/js/general.js"></script>
   <script type="text/javascript" src="{$baseUrl}/lib/pkp/js/tag-it.js"></script>
   <!-- Add javascript required for font sizer -->
   <script type="text/javascript" src="{$baseUrl}/lib/pkp/js/jquery.cookie.js"></script>
   <script type="text/javascript" src="{$baseUrl}/lib/pkp/js/fontController.js" ></script>
   <script type="text/javascript">{literal}
      $(function(){
         fontSize("#sizer", "body", 9, 16, 32, "{/literal}{$basePath|escape:"javascript"}{literal}"); // Initialize the font sizer
      });
   {/literal}</script>

   <script type="text/javascript">
        // initialise plugins
      {literal}
        $(function(){
           {/literal}{if $validateId}{literal}
         jqueryValidatorI18n("{/literal}{$baseUrl}{literal}", "{/literal}{$currentLocale}{literal}"); // include the appropriate validation localization
         $("form[name={/literal}{$validateId}{literal}]").validate({
            errorClass: "error",
            highlight: function(element, errorClass) {
               $(element).parent().parent().addClass(errorClass);
            },
            unhighlight: function(element, errorClass) {
               $(element).parent().parent().removeClass(errorClass);
            }
         });
         {/literal}{/if}{literal}
      });
      {/literal}
   </script>

   <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-36575686-1']);
  _gaq.push(['_setDomainName', 'asianscientificjournals.com']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
   
   {$additionalHeadData}
</head>
<body>

<div id="container" >

<div id="header">
<div id="headerTitle">
  <h1>
    {if $displayPageHeaderLogo && is_array($displayPageHeaderLogo)}
    <img src="{$publicFilesDir}/{$displayPageHeaderLogo.uploadName|escape:"url"}" width="{$displayPageHeaderLogo.width|escape}" height="{$displayPageHeaderLogo.height|escape}" {if $displayPageHeaderLogoAltText != ''}alt="{$displayPageHeaderLogoAltText|escape}"{else}alt="{translate key="common.pageHeaderLogo.altText"}"{/if} />
    {/if}
    {if $displayPageHeaderTitle && is_array($displayPageHeaderTitle)}
    <img src="{$publicFilesDir}/{$displayPageHeaderTitle.uploadName|escape:"url"}" width="{$displayPageHeaderTitle.width|escape}" height="{$displayPageHeaderTitle.height|escape}" {if $displayPageHeaderTitleAltText != ''}alt="{$displayPageHeaderTitleAltText|escape}"{else}alt="{translate key="common.pageHeader.altText"}"{/if} />
    {elseif $displayPageHeaderTitle}
    {$displayPageHeaderTitle}
    {elseif $alternatePageHeader}
    {$alternatePageHeader}
    {elseif $siteTitle}
    {$siteTitle}
    {else}
    {$applicationName}
    {/if}
  </h1>
</div>
</div>

<div id="body">

{if $leftSidebarCode || $rightSidebarCode}
   <div id="sidebar">
      {if $leftSidebarCode}
         <div id="leftSidebar">
            {$leftSidebarCode}
         </div>
      {/if}
      {if $rightSidebarCode}
         <div id="rightSidebar">
            {$rightSidebarCode}
         </div>
      {/if}
   </div>
{/if}

<div id="main">
{include file="common/navbar.tpl"}

{include file="common/breadcrumbs.tpl"}

<h2>{$pageTitleTranslated}</h2>

{if $pageSubtitle && !$pageSubtitleTranslated}{translate|assign:"pageSubtitleTranslated" key=$pageSubtitle}{/if}
{if $pageSubtitleTranslated}
   <h3>{$pageSubtitleTranslated}</h3>
{/if}

<div id="content">



for breadcrumbs.tpl file
Code: Select all
{**
 * breadcrumbs.tpl
 *
 * Copyright (c) 2000-2012 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * Breadcrumbs
 *
 *}
<div id="breadcrumb">
   <a href="{url context=$homeContext page="index"}">{translate key="navigation.home"}</a> &gt;
   {foreach from=$pageHierarchy item=hierarchyLink}
      <a href="{$hierarchyLink[0]|escape}" class="hierarchyLink">{if not $hierarchyLink[2]}{translate key=$hierarchyLink[1]}{else}{$hierarchyLink[1]|escape}{/if}</a> &gt;
   {/foreach}
   {* Disable linking to the current page if the request is a post (form) request. Otherwise following the link will lead to a form submission error. *}
   {if $requiresFormRequest}<span class="current">{else}<a href="{$currentUrl|escape}" class="current">{/if}{$pageCrumbTitleTranslated}{if $requiresFormRequest}</span>{else}</a>{/if}
</div>



My Point is where in the .tpl file can view this CSS/ Div <div class="homepageImage">


Regards
Darryl
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby springday » Sat Dec 01, 2012 3:02 pm

Hi Darryl,

sorry, I got it wrong. I mistook the "homePageImage" for the header image, but actually it is the image for each journal in the homepage's journal overview.
The code for this is in /templates/index/site.tpl.

Best regards,
Kai
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: What .tpl file can I look this code?

Postby darryl » Sat Dec 01, 2012 9:33 pm

springday wrote:Hi Darryl,

sorry, I got it wrong. I mistook the "homePageImage" for the header image, but actually it is the image for each journal in the homepage's journal overview.
The code for this is in /templates/index/site.tpl.

Best regards,
Kai


Wow , Thanks for your help kai,.. I saw it the site.tpl file.

it's helpful to me..

I have one question kai,.. how can I code the previous issues in the site.tpl?

Here is the code I want to insert the Previous Issues.

Code: Select all
<p><a href="{url journal=$journal->getPath()}" class="action">{translate key="site.journalView"}</a> |
  <a href="{url journal=$journal->getPath() page="issue" op="current"}" class="action">{translate key="site.journalCurrent"}</a> |
<!-----Insert the previous issues code here, but how? I tried the code input below------>
<a href="{url journal=$journal->getPath() page="issue" op="Previous"}" class="action">{translate key="site.journalPrevious"}</a> |
<!------previous issues code end----->
<a href="{url journal=$journal->getPath() page="user" op="register"}" class="action">{translate key="site.journalRegister"}</a></p>
Attachments
previoustry.png
Previous try to code.. but not effective..
previoustry.png (44.22 KiB) Viewed 4157 times
input the previous issue.png
I want to insert the link Previous Issues, But How?
input the previous issue.png (44.52 KiB) Viewed 4157 times
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby springday » Sun Dec 02, 2012 11:17 am

Hi Darryl,

there is no "operation" called "Previous" defined in standard OJS. You can change your code fragment

Code: Select all
op="Previous"


to

Code: Select all
op="archive"


It's the same problem with your translate key: no definition for "site.journalPrevious". If you want to define it, you can add a <message> to the file /locale/en_US/locale.xml.

If you want to understand the structure of OJS a little better, you could read the technical documentation available at http://pkp.sfu.ca/ojs/docs/technicalreference/2.1/index.html. That will tell you how the URLs you see in your browser will relate to certain parts of the OJS programming code and will tell you where to look for actual code fragments that are responsible for certain things. Certainly, you can also keep asking questions here, or do both ;-)

Best regards,
Kai
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: What .tpl file can I look this code?

Postby darryl » Fri Dec 07, 2012 5:46 pm

springday wrote:Hi Darryl,

there is no "operation" called "Previous" defined in standard OJS. You can change your code fragment

Code: Select all
op="Previous"


to

Code: Select all
op="archive"


It's the same problem with your translate key: no definition for "site.journalPrevious". If you want to define it, you can add a <message> to the file /locale/en_US/locale.xml.

If you want to understand the structure of OJS a little better, you could read the technical documentation available at http://pkp.sfu.ca/ojs/docs/technicalreference/2.1/index.html. That will tell you how the URLs you see in your browser will relate to certain parts of the OJS programming code and will tell you where to look for actual code fragments that are responsible for certain things. Certainly, you can also keep asking questions here, or do both ;-)

Best regards,
Kai



Hi Kai,

Thanks for your response and help on me. yes I got it and I applied this to our OJS publication system.
http://asianscientificjournals.com/publication/


kai, there is another question to site.tpl file. because I inserted the Html file/CSS codes there.

I created the New Published Issue in site.tpl file but HTML file, my purpose of this if I have some added volume/issue in the this publication, i want to pop up this in the image example below or the new published issue. because it's manually encoded to the site.tpl and Html. how can i perform on that? is limited to 5 lines and every quarter the new published issue well replace by the new issues publish or volumes.

NewPublish Issue.png
New Publish Issues - I want this to translate in smarty codes.
NewPublish Issue.png (21.9 KiB) Viewed 4085 times



some of my concern are solved because of this forum.

Kai, I have some query to be ask:

here is the following:

1. OJS to Thomson Reuters - How? because one of journals listed in Thomson, How to upload the xml to Thomson Reuters.
2. OJS to Scopus(Elsevier) - it is possible to upload the xml file? if the journals are approve?
3. OJS to Cited by linking(crossrefDOI) - our publication are registered in crossref but I want view our Reports/ how to apply this?
4. OJS to CrossMark(crossrefDOI) - How to Apply this Crossmark to OJS code?
5. What is the Best Statistical Report ? Google Analytics or Piwik?

this 5 concern, it's need to create another topic?


Best Regards,
Darryl
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby springday » Sat Dec 08, 2012 3:10 am

Hi Darryl,

hard-coding the "Newly Published Issues" section into your Smarty template is generally a bad idea, because you would have to manually change this everytime you want to add or remove a new issue. Tasks like that should be programmed into the PHP code. The code should be given instructions how to aggregate an array of all the issues that have been published in the previous six or eight or twelve weeks or so, whatever you would like it to be. You could put this code into /pages/index/IndexHandler.inc.php for example, and then assign the array to the Smarty template, where the template could iterate over the array and print the newly published issues.

I can give you some more hints about the PHP functions you would need for that:

If you have a variable holding all the journals to be displayed on your site homepage, you could use this function call to get the most recent issues of every journal:

Code: Select all
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getCurrentIssue($journal->getId(), true);


Sidenote: In case your current issue is not always the most recently published ones, you could use instead:
Code: Select all
$issues =& $issueDao->getPublishedIssues($journal->getId());
$issue =& $issues[1];


With this in mind you could iterate over all your site's journals, retrieve the current issues to each journal, check for the publication date (you can call the function $issue->getDatePublished()), compare the publication date of the issue with the current date and decide whether you want to push this issue to the array of newly published issues. In the end you assign this array to the template manager, for example by

Code: Select all
$templateMgr->assign_by_ref('newlyPublishedIssues', $newlyPublishedIssues);


With this line in the right position, your site template will know about the newly published issues dynamically. You wouldn't have to exchange the issues by manually tweaking the your template's HTML.

As for your other questions, yes, they seem not to fit into this thread here too well. However, a few short words about what I know on these matters (which is little):
2. My company has one journal indexed by Elsevier's Scopus. We provided them with a subscription of the journal and their staff takes care of the indexing by themselves. We do not have to send them XML files.
3. and 4. OJS does contain some helping plugins for dealing with the different aspects of the CrossRef services. However, I haven't used them yet. Check the OJS manuals and search this forum, you might find something. If not, open a new thread with your question.
5. The decision between Google Analytics of Piwik is probably mainly political. It depends on if you want Google to know details of all the internet user's behavior, which means: If you're ok with the idea of a single company holding quite a monopoly of knowledge of the internet. Or if you would rather have an internet world where knowledge is distributed more widely...

Best regards,
Kai
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: What .tpl file can I look this code?

Postby darryl » Sun Dec 09, 2012 5:53 pm

springday wrote:Hi Darryl,

hard-coding the "Newly Published Issues" section into your Smarty template is generally a bad idea, because you would have to manually change this everytime you want to add or remove a new issue. Tasks like that should be programmed into the PHP code. The code should be given instructions how to aggregate an array of all the issues that have been published in the previous six or eight or twelve weeks or so, whatever you would like it to be. You could put this code into /pages/index/IndexHandler.inc.php for example, and then assign the array to the Smarty template, where the template could iterate over the array and print the newly published issues.

I can give you some more hints about the PHP functions you would need for that:

If you have a variable holding all the journals to be displayed on your site homepage, you could use this function call to get the most recent issues of every journal:

Code: Select all
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getCurrentIssue($journal->getId(), true);


Sidenote: In case your current issue is not always the most recently published ones, you could use instead:
Code: Select all
$issues =& $issueDao->getPublishedIssues($journal->getId());
$issue =& $issues[1];


With this in mind you could iterate over all your site's journals, retrieve the current issues to each journal, check for the publication date (you can call the function $issue->getDatePublished()), compare the publication date of the issue with the current date and decide whether you want to push this issue to the array of newly published issues. In the end you assign this array to the template manager, for example by

Code: Select all
$templateMgr->assign_by_ref('newlyPublishedIssues', $newlyPublishedIssues);


With this line in the right position, your site template will know about the newly published issues dynamically. You wouldn't have to exchange the issues by manually tweaking the your template's HTML.

Best regards,
Kai


Hi Kai,

I tried your code suggestions to implement, but something wrong. first of all I'm not good in PHP code or a Smarty Templates, I am a simple HTML/CSS implementer not totally good, because on this forum , my learning are increasing to learn.

index.handler.inc.ph

Code: Select all
           //for New Published Issues Assign:

         $templateMgr->assign_by_ref('newlyPublishedIssues', $newlyPublishedIssues);
         
         //for New Published Issues:

         $issues =& $issueDao->getPublishedIssues($journal->getId());
         $issue->getDatePublished());
         $issue =& $issues[1];


When I insert this code, my index page was not shown.

journal.tpl

Code: Select all
<!--new_pub_issues--->
{if $newlyPublishedIssues}

<div id="new_pub_issue"><!--new_pub_issue-->

</div><!--end new_pub_issue-->



Truly, I don't know how to declare a codes here.

site.tpl

Code: Select all
<div class="linearspot"></div>
<div id="new_pub_issue"><!--new_pub_issue-->
<h4>{translate key="site.NewlyPublishedIssues"}</h4>
<ul>
<li><a href=""></a></li>   
</ul>
</div><!--end new_pub_issue-->

<div class="linearspot"></div>



and Also this, I tried to implement to insert a {iterate}{/iterate} code but the display homepageImage display was lost. but the {translate key="site.NewlyPublishedIssues"} are redundant to display.
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby darryl » Sun Dec 09, 2012 7:17 pm

springday wrote:Hi Darryl,

Questions:
2. OJS to Scopus(Elsevier) - it is possible to upload the xml file? if the journals are approve?

Answer:
2. My company has one journal indexed by Elsevier's Scopus. We provided them with a subscription of the journal and their staff takes care of the indexing by themselves. We do not have to send them XML files.
Best regards,
Kai


Wow it's great,

How to subscribe?

Best Regards,
Darryl
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby springday » Mon Dec 10, 2012 1:59 pm

Hi Darryl,

sorry, the code fragments that I put here last time were not meant to work as a full implementation, but just as a few hints for somebody who can write PHP. I've had another look and will post some more complete code here now, though I haven't been able to fully test it yet, so I can't guarantee, that it's absolutely working.

First, a modification to the file /classes/issue/IssueDAO.inc.php. I added the following function:
Code: Select all
function &getNewestPublishedIssue($journalId) {
      $result =& $this->retrieve(
         'SELECT i.* FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = ? AND i.published = 1 ORDER BY i.date_published DESC LIMIT 1',
         $journalId
      );

      $returner = new DAOResultFactory($result, $this, '_returnIssueFromRow');
      return $returner;
   }

(This code is not really necessary if your current issue is always the newest one. However, assuming that sometimes your current issue and your newest issue is not always the some, I added this function)

Then the main code for checking the newest issues in /pages/index/IndexHandler.inc.php. It should be added after line 109:
Code: Select all
// new code for newly published issues
         $issueDao =& DAORegistry::getDAO('IssueDAO');         
         $newlyPublishedIssues = array();
         while($journal =& $journals->next()){
            $issue =& $issueDao->getNewestPublishedIssue($journal->getJournalId())->next();
            $currentDate = DateTime::createFromFormat("Y-m-d H:i:s", date("Y-m-d H:i:s"));
            $issueDate = $issue ? DateTime::createFromFormat("Y-m-d H:i:s", $issue->getDatePublished()) : new DateTime();
            $interval = $currentDate->diff($issueDate)->format("%R%a");
            if($interval >= -60 and $issue) {
            $newlyPublishedIssues[] = $issue;
            }
         }
         unset($journals);
         $journals =& $journalDao->getJournals(
            true,
            $rangeInfo,
            $searchInitial?JOURNAL_FIELD_TITLE:JOURNAL_FIELD_SEQUENCE,
            $searchInitial?JOURNAL_FIELD_TITLE:null,
            $searchInitial?'startsWith':null,
            $searchInitial
         );
         $templateMgr->assign_by_ref('newlyPublishedIssues', $newlyPublishedIssues);
var_dump($newlyPublishedIssues);

This code is assuming that you want to display issues that are less than 60 days old. You can change this by modifying the number in the line "if($interval >= -60 and $issue)".

And then in /templates/index/site.tpl after line 24:
Code: Select all
{if $newlyPublishedIssues}
<h4>Newly published issues<h4>
{foreach from=$newlyPublishedIssues item=newIssue}
   <p><a href="{url journal=$journal->getPath() page="issue" op="view" path=path=$newIssue->getBestIssueId()}" class="action">{$newIssue->getLocalizedTitle()}</a></p>
{/foreach}
{/if}


I hope it works.

As for Scopus: They have a website for suggesting journals to be indexed. You can check that out here: http://www.info.sciverse.com/scopus/scopus-in-detail/cover/suggest
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: What .tpl file can I look this code?

Postby darryl » Mon Dec 10, 2012 6:49 pm

springday wrote:Hi Darryl,

sorry, the code fragments that I put here last time were not meant to work as a full implementation, but just as a few hints for somebody who can write PHP. I've had another look and will post some more complete code here now, though I haven't been able to fully test it yet, so I can't guarantee, that it's absolutely working.

First, a modification to the file /classes/issue/IssueDAO.inc.php. I added the following function:
Code: Select all
function &getNewestPublishedIssue($journalId) {
      $result =& $this->retrieve(
         'SELECT i.* FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = ? AND i.published = 1 ORDER BY i.date_published DESC LIMIT 1',
         $journalId
      );

      $returner = new DAOResultFactory($result, $this, '_returnIssueFromRow');
      return $returner;
   }

(This code is not really necessary if your current issue is always the newest one. However, assuming that sometimes your current issue and your newest issue is not always the some, I added this function)

Then the main code for checking the newest issues in /pages/index/IndexHandler.inc.php. It should be added after line 109:
Code: Select all
// new code for newly published issues
         $issueDao =& DAORegistry::getDAO('IssueDAO');         
         $newlyPublishedIssues = array();
         while($journal =& $journals->next()){
            $issue =& $issueDao->getNewestPublishedIssue($journal->getJournalId())->next();
            $currentDate = DateTime::createFromFormat("Y-m-d H:i:s", date("Y-m-d H:i:s"));
            $issueDate = $issue ? DateTime::createFromFormat("Y-m-d H:i:s", $issue->getDatePublished()) : new DateTime();
            $interval = $currentDate->diff($issueDate)->format("%R%a");
            if($interval >= -60 and $issue) {
            $newlyPublishedIssues[] = $issue;
            }
         }
         unset($journals);
         $journals =& $journalDao->getJournals(
            true,
            $rangeInfo,
            $searchInitial?JOURNAL_FIELD_TITLE:JOURNAL_FIELD_SEQUENCE,
            $searchInitial?JOURNAL_FIELD_TITLE:null,
            $searchInitial?'startsWith':null,
            $searchInitial
         );
         $templateMgr->assign_by_ref('newlyPublishedIssues', $newlyPublishedIssues);
var_dump($newlyPublishedIssues);

This code is assuming that you want to display issues that are less than 60 days old. You can change this by modifying the number in the line "if($interval >= -60 and $issue)".

And then in /templates/index/site.tpl after line 24:
Code: Select all
{if $newlyPublishedIssues}
<h4>Newly published issues<h4>
{foreach from=$newlyPublishedIssues item=newIssue}
   <p><a href="{url journal=$journal->getPath() page="issue" op="view" path=path=$newIssue->getBestIssueId()}" class="action">{$newIssue->getLocalizedTitle()}</a></p>
{/foreach}
{/if}


I hope it works.

As for Scopus: They have a website for suggesting journals to be indexed. You can check that out here: http://www.info.sciverse.com/scopus/scopus-in-detail/cover/suggest


Hi Kai, I applied your code on the tpl file that I need to view the new published issues. in the index/site.tpl. when I refresh the browser, the new published issues not shown, but with I click a journal they got an error like this.
Code: Select all
Fatal error: Call to a member function next() on a non-object in C:\xampp\htdocs\www\asianscientificjournals.com\pages\index\IndexHandler.inc.php on line 65


IssueDao.inc.php
Code: Select all
<?php

/**
 * @file classes/issue/IssueDAO.inc.php
 *
 * Copyright (c) 2003-2012 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class IssueDAO
 * @ingroup issue
 * @see Issue
 *
 * @brief Operations for retrieving and modifying Issue objects.
 */

// $Id$


import ('classes.issue.Issue');

class IssueDAO extends DAO {
   var $caches;

   function _cacheMiss(&$cache, $id) {
      if ($cache->getCacheId() === 'current') {
         $issue =& $this->getCurrentIssue($id, false);
      } else {
         $issue =& $this->getIssueById($id, null, false);
      }
      $cache->setCache($id, $issue);
      return $issue;
   }

   function &_getCache($cacheId) {
      if (!isset($this->caches)) $this->caches = array();
      if (!isset($this->caches[$cacheId])) {
         $cacheManager =& CacheManager::getManager();
         $this->caches[$cacheId] =& $cacheManager->getObjectCache('issues', $cacheId, array(&$this, '_cacheMiss'));
      }
      return $this->caches[$cacheId];
   }

   /**
    * Retrieve Issue by issue id
    * @param $issueId int
    * @param $journalId int optional
    * @param $useCache boolean optional
    * @return Issue object
    */
   function &getIssueById($issueId, $journalId = null, $useCache = false) {
      if ($useCache) {
         $cache =& $this->_getCache('issues');
         $returner = $cache->get($issueId);
         if ($returner && $journalId != null && $journalId != $returner->getJournalId()) $returner = null;
         return $returner;
      }

      if (isset($journalId)) {
         $result =& $this->retrieve(
            'SELECT i.* FROM issues i WHERE issue_id = ? AND journal_id = ?',
            array($issueId, $journalId)
         );
      } else {
         $result =& $this->retrieve(
            'SELECT i.* FROM issues i WHERE issue_id = ?', $issueId
         );
      }

      $issue = null;
      if ($result->RecordCount() != 0) {
         $issue =& $this->_returnIssueFromRow($result->GetRowAssoc(false));
      }

      $result->Close();
      unset($result);

      return $issue;
   }

   /**
    * Retrieve Issue by public issue id
    * @param $publicIssueId string
    * @param $journalId int optional
    * @param $useCache boolean optional
    * @return Issue object
    */
   function &getIssueByPublicIssueId($publicIssueId, $journalId = null, $useCache = false) {
      if ($useCache) {
         $cache =& $this->_getCache('issues');
         $returner = $cache->get($publicIssueId);
         if ($returner && $journalId != null && $journalId != $returner->getJournalId()) $returner = null;
         return $returner;
      }

      if (isset($journalId)) {
         $result =& $this->retrieve(
            'SELECT i.* FROM issues i WHERE public_issue_id = ? AND journal_id = ?',
            array($publicIssueId, $journalId)
         );
      } else {
         $result =& $this->retrieve(
            'SELECT i.* FROM issues i WHERE public_issue_id = ?', $publicIssueId
         );
      }

      $issue = null;
      if ($result->RecordCount() != 0) {
         $issue =& $this->_returnIssueFromRow($result->GetRowAssoc(false));
      }

      $result->Close();
      unset($result);

      return $issue;
   }
   
   /**
Retrieve Issue by new Published.
//this code is create by Kai of Pkp forum.
**/
   function &getNewestPublishedIssue($journalId) {
    $result =& $this->retrieve(
    'SELECT i.* FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = ? AND i.published = 1 ORDER BY i.date_published DESC LIMIT 1',
         $journalId
      );

      $returner = new DAOResultFactory($result, $this, '_returnIssueFromRow');
      return $returner;
   }

   

   /**
    * Retrieve Issue by some combination of volume, number, and year
    * @param $journalId int
    * @param $volume int
    * @param $number int
    * @param $year int
    * @return Iterator object
    */
   function &getPublishedIssuesByNumber($journalId, $volume = null, $number = null, $year = null) {
      $sql = 'SELECT i.* FROM issues i WHERE i.published = 1 AND i.journal_id = ?';
      $params = array($journalId);

      if ($volume !== null) {
         $sql .= ' AND i.volume = ?';
         $params[] = $volume;
      }
      if ($number !== null) {
         $sql .= ' AND i.number = ?';
         $params[] = $number;
      }
      if ($year !== null) {
         $sql .= ' AND i.year = ?';
         $params[] = $year;
      }

      $result =& $this->retrieve($sql, $params);
      $returner = new DAOResultFactory($result, $this, '_returnIssueFromRow');
      return $returner;
   }

   /**
    * Retrieve Issue by "best" issue id -- public ID if it exists,
    * falling back on the internal issue ID otherwise.
    * @param $issueId string
    * @param $journalId int optional
    * @param $useCache boolean optional
    * @return Issue object
    */
   function &getIssueByBestIssueId($issueId, $journalId = null, $useCache = false) {
      $issue =& $this->getIssueByPublicIssueId($issueId, $journalId, $useCache);
      if (!isset($issue)) $issue =& $this->getIssueById((int) $issueId, $journalId, $useCache);
      return $issue;
   }

   /**
    * Retrieve the last created issue
    * @param $journalId int
    * @return Issue object
    */
   function &getLastCreatedIssue($journalId) {
      $result =& $this->retrieveLimit(
         'SELECT i.* FROM issues i WHERE journal_id = ? ORDER BY year DESC, volume DESC, number DESC', $journalId, 1
      );

      $issue = null;
      if ($result->RecordCount() != 0) {
         $issue =& $this->_returnIssueFromRow($result->GetRowAssoc(false));
      }

      $result->Close();
      unset($result);

      return $issue;
   }

   /**
    * Retrieve current issue
    * @param $journalId int
    * @param $useCache boolean optional
    * @return Issue object
    */
   function &getCurrentIssue($journalId, $useCache = false) {
      if ($useCache) {
         $cache =& $this->_getCache('current');
         $returner = $cache->get($journalId);
         return $returner;
      }

      $result =& $this->retrieve(
         'SELECT i.* FROM issues i WHERE journal_id = ? AND current = 1', $journalId
      );

      $issue = null;
      if ($result->RecordCount() != 0) {
         $issue =& $this->_returnIssueFromRow($result->GetRowAssoc(false));
      }

      $result->Close();
      unset($result);

      return $issue;
   }

   /**
    * update current issue
    * @return Issue object
    */
   function updateCurrentIssue($journalId, $issue = null) {
      $this->update(
         'UPDATE issues SET current = 0 WHERE journal_id = ? AND current = 1', $journalId
      );
      if ($issue) $this->updateIssue($issue);

      $cache =& $this->_getCache('issues');
      $cache->flush();
      unset($cache);
      $cache =& $this->_getCache('current');
      $cache->flush();
   }


   /**
    * creates and returns an issue object from a row
    * @param $row array
    * @return Issue object
    */
   function &_returnIssueFromRow($row) {
      $issue = new Issue();
      $issue->setId($row['issue_id']);
      $issue->setJournalId($row['journal_id']);
      $issue->setVolume($row['volume']);
      $issue->setNumber($row['number']);
      $issue->setYear($row['year']);
      $issue->setPublished($row['published']);
      $issue->setCurrent($row['current']);
      $issue->setDatePublished($this->datetimeFromDB($row['date_published']));
      $issue->setDateNotified($this->datetimeFromDB($row['date_notified']));
      $issue->setAccessStatus($row['access_status']);
      $issue->setOpenAccessDate($this->datetimeFromDB($row['open_access_date']));
      $issue->setPublicIssueId($row['public_issue_id']);
      $issue->setShowVolume($row['show_volume']);
      $issue->setShowNumber($row['show_number']);
      $issue->setShowYear($row['show_year']);
      $issue->setShowTitle($row['show_title']);
      $issue->setStyleFileName($row['style_file_name']);
      $issue->setOriginalStyleFileName($row['original_style_file_name']);

      $this->getDataObjectSettings('issue_settings', 'issue_id', $row['issue_id'], $issue);

      HookRegistry::call('IssueDAO::_returnIssueFromRow', array(&$issue, &$row));

      return $issue;
   }

   /**
    * Get a list of fields for which localized data is supported
    * @return array
    */
   function getLocaleFieldNames() {
      return array('title', 'coverPageDescription', 'coverPageAltText', 'showCoverPage', 'hideCoverPageArchives', 'hideCoverPageCover', 'originalFileName', 'fileName', 'width', 'height', 'description');
   }

   /**
    * Update the localized fields for this object.
    * @param $issue
    */
   function updateLocaleFields(&$issue) {
      $this->updateDataObjectSettings('issue_settings', $issue, array(
         'issue_id' => $issue->getId()
      ));
   }

   /**
    * inserts a new issue into issues table
    * @param Issue object
    * @return Issue Id int
    */
   function insertIssue(&$issue) {
      $this->update(
         sprintf('INSERT INTO issues
            (journal_id, volume, number, year, published, current, date_published, date_notified, access_status, open_access_date, public_issue_id, show_volume, show_number, show_year, show_title, style_file_name, original_style_file_name)
            VALUES
            (?, ?, ?, ?, ?, ?, %s, %s, ?, %s, ?, ?, ?, ?, ?, ?, ?)',
            $this->datetimeToDB($issue->getDatePublished()), $this->datetimeToDB($issue->getDateNotified()), $this->datetimeToDB($issue->getOpenAccessDate())),
         array(
            (int) $issue->getJournalId(),
            $issue->getVolume(),
            $issue->getNumber(),
            $issue->getYear(),
            $issue->getPublished(),
            $issue->getCurrent(),
            (int) $issue->getAccessStatus(),
            $issue->getPublicIssueId(),
            (int) $issue->getShowVolume(),
            (int) $issue->getShowNumber(),
            (int) $issue->getShowYear(),
            (int) $issue->getShowTitle(),
            $issue->getStyleFileName(),
            $issue->getOriginalStyleFileName()
         )
      );

      $issue->setId($this->getInsertIssueId());

      $this->updateLocaleFields($issue);

      if ($this->customIssueOrderingExists($issue->getJournalId())) {
         $this->resequenceCustomIssueOrders($issue->getJournalId());
      }

      return $issue->getId();
   }

   /**
    * Get the ID of the last inserted issue.
    * @return int
    */
   function getInsertIssueId() {
      return $this->getInsertId('issues', 'issue_id');
   }

   /**
    * Check if volume, number and year have already been issued
    * @param $journalId int
    * @param $volume int
    * @param $number int
    * @param $year int
    * @return boolean
    */
   function issueExists($journalId, $volume, $number, $year, $issueId) {
      $result =& $this->retrieve(
         'SELECT i.* FROM issues i WHERE journal_id = ? AND volume = ? AND number = ? AND year = ? AND issue_id <> ?',
         array($journalId, $volume, $number, $year, $issueId)
      );
      $returner = $result->RecordCount() != 0 ? true : false;

      $result->Close();
      unset($result);

      return $returner;
   }

   /**
    * updates an issue
    * @param Issue object
    */
   function updateIssue($issue) {
      $this->update(
         sprintf('UPDATE issues
            SET
               journal_id = ?,
               volume = ?,
               number = ?,
               year = ?,
               published = ?,
               current = ?,
               date_published = %s,
               date_notified = %s,
               open_access_date = %s,
               public_issue_id = ?,
               access_status = ?,
               show_volume = ?,
               show_number = ?,
               show_year = ?,
               show_title = ?,
               style_file_name = ?,
               original_style_file_name = ?
            WHERE issue_id = ?',
         $this->datetimeToDB($issue->getDatePublished()), $this->datetimeToDB($issue->getDateNotified()), $this->datetimeToDB($issue->getOpenAccessDate())),
         array(
            (int) $issue->getJournalId(),
            $issue->getVolume(),
            $issue->getNumber(),
            $issue->getYear(),
            (int) $issue->getPublished(),
            (int) $issue->getCurrent(),
            $issue->getPublicIssueId(),
            (int) $issue->getAccessStatus(),
            (int) $issue->getShowVolume(),
            (int) $issue->getShowNumber(),
            (int) $issue->getShowYear(),
            (int) $issue->getShowTitle(),
            $issue->getStyleFileName(),
            $issue->getOriginalStyleFileName(),
            (int) $issue->getId()
         )
      );

      $this->updateLocaleFields($issue);

      if ($this->customIssueOrderingExists($issue->getJournalId())) {
         $this->resequenceCustomIssueOrders($issue->getJournalId());
      }

      $cache =& $this->_getCache('issues');
      $cache->flush();
      unset($cache);
      $cache =& $this->_getCache('current');
      $cache->flush();
   }

   /**
    * Delete issue. Deletes associated published articles and cover file.
    * @param $issue object issue
    */
   function deleteIssue(&$issue) {
      import('classes.file.PublicFileManager');
      $publicFileManager = new PublicFileManager();

      if (is_array($issue->getFileName(null))) foreach ($issue->getFileName(null) as $fileName) {
         if ($fileName != '') {
            $publicFileManager->removeJournalFile($issue->getJournalId(), $fileName);
         }
      }
      if (($fileName = $issue->getStyleFileName()) != '') {
         $publicFileManager->removeJournalFile($issue->getJournalId(), $fileName);
      }

      $issueId = $issue->getId();

      // Delete issue-specific ordering if it exists.
      $sectionDao =& DAORegistry::getDAO('SectionDAO');
      $sectionDao->deleteCustomSectionOrdering($issueId);

      $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
      $publishedArticleDao->deletePublishedArticlesByIssueId($issueId);

      $this->update('DELETE FROM issue_settings WHERE issue_id = ?', $issueId);
      $this->update('DELETE FROM issues WHERE issue_id = ?', $issueId);
      $this->resequenceCustomIssueOrders($issue->getJournalId());

      $cache =& $this->_getCache('issues');
      $cache->flush();
      unset($cache);
      $cache =& $this->_getCache('current');
      $cache->flush();
   }

   /**
    * Delete issues by journal id. Deletes dependent entities.
    * @param $journalId int
    */
   function deleteIssuesByJournal($journalId) {
      $issues =& $this->getIssues($journalId);
      while (($issue =& $issues->next())) {
         $this->deleteIssue($issue);
         unset($issue);
      }
   }

   /**
    * Checks if issue exists
    * @param $publicIssueId string
    * @return boolean
    */
   function issueIdExists($issueId, $journalId) {
      $result =& $this->retrieve(
         'SELECT COUNT(*) FROM issues WHERE issue_id = ? AND journal_id = ?',
         array($issueId, $journalId)
      );
      return $result->fields[0] ? true : false;
   }

   /**
    * Checks if public identifier exists
    * @param $publicIssueId string
    * @return boolean
    */
   function publicIssueIdExists($publicIssueId, $issueId, $journalId) {
      $result =& $this->retrieve(
         'SELECT COUNT(*) FROM issues WHERE public_issue_id = ? AND issue_id <> ? AND journal_id = ?', array($publicIssueId, $issueId, $journalId)
      );
      $returner = $result->fields[0] ? true : false;

      $result->Close();
      unset($result);

      return $returner;
   }

   /**
    * Get issue by article id
    * @param articleId int
    * @param journalId int optional
    * @return issue object
    */
   function &getIssueByArticleId($articleId, $journalId = null) {
      $params = array($articleId);
      $sql = 'SELECT   i.*
         FROM   issues i,
            published_articles pa,
            articles a
         WHERE   i.issue_id = pa.issue_id AND
            pa.article_id = ? AND
            pa.article_id = a.article_id';
      if ($journalId !== null) {
         $sql .= ' AND i.journal_id = ? AND a.journal_id = i.journal_id';
         $params[] = $journalId;
      }

      $result =& $this->retrieve($sql, $params);

      $issue = null;
      if ($result->RecordCount() != 0) {
         $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
         $issue =& $this->_returnIssueFromRow($result->GetRowAssoc(false));
      }

      $result->Close();
      unset($result);

      return $issue;
   }

   /**
    * Get all issues organized by published date
    * @param $journalId int
    * @param $rangeInfo object DBResultRange (optional)
    * @return issues object ItemIterator
    */
   function &getIssues($journalId, $rangeInfo = null) {
      $issues = array();

      $sql = 'SELECT i.* FROM issues i WHERE journal_id = ? ORDER BY current DESC, date_published DESC';
      $result =& $this->retrieveRange($sql, $journalId, $rangeInfo);

      $returner = new DAOResultFactory($result, $this, '_returnIssueFromRow');
      return $returner;
   }

   /**
    * Get published issues organized by published date
    * @param $journalId int
    * @param $rangeInfo object DBResultRange
    * @return issues ItemIterator
    */
   function &getPublishedIssues($journalId, $rangeInfo = null) {
      $result =& $this->retrieveRange(
         'SELECT i.* FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = ? AND i.published = 1 ORDER BY o.seq ASC, i.current DESC, i.date_published DESC',
         $journalId, $rangeInfo
      );

      $returner = new DAOResultFactory($result, $this, '_returnIssueFromRow');
      return $returner;
   }

   /**
    * Get unpublished issues organized by published date
    * @param $journalId int
    * @param $rangeInfo object DBResultRange
     * @return issues ItemIterator
    */
   function &getUnpublishedIssues($journalId, $rangeInfo = null) {
      $result =& $this->retrieveRange(
         'SELECT i.* FROM issues i WHERE journal_id = ? AND published = 0 ORDER BY year ASC, volume ASC, number ASC',
         $journalId, $rangeInfo
      );

      $returner = new DAOResultFactory($result, $this, '_returnIssueFromRow');
      return $returner;
   }

   /**
    * Return number of articles assigned to an issue.
    * @param $issueId int
    * @return int
    */
   function getNumArticles($issueId) {
      $result =& $this->retrieve('SELECT COUNT(*) FROM published_articles WHERE issue_id = ?', $issueId);
      $returner = isset($result->fields[0]) ? $result->fields[0] : 0;

      $result->Close();
      unset($result);

      return $returner;
   }

   /**
    * Delete the custom ordering of a published issue.
    * @param $journalId int
    */
   function deleteCustomIssueOrdering($journalId) {
      return $this->update(
         'DELETE FROM custom_issue_orders WHERE journal_id = ?', $journalId
      );
   }

   /**
    * Sequentially renumber custom issue orderings in their sequence order.
    * @param $journalId int
    */
   function resequenceCustomIssueOrders($journalId) {
      $result =& $this->retrieve(
         'SELECT i.issue_id FROM issues i LEFT JOIN custom_issue_orders o ON (o.issue_id = i.issue_id) WHERE i.journal_id = ? ORDER BY o.seq',
         $journalId
      );

      for ($i=1; !$result->EOF; $i++) {
         list($issueId) = $result->fields;
         $resultB =& $this->retrieve('SELECT issue_id FROM custom_issue_orders WHERE journal_id=? AND issue_id=?', array($journalId, $issueId));
         if (!$resultB->EOF) {
            $this->update(
               'UPDATE custom_issue_orders SET seq = ? WHERE issue_id = ? AND journal_id = ?',
               array($i, $issueId, $journalId)
            );
         } else {
            // This entry is missing. Create it.
            $this->insertCustomIssueOrder($journalId, $issueId, $i);
         }
         $resultB->Close();
         unset($resultB);
         $result->moveNext();
      }

      $result->close();
      unset($result);
   }

   /**
    * Check if a journal has custom issue ordering.
    * @param $journalId int
    * @return boolean
    */
   function customIssueOrderingExists($journalId) {
      $result =& $this->retrieve(
         'SELECT COUNT(*) FROM custom_issue_orders WHERE journal_id = ?',
         $journalId
      );
      $returner = isset($result->fields[0]) && $result->fields[0] == 0 ? false : true;

      $result->Close();
      unset($result);

      return $returner;
   }

   /**
    * Get the custom issue order of a journal.
    * @param $journalId int
    * @param $issueId int
    * @return int
    */
   function getCustomIssueOrder($journalId, $issueId) {
      $result =& $this->retrieve(
         'SELECT seq FROM custom_issue_orders WHERE journal_id = ? AND issue_id = ?',
         array($journalId, $issueId)
      );

      $returner = null;
      if (!$result->EOF) {
         list($returner) = $result->fields;
      }
      $result->Close();
      unset($result);

      return $returner;
   }

   /**
    * Import the current issue orders into the specified journal as custom
    * issue orderings.
    * @param $journalId int
    */
   function setDefaultCustomIssueOrders($journalId) {
      $publishedIssues =& $this->getPublishedIssues($journalId);
      $i=1;
      while ($issue =& $publishedIssues->next()) {
         $this->insertCustomIssueOrder($journalId, $issue->getId(), $i);
         unset($issue);
         $i++;
      }
   }

   /**
    * INTERNAL USE ONLY: Insert a custom issue ordering
    * @param $journalId int
    * @param $issueId int
    * @param $seq int
    */
   function insertCustomIssueOrder($journalId, $issueId, $seq) {
      $this->update(
         'INSERT INTO custom_issue_orders (issue_id, journal_id, seq) VALUES (?, ?, ?)',
         array(
            $issueId,
            $journalId,
            $seq
         )
      );
   }

   /**
    * Move a custom issue ordering up or down, resequencing as necessary.
    * @param $journalId int
    * @param $issueId int
    * @param $newPos int The new position (0-based) of this section
    */
   function moveCustomIssueOrder($journalId, $issueId, $newPos) {
      $result =& $this->retrieve('SELECT issue_id FROM custom_issue_orders WHERE journal_id=? AND issue_id=?', array($journalId, $issueId));
      if (!$result->EOF) {
         $this->update(
            'UPDATE custom_issue_orders SET seq = ? WHERE journal_id = ? AND issue_id = ?',
            array($newPos, $journalId, $issueId)
         );
      } else {
         // This entry is missing. Create it.
         $this->insertCustomIssueOrder($journalId, $issueId, $newPos);
      }
      $result->Close();
      unset($result);
      $this->resequenceCustomIssueOrders($journalId);
   }
}

?>


Indexhandler.inc.php
Code: Select all
<?php

/**
 * @file IndexHandler.inc.php
 *
 * Copyright (c) 2003-2012 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class IndexHandler
 * @ingroup pages_index
 *
 * @brief Handle site index requests.
 */

// $Id$


import('classes.handler.Handler');

class IndexHandler extends Handler {
   /**
    * Constructor
    **/
   function IndexHandler() {
      parent::Handler();
   }

   /**
    * If no journal is selected, display list of journals.
    * Otherwise, display the index page for the selected journal.
    * @param $args array
    * @param $request Request
    */
   function index($args, &$request) {
      $this->validate();
      $this->setupTemplate();

      $router =& $request->getRouter();
      $templateMgr =& TemplateManager::getManager();
      $journalDao =& DAORegistry::getDAO('JournalDAO');
      $journalPath = $router->getRequestedContextPath($request);
      $templateMgr->assign('helpTopicId', 'user.home');
      $journal =& $router->getContext($request);
      if ($journal) {
         // Assign header and content for home page
         $templateMgr->assign('displayPageHeaderTitle', $journal->getLocalizedPageHeaderTitle(true));
         $templateMgr->assign('displayPageHeaderLogo', $journal->getLocalizedPageHeaderLogo(true));
         $templateMgr->assign('displayPageHeaderTitleAltText', $journal->getLocalizedSetting('homeHeaderTitleImageAltText'));
         $templateMgr->assign('displayPageHeaderLogoAltText', $journal->getLocalizedSetting('homeHeaderLogoImageAltText'));
         $templateMgr->assign('additionalHomeContent', $journal->getLocalizedSetting('additionalHomeContent'));
         $templateMgr->assign('homepageImage', $journal->getLocalizedSetting('homepageImage'));
         $templateMgr->assign('homepageImageAltText', $journal->getLocalizedSetting('homepageImageAltText'));
         $templateMgr->assign('journalDescription', $journal->getLocalizedSetting('description'));
   
         
         $displayCurrentIssue = $journal->getSetting('displayCurrentIssue');
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         $issue =& $issueDao->getCurrentIssue($journal->getId(), true);
         
      // new code for newly published issues
      //this code is create by Kai of Pkp forum.
      
       $issueDao =& DAORegistry::getDAO('IssueDAO');         
         $newlyPublishedIssues = array();
         while($journal =& $journals->next()){
            $issue =& $issueDao->getNewestPublishedIssue($journal->getJournalId())->next();
            $currentDate = DateTime::createFromFormat("Y-m-d H:i:s", date("Y-m-d H:i:s"));
            $issueDate = $issue ? DateTime::createFromFormat("Y-m-d H:i:s", $issue->getDatePublished()) : new DateTime();
            $interval = $currentDate->diff($issueDate)->format("%R%a");
            if($interval >= -60 and $issue) {
            $newlyPublishedIssues[] = $issue;
            }
         }
         unset($journals);
         $journals =& $journalDao->getJournals(
            true,
            $rangeInfo,
            $searchInitial?JOURNAL_FIELD_TITLE:JOURNAL_FIELD_SEQUENCE,
            $searchInitial?JOURNAL_FIELD_TITLE:null,
            $searchInitial?'startsWith':null,
            $searchInitial
         );
         $templateMgr->assign_by_ref('newlyPublishedIssues', $newlyPublishedIssues);
          var_dump($newlyPublishedIssues);
         
   
   //end of new created code by kai of pkp forum
         
         
         
         if ($displayCurrentIssue && isset($issue)) {
            import('pages.issue.IssueHandler');
            // The current issue TOC/cover page should be displayed below the custom home page.
            IssueHandler::setupIssueTemplate($issue);
         }
         
         // Display creative commons logo/licence if enabled
         $templateMgr->assign('displayCreativeCommons', $journal->getSetting('includeCreativeCommons'));

         $enableAnnouncements = $journal->getSetting('enableAnnouncements');
         if ($enableAnnouncements) {
            $enableAnnouncementsHomepage = $journal->getSetting('enableAnnouncementsHomepage');
            if ($enableAnnouncementsHomepage) {
               $numAnnouncementsHomepage = $journal->getSetting('numAnnouncementsHomepage');
               $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
               $announcements =& $announcementDao->getNumAnnouncementsNotExpiredByAssocId(ASSOC_TYPE_JOURNAL, $journal->getId(), $numAnnouncementsHomepage);
               $templateMgr->assign('announcements', $announcements);
               $templateMgr->assign('enableAnnouncementsHomepage', $enableAnnouncementsHomepage);
            }
         }
         $templateMgr->display('index/journal.tpl');
      } else {
         $site =& Request::getSite();

         if ($site->getRedirect() && ($journal = $journalDao->getJournal($site->getRedirect())) != null) {
            $request->redirect($journal->getPath());
         }

         $templateMgr->assign('intro', $site->getLocalizedIntro());
         $templateMgr->assign('journalFilesPath', $request->getBaseUrl() . '/' . Config::getVar('files', 'public_files_dir') . '/journals/');
         $journals =& $journalDao->getEnabledJournals();
         $templateMgr->assign_by_ref('journals', $journals);
         $templateMgr->setCacheability(CACHEABILITY_PUBLIC);
         $templateMgr->display('index/site.tpl');
      }
   }
}

?>


site.tpl file.

Code: Select all
{**
 * site.tpl
 *
 * Copyright (c) 2003-2012 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * Site index.
 *
 * $Id$
 *}
{strip}
{if $siteTitle}
   {assign var="pageTitleTranslated" value=$siteTitle}
{/if}
{include file="common/header.tpl"}
{/strip}

{if $intro}{$intro|nl2br}{/if}

<div class="linearspot"></div>

<div id="new_pub_issue"><!--new_pub_issue-->
    {if $newlyPublishedIssues}
<h4>{translate key="site.NewlyPublishedIssues"}<h4>

    {foreach from=$newlyPublishedIssues item=newIssue}
<ul>
<li><a href="{url journal=$journal->getPath() page="issue" op="view" path=path=$newIssue->getBestIssueId()}" class="action">{$newIssue->getLocalizedTitle()}</a></li>

</ul>
{/foreach}

{/if}

</div><!--end new_pub_issue-->

<div class="linearspot"></div>



{iterate from=journals item=journal}

   {assign var="displayHomePageImage" value=$journal->getLocalizedSetting('homepageImage')}
   {assign var="displayHomePageLogo" value=$journal->getLocalizedPageHeaderLogo(true)}
   {assign var="displayPageHeaderLogo" value=$journal->getLocalizedPageHeaderLogo()}



<div id="item_col">
   
<div style="clear:both;">
           
   {if $displayHomePageImage && is_array($displayHomePageImage)}
      {assign var="altText" value=$journal->getLocalizedSetting('homepageImageAltText')}
       
<div class="homepageImage">
<img src="{$journalFilesPath}{$journal->getId()}/{$displayHomePageImage.uploadName|escape:"url"}" {if $altText != ''}alt="{$altText|escape}"{else}alt="{translate key="common.pageHeaderLogo.altText"}"{/if} />
</div>

{elseif $displayHomePageLogo && is_array($displayHomePageLogo)}
{assign var="altText" value=$journal->getLocalizedSetting('homeHeaderLogoImageAltText')}

<div class="homepageImage">
<img src="{$journalFilesPath}{$journal->getId()}/{$displayHomePageLogo.uploadName|escape:"url"}" {if $altText != ''}alt="{$altText|escape}"{else}alt="{translate key="common.pageHeaderLogo.altText"}"{/if} />
</div>
   {elseif $displayPageHeaderLogo && is_array($displayPageHeaderLogo)}
      {assign var="altText" value=$journal->getLocalizedSetting('pageHeaderLogoImageAltText')}

<div class="homepageImage">
<img src="{$journalFilesPath}{$journal->getId()}/{$displayPageHeaderLogo.uploadName|escape:"url"}" {if $altText != ''}alt="{$altText|escape}"{else}alt="{translate key="common.pageHeaderLogo.altText"}"{/if} />
</div>
   {/if}
   


   <h5><center>{$journal->getLocalizedTitle()|escape}</center></h5>
   <center>
    <span>
    {if $journal->getLocalizedDescription()}
   {$journal->getLocalizedDescription()|nl2br}</span>
   {/if}
    </center>
   
 
    <font>
    <center>
    <a href="{url journal=$journal->getPath()}" class="action">{translate key="site.journalCurrent"}</a> |
    <a href="{url journal=$journal->getPath() page="issue" op="archive"}" class="action">{translate key="site.journalPrevious"}</a>
   </center>
    </font>
</div></div>
   
   {/iterate}

{include file="common/footer.tpl"}




Thanks,

Darryl
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby springday » Tue Dec 11, 2012 1:11 am

Hi Darryl,

error on line 65 sounds not right. Probably you put the code in the wrong part of IndexHandler.inc.php. If you look at the source code of IndexHandler.inc.php, you have to put the new code into the "else"-part. I suggest to put it after line 104:
https://github.com/pkp/ojs/blob/master/pages/index/IndexHandler.inc.php

I would like to encourage you to learn some PHP if you want to do those modifications. It's not that hard to be done, and it will help you to figure out what some programs would do. It is probably difficult to modify your OJS installation if you just use copy-and-paste of things you read here in this forum...

A little guideline about the file in question (/pages/IndexHandler.inc.php):
The code in the lines 41 to 75 is responsible for showing the index page of your individual journals, e.g. http://asianscientificjournals.com/publication/index.php/alcr. The code in the lines 76 to 111 is responsible for showing the general homepage, e.g. http://asianscientificjournals.com/publication/index.php/. So every modification you want to take effect on your general homepage has to be put into this section.

Best regards,
Kai
springday
 
Posts: 111
Joined: Wed Jul 25, 2012 2:56 pm
Location: Munich, Germany

Re: What .tpl file can I look this code?

Postby darryl » Tue Dec 11, 2012 8:34 pm

springday wrote:Hi Darryl,

error on line 65 sounds not right. Probably you put the code in the wrong part of IndexHandler.inc.php. If you look at the source code of IndexHandler.inc.php, you have to put the new code into the "else"-part. I suggest to put it after line 104:
https://github.com/pkp/ojs/blob/master/pages/index/IndexHandler.inc.php

I would like to encourage you to learn some PHP if you want to do those modifications. It's not that hard to be done, and it will help you to figure out what some programs would do. It is probably difficult to modify your OJS installation if you just use copy-and-paste of things you read here in this forum...

A little guideline about the file in question (/pages/IndexHandler.inc.php):
The code in the lines 41 to 75 is responsible for showing the index page of your individual journals, e.g. http://asianscientificjournals.com/publication/index.php/alcr. The code in the lines 76 to 111 is responsible for showing the general homepage, e.g. http://asianscientificjournals.com/publication/index.php/. So every modification you want to take effect on your general homepage has to be put into this section.

Best regards,
Kai


Hi Kai,
thanks, Maybe.. I need learn more about Php Coding.hehehe

Thanks
Darryl
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Re: What .tpl file can I look this code?

Postby darryl » Mon Jan 14, 2013 6:08 pm

Hi Kai,

I would like to ask about how to view the Print ISSN and E-ISSN in footer of the issue.tpl/TOC and article.tpl/article file?


Best Regards,
Darryl
darryl
 
Posts: 96
Joined: Wed Jul 04, 2012 6:52 pm
Location: Cagayan de Oro , Misamis Oriental Philippines

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: Alexa [Bot], Baidu [Spider], Google [Bot] and 2 guests