CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Display Full Events in Drupal View
Pages: [1]

Author Topic: Display Full Events in Drupal View  (Read 878 times)

Michael

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 2
  • Isn't this just terrific?
  • CiviCRM version: 4.4.0
  • CMS version: Drupal 7.23
  • MySQL version: 5.3.19
  • PHP version: 5.5.30
Display Full Events in Drupal View
April 06, 2013, 12:25:41 pm
Our organization needs to display a list of events that show the vacancy status (vacancies or full) because we have hundreds of volunteer events per month for volunteers to check.

It appears this was possible in the past (version 3, 4.0, 4.1) but previous methods described in the wiki:

http://wiki.civicrm.org/confluence/display/CRMDOC41/Event+listing+showing+fully-booked+result+using+Drupal+Views+PHP

...  do not work for v 4.2. The PHP code that apparently did work is here:

SETUP CODE:

if (module_exists('civicrm')) {
  civicrm_initialize(TRUE);
  require_once 'api/v2/Event.php';

VALUE CODE:

if (module_exists('civicrm')) {
  $booked=CRM_Event_BAO_Participant::eventFull($row->ID);
  if ($booked)
    return " is_fully_booked";
  else
    return " is_available";

This gets an Ajax error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /admin/structure/views/view/events_that_are_full/preview/default/ajax
StatusText: OK
ResponseText:
Parse error:  syntax error, unexpected $end in /home/michael/public_html/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc(117) : runtime-created function on line 3
Fatal error:  Function name must be a string in /home/michael/public_html/sites/all/modules/views_php/plugins/views/views_php_handler_field.inc on line 119

Is it possible there is a missing "}" at the end of the code in the setup or value (or both) codes?

If anyone can offer suggestions as to why the code for version 4.1 no longer works for 4.2 with a possible fix I will be more than happy to test it! (It's probably something simple but I haven't been able to figure it out.)

Thanks in advance.
« Last Edit: April 06, 2013, 12:41:55 pm by Michael »

Michael

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 2
  • Isn't this just terrific?
  • CiviCRM version: 4.4.0
  • CMS version: Drupal 7.23
  • MySQL version: 5.3.19
  • PHP version: 5.5.30
Re: Display Full Events in Drupal View
April 06, 2013, 12:58:03 pm
Possible answered my own question!

Wow, this may be actually useful to others needing to do the same thing. I added closing brackets "}" at the end of the setup and value codes in my original post and it appears to work! If anyone else needs this and uses it please post here whether it works for you or not. If it works then maybe the documentation could get updated for 4.2.9.

And perhaps someone may want to try it in 4.3?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Display Full Events in Drupal View
April 06, 2013, 01:47:31 pm

the current docs:

http://wiki.civicrm.org/confluence/display/CRMDOC43/Event+listing+showing+fully-booked+result+using+Drupal+Views+PHP

do include the close braces in both the setup and value code blocks

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Michael

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 2
  • Isn't this just terrific?
  • CiviCRM version: 4.4.0
  • CMS version: Drupal 7.23
  • MySQL version: 5.3.19
  • PHP version: 5.5.30
Re: Display Full Events in Drupal View
April 06, 2013, 02:06:26 pm
Right you are! Don't know what I was looking a ... must need new glasses. :-[

However, a huge Thank You to the person that wrote that documentation. ;D

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Display Full Events in Drupal View

This forum was archived on 2017-11-26.