update eventtype selector to select2
authorTim Mallezie <tim.mallezie@chiro.be>
Mon, 2 Mar 2015 07:18:38 +0000 (08:18 +0100)
committerTim Mallezie <tim.mallezie@chiro.be>
Mon, 2 Mar 2015 07:18:38 +0000 (08:18 +0100)
CRM/Event/Form/SearchEvent.php
CRM/Event/Page/ManageEvent.php
templates/CRM/Event/Form/SearchEvent.tpl

index 75d8bbc350f84914714ac3085aa0001ea31bbff3..7314cf6980f18ebc4f7e3e93da02450f954f7912 100644 (file)
@@ -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'));
index 4200cbef450d0c0094ca829fce039e519e38507f..c4f04490a8f9941564a6a2a2cc08d769442624e2 100644 (file)
@@ -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})";
     }
index e1fb50eb3a6d40f13d00b9d6657e560c390b46be..9fa62a8487a883210ae2c84ad7a9fa7e946c3868 100644 (file)
              <div style="height: auto; vertical-align: bottom">{$form.eventsByDates.html}</div>
         </td>
         <td rowspan="2"><label>{ts}Event Type{/ts}</label>
-            <div class="listing-box">
-                {foreach from=$form.event_type_id item="event_val"}
-                <div class="{cycle values="odd-row,even-row"}">
-                    {$event_val.html}
-                </div>
-                {/foreach}
-            </div>
+          {$form.event_type_id.html}
         </td>
         <td class="right" rowspan="2">&nbsp;{include file="CRM/common/formButtons.tpl"}</td>
     </tr>