Page 1 of 5

Event Calendar RSVP

Posted: Tue Feb 02, 2010 5:19 am
by havocwreaker
Hi all,

I was directed to ask here, (thanks BTW) so I'm hoping I can get some assistance on a mod. I would like members to create an event. When members reply to the post they have radio option buttons to select whether they will attend the even or not. (It is like creating a poll in that the OP selects how many answers) The Post is then automatically updated with the RSVP yes and no answers. (Instead of the Topic creator having to go back and edit the post.)

To attempt to explain it further. I creat an OP by Selecting New Topic. As I type the Event name (=topic) I can open a calendar to select the date of the event. The Output topic title is something like: Sandella's Bike Night free trackday and suspension setup: 02-17-2010 07:00 PM - 09:00 PM

I then list any pertinent information in the topic body as any regular post.

I Submit the thread. When a user submits his/her reply, they click a radio button to select their option. (Similar to a poll) The result is time stamped with a brief response. The thread still posts the members reply sequentially but the OP now has a small section where it stamps information like this:

Code: Select all

RSVP'd Yes: 10  (9 members and 1 guests)

    * MojoNoGo [01-20-2010 08:50 AM] - But...but...but, that's Ash Wednesday!!
    * Jeremy [01-20-2010 09:42 AM]
    * Research Monkey [01-20-2010 10:17 AM]
    * Jayfooey [01-20-2010 12:55 PM] + 1 guest - I might be able to make it.
    * KTK [01-20-2010 12:58 PM] - if i get a new streetbike in time.. if not ill just borrow a friends.
    * HollywoodBush [01-20-2010 01:57 PM] - I am all in
    * crzyb16agirl [01-20-2010 02:20 PM] - If Bushy thinks he'll make it... I just may have to go too.
    * MOOCHER [01-20-2010 02:43 PM] - I will try to make it out.
    * Cyclemall [01-20-2010 05:42 PM]

RSVP'd No: 3

    * Asian Dave [01-20-2010 01:53 PM] - Maybeeeeeeeeeeeeeee.
    * OsweetchildrenO [01-21-2010 10:27 AM]
    * RayPDA [02-01-2010 12:08 PM] - mebbeeee
I hope I have explained this clearly. I got the idea from this VB site: http://www.socalmoto.org/forum/showthread.php?t=7486

The reason behind me having a feature like this is because my site uses event listings that members can search through. However, they cannot sign up for an event via my site interface. I figured it would be somewhat easier to take an existing date mod and change it to be able to do this. I appreciate any feedback or help.

Thanks!

Andy
from Mythrottle.net

Re: Event Calendar RSVP

Posted: Tue Feb 02, 2010 12:38 pm
by battye
Unfortunately my Calendar Alerts MOD doesn't edit the viewtopic/post new topic page at all. All of the alerts are listed on the index. So anything to do with the viewtopic page isn't really viable.

You said in the other post that the main thing was a list of the members that have RSVP'ed. I thought it might not be too hard to have an alert appear and a simple "RSVP: Yes or No" type button - then have a list of the people who have said either Yes or No could appear. If you wanted (as it appears you do from the above post) they could also include a sentence to explain their decision.

Then once you've got enough RSVP's you could copy it into the thread yourself.

How does this sound?

Re: Event Calendar RSVP

Posted: Tue Feb 02, 2010 7:28 pm
by havocwreaker
sounds good. Just to get this right, the members would be able to see who has rsvp'd when they select the option?

I wanted to have the OP alleviated from having to constantly update, but if there is a popup that displays the summary I would be all for it. (or even something that displays similar to a poll but gives the detailed member response.)

Re: Event Calendar RSVP

Posted: Wed Feb 03, 2010 7:06 am
by battye
havocwreaker wrote:sounds good. Just to get this right, the members would be able to see who has rsvp'd when they select the option?
Do you mean before or after they select the option?

Re: Event Calendar RSVP

Posted: Thu Feb 04, 2010 3:22 am
by havocwreaker
Before. Sometimes if someone else is going it might allow someone to make up their mind.

Re: Event Calendar RSVP

Posted: Fri Feb 05, 2010 10:53 am
by battye
I've packaged Beta 2 of Calendar Alerts MOD if you are interested, you can find it at http://www.phpbb.com/community/viewtopi ... #p11964945

On to your request now, the first thing I want you to do is create a new table in the database (using something like phpMyAdmin). This is the SQL:

Code: Select all

