Page 4 of 5

Re: Event Calendar RSVP

Posted: Mon Feb 22, 2010 3:28 am
by battye
Should the second box be RSVP No?
What do you mean?
How do I see the explanations?


I will add that and the ability to show/hide boxes shortly :)
Lastly, will this be able to be "globally" set for groups instead of every member?
Is everyone in usergroups based on location?

Re: Event Calendar RSVP

Posted: Mon Feb 22, 2010 3:37 am
by havocwreaker
Question 1: I see two RSVp yes but I don't know if anyone has RSVp'd no. When I submitted the yest the top one updated. I am guessing the bottom value should be "RSVP No"?

Question 2: Thank you!

Question 3: I could set it that way. Since the alert box cannot be made in the appropriate thread or for example regional area. I figured I could make groups based on locality that way the alerts would be appropriate to the members it was being displayed to. Example: I don't want my California event displayed to someone in Florida. It would only clog up the index page area and if the forum ever reaches thousands of members, could get very confusing to find the appropriate event.

I am assuming from our previous conversation that the alerts cannot be set to go into the specific forums or threads? Look at my site forums (mythrottle.net) and look at the regionals to see how I have it broken down.

Re: Event Calendar RSVP

Posted: Mon Feb 22, 2010 4:12 am
by battye
1) Oh yes, my mistake :oops:

FIND (in index_body.html I think)

Code: Select all

 RSVP Yes: {alerts.U_RSVP_NO}%<br />
REPLACE WITH

Code: Select all

 RSVP No: {alerts.U_RSVP_NO}%<br />
Just out of interest, if you enter the RSVP a couple of times (enter a few yes's, a few no's) does the tally add up correctly?

Even though I haven't done it yet, I will make it so people cannot add an RSVP more than once :)



3) I might be able to do it based on forums (mid-west, north-east, etc)... let me have a think about it :)

Re: Event Calendar RSVP

Posted: Mon Feb 22, 2010 4:35 am
by havocwreaker
Sounds great! I'm adding the fixes now.

Ok...

It adds the yes and No replies.

I fixed the text but do you know why when it defaults it displays a 0 on one category and not the other? (see below)
Test Alert
21 February 2010

RSVP Yes:
RSVP No: 0 <--------Why is there a zero here and not in RSVP Yes too?
Click here to submit your RSVP

Re: Event Calendar RSVP

Posted: Mon Feb 22, 2010 5:38 am
by battye
FIND in index.php

Code: Select all

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

Code: Select all

$rsvp_yes = $rsvp_row['yes_rsvp'];
$rsvp_yes = ($rsvp_yes >= 0) ? $rsvp_yes : 0;
$rsvp_no = $rsvp_total - $rsvp_yes;
$rsvp_no = ($rsvp_no >= 0) ? $rsvp_no : 0;
Let me know if that works.

Also, I didn't realise you had replied because when you edit a post a new flag doesn't appear ;)

If you have an hour or so now to finish this MOD off, let me know :)

Re: Event Calendar RSVP

Posted: Mon Feb 22, 2010 5:52 am
by havocwreaker
Ok I will update now. I will be around for another hour or so. I am working another issue as well.

Re: Event Calendar RSVP

Posted: Tue Feb 23, 2010 3:15 am
by havocwreaker
No, it still displays without the zero. If I vote no then when it updates RSVP Yes will show a zero.

Wow alert
22 February 2010

RSVP Yes:
RSVP No: 0
Click here to submit your RSVP

Re: Event Calendar RSVP

Posted: Tue Feb 23, 2010 4:28 pm
by battye
Try replacing:

Code: Select all

$rsvp_yes = $rsvp_row['yes_rsvp'];
With

Code: Select all

$rsvp_yes = (isset($rsvp_row['yes_rsvp'])) ? $rsvp_row['yes_rsvp'] : 0;
Does that fix it?

Re: Event Calendar RSVP

Posted: Wed Feb 24, 2010 5:21 am
by havocwreaker
THAT did it!!

Thank you!

Re: Event Calendar RSVP

Posted: Wed Feb 24, 2010 6:09 am
by battye
So just so I'm clear (I'm writing a lot of code right now, things are becoming blurred :P) the core part of this is now working correctly?

All that you need done now is:

- To have the "Yes" and "No" appear like a poll with a horizontal bar graph? (or is having the numbers sufficient?)
- having a show/hide button so the page is not cluttered
- allowing users to select the region (midwest, northeast, etc) when entering an alert and having the alert appear on the viewforum page and not the index.

Please confirm that :)

Thanks

Re: Event Calendar RSVP

