$memberContact = false;
$memberManager = false;
$members = false;
+ $eventAmenities = array();
if ( isset( $actionData['request']['member_only'] )
&& $memberOnly = filter_var( $actionData['request']['member_only'], FILTER_VALIDATE_BOOLEAN ) ) {
$memberContact = ( isset( $config['loggedInUser']['contactUser'] ) ) ? $config['loggedInUser']['contactUser']: null;
if ( current_user_can( 'glm_members_members' ) ) {
$memberManager = true;
- $members = apply_filters( 'member_names_and_ids', '' );
+ $members = apply_filters( 'member_names_and_ids', '' );
}
+ // Grab member list for creating an array of venues
+ $venues = apply_filters( 'member_names_and_ids', '' );
+
+ // Grab list of Amenities for creating checkboxes
+ $amenities = new GlmDataEventsAmenities( $this->wpdb, $this->config );
+ $eventAmenities = $amenities->getList();
}
if( ! wp_script_is( 'jquery-ui', 'enqueued' ) ){
}
$view = 'frontAdd';
// populate category dropdown
- $categories = new GlmDataEventsCategories($this->wpdb, $this->config);
- $emailInfo = new GlmDataEventsManagement($this->wpdb, $this->config);
+ $categories = new GlmDataEventsCategories( $this->wpdb, $this->config );
+ $emailInfo = new GlmDataEventsManagement( $this->wpdb, $this->config );
$emailInfo = $emailInfo->getEntry(1);
// get and validate recipient email address, put into an array to pass to wp_mail
// if form is submitted
if ( isset( $_REQUEST['newEvent'] ) && $_REQUEST['newEvent'] == "Add Event" ) {
+
// Check to see if the honey pot caught spam.
if ( isset( $_REQUEST['real_email'] ) && $_REQUEST['real_email'] ) {
$view = 'confirmation';
'%s',
'%s'
);
- if ( $memberOnly && $memberContact ) {
- $eventData['ref_type'] = $memberContact['ref_type'];
- $eventData['ref_dest'] = $memberContact['ref_dest'];
- $eventDataFormat[] = '%d';
- $eventDataFormat[] = '%d';
- }
- if ( $memberOnly && $ref_dest = filter_var( $_REQUEST['ref_dest'], FILTER_VALIDATE_INT ) ) {
- $eventData['ref_type'] = 10;
- $eventData['ref_dest'] = $ref_dest;
- $eventDataFormat[] = '%d';
- $eventDataFormat[] = '%d';
+ if ( $memberOnly ) {
+ if ( $memberContact ) {
+ $eventData['ref_type'] = $memberContact['ref_type'];
+ $eventData['ref_dest'] = $memberContact['ref_dest'];
+ $eventDataFormat[] = '%d';
+ $eventDataFormat[] = '%d';
+ }
+ if ( $ref_dest = filter_var( $_REQUEST['ref_dest'], FILTER_VALIDATE_INT ) ) {
+ $eventData['ref_type'] = 10;
+ $eventData['ref_dest'] = $ref_dest;
+ $eventDataFormat[] = '%d';
+ $eventDataFormat[] = '%d';
+ }
+ if ( $other_ref_dest = filter_var( $_REQUEST['other_ref_dest'], FILTER_VALIDATE_INT ) ) {
+ $eventData['other_ref_dest'] = $other_ref_dest;
+ $eventDataFormat[] = '%d';
+ }
+ if ( $user_member_location = filter_var( $_REQUEST['use_member_location'], FILTER_VALIDATE_BOOLEAN ) ) {
+ $eventData['use_member_location'] = $user_member_location;
+ $eventDataFormat[] = '%s';
+ }
}
$this->wpdb->insert(
GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
'%d'
)
);
+ // Amenity Data
+ if ( $this->config['settings']['use_event_amenities'] ) {
+ $amenityRequestData = $_REQUEST['amenity'];
+ if ( is_array( $amenityRequestData ) && !empty( $amenityRequestData ) ) {
+ foreach ( $amenityRequestData as $amm ) {
+ $this->wpdb->insert(
+ GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'amenity_event',
+ array( 'event' => $eventID, 'amenity' => $amm ),
+ array( '%d' )
+ );
+ }
+ }
+ }
$smarty = new smartyTemplateSupport();
$default_state = ( $this->config['settings']['default_state'] )
? $this->config['settings']['default_state']
: ( $this->config['settings']['event_default_state'] ) ? $this->config['settings']['event_default_state']: 'MI';
+
// Compile template data
$templateData = array(
- 'members' => $members,
- 'memberManager' => $memberManager,
- 'memberOnly' => $memberOnly,
- 'memberContact' => $memberContact,
- 'states' => $this->config['states'],
- 'state_def' => $default_state,
- 'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL,
- 'currentUrl' => ((isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),
- 'categories' => $eventCategories,
- 'fromDate' => $fromDate,
- 'event' => $newEvent,
- 'permalink' => $permalink,
- 'title' => $title,
- 'to_email' => $to_email,
- 'from_email' => $fromEmail,
- 'notification' => $emailNotification,
- 'mainImgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/'
+ 'members' => $members,
+ 'venues' => $venues,
+ 'eventAmenities' => $eventAmenities,
+ 'memberManager' => $memberManager,
+ 'memberOnly' => $memberOnly,
+ 'memberContact' => $memberContact,
+ 'states' => $this->config['states'],
+ 'state_def' => $default_state,
+ 'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL,
+ 'currentUrl' => ((isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),
+ 'categories' => $eventCategories,
+ 'fromDate' => $fromDate,
+ 'event' => $newEvent,
+ 'permalink' => $permalink,
+ 'title' => $title,
+ 'to_email' => $to_email,
+ 'from_email' => $fromEmail,
+ 'notification' => $emailNotification,
+ 'mainImgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/'
);
//error_reporting(E_ALL ^ E_NOTICE);
<form action="{$thisUrl}" method="post" enctype="multipart/form-data" name="frontAddForm" id="frontForm">
{if $memberOnly && $memberContact}
- <input type="hidden" name="ref_type" value="{$memberContact.ref_type}" />
- <input type="hidden" name="ref_dest" value="{$memberContact.ref_dest}" />
+ <input type="hidden" name="ref_type" value="{$memberContact.ref_type}" />
+ <input type="hidden" name="ref_dest" value="{$memberContact.ref_dest}" />
{/if}
<table id="glm-table-descr" class="glm-admin-table glm-event-table">
<tr id="glmRealEmail">
<td><input type="text" name="real_email"></td>
</tr>
{if $memberManager}
- <tr>
- <td> Member </td>
- <td>
- <select name="ref_dest">
- <option value="0">Choose Member</option>
- {foreach $members as $m}
- <option value="{$m.id}">{$m.name}</option>
- {/foreach}
- </select>
- </td>
- </tr>
+ <tr>
+ <td> Member </td>
+ <td>
+ <select name="ref_dest">
+ <option value="0">Choose Member</option>
+ {foreach $members as $m}
+ <option value="{$m.id}">{$m.name}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ {/if}
+ {if $memberOnly}
+ <tr>
+ <th style="color: red;"> Categories </th>
+ <td>
+ <select class="glm-required" id="eventCategories" name="categories" required>
+ <option selected value> Select Category</option>
+ {foreach from=$categories item=cat}
+ <option value="{$cat['id']}"> {$cat['name']} </option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
{/if}
<tr>
<th style="color: red;">Event Name: </th>
<input type="text" name="event_name" value="" class="glm-form-text-input-medium glm-required" placeholder="Name of this event" required>
</td>
</tr>
+ {if $memberOnly && $settings.use_event_amenities}
+ <tr>
+ <th style="color: red;">{$settings.term_event_amenities_plural}: (Check all that apply)</th>
+ <td>
+ {foreach $eventAmenities as $amenity}<label>
+ <input type="checkbox" class="beerType" name="amenity[]" value="{$amenity.id}" onclick="EventFront.deRequireCb('beerType')" required />
+ {$amenity.name}
+ </label>
+ {/foreach}
+ </td>
+ </tr>
+ {/if}
<tr>
<th style="color: red;"> Start Date </th>
<td><input class="glm-datetime-input glm-required" id="sdate" name="starting" maxlength="100" type="text" required></td>
<th> Start Time </th>
<td>
<select class="timeDropDown glm-required" name="shour">
- <option value="">Hour</option>
- <option value="1">01</option>
- <option value="2">02</option>
- <option value="3">03</option>
- <option value="4">04</option>
- <option value="5">05</option>
- <option value="6">06</option>
- <option value="7">07</option>
- <option value="8">08</option>
- <option value="9">09</option>
- <option value="10">10</option>
- <option value="11">11</option>
- <option value="12">12</option>
+ <option value="">Hour</option>
+ <option value="1">01</option>
+ <option value="2">02</option>
+ <option value="3">03</option>
+ <option value="4">04</option>
+ <option value="5">05</option>
+ <option value="6">06</option>
+ <option value="7">07</option>
+ <option value="8">08</option>
+ <option value="9">09</option>
+ <option value="10">10</option>
+ <option value="11">11</option>
+ <option value="12">12</option>
</select> : <select class="timeDropDown glm-required" name="smin">
- <option value="">Minute</option>
- <option value="00">00</option>
- <option value="15">15</option>
- <option value="30">30</option>
- <option value="45">45</option>
+ <option value="">Minute</option>
+ <option value="00">00</option>
+ <option value="15">15</option>
+ <option value="30">30</option>
+ <option value="45">45</option>
</select> <select class="timeDropDown glm-required" name="sampm">
- <option value="">AM/PM</option>
- <option value="AM">AM</option>
- <option value="PM">PM</option>
+ <option value="">AM/PM</option>
+ <option value="AM">AM</option>
+ <option value="PM">PM</option>
</select>
</td>
</tr>
<th> End Time </th>
<td>
<select class="timeDropDown" name="ehour">
- <option value="">Hour</option>
- <option value="1">01</option>
- <option value="2">02</option>
- <option value="3">03</option>
- <option value="4">04</option>
- <option value="5">05</option>
- <option value="6">06</option>
- <option value="7">07</option>
- <option value="8">08</option>
- <option value="9">09</option>
- <option value="10">10</option>
- <option value="11">11</option>
- <option value="12">12</option>
+ <option value="">Hour</option>
+ <option value="1">01</option>
+ <option value="2">02</option>
+ <option value="3">03</option>
+ <option value="4">04</option>
+ <option value="5">05</option>
+ <option value="6">06</option>
+ <option value="7">07</option>
+ <option value="8">08</option>
+ <option value="9">09</option>
+ <option value="10">10</option>
+ <option value="11">11</option>
+ <option value="12">12</option>
</select> : <select class="timeDropDown" name="emin">
- <option value="">Minute</option>
- <option value="00">00</option>
- <option value="15">15</option>
- <option value="30">30</option>
- <option value="45">45</option>
+ <option value="">Minute</option>
+ <option value="00">00</option>
+ <option value="15">15</option>
+ <option value="30">30</option>
+ <option value="45">45</option>
</select> <select class="timeDropDown" name="eampm">
- <option value="">AM/PM</option>
- <option value="AM">AM</option>
- <option value="PM">PM</option>
+ <option value="">AM/PM</option>
+ <option value="AM">AM</option>
+ <option value="PM">PM</option>
</select>
</td>
</tr>
<tr class="frontRecurrences" id="daysOfWeek">
<td class="labelcell"><label>Days of Week</label></td>
<td>
-
- <input name="daysow[1]" value="" type="hidden">
- <label class="glmCheckBox">
- <input name="daysow[1]" value="1" type="checkbox">Sunday
- </label>
- <input name="daysow[2]" value="" type="hidden">
- <label class="glmCheckBox">
- <input name="daysow[2]" value="2" type="checkbox">Monday
- </label>
- <input name="daysow[3]" value="" type="hidden">
- <label class="glmCheckBox">
- <input name="daysow[3]" value="4" type="checkbox">Tuesday
- </label>
- <input name="daysow[4]" value="" type="hidden">
- <label class="glmCheckBox">
- <input name="daysow[4]" value="8" type="checkbox">Wednesday
- </label>
- <input name="daysow[5]" value="" type="hidden">
- <label class="glmCheckBox">
- <input name="daysow[5]" value="16" type="checkbox">Thursday
- </label>
- <input name="daysow[6]" value="" type="hidden">
- <label class="glmCheckBox">
- <input name="daysow[6]" value="32" type="checkbox">Friday
- </label>
- <input name="daysow[7]" value="" type="hidden">
- <label class="glmCheckBox">
- <input name="daysow[7]" value="64" type="checkbox">Saturday
- </label>
- </td>
- </tr>
- <tr>
- <th> Categories </th>
- <td>
-
- <select class="glm-required" id="eventCategories" name="categories" >
- <option selected value> Select Category</option>
- {foreach from=$categories item=cat}
- <option value="{$cat['id']}"> {$cat['name']} </option>
- {/foreach}
- </select>
+ <input name="daysow[1]" value="" type="hidden">
+ <label class="glmCheckBox">
+ <input name="daysow[1]" value="1" type="checkbox">Sunday
+ </label>
+ <input name="daysow[2]" value="" type="hidden">
+ <label class="glmCheckBox">
+ <input name="daysow[2]" value="2" type="checkbox">Monday
+ </label>
+ <input name="daysow[3]" value="" type="hidden">
+ <label class="glmCheckBox">
+ <input name="daysow[3]" value="4" type="checkbox">Tuesday
+ </label>
+ <input name="daysow[4]" value="" type="hidden">
+ <label class="glmCheckBox">
+ <input name="daysow[4]" value="8" type="checkbox">Wednesday
+ </label>
+ <input name="daysow[5]" value="" type="hidden">
+ <label class="glmCheckBox">
+ <input name="daysow[5]" value="16" type="checkbox">Thursday
+ </label>
+ <input name="daysow[6]" value="" type="hidden">
+ <label class="glmCheckBox">
+ <input name="daysow[6]" value="32" type="checkbox">Friday
+ </label>
+ <input name="daysow[7]" value="" type="hidden">
+ <label class="glmCheckBox">
+ <input name="daysow[7]" value="64" type="checkbox">Saturday
+ </label>
</td>
</tr>
+ {if !$memberOnly}
+ <tr>
+ <th> Categories </th>
+ <td>
+ <select class="glm-required" id="eventCategories" name="categories" >
+ <option selected value> Select Category</option>
+ {foreach from=$categories item=cat}
+ <option value="{$cat['id']}"> {$cat['name']} </option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ {/if}
<tr>
<th {if $event.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
<td {if $event.fieldFail.url}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
<input type="text" name="url" value="{$event.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
-
</td>
</tr>
<tr>
<th style="color: red;" {if $event.fieldRequired.intro}class="glm-required"{/if}>Intro Text:</th>
<td {if $event.fieldFail.intro}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
<textarea name="intro" class="glm-form-textarea" required>{$event.fieldData.intro}</textarea>
-
</td>
</tr>
<input type="text" name="cost" value="{$event.fieldData.cost}" class="glm-form-text-input-medium">
</td>
</tr>
+ {debug}
<tr>
- <th {if $event.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
+ <th {if $event.fieldRequired.descr}style="color: red;"{/if}>Description:</th>
<td {if $event.fieldFail.descr}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
{php}
wp_editor('{$event.fieldData.descr|escape:quotes}', 'glm_descr', array(
<th {if $event.fieldRequired.image}class="glm-required"{/if}>Image:</th>
<td {if $event.fieldFail.image}class="glm-form-bad-input"{/if}>
<table class="glm-admin-image-edit-table">
- {if $event.fieldData.image}
- <tr>
- <td>
- <div class="glm-galleryImage" data-id="image">
- <img src="{$glmPluginMediaUrl}/images/small/{$event.fieldData.image}">
- </div>
- </td>
- <td>
- <input type="checkbox" name="image_delete"> Delete Image<br>
- {$event.fieldData.image}<br>
- </td>
- </tr>
- {/if}
+ {if $event.fieldData.image}
+ <tr>
+ <td>
+ <div class="glm-galleryImage" data-id="image">
+ <img src="{$glmPluginMediaUrl}/images/small/{$event.fieldData.image}">
+ </div>
+ </td>
+ <td>
+ <input type="checkbox" name="image_delete"> Delete Image<br>
+ {$event.fieldData.image}<br>
+ </td>
+ </tr>
+ {/if}
<tr><td colspan="2"><b>New image:</b> <input type="file" name="image_new"></td></tr>
</table>
</td>
</tr>
- <tr>
- <td>
- <label style="color: red;">Place</label>
- <input type="hidden" id="glm-add-event-lat" name="lat">
- <input type="hidden" id="glm-add-event-lon" name="lon">
- </td>
- <td>
- <input class="glm-required" name="place" maxlength="100" type="text" required>
- </td>
- </tr>
- <tr>
- <td>
- <label >Address</label>
- </td>
- <td>
- <input name="address" maxlength="100" type="text">
- </td>
- </tr>
- <tr>
- <td>
- <label style="color: red;">City</label>
- </td>
- <td>
- <input name="city" maxlength="100" type="text" class="glm-required" required>
- </td>
- </tr>
- <tr>
- <th style='color:red;'>State:</th>
- <td>
- <select id="state_30" name="state" required>
- {foreach $states as $stateAbbr => $stateName}
- <option value="{$stateAbbr}"{if $state_def == $stateAbbr} selected{/if}>
- {$stateName}
- </option>
- {/foreach}
- </select>
- </td>
-</tr>
- <tr>
- <td>
- <label >ZIP</label>
- </td>
- <td>
- <input name="zip" maxlength="100" type="text">
- </td>
- </tr>
+ {if $memberOnly}
+ <tr>
+ <th></th>
+ <td>
+ <label>
+ <input type="checkbox" name="use_member_location" value="1" />
+ Use {if $memberContact}your{else}{$terms.term_member}{/if} location
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <th> Venue </th>
+ <td>
+ <input type="hidden" id="glm-add-event-lat" name="lat" />
+ <input type="hidden" id="glm-add-event-lon" name="lon" />
+ <input type="hidden" name="place" />
+ <input type="hidden" name="address" />
+ <input type="hidden" name="city" />
+ <input type="hidden" name="state" />
+ <input type="hidden" name="zip" />
+ <select name="other_ref_dest">
+ <option value="0">Choose Venue</option>
+ {foreach $venues as $m}
+ <option value="{$m.id}">{$m.name}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ {else}
+ <tr>
+ <td>
+ <label style="color: red;">Place</label>
+ <input type="hidden" id="glm-add-event-lat" name="lat" />
+ <input type="hidden" id="glm-add-event-lon" name="lon" />
+ </td>
+ <td>
+ <input class="glm-required" name="place" maxlength="100" type="text" required>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label >Address</label>
+ </td>
+ <td>
+ <input name="address" maxlength="100" type="text">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label style="color: red;">City</label>
+ </td>
+ <td>
+ <input name="city" maxlength="100" type="text" class="glm-required" required>
+ </td>
+ </tr>
+ <tr>
+ <th style='color:red;'>State:</th>
+ <td>
+ <select id="state_30" name="state" required>
+ {foreach $states as $stateAbbr => $stateName}
+ <option value="{$stateAbbr}"{if $state_def == $stateAbbr} selected{/if}>
+ {$stateName}
+ </option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label >ZIP</label>
+ </td>
+ <td>
+ <input name="zip" maxlength="100" type="text">
+ </td>
+ </tr>
+ {/if}
<tr>
<td>
<label>Event Contact Person<br>(published on Web site)</label>
</td>
<td class="contactName">
- <input id="contactFirstName" name="contact_fname" maxlength="100" type="text" placeholder="First Name">
-
- <input id="contactLastName" name="contact_lname" maxlength="100" type="text" placeholder="Last Name">
+ <input id="contactFirstName" name="contact_fname" maxlength="100" type="text" placeholder="First Name">
+ <input id="contactLastName" name="contact_lname" maxlength="100" type="text" placeholder="Last Name">
</td>
</tr>
<tr>
<td>
- <label>Contact Email<br>(published on Web site)</label>
+ <label>Contact Email<br>(published on Web site)</label>
</td>
<td>
<input name="contact_email" maxlength="100" type="text">
</tr>
<tr>
<td>
- <label style="color: red;">Contact Phone<br>(published on Web site)</label>
+ <label style="color: red;">Contact Phone<br>(published on Web site)</label>
</td>
<td>
- <input name="contact_phone" maxlength="100" type="text" class="glm-required" required>
+ <input name="contact_phone" maxlength="100" type="text" class="glm-required" required>
</td>
</tr>
<tr>
<td>
- <label style="color: red;">Organization Contact Name Submitting Event</label>
+ <label style="color: red;">Organization Contact Name Submitting Event</label>
</td>
<td>
- <input name="admin_name" maxlength="100" type="text" class="glm-required">
+ <input name="admin_name" maxlength="100" type="text" class="glm-required">
</td>
</tr>
<tr>
<td>
- <label style="color: red;"> Name of Organization </label>
+ <label style="color: red;"> Name of Organization </label>
</td>
<td>
- <input name="admin_org" maxlength="100" type="text" class="glm-required">
+ <input name="admin_org" maxlength="100" type="text" class="glm-required">
</td>
</tr>
<tr>
<label style="color: red;">Organization Phone</label>
</td>
<td>
- <input name="admin_phone" maxlength="100" type="text" class="glm-required" required>
+ <input name="admin_phone" maxlength="100" type="text" class="glm-required" required>
</td>
</tr>
<tr>
<td>
-
- <label style="color: red;">Organization Email Address</label>
+ <label style="color: red;">Organization Email Address</label>
</td>
<td>
- <input name="admin_email" maxlength="100" type="text" class="glm-required" required>
+ <input name="admin_email" maxlength="100" type="text" class="glm-required" required>
</td>
</tr>
<tr>
<td>
- <label>Event File</label>
+ <label>Event File</label>
</td>
<td>
- <input name="file_rmv" type="file">
+ <input name="file_rmv" type="file">
</td>
</tr>
<tr>
<td>
- <label>File Description</label>
+ <label>File Description</label>
</td>
<td>
- <input name="fileDescription" maxlength="100" type="text">
+ <input name="fileDescription" maxlength="100" type="text">
</td>
</tr>
-
</table>
-<input class="button radius" id="newEvent" name='newEvent' type="submit" value="Add Event">
-<!--<input name="option" value="submit" type="hidden">-->
+ <input class="button radius" id="newEvent" name='newEvent' type="submit" value="Add Event">
</form>
-
-