CREATE TABLE  phpbb_alerts_rsvp (
`rsvp_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`alert_id` INT( 8 ) NOT NULL ,
`user_id` INT( 8 ) NOT NULL ,
`username` VARCHAR( 50 ) NOT NULL ,
`rsvp_text` VARCHAR( 255 ) NOT NULL ,
`rsvp_yes_no` INT( 1 ) NOT NULL ,
`rsvp_time` INT( 20 ) NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_bin
Let me know when this is done.

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 12:23 am
by havocwreaker
I will get this done very soon. Thank you so much for the help. I'm fixing an image issue then I will create the table.

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 1:05 am
by havocwreaker
oK It;s complete. What next?

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 1:56 am
by battye
Do you have a multi-language board or do you mind if I just give you the code hard-coded in English?

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 2:59 am
by havocwreaker
Just english is fine. I have hopes the board will eventually reach the international community, but still in english ;)

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 6:42 am
by battye
What I was thinking, based on your post a bit above, was within the alert have a brief summary (number of people/percentage that chose yes or no to the RSVP) and a link that said RSVP which when you click it gives you a popup window with a poll type summary (a graph) and allows the user to select their RSVP option (if they haven't already). Does that sound alright?

Here is the first bit, once this is working I will do the popup code.

FIND in index.php

Code: Select all

	while( $row = $db->sql_fetchrow($results) )
	{
		// Sort through the alerts
IN LINE FIND

Code: Select all

// Sort through the alerts
BEFORE ADD

Code: Select all

		$rsvp_sql = 'SELECT COUNT(rsvp_id) AS count_rsvp,
					 SUM(rsvp_yes_no) AS yes_rsvp, alert_id
					 FROM phpbb_alerts_rsvp
					 WHERE alert_id = ' . $row['alert_id'];
		$rsvp_result = $db->sql_query($rsvp_sql);
		$rsvp_row = $db->sql_fetchrow($rsvp_result);

		$rsvp_total = $rsvp_row['count_rsvp'];
		$rsvp_yes = $rsvp_row['yes_rsvp'];
		$rsvp_no = $rsvp_total - $rsvp_yes;

		$rsvp_yes_percent = number_format(($rsvp_yes / $rsvp_total), 0);
		$rsvp_no_percent = number_format(($rsvp_no / $rsvp_total), 0);

		$db->sql_freeresult($rsvp_result);
FIND

Code: Select all

$template->assign_block_vars('alerts', array(
AFTER ADD

Code: Select all

				'U_RSVP_YES'	=> $rsvp_yes_percent,
				'U_RSVP_NO'		=> $rsvp_no_percent,
				'U_RSVP_LINK'	=> append_sid('alerts_rsvp.'.$phpEx),
OPEN index_body.html

FIND

Code: Select all

			<strong>{alerts.U_CALENDAR_ALERT_NOTIFICATION}</strong><br />
			{alerts.U_CALENDAR_ALERT_DATE}
AFTER ADD

Code: Select all

			<br /><br />
			RSVP Yes: {alerts.U_RSVP_YES}%<br />
			RSVP Yes: {alerts.U_RSVP_NO}%<br />
			<a href="{alerts.U_RSVP_LINK}">Click here to send your RSVP</a>
And purge cache when you are done. Providing I haven't made any errors there, you should see some RSVP information (it will be at 0% to start with) on your index page.

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 8:43 am
by havocwreaker
So it will be percentage based and not numbers? If its possible an integer would be better than the percent. My thinking is that if only one person has voted/rsvp'd YES then the count would be 100% if no one has chosen no. Either way, Im very curious to see what you have made. Anything is better than what i have right now. lol

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 8:46 am
by battye
It can be either, it is a very simple change.

To have raw numbers, instead of:

Code: Select all

            'U_RSVP_YES'   => $rsvp_yes_percent,
            'U_RSVP_NO'      => $rsvp_no_percent,
            'U_RSVP_LINK'   => append_sid('alerts_rsvp.'.$phpEx),
Use

Code: Select all

            'U_RSVP_YES'   => $rsvp_yes,
            'U_RSVP_NO'      => $rsvp_no,
            'U_RSVP_LINK'   => append_sid('alerts_rsvp.'.$phpEx),
And remove the percentage signs from the final "AFTER ADD" in the post above. :)

Once you have got the above working, I will write the code for the popup window.

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 9:10 am
by havocwreaker
Just so i don't mess anything up, I need to install the event calendar mod before I insert the code above; right?

Re: Event Calendar RSVP

Posted: Sat Feb 06, 2010 9:10 am
by battye
Yes, that is correct.

The latest version of the MOD can be downloaded at http://forums.cricketmx.com/viewtopic.php?f=63&t=4746