OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Conditional clauses and scheduled Conferences

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

Moderators: jmacgreg, michael

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Conditional clauses and scheduled Conferences

Postby mendesrocha » Thu Jun 02, 2011 11:43 pm

Hi All!

I have a Conference with 2 schededuled Conferences. The Conference Director asked for it because they have to manage two submissions kind that vary on dates, review process and committes.

OCS review process has been fine for both Conferences, but I need to improve some semantic aspects. These conference have some differences in how they label some functions, for example, the Author role should be called "Author" in one and should be "Artist" in another. I think some conditional clauses can solve some of this cosmetic changes. They are not critical for our conference, but it would be nice if I could achieve some of these improvements. So I am asking for help.

The first change I would like to do is in /plugins/blocks/navigation/block.tpl, where I added a list item. I tried this:

Code: Select all
{if ($currentSchedConfPath == "Perfomance")} <li>&#187;<a href="http://pkp.sfu.ca" target="_Blank"> Link text</a> {/if}


My aim is that this list item appears only in one of the scheduled conference. The parameter I would like to check is the current schedule conference path, that in my case is "Perfomance".

Thanks in advance.
mendesrocha
 
Posts: 178
Joined: Mon Nov 05, 2007 11:10 am
Location: Brazil

Re: Conditional clauses and scheduled Conferences

Postby jmacgreg » Tue Jun 07, 2011 11:00 am

Hi Renato,

In order to use a template variable like $currentSchedConfPath, you will have to define and populate it in the plugin, in this case in NavigationBlockPlugin.inc.php. See the "Advanced Block Plugins" section in this tutorial.

Cheers,
James
jmacgreg
 
Posts: 4191
Joined: Tue Feb 14, 2006 10:50 am

Re: Conditional clauses and scheduled Conferences

Postby mendesrocha » Tue Jul 26, 2011 10:42 am

Hi James,

Thanks for your tip. But, I haven't found the solution for my problem yet.

I tried adding the following function NavigationBlockPlugin:

Code: Select all
   function &getContents($currentSchedConfpath) {
      $currentSchedConfPath->retrieve('SELECT path FROM sched_confs WHERE sched_conf_id=4');
       }


But it was not successful.

If it were correct, it would work only in the Navigation Block. Right? And, if I want to use this variable in other pages? I would have to create a global variable? Where should it be located?

If someone is understanding what I need, I am willing to pay for support.
mendesrocha
 
Posts: 178
Joined: Mon Nov 05, 2007 11:10 am
Location: Brazil

Re: Conditional clauses and scheduled Conferences

Postby mcrider » Wed Jul 27, 2011 5:06 pm

Hi Renato,

The scheduled conference object is already available to that template (and any template in the context of a scheduled conference, as it assigned by the classes/template/TemplateManager.inc.php if the scheduled conference exists) in the $currentSchedConf variable. With that variable, you can access anything in the SchedConf object (classes/schedConf/SchedConf.inc.php), so in the template you could do something like
Code: Select all
{if $currentSchedConf->getPath() == 'foo'}Display stuff only for the 'foo' scheduled conference{/if}

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Conditional clauses and scheduled Conferences

Postby mendesrocha » Fri Jul 29, 2011 12:57 pm

hello Matt!

Thank a lot for your answer. Your code is exactly what I was looking for.

The solution works, but now I got a new problem. After inserting the code (on bottom of ocs/plugins/blocks/navigation/block.tpl) the page is loaded once, but in the next time OCS returns this error:

Fatal error: Call to a member function getPath() on a non-object in /home/anppomc/public_html/congressos/cache/t_compile/%%1D^1DF^1DFDC00E%%block.tpl.php on line 96


The erros shows up when, for instance, I click in the "Current conferences" in the navigation bar.

Then, if I remove the code, the page only loads the side bar partially.

So, I have to clear the compiled caches, and then I got the complete website back.
mendesrocha
 
Posts: 178
Joined: Mon Nov 05, 2007 11:10 am
Location: Brazil

Re: Conditional clauses and scheduled Conferences

Postby mcrider » Fri Jul 29, 2011 1:14 pm

Hi Renato,

If you're not in the context of a scheduled conference (e.g. at the current conferences page), that $currentSchedConf variable will be null so if you try to access a method from it, you'll get an error. So you'll probably want to modify that {if} block to say {if $currentSchedConf && $currentSchedConf->getPath() == 'foo'}.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Conditional clauses and scheduled Conferences

Postby mendesrocha » Sun Jul 31, 2011 2:59 pm

Perfectly working now. Thanks again Matt.
mendesrocha
 
Posts: 178
Joined: Mon Nov 05, 2007 11:10 am
Location: Brazil


Return to OCS Development

Who is online

Users browsing this forum: No registered users and 0 guests