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
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page. While these are OJS-specific, the OCS codebase is similar enough to OJS they should be of help. There is also an [url=http://pkp.sfu.ca/ocs_documentation[/url]OCS Documentation[/url] page with some more general documentation that might also be of interest.

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 OCS Conference Support and Discussion subforum; if you have a technical support question, try the OCS Technical Support subforum.

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: 169
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: 4183
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: 169
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: 169
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: 169
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 1 guest