Event Calendar RSVP

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

Re: Event Calendar RSVP

Postby battye » Sun Mar 21, 2010 9:58 am

I'm really sorry havocwreaker, I've had a really busy fortnight. I promise that later this week we'll finish this off... my to-do list is growing quite quickly: viewtopic.php?p=100229#p100229 :)
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Re: Event Calendar RSVP

Postby battye » Sat Mar 27, 2010 7:08 am

I'm back now havocwreaker :)

Could you please post your full make_rsvp.php file (as it is right now) here in code tags.

Thanks
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Re: Event Calendar RSVP

Postby havocwreaker » Mon Apr 05, 2010 2:33 am

As requested:

Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

$alert_id = request_var('alert', 0);

   // html
   echo '<html>';
     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>';
   echo '<body bgcolor="#CADCEB">';

if( $alert_id > 0 )
{
        $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);
   echo '<form action="' . append_sid('make_rsvp.'.$phpEx, 'mode=submit') . '" method="post">';
   echo '<h3>RSVP:</h3><br />';
   echo '<input type="radio" name="rsvp" value="1" /> Yes <br />';
   echo '<input type="radio" name="rsvp" value="0" /> No <br /><br />';
   echo '<h3>Explanation:</h3>';
   echo '<input type="text" name="explain" maxlength="255" />';
   echo '<input type="hidden" name="alert_id" value="' . $alert_id . '" />';
   echo '</form>';
   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>';
}

else if( request_var('mode', '') == 'submit' && request_var('alert_id', 0) > 0 )
{
   $rsvp_array = array(
       'alert_id'            => request_var('alert_id', 0),
      'user_id'            => $user->data['user_id'],
      'username'            => $user->data['username'],
      'rsvp_text'            => request_var('explain', ''),
      'rsvp_yes_no'         => request_var('rsvp', 0),
      'rsvp_time'            => time(),
   );

   $rsvp_sql = 'INSERT INTO phpbb_alerts_rsvp ' . $db->sql_build_array('INSERT', $rsvp_array);
   $db->sql_query($rsvp_sql);

   echo 'Your RSVP has been submitted to the database';   
}

else
{
   echo 'Invalid id';
}

   // html
   echo '</body>';
   echo '</html>';
?>
havocwreaker
Frequent Poster
Frequent Poster
 
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

Re: Event Calendar RSVP

Postby battye » Mon Apr 05, 2010 4:09 am

FIND

Code: Select all
if( $alert_id > 0 )
{
        $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'];


REPLACE WITH

Code: Select all
if( $alert_id > 0 )
{
        $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 = ' . $alert_id;


(the only change is on that final line, to $alert_id)

That should remove that SQL database error you were getting?

Happy Easter :)
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Re: Event Calendar RSVP

Postby havocwreaker » Tue Apr 06, 2010 1:15 am

File updated. I can't review to see if it works since the developers broke the forum. I will verify once it is running smooth again.
havocwreaker
Frequent Poster
Frequent Poster
 
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

Re: Event Calendar RSVP

Postby havocwreaker » Tue Apr 20, 2010 4:04 am

Site is working as it should now. I apologize for taking so long to get back to you but I was prepping for an event. I didn't get to use the alert mod you mode though. :(

It's active now. Would you care to continue helping me get it so that it works for regions or states?
havocwreaker
Frequent Poster
Frequent Poster
 
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

Previous

Return to Web Design

Who is online

Users browsing this forum: No registered users and 2 guests

cron