JEvents 1.4

Adding DB Fields

Postby keb1965 » Fri Dec 11, 2009 8:49 pm

I was in need of an automation client for my installation, to automatically email members to remind them of upcoming events. For the most part everything is working. I wrote a PHP script that reads the DB and extracts the event information and then outputs that to a mail client. That PHP script is called using a cron job once a day.

Initially I hard coded all of the email addresses in the script (not very user friendly) and only sent email reminders if an event was going to happen "tomorrow". I reasoned that occasionally it may be desirable to notify the users at an earlier or later date i.e. 1 week prior to the event to allow ample time to make arrangments to attend .. or the morning of the event to ensure the event is remembered for that day or perhaps a reminder will be needed multiple times.

So, I went about adding an E-mail Notification tab to JEvents ... I figured at minimum, to have a single reminder date, I needed 3 fields ...
    email_notify - tinyint(1)
    notify_date -datetime
    email_recipient longtext

I created the additional fields in the admin.events.html.php file and added the requisite fields to mosEvents in events.class.php ...

Since everything is already installed, I simply added the DB fields manually ...

When I edit an event, I can read the values stored in the DB easily enough and save the values back, with the exception of my checkbox for email_notify.

The checkbox code is:
Code: Select all

function checkNotify(){
     var check = 0;
     if (document.adminForm.notify_date.checked==true){
       var check = 1;
     }
      return check;
}

<span><input type="checkbox" id="email_notify" name="email_notify" value="0" onclick="checkNotify();"
<?php if ($row->email_notify == 1) echo "checked"; ?>/></span>



The event code is:
Code: Select all
$email_notify = mosGetParam( $_POST, 'email_notify','' );
if( $email_notify == 1){
    $row->email_notify = 1;
} else {
    $row->email_notify = 0;
}


I am not the smartest cookie when dealing with forms transactions, although it seems to be pretty straightforward ... I know it is something relatively simple ... I'd appreciate a nudge in the right direction.

Thanks
keb1965
 
Posts: 1
Joined: Fri Dec 11, 2009 6:58 pm

Return to JEvents 1.4

cron
  • Who is online
  • View new posts
  • View unanswered posts
  • In total there are 0 users online :: 0 registered and 0 hidden (based on users active over the past 5 minutes)
  • Most users ever online was 94 on Tue Sep 01, 2009 12:33 am
  • Users browsing this forum: No registered users