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 »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Visual way to display open vs full events?
Pages: [1]

Author Topic: Visual way to display open vs full events?  (Read 1676 times)

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Visual way to display open vs full events?
February 05, 2011, 08:15:56 am
We would like to use CiviEvent (+ Drupal modules...) as a 'scheduler' system.  Our organization has about 90 days per year when we are open to the public and have member volunteers staffing the facilities.  Our current scheduling system is not reliable, and as we are using Drupal to build our new web site and CiviCRM (+ Mail, Member & Report) for our member management database, it makes sense to at least try to use CiviEvent as a replacement scheduler.

I've done enough testing of CiviEvent to know that I can set up an event for each day, with maximum participants set, allow online registration & have members sign up.  Basically, I believe I've got CiviEvent figured out, and I believe it will work as a 'back end' to meet our needs.

Also, the reading I've done over the past few weeks leads me to believe we should be able to display all of these events in Drupal, allowing members to click on the event for which they'd like to register and do so without any input from staff (we're all volunteers, so this is a big deal...).

What I need to know before moving forward with the setting up of the Drupal portion of this, is whether or not I will be able to do either or both of the following, without any php or other programming:

1 - Display only 'open' events, i.e. those events that have not yet reached the max participants limit.

2 - Easily differentiate between 'open' & 'full' events.  If all 'full' events were shown in red, and 'open' events were shown in green, for example, that would work.  Any other methods of achieving the required differentiation would be acceptable as well.



As I am new to both Drupal & CiviCRM / CiviEvent, and have no programming background (other than *nix shell scripting), I'd like to know if this is possible, before investing the 1-2 weeks it would likely take me to figure it out on my own.

If it isn't possible, please let me know so that I can start looking for alternative solutions.  If it is, that's all I really need to know.  I'll of course take any advice on how to move forward, but I'll also happily plug ahead on my own, so long as I know my required end result is achievable.

Finally, if it is possible, but only by doing some custom programming, I'd like to know that too.  There may be a few others in the organization who have the necessary programming skills to work on this now, and I definitely plan on gaining the PHP, MySQL & any other skills needed to do Drupal & Civi* development myself at some point in the future.

I apologize for the lengthy post - any & all advice or insights will be much appreciated!
Thanks

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Visual way to display open vs full events?
February 05, 2011, 11:49:32 am
Welcome.
In case you don't get a more fulsome response to this - I would be looking down the Views route (Drupal module) but can't confirm the 'open' v 'full' or the colour being possible without at least some theming work.
Good luck
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Visual way to display open vs full events?
February 05, 2011, 11:58:08 am
Thanks for the 'welcome'!

I'm at the beginning stages of learning as much as possible about the Views, CCK  & Panels modules, so it is good to have confirmation I'm heading down the right path...   8)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Visual way to display open vs full events?
February 05, 2011, 05:10:58 pm
This can certainly be done with Views and I have done similar tasks, but it will require a bit of custom theming in PHP. Specifically, the Views template(s) will need to be customized to mark 'open' & 'full' events.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Visual way to display open vs full events?
February 05, 2011, 05:21:27 pm
hershel-

I appreciate the quick reply.  My programming experience is limited to shell scripts and a little bit of Perl about 10 years ago.  When I read PHP code, I can typically follow & understand what I see (when I can see the end result), but I haven't a clue about how to create anything in PHP.  Given that (very small) bit of information, could you estimate how much time it might take someone like myself to implement this custom theming?

I ask because while I will definitely be learning PHP in the near future, I am working on a March 1st deadline for this phase of the project.  If I can cobble together something through trial and error over a couple of days, that will be OK.  If it'll take longer than that, I may need to search for an alternative solution for the near term.

Thanks!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Visual way to display open vs full events?
February 05, 2011, 05:30:08 pm
I can not estimate your coding time based on "a little bit of Perl about 10 years ago." But I can say that the Views module itself is quite complicated and takes time to learn. Once you are in it, there is a section for Theming. There it provides you with the default theme templates and also explains what variables are available in that template.

You would need to first create your basic View, then look through those template files to find the relevant one (correct level of specificity basically), then use print_r() to examine the variables to find the particular datum you need, and then use that datum to add a class to some HTML element, which can then be styled via CSS.

This process could easily take a few days if you are new to CiviCRM, Views and PHP, without question.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Visual way to display open vs full events?
February 05, 2011, 05:45:45 pm
Quote from: hershel on February 05, 2011, 05:30:08 pm
This process could easily take a few days if you are new to CiviCRM, Views and PHP, without question.

That is basically what I needed to know.  I'm going to take that to mean that this is something I'll be able to figure out in a reasonable amount of time (based on my knowledge of my own skill level, etc.).  It'll be interesting to tackle this...

Sorry for the awkward phrasing of the question, and thank you for answering anyway!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Visual way to display open vs full events?
February 05, 2011, 11:37:16 pm
and in the grand perl tradition of there is more than one way, I'd pull the smarty template

