From adf296588d21a37c38b256bd83f7e3f3f03b5b47 Mon Sep 17 00:00:00 2001 From: Russ Date: Mon, 20 Apr 2015 18:58:10 -0400 Subject: [PATCH] Change how event updates are handled --- includes/update_event.php | 73 ++++++++++++++++-------------- viewevent.php | 93 +++++++++++++++++++++++++-------------- 2 files changed, 100 insertions(+), 66 deletions(-) diff --git a/includes/update_event.php b/includes/update_event.php index 500a83d..add5a89 100644 --- a/includes/update_event.php +++ b/includes/update_event.php @@ -1,5 +1,5 @@ - - BMS Unit: ".$unitname." -
- Type of Alert: ".$alertname." -
- Start Date / Time: ".$start_date_time." -
- End Date / Time: ".$end_date_time." -
- Description: ".$description_for_email." -
- Updated by: ".$user." -
- Event Link: https://DOMAIN.com/bms/viewevent.php?eventid=$event_id -

- This message generated by https://DOMAIN.com/bms - - "; - //WordWrap the message - $message_wrapped = wordwrap($message, 70, "\n", true); - //Send the email + $to = "TO.ADDRES@DOMAIN.com"; + $subject = "TEST Updated BMS Alert: ".$unitname." ".$alertname.""; + $headers = "MIME-Version: 1.0" . "\r\n"; + $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; + $headers .= "From: FROM.ADDRESS@DOMAIN.com"; + $message = " + + + BMS Unit: ".$unitname." +
+ Type of Alert: ".$alertname." +
+ Start Date / Time: ".$start_date_time." +
+ End Date / Time: ".$end_date_time." +
+ Description: ".$description_for_email." +
+ Updated by: ".$user." +
+ Event Link: https://DOMAIN.com/bms/viewevent.php?eventid=$event_id +

+ This message generated by https://DOMAIN.com/bms + + "; + //WordWrap the message + $message_wrapped = wordwrap($message, 70, "\n", true); + //Send the email mail($to,$subject,$message_wrapped,$headers); } else{ echo('Error! Please go back and try again'); diff --git a/viewevent.php b/viewevent.php index 74c5493..c10f335 100644 --- a/viewevent.php +++ b/viewevent.php @@ -21,8 +21,8 @@ if( $_SESSION['access'] != 1 ) { echo "Hello, "; print_r($_SESSION['uname']); } - echo "

View Event

"; - include("includes/menu.php"); ?> + echo "

View Event

"; + include("includes/menu.php"); ?>
query($sql1); if ($result1->num_rows >0){ while ($row1 = $result1->fetch_assoc()) { - echo "
"; - echo ""; + echo ""; + echo "
"; - echo "Unit: "; - echo ""; - print_r($row1['unit_name']); + echo "
"; + echo ""; - echo "
"; + echo "Unit: "; + echo ""; + print_r($row1['unit_name']); echo "
"; - echo "Alert: "; - echo ""; - print_r($row1['alert_name']); + echo "Alert: "; + echo ""; + print_r($row1['alert_name']); + echo "
"; + echo "Description: "; + echo ""; + echo nl2br($row1['description']); + echo "
"; + echo "Start Date and Time: "; + echo ""; + print_r($row1['date_time_start']); echo "
"; - echo "Description: "; - echo ""; - echo nl2br($row1['description']); + echo "Currently Ongoing? "; + echo ""; + if($row1['is_ongoing'] ==1) { + echo "Yes"; + } else { + echo "No"; + } echo "
"; - echo "Start Date and Time: "; - echo ""; - print_r($row1['date_time_start']); - echo "
"; - echo "Currently Ongoing? "; - echo ""; - if($row1['is_ongoing'] ==1) { - echo "Yes"; - } else { - echo "No"; - } - echo "
"; - echo "End Date and Time: "; - echo ""; - print_r($row1['date_time_end']); - echo "
"; - echo "Edit Event"; - echo "
"; - } - } else { + echo "End Date and Time: "; + echo "
"; + print_r($row1['date_time_end']); + echo "
"; + echo "Event Updates"; + echo ""; + $update_query = "SELECT update_desc, update_date_time, update_user FROM event_updates WHERE event_updates.event_id=".$eventid.";"; + $update_result = $conn1->query($update_query); + if ($update_result->num_rows >0){ + while ($update_row = $update_result->fetch_assoc()) { + echo "
"; + echo "Update Desc: "; + echo ""; + echo nl2br($update_row['update_desc']); + echo "
"; + echo "Update User: "; + echo ""; + print_r($update_row['update_user']); + echo "
"; + echo "Update Date and Time: "; + echo ""; + print_r($update_row['update_date_time']); + echo "
"; + } + } else { + echo "No updates to this event"; + } + echo "
"; + echo "Edit Event"; + echo "
"; + } + } else { echo "

ERROR Event ID Not Found

"; } if ($conn1->connect_error) {