Posted: Thu Feb 25, 2010 1:14 am
by havocwreaker
Sorry about not responding sooner. I never got the notification about your post. Strange...

The core part is working correctly:
1. The alerts list after being added. I confirmed only pacific timezone though. All else should work I'm thinking?
2. The Link opens a new windows in where the user is able to select yes/no and type in a response. After pressing enter, the numbers add up in the appropriate block.


A poll bar graph would be great but not absolutely necessary. I do think this would add to the use of the feature though since users can see a visual representation of the responses.

Show hide button is definitely a good idea.

- allowing users to select the region (midwest, northeast, etc) when entering an alert and having the alert appear on the viewforum page and not the index. PERFECT-ideally, this could get more streamlined as a region has a lot of states and even statewide events could get very congested. However, I don't know the difficulty in configuring by state so I would very much appreciate at least the regions part.

I created this when I had the user search feature implemented.

Code: Select all

<option value="AK" <?php  if($state =='AK') echo "selected";?>>AK</option>
                                      <option value="AL" <?php  if($state =='AL') echo "selected";?>>AL</option>
                                      <option value="AR" <?php  if($state =='AR') echo "selected";?>>AR</option>
                                      <option value="AZ" <?php  if($state =='AZ') echo "selected";?>>AZ</option>
                                      <option value="CA" <?php  if($state =='CA') echo "selected";?>>CA</option>
                                      <option value="CO" <?php  if($state =='CO') echo "selected";?>>CO</option>
                                      <option value="CT" <?php  if($state =='CT') echo "selected";?>>CT</option>
                                      <option value="DE" <?php  if($state =='DE') echo "selected";?>>DE</option>
                                      <option value="FL" <?php  if($state =='FL') echo "selected";?>>FL</option>
                                      <option value="GA" <?php  if($state =='GA') echo "selected";?>>GA</option>
                                      <option value="HI" <?php  if($state =='HI') echo "selected";?>>HI</option>
                                      <option value="IA" <?php  if($state =='IA') echo "selected";?>>IA</option>
                                      <option value="ID" <?php  if($state =='ID') echo "selected";?>>ID</option>
                                      <option value="IL" <?php  if($state =='IL') echo "selected";?>>IL</option>
                                      <option value="IN" <?php  if($state =='IN') echo "selected";?>>IN</option>
                                      <option value="KS" <?php  if($state =='KS') echo "selected";?>>KS</option>
                                      <option value="KY" <?php  if($state =='KY') echo "selected";?>>KY</option>
                                      <option value="LA" <?php  if($state =='LA') echo "selected";?>>LA</option>
                                      <option value="MA" <?php  if($state =='MA') echo "selected";?>>MA</option>
                                      <option value="MD" <?php  if($state =='MD') echo "selected";?>>MD</option>
                                      <option value="ME" <?php  if($state =='ME') echo "selected";?>>ME</option>
                                      <option value="MI" <?php  if($state =='MI') echo "selected";?>>MI</option>
                                      <option value="MN" <?php  if($state =='MN') echo "selected";?>>MN</option>
                                      <option value="MO" <?php  if($state =='MO') echo "selected";?>>MO</option>
                                      <option value="MS" <?php  if($state =='MS') echo "selected";?>>MS</option>
                                      <option value="MT" <?php  if($state =='MT') echo "selected";?>>MT</option>
                                      <option value="NC" <?php  if($state =='NC') echo "selected";?>>NC</option>
                                      <option value="ND" <?php  if($state =='ND') echo "selected";?>>ND</option>
                                      <option value="NE" <?php  if($state =='NE') echo "selected";?>>NE</option>
                                      <option value="NH" <?php  if($state =='NH') echo "selected";?>>NH</option>
                                      <option value="NJ" <?php  if($state =='NJ') echo "selected";?>>NJ</option>
                                      <option value="NM" <?php  if($state =='NM') echo "selected";?>>NM</option>
                                      <option value="NV" <?php  if($state =='NV') echo "selected";?>>NV</option>
                                      <option value="NY" <?php  if($state =='NY') echo "selected";?>>NY</option>
                                      <option value="OH" <?php  if($state =='OH') echo "selected";?>>OH</option>
                                      <option value="OK" <?php  if($state =='OK') echo "selected";?>>OK</option>
                                      <option value="OR" <?php  if($state =='OR') echo "selected";?>>OR</option>
                                      <option value="PA" <?php  if($state =='PA') echo "selected";?>>PA</option>
                                      <option value="RI" <?php  if($state =='RI') echo "selected";?>>RI</option>
                                      <option value="SC" <?php  if($state =='SC') echo "selected";?>>SC</option>
                                      <option value="SD" <?php  if($state =='SD') echo "selected";?>>SD</option>
                                      <option value="TN" <?php  if($state =='TN') echo "selected";?>>TN</option>
                                      <option value="TX" <?php  if($state =='TX') echo "selected";?>>TX</option>
                                      <option value="UT" <?php  if($state =='UT') echo "selected";?>>UT</option>
                                      <option value="VA" <?php  if($state =='VA') echo "selected";?>>VA</option>
                                      <option value="VT" <?php  if($state =='VT') echo "selected";?>>VT</option>
                                      <option value="WA" <?php  if($state =='WA') echo "selected";?>>WA</option>
                                      <option value="WI" <?php  if($state =='WI') echo "selected";?>>WI</option>
                                      <option value="WV" <?php  if($state =='WV') echo "selected";?>>WV</option>
                                      <option value="WY" <?php  if($state =='WY') echo "selected";?>>WY</option>
                                      <option value="Foreign" <?php  if($state =='Foreign') echo "selected";?>>Foreign</option>
