width: 35%;
}
}
+/* Front page styles */
+#glm-events-frontpage-wrapper {
+ font-size: 1rem;
+ line-height: 1.2;
+ width: 100%;
+}
+.glm-events-frontpage-day {
+ background-color: grey;
+ color: white;
+ border-radius: 5px;
+ margin: 0 0 10px 0;
+ padding: 5px;
+ text-align: center;
+ font-size: .7em;
+ font-weight: bold;
+}
+.glm-events-frontpage-event-image {
+ float: left;
+ height: 100%;
+ width: 30%;
+}
+.glm-events-frontpage-event-image img {
+ min-width: 90px;
+ float: left;
+ height: 100%;
+}
+.glm-events-frontpage-event-container {
+ border: lightgrey solid 1px;
+ border-radius: 5px;
+ background-color: white;
+ height: 90px;
+}
+.glm-events-frontpage-event-title {
+ font-size: .66em;
+ font-weight: bold;
+ float: right;
+ width: 70%;
+}
+.glm-events-frontpage-event-dates {
+ font-size: .63em;
+ font-weight: bold;
+ float: right;
+ width: 70%;
+}
+.glm-events-frontpage-event-content {
+ font-size: .63em;
+ float: right;
+ width: 70%;
+}
// If a catgegory ID is supplied
if ($catId = filter_var( $categoryId, FILTER_VALIDATE_INT )) {
$events = $this->getEventsByCategory( $catId, $limit );
-
- // Else if a category name is supplied
+ // Else if a category name is supplied
} else if ($term = filter_var( $categoryId, FILTER_SANITIZE_STRING )) {
$searchTerm = $this->wpdb->esc_like( $term );
$where .= "T.name like '%" . $searchTerm . "%'
$order = "T.id";
$order .= " LIMIT 2 OFFSET 0";
$events = $this->getList($where, $order);
-
- // Otherwise get all categories
+ } else if ( $limit = filter_var( $limit, FILTER_VALIDATE_INT ) ) {
+ // Need to get the event id's for the next $limit number of events.
+ $where .= "T.id
+ AND T.status = " . $this->config['status_numb']['Active'] . "
+ AND T.id IN (
+ SELECT distinct event
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET
+ WHERE active
+ AND start_time >= NOW()
+ )
+ ";
+ $order = "T.id";
+ //$order .= " LIMIT {$limit} OFFSET 0";
+ //echo '<pre>$order: ' . print_r($order, true) . '</pre>';
+ $events = $this->getList( $where, $order );
+ //echo '<pre>$events: ' . print_r($events, true) . '</pre>';
+ // Otherwise get all categories
} else {
-
$where .= "T.status = " . $this->config['status_numb']['Active'] . "
AND T.id IN (
SELECT event
if ($memberId == 0) {
$memberId = null;
}
+ $limit = filter_var( $actionData['request']['limit'], FILTER_VALIDATE_INT );
+ if ( $limit ) {
+ $action = 'front-page';
+ }
if (isset($_REQUEST['eventId']) && $eventId = filter_var($_REQUEST['eventId'], FILTER_VALIDATE_INT)) {
$search = true;
switch ($action) {
+ case 'front-page':
+ $events = $this->getModelEventsData($categoryId, $limit);
+ break;
case 'event-list-name':
$events = $this->getModelEventsData($eventNameSearch);
$view = 'agenda.html';
$eventsByDate = $mainEvents;
}
- // Check for alternate template requests
+ // Check for alternate template requests
switch($actionData['request']['template']) {
case 'member-list':
wp_enqueue_style('glm-member-db-events-style', GLM_MEMBERS_EVENTS_PLUGIN_URL . 'css/front.css');
case 'member-detail':
$view = 'listForMemberDetail.html';
break;
+ case 'frontPage':
+ $view = 'eventsFrontPage.html';
+ // update the $eventsByDate array so it has the limit
+ $eventCountInArray = 0;
+ $newEventsByDateArray = array();
+ if ( $limit ) {
+ foreach ( $eventsByDate as $eventDate => &$eventgroup ) {
+ foreach ( $eventgroup as $key => &$events ) {
+ $i = 0;
+ foreach ( $events as $time => &$times ) {
+ ++$i;
+ ++$eventCountInArray;
+ $newEventsByDateArray[$eventDate][$i][$time] = $times;
+ if ( $eventCountInArray === $limit ) {
+ break 3;
+ }
+ }
+ if ( $eventCountInArray === $limit ) {
+ break 2;
+ }
+ }
+ if ( $eventCountInArray === $limit ) {
+ break 1;
+ }
+ }
+ }
+ $eventsByDate = $newEventsByDateArray;
+ break;
default:
// No changes otherwise
break;
}
+ //echo '<pre>$eventsByDate: ' . print_r($eventsByDate, true) . '</pre>';
// Compile template data
$templateData = array(
'assetsUrl' => GLM_MEMBERS_EVENTS_PLUGIN_URL . 'assets/',
'fromDate' => $fromDate,
'toDate' => $toDate,
'eventName' => $eventNameSearch,
- 'imgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/small/',
- 'calDates' => $calDates
+ 'imgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/small/',
+ 'calDates' => $calDates
);
error_reporting(E_ALL ^ E_NOTICE);
'type' => 'all',
'order' => 'title',
'member' => false,
- 'template' => false
+ 'template' => false,
+ 'limit' => null
)
),
'glm-members-event-detail' => array(
'action' => 'detail',
'table' => false,
'attributes' => array(
- 'id' => false
+ 'id' => false,
)
),
--- /dev/null
+<div id="glm-events-frontpage-wrapper">
+ {foreach $eventsByDate as $date => $key}
+ <div class="glm-events-frontpage-day">
+ {$date|date_format:"%B %e"}
+ ({$date|date_format:"%A"})
+ </div>
+ {foreach $key as $events}
+ {foreach $events as $event}
+ <div class="glm-events-frontpage-event-container">
+ <div class="glm-events-frontpage-event-image"
+ {if $event.image}style="background: url('{$imgUrl}{$event.image}') bottom center no-repeat;background-size: cover;"{/if}>
+ </div>
+ <div class="glm-events-frontpage-event-title">
+ {$event.name}
+ </div>
+ <div class="glm-events-frontpage-event-dates">
+ {$event.dates}
+ </div>
+ <div class="glm-events-frontpage-event-content">
+ {$event.intro}
+ </div>
+ </div>
+ {/foreach}
+ {/foreach}
+ {/foreach}
+</div>