{crmAPI var="results" entity="events" action="get" param1="ddd"}
{foreach results ...}
<some html magic>{$event.somedata}
{/foreach}

The civi_view module allows you to create a wunderschon.tpl and access it through civiview/wunderschon

X+

Quote from: peterd on February 05, 2011, 11:49:32 am
In case you don't get a more fulsome response to this - I would be looking down the Views route (Drupal module) but can't confirm the 'open' v 'full' or the colour being possible without at least some theming work.
Good luck
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Visual way to display open vs full events?
February 06, 2011, 07:31:47 am
Excellent - thank you!

katmandoo

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.3.0
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.49
  • PHP version: 5.3.3-1ubuntu9.3
Re: Visual way to display open vs full events?
April 16, 2011, 07:15:24 am
OK, from what i can tell CiviCRM uses multiple participant status types (civicrm_participant.status_id) to determine if the participant is to be counted towards the civicrm_event.max_participant value.  I wanted to use Views to calculate this and then alter the date link in year view, and/or change the title displayed in the month, week, day view. 

I couldn't see an obvious way to do this in Views, although you would think it was possible.  So, what i ended up doing was creating a trigger in the civicrm database on the civicrm_participant table that would check the count of specific civicrm_participant.status_id values for all entries in the table with the civicrm_participant.event_id = to the NEW.event_id of the inserted record and then compare that to the civicrm_event.max_participants of the event with the id = NEW.event_id.  if the count is >= max_participants then it would add "[FULL]" to the title text.  of course this does not address any updated/deleted records but triggers could be added for each of those.

Now, i am not a big fan of messing with the database, and you have to be running MySQL 5.1.6 or above to be able to use triggers,  but since i am more familiar with SQL than i am with Drupal/Views i decided to go this route at least temporarily, besides once tested it actually seemed like the easiest and cleanest way to get it done.

below is the trigger and 2 separate SQL statements i used for testing - they are formatted to paste into phpmyadmin, you will need to reformat if you use the mysql cli
... if someone could offer a better way within Views (or with SQL) i would certainly appreciate your feedback.


# ==================================
# create Trigger to update records as users register and event becomes full

CREATE TRIGGER CheckFull AFTER INSERT ON civicrm_participant
FOR EACH ROW
UPDATE civicrm_event SET civicrm_event.title = CONCAT_WS('',`civicrm_event`.`title`, " [FULL]")
WHERE civicrm_event.id = NEW.event_id
AND (SELECt COUNT(*)
FROM civicrm_participant
WHERE civicrm_participant.event_id = NEW.event_id
AND (civicrm_participant.status_id = '1'
OR civicrm_participant.status_id = '2'
OR civicrm_participant.status_id = '5'
OR civicrm_participant.status_id = '8'
OR civicrm_participant.status_id = '9'
OR civicrm_participant.status_id = '10'
)) >= civicrm_event.max_participants

# ====================================
# Run this to verify you will get the correct records
# remove the - WHERE title NOT LIKE '%[FULL]' - to get all records

SELECT a.id, a.title, a.max, b.ev_id, b.eCnt
FROM (SELECT id, title, max_participants as max FROM civicrm_event WHERE title NOT LIKE '%[FULL]') as a, (
SELECT event_id as ev_id, COUNT(*) AS eCnt
FROM civicrm_participant
WHERE status_id = '1'
OR status_id = '2'
OR status_id = '5'
OR status_id = '8'
OR status_id = '9'
OR status_id = '10'
GROUP BY event_id
) as b
WHERE a.id = b.ev_id AND b.eCnt >= a.max

# =================================
# Run to 'manually' update all current records that are full

UPDATE civicrm_event, civicrm_participant SET civicrm_event.title = CONCAT_WS('',`civicrm_event`.`title`, " [FULL]")
WHERE civicrm_event.title NOT LIKE '%[FULL]'
AND (
SELECT COUNT(*) AS eCnt
FROM civicrm_participant
WHERE civicrm_participant.event_id = civicrm_event.id
AND ( status_id = '1'
OR status_id = '2'
OR status_id = '5'
OR status_id = '8'
OR status_id = '9'
OR status_id = '10')
) >= civicrm_event.max_participants


 ::)
« Last Edit: April 16, 2011, 07:42:54 am by katmandoo »
~ Thanks ~
Kevin
Stillwater, MN

katmandoo

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.3.0
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.49
  • PHP version: 5.3.3-1ubuntu9.3
Re: Visual way to display open vs full events?
April 16, 2011, 07:40:09 am
Just an additional note - this changes the event title in the civicrm database which is displayed on month/week/day views, however it does not address the year view.  I would like a way to identify the full events in the year view, either by setting the alt text of the date link (link on number in each day box on year calendar) or  changing the color of the number for full event days.  the 'alt text' for the link seems more doable.  even if it just used the event title as the link alt text.  i would like to do this without hacking the views page code if possible. 

again, any help would be appreciated.
~ Thanks ~
Kevin
Stillwater, MN

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Visual way to display open vs full events?

This forum was archived on 2017-11-26.