private function getCategories()
{
return array(
- array(
+ 1 => array(
'id' => 1,
'name' => 'Arts & Crafts'
),
- array(
+ 2 => array(
'id' => 2,
'name' => 'Arts/Cultural/Live Theatre'
),
- array(
+ 3 => array(
'id' => 3,
'name' => 'Beer/Wine Focus'
),
- array(
+ 4 => array(
'id' => 4,
'name' => 'Concerts/Live Music'
),
- array(
+ 5 => array(
'id' => 5,
'name' => 'Educational'
),
- array(
+ 6 => array(
'id' => 6,
'name' => 'Festivals/Fairs/Parades'
),
- array(
+ 7 => array(
'id' => 7,
'name' => 'Outdoor/Nature'
),
- array(
+ 8 => array(
'id' => 8,
'name' => 'Special Event'
),
- array(
+ 9 => array(
'id' => 9,
'name' => 'Sports'
),
);
}
- private function getModelEventsData()
+ private function getModelEventsData($categoryId = null)
{
- return array(
+ $events = array(
array(
+ 'id' => 1,
'title' => '20th Annual Garage Sale Art fair',
'starting' => '02/27/2016',
'ending' => '02/27/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Arts & Crafts'
+ 'category' => 1
),
array(
+ 'id' => 2,
'title' => 'ARTbreak: Talk: The Art of Collaboration with artists Vicki VanAmeyden and Ginger Owen',
'starting' => '03/01/2016',
'ending' => '03/01/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Arts & Crafts'
+ 'category' => 1
),
array(
+ 'id' => 3,
'title' => 'Easter Craft & Vendor Show',
'starting' => '03/26/2016',
'ending' => '03/26/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Arts & Crafts'
+ 'category' => 1
),
array(
+ 'id' => 4,
'title' => 'Henderson Castle Tours',
'starting' => '05/11/2016',
'ending' => '05/11/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Arts/Cultural/Live Theatre'
+ 'category' => 2
),
array(
+ 'id' => 5,
'title' => 'Colour Correction: British and American Screenprints, 1967-75',
'starting' => '06/11/2015',
'ending' => '06/10/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Arts/Cultural/Live Theatre'
+ 'category' => 2
),
array(
+ 'id' => 6,
'title' => 'Suspended! Sculpture from ArtPrize 2015',
'starting' => '12/12/2016',
'ending' => '12/13/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Arts/Cultural/Live Theatre'
+ 'category' => 2
),
array(
+ 'id' => 7,
'title' => '"Tasting on the Town"',
'starting' => '04/21/2016',
'ending' => '04/21/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Beer/Wine Focus'
+ 'category' => 3
),
array(
+ 'id' => 8,
'title' => 'Patrick Henry Beer Collectibles Show',
'starting' => '05/14/2016',
'ending' => '05/14/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Beer/Wine Focus'
+ 'category' => 3
),
array(
+ 'id' => 9,
'title' => '"Tasting on the Town"',
'starting' => '05/20/2016',
'ending' => '05/20/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Beer/Wine Focus'
+ 'category' => 3
),
array(
+ 'id' => 10,
'title' => 'Owl Prowl: Barred Owls',
'starting' => '02/25/2016',
'ending' => '02/25/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Outdoor/Nature'
+ 'category' => 7
),
array(
+ 'id' => 11,
'title' => 'Owls of Michigan',
'starting' => '02/28/2016',
'ending' => '02/28/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Outdoor/Nature'
+ 'category' => 7
),
array(
+ 'id' => 12,
'title' => 'Bird Sanctuary Resource Center Re-Opening',
'starting' => '02/29/2016',
'ending' => '02/29/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Outdoor/Nature'
+ 'category' => 7
),
array(
+ 'id' => 13,
'title' => 'Lead Day Hike',
'starting' => '02/29/2016',
'ending' => '02/29/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Outdoor/Nature'
+ 'category' => 7
),
array(
+ 'id' => 14,
'title' => 'Project Snowstorm: Snowy Owls in Michigan',
'starting' => '03/01/2016',
'ending' => '03/01/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Outdoor/Nature'
+ 'category' => 7
)
);
+ if ($categoryId) {
+ return array_filter($events, function($data) use($categoryId) {
+ return ($data['category'] == $categoryId) ? 1 : 0;
+ });
+ }
+ return $events;
}
private function getModelEventData()
'starting' => '02/25/2016',
'ending' => '02/25/2016',
'description' => '<p>Test event description text here!</p>',
- 'category' => 'Outdoor/Nature'
+ 'category' => 7
);
}
*/
public function modelAction($actionData = false)
{
+ $categoryId = null;
$action = '';
$settings = $events = $event = array();
if ($eventId = filter_var($_REQUEST['eventId'], FILTER_VALIDATE_INT)) {
$search = true;
$action = 'event-detail';
}
+ if ($categoryId = filter_var($_REQUEST['category'], FILTER_VALIDATE_INT)) {
+ $search = true;
+ $action = 'event-list';
+ }
if ($search = filter_var($_REQUEST['search'], FILTER_VALIDATE_INT)) {
$search = true;
$action = 'event-list';
}
+ $categories = $this->getCategories();
+
switch ($action) {
case 'event-detail':
- $event = $this->getModelEventData();
+ $event = $this->getModelEventData($eventId);
break;
case 'event-list':
- $events = $this->getModelEventsData();
+ $events = $this->getModelEventsData($categoryId);
$view = 'list.html';
break;
default:
// filter out the events
$events = $this->getModelEventsData();
$view = 'dashboard.html';
+ $categoryEvents = array();
+ foreach ( $categories as $cat ) {
+ $catEvents = array_filter( $events, function($data) use($cat) {
+ return ($data['category'] == $cat['id']) ? 1 : 0;
+ } );
+ if ( !empty($catEvents) ) {
+ $categoryEvents[$cat['id']] = $catEvents;
+ }
+ }
break;
}
- $categories = $this->getCategories();
// Compile template data
$templateData = array(
'siteBaseUrl' => GLM_MEMBERS_SITE_BASE_URL,
+ 'categoryId' => $categoryId,
'categories' => $categories,
'events' => $events,
- 'event' => $event
+ 'event' => $event,
+ 'catEvents' => $categoryEvents
);
return array(
-<h1>Dashboard</h1>
+<h2>Dashboard</h2>
<div class="row">
- <div class="small-12 medium-5 columns">
{include file='front/events/searchForm.html'}
- </div>
- <div id="shortcuts" class="small-12 medium-4 columns">
{include file='front/events/shortCuts.html'}
- </div>
</div>
<div class="row">
- <div class="small-12 medium-6 columns">
- <ul class="category-block pricing-table">
- <li class="title">Arts & Crafts</li>
- <li class="description text-left">Event title and date</li>
- </ul>
- </div>
- <div class="small-12 medium-6 columns">
- <ul class="category-block pricing-table">
- <li class="title">Arts/Cultural Events</li>
- <li class="description text-left">Event title and date</li>
- </ul>
- </div>
- <div class="small-12 medium-6 columns">
- <ul class="category-block pricing-table">
- <li class="title">Beer/Wine Focus</li>
- <li class="description text-left">Event title and date</li>
- </ul>
- </div>
- <div class="small-12 medium-6 columns">
- <ul class="category-block pricing-table">
- <li class="title">Concert/Live Music</li>
- <li class="description text-left">Event title and date</li>
- </ul>
- </div>
- <div class="small-12 medium-6 columns end">
+ {foreach $catEvents as $catid => $category}
+ <div class="small-12 medium-6 columns{if $category@last} end{/if}">
<ul class="category-block pricing-table">
- <li class="title">Educational</li>
- <li class="description text-left">Event title and date</li>
+ <li class="title">{$categories.{$catid}.name}</li>
+ {foreach $category as $event}
+ {if $event@iteration == 4}
+ {break}
+ {/if}
+ <li class="description text-left">{$event.title}</li>
+ {/foreach}
</ul>
</div>
+ {if $category@iteration is div by 2}
+ </div><div class="row">
+ {/if}
+ {/foreach}
</div>
+ <div class="small-12 medium-6 columns">
<h3 class="text-center">Find An Event</h3>
<form action="">
<input type="hidden" name="search" value="1">
<div class="row">
- <div class="small-12 medium-6 columns">
+ <div class="small-12 medium-6 text-right columns">
<label for="glm-event-name">Event Name </label>
</div>
<div class="small-12 medium-6 columns">
<input id="glm-event-name" name="event_name">
</div>
<div class="small-12 small-text-center columns">
- <input type="submit" class="button">
+ <input type="submit" class="button radius">
</div>
</div>
</form>
<form action="">
<input type="hidden" name="search" value="1">
<div class="row">
- <div class="small-12 medium-6 columns">
+ <div class="small-12 medium-6 text-right columns">
<label for="glm-event-from">From</label>
</div>
<div class="small-12 medium-6 columns">
<input id="glm-event-from" name="event_name">
</div>
- <div class="small-12 medium-6 columns">
+ <div class="small-12 medium-6 text-right columns">
<label for="glm-event-to">To</label>
</div>
<div class="small-12 medium-6 columns">
<input id="glm-event-to" name="event_name">
</div>
- <div class="small-12 medium-6 columns">
+ <div class="small-12 medium-6 text-right columns">
<label for="glm-event-category">Category</label>
</div>
<div class="small-12 medium-6 columns">
<select id="glm-event-category" name="category">
- <option></option>
+ <option value="">-- Select --</option>
+ {foreach $categories as $cat}
+ <option value="{$cat.id}"{if $categoryId == $cat.id} selected{/if}>{$cat.name}</option>
+ {/foreach}
</select>
</div>
<div class="small-12 small-text-center columns">
- <input type="submit" class="button">
+ <input type="submit" class="button radius">
</div>
</div>
</form>
+ </div>