protected function _get_table_filters() { $filters = $where = array(); EE_Registry::instance()->load_helper('Form_Fields'); if (empty($this->_dtts_for_event)) { //this means we don't have an event so let's setup a filter dropdown for all the events to select //note possible capability restrictions if (!EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { $where['status**'] = array('!=', 'private'); } if (!EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { $where['EVT_wp_user'] = get_current_user_id(); } $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('EVT_name' => 'asc'))); $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); foreach ($events as $evt) { //any registrations for this event? if (!$evt->get_count_of_all_registrations()) { continue; } $evts[] = array('id' => $evt->ID(), 'text' => $evt->get('EVT_name')); } $filters[] = EEH_Form_Fields::select_input('event_id', $evts); } else { //DTT datetimes filter $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); $dtts = array(); foreach ($this->_dtts_for_event as $dtt) { $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); } $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); } return $filters; }
protected function _get_table_filters() { $filters = $where = array(); if (empty($this->_dtts_for_event)) { //this means we don't have an event so let's setup a filter dropdown for all the events to select //note possible capability restrictions if (!EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { $where['status**'] = array('!=', 'private'); } if (!EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { $where['EVT_wp_user'] = get_current_user_id(); } $events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'))); $evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso')); foreach ($events as $evt) { //any registrations for this event? if (!$evt->get_count_of_all_registrations()) { continue; } $evts[] = array('id' => $evt->ID(), 'text' => $evt->get('EVT_name'), 'class' => $evt->is_expired() ? 'ee-expired-event' : ''); } $event_filter = '<div class="ee-event-filter">'; $event_filter .= EEH_Form_Fields::select_input('event_id', $evts); $event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __('Hide Expired Events', 'event_espresso') . '</span>'; $event_filter .= '</div>'; $filters[] = $event_filter; } else { //DTT datetimes filter $cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID(); $dtts = array(); foreach ($this->_dtts_for_event as $dtt) { $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time(); $dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string); } $filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt); } return $filters; }
/** * @param EE_Event $item * * @return string */ public function column_cb($item) { if (!$item instanceof EE_Event) { return ''; } $this->_dtt = $item->primary_datetime(); //set this for use in other columns //does event have any attached registrations? $regs = $item->count_related('Registration'); return $regs > 0 && $this->_view == 'trash' ? '<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="EVT_IDs[]" value="%s" />', $item->ID()); }