From 157e9eb6299672accfc15ada709bdc12cf804437 Mon Sep 17 00:00:00 2001 From: Tim Mallezie Date: Mon, 2 Mar 2015 08:18:38 +0100 Subject: [PATCH] update eventtype selector to select2 --- CRM/Event/Form/SearchEvent.php | 4 +--- CRM/Event/Page/ManageEvent.php | 8 +------- templates/CRM/Event/Form/SearchEvent.tpl | 8 +------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/CRM/Event/Form/SearchEvent.php b/CRM/Event/Form/SearchEvent.php index 75d8bbc350..7314cf6980 100644 --- a/CRM/Event/Form/SearchEvent.php +++ b/CRM/Event/Form/SearchEvent.php @@ -63,9 +63,7 @@ class CRM_Event_Form_SearchEvent extends CRM_Core_Form { $event_type = CRM_Core_OptionGroup::values('event_type', FALSE); - foreach ($event_type as $eventId => $eventName) { - $this->addElement('checkbox', "event_type_id[$eventId]", 'Event Type', $eventName); - } + $this->add('select', 'event_type_id', ts('Event type'), $event_type, FALSE, array('class' => 'crm-select2 huge', 'multiple' => TRUE)); $eventsByDates = array(); $searchOption = array(ts('Show Current and Upcoming Events'), ts('Search All or by Date Range')); diff --git a/CRM/Event/Page/ManageEvent.php b/CRM/Event/Page/ManageEvent.php index 4200cbef45..c4f04490a8 100644 --- a/CRM/Event/Page/ManageEvent.php +++ b/CRM/Event/Page/ManageEvent.php @@ -461,15 +461,9 @@ ORDER BY start_date desc } $value = $this->get('event_type_id'); - $val = array(); if ($value) { if (is_array($value)) { - foreach ($value as $k => $v) { - if ($v) { - $val[$k] = $k; - } - } - $type = implode(',', $val); + $type = implode(',', $value); } $clauses[] = "event_type_id IN ({$type})"; } diff --git a/templates/CRM/Event/Form/SearchEvent.tpl b/templates/CRM/Event/Form/SearchEvent.tpl index e1fb50eb3a..9fa62a8487 100644 --- a/templates/CRM/Event/Form/SearchEvent.tpl +++ b/templates/CRM/Event/Form/SearchEvent.tpl @@ -34,13 +34,7 @@
{$form.eventsByDates.html}
-
- {foreach from=$form.event_type_id item="event_val"} -
- {$event_val.html} -
- {/foreach} -
+ {$form.event_type_id.html}  {include file="CRM/common/formButtons.tpl"} -- 2.25.1