public function modelAction ( $actionData = false )
{
- $success = true;
+ $success = true;
+ $memberID = false;
// Get list of member events.
if ( isset( $this->config['loggedInUser']['contactUser']['ref_dest'] )
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events E,
" . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times T1,
" . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times T2
- WHERE E.ref_dest = %d
- AND T1.event = E.id AND T1.start_time IN (SELECT MIN(start_time) FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times WHERE event = E.id)
- AND T2.event = E.id AND T2.end_time IN (SELECT MAX(end_time) FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times WHERE event = E.id)
+ WHERE E.status != " . $this->config['status_numb']['Archived'] . "
+ AND E.ref_dest = %d
+ AND T1.event = E.id AND T1.start_time IN (SELECT MIN(start_time)
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+ WHERE event = E.id)
+ AND T2.event = E.id AND T2.end_time IN (SELECT MAX(end_time)
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+ WHERE event = E.id)
ORDER BY E.status DESC,end DESC,start DESC
LIMIT 5
OFFSET 0",
ARRAY_A
);
+ foreach ( $events as &$event ) {
+ // set the status
+ $event['status'] = $this->config['status'][$event['status']];
+ }
+ } else {
+ $events = $this->wpdb->get_results(
+ "SELECT E.id,E.name,E.status,E.approved,T1.start_time as start,T2.end_time as end
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events E,
+ " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times T1,
+ " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times T2
+ WHERE E.status = " . $this->config['status_numb']['Pending'] . "
+ AND T1.event = E.id AND T1.start_time IN (SELECT MIN(start_time)
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+ WHERE event = E.id)
+ AND T2.event = E.id AND T2.end_time IN (SELECT MAX(end_time)
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
+ WHERE event = E.id)
+ ORDER BY E.status DESC,end DESC,start DESC
+ LIMIT 5
+ OFFSET 0",
+ ARRAY_A
+ );
+
foreach ( $events as &$event ) {
// set the status
$event['status'] = $this->config['status'][$event['status']];
<div class="glm-widget-container">
<div class="glm-widget">
<h2>
- <a href="{$thisUrl}?page=glm-members-admin-menu-events-list">Events</a> (5 most recent)
+ <a href="{$thisUrl}?page=glm-members-admin-menu-events-list">Events</a> {if $memberID}(5 most recent){else}(Pending){/if}
+
+ {if $memberID}
<a class="button glm-button glm-right" href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=events&option=add&member={$memberID}">Add Event</a>
+ {else}
+ <a class="button glm-button glm-right" href="{$thisUrl}?page=glm-members-admin-menu-events-list&glm_action=list&option=add">Add Event</a>
+ {/if}
</h2>
<div class="glm-widget-content">
{if $events}
<th>Name</th>
<th>Start</th>
<th>End</th>
- <th>Status</th>
- <th>Approved</th>
+ {if $memberID}<th>Status</th>
+ <th>Approved</th>{/if}
</tr>
</thead>
<tbody>
{foreach $events as $event}
<tr>
<td>
- <a href="{$thisUrl}?page=glm-members-admin-menu-events-list&glm_action=list&member={$memberID}&option=edit&event={$event.id}">
+ <a href="{$thisUrl}?page=glm-members-admin-menu-events-list&glm_action=list{if $memberID}&member={$memberID}{/if}&option=edit&event={$event.id}">
{$event.name}
</a>
</td>
<td>{$event.start|date_format:"%m/%d/%Y"}</td>
<td>{$event.end|date_format:"%m/%d/%Y"}</td>
- <td>{$event.status}</td>
- <td>{$event.approved|date_format:"%m/%d/%Y"}</td>
+ {if $memberID}<td>{$event.status}</td>
+ <td>{$event.approved|date_format:"%m/%d/%Y"}</td>{/if}
</tr>
{/foreach}
</tbody>