I can't thank you enough for all of the help and the continued development of this cool mod!

Re: Event Calendar RSVP

Posted: Wed Mar 03, 2010 6:07 am
by havocwreaker
I'm sure you're real busy. I'm just keeping the thread alive. ;)

I haven't been able to make much progress on my site. There's a couple of glitches frustrating me to no end.

Re: Event Calendar RSVP

Posted: Wed Mar 03, 2010 12:43 pm
by battye
Sorry about the delay. Here's how to do the bar graph (hopefully :wink:):

Open make_rsvp.php and find:

Code: Select all

   echo '<head><title>RSVP Page</title></head>';
REPLACE WITH

Code: Select all

   echo '<head><title>RSVP Page</title>';
echo '    <style type="text/css">
      .graph {
        background-color: #C8C8C8;
        border: solid 1px black;
      }
      
      .graph td {
        font-family: verdana, arial, sans serif;
      }
      
      .graph thead th {
        border-bottom: double 3px black;
        font-family: verdana, arial, sans serif;
        padding: 1em;
      }
    
      .graph tfoot td {
        border-top: solid 1px #999999;
        font-size: x-small;
        text-align: center;
        padding: 0.5em;
        color: #666666;
      }

      .bar {
        background-color: white;
        text-align: right;
        border-left: solid 1px black;
        padding-right: 0.5em;
        width: 400px;
      }
      
      .bar div { 
        border-top: solid 2px #0077DD;
        background-color: #004080;
        border-bottom: solid 2px #002266;
        text-align: right;
        color: white;
        float: left;
        padding-top: 0;
        height: 1em;
      }
      
      body {
        background-color: white;
      }
    </style>';
echo '</head>';
FIND

Code: Select all

if( $alert_id > 0 )
{
AFTER 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_yes = ($rsvp_yes >= 0) ? $rsvp_yes : 0;
      $rsvp_no = $rsvp_total - $rsvp_yes;
      $rsvp_no = ($rsvp_no >= 0) ? $rsvp_no : 0;

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

Code: Select all

   echo '</form>';
AFTER ADD

Code: Select all

   echo '<h3>Statistics:</h3>';
echo '<br /><br /><table width="530" class="graph" cellspacing="6" cellpadding="0">
      <thead>
        <tr><th colspan="3">RSVP statistics</th></tr>
      </thead>
      <tbody>
        <tr>
          <td>Yes</td><td class="bar"><div style="width: ' . $rsvp_yes_percent . '%"></div>' . $rsvp_yes . '</td><td>' . $rsvp_yes_percent . '%</td>
        </tr>
        <tr>
          <td>No</td><td class="bar"><div style="width: ' . $rsvp_no_percent . '%"></div>' . $rsvp_no . '</td><td>' . $rsvp_no_percent . '%</td>
        </tr>
      </tbody>
      <tfoot>
        <tr><td colspan="3">This shows the number of people to have submitted their RSVP.</td></tr>
      </tfoot>
    </table>';

Re: Event Calendar RSVP

Posted: Mon Mar 08, 2010 5:26 am
by havocwreaker
Sorry for the delay. I have been tied up. I made the changes as instructed and now I get the following error:

Code: Select all

SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 [1064]

SQL

SELECT COUNT(rsvp_id) AS count_rsvp, SUM(rsvp_yes_no) AS yes_rsvp, alert_id FROM phpbb_alerts_rsvp WHERE alert_id =

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 163
CALL: dbal->sql_error()

FILE: make_rsvp.php
LINE: 73
CALL: dbal_mysqli->sql_query()

Re: Event Calendar RSVP

Posted: Sun Mar 21, 2010 9:03 am
by havocwreaker
Just keeping this thread alive. :D