Skip to content

Instantly share code, notes, and snippets.

@naeluh
Created July 17, 2013 21:31
Show Gist options
  • Save naeluh/6024705 to your computer and use it in GitHub Desktop.
Save naeluh/6024705 to your computer and use it in GitHub Desktop.
<?
$specialevents = array();
if ($reserv_status == "success") {
// print the confirmation form that will then input the event into the database
unset($toemails);
$spevent = new event;
$spevent->id = $_POST["id"];
if (isset($recurrence->groupid)) {
$spevent->groupid = $recurrence->groupid;
} else {
$spevent->groupid = '';
}
$spevent->groupid = $recurrence->groupid;
$spevent->event_name = $_POST['event_name'];
$spevent->b_day = $mybday;
$spevent->b_month = $mybmonth;
$spevent->b_year = $mybyear;
$spevent->b_time = $b_time;
$spevent->b_time2 = $b_time2;
$spevent->b_tindex = $b_tindex;
$spevent->e_day = $myeday;
$spevent->e_month = $myemonth;
$spevent->e_year = $myeyear;
$spevent->e_time = $e_time;
$spevent->e_time2 = $e_time2;
$spevent->e_tindex = $e_tindex;
$spevent->locations = "";
$spevent->locations_text = "";
foreach ($locations_order as $mylocation) {
$loc_var = "location" . $mylocation->location_id;
if ($loc_status[$loc_var] == "selected") {
$spevent->locations .= $loc_var . ",";
$spevent->locations_text .= $mylocation->location_name . ", ";
$approver1 = $mylocation->approver1;
$approver2 = $mylocation->approver2;
$approver3 = $mylocation->approver3;
$toemails[] = $approver1->email;
if (!empty($approver2->email)) {
$toemails[] = $approver2->email;
}
if (!empty($approver3->email)) {
$toemails[] = $approver3->email;
}
}
} // END foreach
$spevent->vendors = $_POST['vendors'];
$spevent->setup_needs = $_POST['setup_needs'];
$spevent->request_name = $_POST['request_name'];
$spevent->request_email = $_POST['request_email'];
$spevent->appr_emails = "";
foreach ($toemails as $myemail) {
$spevent->appr_emails .= $myemail . ",";
}
$spevent->approval = "pending";
$successes += 1;
$specialevents[] = $spevent;
echo '<pre>';
var_dump($specialevents);
echo '</pre>';
}
}
if (count($specialevents) > 0) {
foreach ($specialevents as $myspevent) {
$conf = "Event Name: <b>" . $myspevent->event_name . "</b><br>";
$conf .= "Group ID: <b>" . $myspevent->groupid . "</b><br>";
$conf .= "Date: <b>" . $myspevent->b_month . "/" . $myspevent->b_day . "/" . $myspevent->b_year . "</b><br>";
if ($nextdayend == "sameday") {
$conf .= "Times: <b> ". $myspevent->b_time . $myspevent->b_time2 . " - " . $myspevent->e_time . $myspevent->e_time2 . "</b><br>";
} else {
$conf .= "Times: <b> ". $myspevent->b_time . $myspevent->b_time2 . " - " . $myspevent->e_time . $myspevent->e_time2 . " Next Day" . "</b><br>";
}
$conf .= "Locations: <b>" . $myspevent->locations_text . "</b><br>";
$conf .= "Vendors: " . $myspevent->vendors . "<br>";
$conf .= "Set Up Needs: " . $myspevent->setup_needs . "<br>";
$conf .= "Requested by: " . $myspevent->request_name . "; " . $myspevent->request_email . "";
$conf .= $exec_office_txt;
if (isset($_POST['status']) && $_POST['status'] != "edit") {
print "<br><div class='instructions'><span class='blacktext'><b>SUMMARY - Don't Forget to Finilize Your Request Below</b><br>The Following Events can be successfully booked: <br>$conf<br></span></div><br><br>";
} else {
print "<br><div class='instructions'><span class='blacktext'><br><b>SUMMARY - Don't Forget to Finilize Your Request Below</b><br>The Following Events can be successfully updated: <br>$conf<br></span></div><br><br>";
}
} // END foreach
$hidden_form = '<form action="specialevents_confirm.php?mode=input" method="post" name="addevent" id="addevent">';
$event_count = 0;
foreach ($specialevents as $myevent) {
$event_count ++;
foreach ($myevent as $key => $value) {
$hidden_form .= '<input type="hidden" name="eventcount' . $event_count . '_' . $key . '" id="' . $event_count . '_' . $key . '" value="' . $value . '">';
//print "Total: " . $myevent[$key] . "; Key: " . $key . "; Value: " . $value . "<br>";
}
} // END foreach
if ($frequency != '') {
foreach ($recurrence as $key => $value) {
$hidden_form .= '<input type="hidden" name="' . $key . '" id="' . $key . '" value="' . $value . '">';
//print "Total: " . $myevent[$key] . "; Key: " . $key . "; Value: " . $value . "<br>";
}
} // END IF
$hidden_form .= '<input type="hidden" name="eventcount" id="eventcount" value="' . $event_count . '">';
if (isset($_POST['status'])) {
$hidden_form .= '<input type="hidden" name="status" id="status" value="' . $_POST['status'] . '">';
} else {
$hidden_form .= '<input type="hidden" name="status" id="status" value="">';
}
$hidden_form .= '<input type="hidden" name="username" id="username" value="' . $_POST['request_name'] . '">';
$hidden_form .= '<div class="instructions"><span class="black14"><a href="#" onClick="javascript:document.addevent.submit();"><strong>Click here to FINILIZE YOUR RESERVATION</strong></a></span></div> or <div class="instructions"><span class="black14"><a href="javascript:history.back()">Go Back to make edits to your request</a></span></div></form>';
print $hidden_form;
echo '<pre>';
var_dump($conf);
echo '</pre>';
}
else {
print "<br><div class='instructions'><span class='blacktext'>The events you requested cannot be booked because of overlap with existing reservations. <br><strong><a href='javascript:history.back()'>Please go back and revise your request</a></strong>. <br>Thank you.</span></div>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment