$eventAdded = false;
$eventAddError = false;
$view = 'list';
+ $fromDate = false;
+ $toDate = false;
$filterArchived = false;
$filterPending = false;
$eventDeleted = false;
case 'list':
default:
- $where = '';
+ $where = 'true';
// Add "selected" element default false;
reset($categories);
$categories[$k]['selected'] = false;
}
+ // Check if there is a category filter (multi-select)
+ if (isset($_REQUEST['filterCategories']) && count($_REQUEST['filterCategories']) > 0) {
+
+ $cats = '';
+ $catsSep = '';
+
+ // For each selected category
+ foreach($_REQUEST['filterCategories'] as $c) {
+ $cats .= $catsSep.$c;
+ $catsSep = ',';
+ $categories[$c]['selected'] = true;
+ }
+
+ $where .= " AND T.id in (
+ SELECT DISTINCT(EC.event)
+ FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX."event_categories EC,
+ ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX."categories C
+ WHERE (
+ EC.category in ($cats)
+ OR (C.parent in ($cats) AND EC.category = C.id)
+ )
+ )";
+ }
+
+ // If we have a From date
+ if (isset($_REQUEST['fromDate']) && trim($_REQUEST['fromDate']) != '') {
+ $fromDate = date('m/d/Y', strtotime($_REQUEST['fromDate']));
+ $fromMYSQL = date('Y-m-d', strtotime($fromDate));
+ }
+
+ // If we have a to Date
+ if (isset($_REQUEST['toDate']) && trim($_REQUEST['toDate']) != '') {
+ $toDate = date('m/d/Y', strtotime($_REQUEST['toDate']));
+ $toMYSQL = date('Y-m-d', strtotime($toDate." +1 day"));
+
+ // If we have a from but not a to date, use from as the to but don't populate the to field
+ } elseif ($fromDate) {
+ $toDate = date('m/d/Y', strtotime($_REQUEST['fromDate']));
+ $toMYSQL = date('Y-m-d', strtotime($toDate." +1 day"));
+ $toDate = false;
+ }
+
+ // If we have from and to dates, do search for those inclusive
+ if ($fromDate) {
+ $where .= "
+ AND T.id in (
+ SELECT DISTINCT(event)
+ FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX."times
+ WHERE (
+ start_time BETWEEN '$fromMYSQL' AND '$toMYSQL'
+ OR
+ end_time BETWEEN '$fromMYSQL' AND '$toMYSQL'
+ )
+ AND active
+ )
+ ";
+ }
+
// Check if the list is for a specific member
if (defined('GLM_EVENTS_MEMBER_MENU') && $memberID) {
$where .= "T.ref_dest = $memberID";
'eventAddError' => $eventAddError,
'numbEvents' => $numbEvents,
'categories' => $categories,
+ 'fromDate' => $fromDate,
+ 'toDate' => $toDate,
'filterArchived' => $filterArchived,
'filterPending' => $filterPending,
'eventDeleted' => $eventDeleted,
</td>
</tr>
<tr class="not-all-day-{$r.id}{if $r.all_day.value} glm-hidden{/if}">
- <th>Start Time:</th>
+ <th {if $newRecurrence.fieldRequired.start_time}class="glm-required"{/if}>Start Time:</th>
<td>
<input data-id="{$r.id}" type="text" name="Recur{$r.id}_start_time" value="{trim($r.start_time.time)}" class="glm-form-text-input-veryshort glm-time-input recurrence-input">
<input data-id="{$r.id}" type="checkbox" name="Recur{$r.id}_start_time_only" class="start-time-only-checkbox recurrence-input" {if $r.start_time_only.value} checked{/if}> Start time only
</td>
</tr>
<tr id="endTimeRow_{$r.id}" class="not-all-day-{$r.id}{if $r.all_day.value} glm-hidden{/if}">
- <th>End Time:</th>
+ <th {if $newRecurrence.fieldRequired.end_time}class="glm-required"{/if}>End Time:</th>
<td><input data-id="{$r.id}" type="text" name="Recur{$r.id}_end_time" value="{trim($r.end_time.time)}" class="glm-form-text-input-veryshort glm-time-input recurrence-input"></td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
- <th>Start Date:</th>
+ <th {if $newRecurrence.fieldRequired.from_date}class="glm-required"{/if}>Start Date:</th>
<td>
<input data-id="{$r.id}" type="text" name="Recur{$r.id}_from_date" value="{$r.from_date.date}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
</td>
</tr>
<tr>
- <th>End Date:</th>
+ <th {if $newRecurrence.fieldRequired.to_date}class="glm-required"{/if}>End Date:</th>
<td>
<input data-id="{$r.id}" type="text" name="Recur{$r.id}_to_date" value="{$r.to_date.date}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
</td>
{else}
{include file='admin/events/header.html'}
{/if}
-
+
{if apply_filters('glm_members_permit_admin_events_index_add_event', true)}
<h2 style="margin-bottom: 1em;">
</h2>
{/if}
- <form action="{$thisUrl}?page={$thisPage}" method="post" id="searchForm" class="glm-right">
+ <form action="{$thisUrl}?page={$thisPage}" method="post" id="searchForm">
<input type="hidden" name="glm_action" value="list">
- <table>
- <tr>
- <th>Events Found:</th><td><span style="margin-right: 2em;">{$numbEvents}</span></td>
- <th>Categories:</th>
- <td style="min-width: 25em; padding-right: 1em;">
- <select id="filterCategories" name="filterCategories[]" multiple="multiple">
- {foreach from=$categories item=v}
- <option value="{$v.id}" data-parent="{$v.parent}"{if $v.selected} selected{/if}>
- {if $v.parent_id} {/if}{$v.name}
- </option>
- {/foreach}
- </select>
- </td>
- <td><input type="submit" value="Submit" style="margin-right: 2em;"></td>
- <th>Show Archived:</th><td><input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if} style="margin-right: 1em;"></td>
- <th>Pending Only:</th><td><input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if} style="margin-right: 1em;"></td>
- <th>Text Search:</th><td><input id="glmEventsSearch" type="text" id="autoTest"></td>
- </tr>
- </table>
+ <div class="glm-right" style="text-align: right;">
+ <p>
+ <b>From Date: </b><input type="text" name="fromDate" value="{$fromDate}" class="glm-form-text-input-short glm-date-input">
+ <b>To Date: </b><input type="text" name="toDate" value="{$toDate}" class="glm-form-text-input-short glm-date-input">
+ <b>Categories: </b>
+ <select id="filterCategories" name="filterCategories[]" multiple="multiple" size="1">
+ {foreach from=$categories item=v}
+ <option value="{$v.id}" data-parent="{$v.parent}"{if $v.selected} selected{/if}>
+ {if $v.parent_id} {/if}{$v.name}
+ </option>
+ {/foreach}
+ </select>
+ <input type="submit" value="Submit">
+ </p><p>
+ <b>Show Archived: </b><input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if} style="margin-right: 1em;">
+ <b>Pending Only: </b><input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if} style="margin-right: 1em;">
+ <b>Text Search: </b><input id="glmEventsSearch" type="text" id="autoTest"><br>
+ <p>
+ </div>
</form>
<table class="wp-list-table striped glm-admin-table">
<tr>
<th>ID</th>
<th>Event Name</th>
- <th>Member</th>
+ <th>Member</th>
<th>Status</th>
<th>Created</th>
<th>Updated</th>
{if $events}
{assign var="i" value="0"}
{foreach $events as $e}
- {if $i++ is odd by 1}
+ {if $i++ is odd by 1}
<tr>
{else}
<tr class="alternate">
<script type="text/javascript">
jQuery(document).ready(function($) {
-
+
// Add Event Button Action
$('#addEventButton').click( function() {
window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=list&option=add";
});
-
+
// Date Input
$('.glm-date-input').datepicker();
-
- // Flash certain elements for a short time after display
+
+ // Flash certain elements for a short time after display
$(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
// Filter triggers
$(".listFilter" ).change( function() {
-
+
var filter = '';
-
+
// Check for archived filter
if ($("#filterArchived").attr('checked')) {
filter += '&filterArchived=true';
}
-
+
// Check for pending data filter
if ($("#filterPending").attr('checked')) {
filter += '&filterPending=true';
}
-
+
window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=list" + filter;
-
+
return false;
});
-
+
/*
* Do autocomplete search for member
* label: What will be searched
* value: What will be displayed when selected
* id: Member id added so we can go to the member while showing what was selected
- * Also note that autocomplete does not properly render HTML codes, so we
+ * Also note that autocomplete does not properly render HTML codes, so we
* "unescape" them for HTML in Smarty.
*/
});
// Expand multi-select on hover
- $('#filterCategories').multiselect({
- columns: 1,
- placeholder: 'Click to select categories',
- search: 1,
- selectAll: true,
- maxWidth: 200
- });
-
-
+ $('#filterCategories').multiselect();
+
});
</script>
-
+
{include file='admin/footer.html'}