function ok_to_show_qty_dd($price_key = null, $qty = 0)
{
    if (is_null($price_key)) {
        return false;
    }
    global $event_details;
    $r = array('ok' => 1, 'msg' => epl__('-'));
    $price_start_date = epl_get_element($price_key, $event_details['_epl_price_date_from']);
    if ($price_start_date) {
        $diff = epl_timespan(EPL_TIME, strtotime("00:00:00", epl_get_date_timestamp($price_start_date)));
        $diff['_date'] = $price_start_date;
        //epl_log( "debug", "<pre>" . print_r($diff, true ) . "</pre>" );
        $r['msg'] = epl__('Available on') . ' ' . epl_formatted_date($price_start_date);
        if ($diff['past'] == 0) {
            $r['ok'] = 0;
        }
    }
    $price_end_date = epl_get_element($price_key, $event_details['_epl_price_date_to']);
    if ($r['ok'] == 1 && $price_end_date) {
        $diff = epl_timespan(EPL_TIME, strtotime("23:59:59", epl_get_date_timestamp($price_end_date)));
        $diff['_date'] = $price_end_date;
        $r['ok'] = 0;
        $r['msg'] = epl_formatted_date($price_end_date) . ' ' . epl__('Ended');
        if ($diff['past'] == 0) {
            $r['ok'] = 1;
            $r['msg'] = epl_display_date_diff($diff);
        }
        if ($qty > 0) {
            $r['ok'] = 1;
        }
    }
    //epl_log( "debug", "<pre>" . print_r( $diff, true ) . "</pre>" );
    return $r;
}
 function get_week_of_the_month($date)
 {
     $date = epl_get_date_timestamp($date);
     $d = date_i18n('j', $date);
     $w = date_i18n('w', $date) + 1;
     //add 1 because date returns value between 0 to 6
     $dt = floor($d % 7) != 0 ? floor($d % 7) : 7;
     $k = $w - $dt < 0 ? 7 + ($w - $dt) : $w - $dt;
     $W = ceil(($d + $k) / 7);
     return $W;
 }
 function filter_where($where = '')
 {
     if (isset($_REQUEST['daterange']) && $_REQUEST['daterange'] != '') {
         $dates = array();
         if (strpos($_REQUEST['daterange'], '-') !== false) {
             $dates = explode('-', $_REQUEST['daterange']);
         } else {
             $dates[0] = $_REQUEST['daterange'];
         }
     }
     if (!empty($dates[0])) {
         $where .= " AND post_date >= '" . date_i18n("Y-m-d", epl_get_date_timestamp($dates[0])) . "'";
     }
     if (!empty($dates[1])) {
         $where .= "  AND post_date <= '" . date_i18n("Y-m-d", epl_get_date_timestamp($dates[1])) . "'";
     }
     return $where;
 }

<div class="fc_template1">

    <div class="event_title"><?php 
echo $_event['title'];
?>
</div>

    <div class="event_details">

        <div class="event_date">
            <?php 
echo date_i18n(get_option('date_format'), epl_get_date_timestamp($_event['date']));
?>
        </div>


        <?php 
foreach ($_event['times']['start'] as $k => $_v) {
    $_e = $_v != $_event['times']['end'][$k] ? ' - ' . $_event['times']['end'][$k] : '';
    ?>
                <div class="event_time"><?php 
    echo $_v . $_e;
    ?>
</div>
        <?php 
}
?>

function epl_formatted_date($date, $format = null, $disp_func = 'date_i18n')
{
    if ($date == '') {
        return;
    }
    $disp_func = 'date_i18n';
    $_d = epl_get_date_timestamp(epl_admin_dmy_convert($date));
    $date_format = !is_null($format) ? $format : get_option('date_format');
    return date_i18n($date_format, $_d);
}
                <li class="epl_list_row <?php 
        echo $enable_tooltip;
        ?>
" id="epl_<?php 
        echo $event['event_id'];
        ?>
">

                    <div class="epl-ue-widget-calendar ">
                        <span class="month"><?php 
        echo date_i18n('M', epl_get_date_timestamp($event['date']));
        ?>
</span>
                        <span class="day"><?php 
        echo date_i18n('d', epl_get_date_timestamp($event['date']));
        ?>
</span>
                    </div>

                    <div class="event_details">
                        <a class="event_detail_link <?php 
        echo $link_class;
        ?>
" href="<?php 
        echo $event['register_link'];
        ?>
">
                            <?php 
        echo $event['title'];
        ?>
 /**
  * This function will create a global variable called $event_snapshot, which holds all the following information about the event
  * -Availability for each date, each time inside each date, each price inside each date and time.
  * -Availability errors
  *
  * Uses global vars $event_details, $current_att_count
  *
  * @since 1.0.0
  * @param event_id
  * @param refresh
  * @return  Sets the global $event_snapshot variable
  */
 function event_snapshot($event_id = null, $refresh = false)
 {
     global $event_details, $capacity, $current_att_count, $event_snapshot, $epl_error, $event_totals;
     $event_id = is_null($event_id) ? $this->get_current_event_id() : $event_id;
     setup_event_details($event_id);
     $meta = $this->current_data[$this->regis_id];
     $cart_selected_dates = epl_get_element($event_id, epl_get_element('_epl_start_date', $this->get_cart_values('_dates')));
     $cart_selected_times = (array) epl_get_element($event_id, epl_get_element('_epl_start_time', $this->get_cart_values('_dates')));
     $cart_selected_quantities = (array) epl_get_element($event_id, epl_get_element('_att_quantity', $this->get_cart_values('_dates')));
     static $_cache = array();
     $_is_cached = epl_get_element($event_id, $_cache);
     if ($_is_cached) {
         return $_cache[$event_id];
     }
     if (empty($cart_selected_dates) && epl_get_element('cart_action', $_REQUEST) != 'add') {
         $epl_error[] = array('', epl__('Please select at least one date.'));
     }
     $current_att_count = EPL_report_model::get_instance()->get_attendee_counts($event_id, true);
     $sold_out_text = apply_filters('merm__event_snapshot__sold_out_text', epl__('Sold Out.'));
     //get the attendee and money totals
     //$_totals = $this->calculate_cart_totals();
     setup_event_details($event_id);
     $grand_total = epl_get_element_m('grand_total', 'money_totals', $event_totals);
     $grand_total_key = "_grand_total";
     //this will hold the snapshot
     $event_snapshot = array();
     $qty_meta_key = "_total_att_" . $event_id;
     //$total_att = array_sum( ( array ) $meta[$this->regis_id]['_dates']['_att_quantity'][$event_details['ID']] );
     $total_att = epl_get_element_m($event_id, 'total', epl_get_element('_att_quantity', $event_totals));
     //event dates, times and prices
     $dates = epl_get_element('_epl_start_date', $event_details);
     $times = epl_get_element('_epl_start_time', $event_details);
     $prices = epl_get_element('_epl_price_name', $event_details);
     $rolling_regis = epl_get_element('_epl_rolling_regis', $event_details) == 10;
     if (epl_is_empty_array($dates)) {
         return;
     }
     //foreach event date
     foreach ($dates as $_date_key => $date_timestamp) {
         $date_timestamp = epl_get_date_timestamp($date_timestamp);
         //number registered for the date
         $date_total_att = 0;
         $_date = epl_formatted_date($event_details['_epl_start_date'][$_date_key], 'Y-m-d', 'date');
         //the date to display
         $_displ_date = epl_formatted_date($_date);
         $qty_meta_key = "_total_att_" . $event_details['ID'] . '_date_' . $_date_key;
         //find the capacity for this date.
         $cap = $event_details['_epl_date_capacity'][$_date_key];
         //find the number of people regitered for this date
         $num_att = epl_get_element($qty_meta_key, $current_att_count, 0);
         //find the available spcaes.  If there is no capacity, always available
         $date_avail = $this->avail_spaces($cap, $num_att);
         $_past = epl_compare_dates(EPL_TIME, $_date . ' 23:59:59', ">");
         $_date_avail_display = epl_is_ok_to_register($event_details, $_date_key);
         $_date_avail_display = $_date_avail_display === true ? epl__('Available') : $_date_avail_display;
         //snapshot template
         $_t = array('timestamp' => $date_timestamp, 'disp' => $_displ_date, 'avail' => $date_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'cart' => 0, 'past' => $_past, 'hide' => $date_avail != '' && $date_avail <= 0);
         //Set the snapshot for this date
         $event_snapshot[$event_id][$_date_key]['date'] = $_t;
         $rolling_regis_time_avail = 0;
         //foreach time available for the event
         foreach ($times as $_time_key => $_time_id) {
             $time_total_att = 0;
             $_time = $event_details['_epl_start_time'][$_time_key];
             $qty_meta_key = "_total_att_" . $event_details['ID'] . '_time_' . $_date_key . '_' . $_time_key;
             //$cap = $capacity['time'][$_time_key];
             $cap = epl_get_element($_time_key, epl_get_element('_epl_time_capacity', $event_details), '');
             if ($rolling_regis && $cap == '') {
                 $cap = epl_get_element_m($_date_key, '_epl_date_per_time_capacity', $event_details);
             }
             $num_att = epl_nz(epl_get_element($qty_meta_key, $current_att_count), 0);
             $time_avail = $this->avail_spaces($cap, $num_att);
             $rolling_regis_time_avail += $cap == '' ? 999 : epl_nz($time_avail, 0);
             $_comp_time = epl_get_element($_time_key, $event_details['_epl_regis_endtime']);
             $_comp_time = !$_comp_time ? $_time : $_comp_time;
             //Is this time for this date in the past and not available any more?
             $_past = epl_compare_dates(EPL_TIME, $_date . ' ' . $_comp_time, ">");
             if ($rolling_regis && $_past) {
                 $event_snapshot[$event_id][$_date_key]['date']['hide'] = true;
             }
             $_t = array('timestamp' => strtotime($times[$_time_key], $date_timestamp), 'disp' => $times[$_time_key], 'avail' => $time_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'past' => $_past);
             //Set the snapsot for this time for this date
             $event_snapshot[$event_id][$_date_key]['time'][$_time_key] = $_t;
             foreach ($prices as $_price_key => $_price_id) {
                 $_price = $event_details['_epl_price_name'][$_price_key];
                 $price_avail = 0;
                 $do_count = true;
                 $price_att = 0;
                 $price_type = epl_get_element($_price_key, epl_get_element('_epl_price_type', $event_details), 'att');
                 if (isset($meta['_dates']['_att_quantity'][$event_details['ID']])) {
                     if (is_array(epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]))) {
                         $price_att = array_sum((array) epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]));
                     } else {
                         $price_att = epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]);
                     }
                 }
                 $qty_meta_key = "_total_att_" . $event_details['ID'] . '_price_' . $_date_key . '_' . $_time_key . '_' . $_price_key;
                 if (epl_is_date_level_price()) {
                     $price_att = epl_get_element_m($_date_key, $_price_key, $cart_selected_quantities);
                 }
                 $cap = epl_get_element($_price_key, epl_get_element('_epl_price_capacity', $event_details), '');
                 $num_att = epl_nz(epl_get_element($qty_meta_key, $current_att_count), 0);
                 $price_avail = $this->avail_spaces($cap, $num_att);
                 if (!epl_is_empty_array($offset = $this->is_offsetter_price($_price_key)) && $cap !== '' && $price_avail > 0) {
                     //check to make sure users are not using the price as offset against itself
                     if ($offset['offset_key'] != $_price_key) {
                         // see if available count of the offseter is > capacity for this price
                         $offset_avail = $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$offset['offset_key']]['avail'];
                         $offset_count = $offset['offset_count'];
                         if ((int) $offset_count > (int) $offset_avail) {
                             $price_avail = 0;
                         } elseif ($offset_avail >= $offset_count) {
                             $price_avail = intval($offset_avail / $offset_count);
                         }
                     }
                 }
                 //echo "<pre class='prettyprint'>" . __LINE__ . "> $event_id >>>> " . print_r($price_avail, true). "</pre>";
                 $time_total_att += $price_att;
                 $_t = array('disp' => $prices[$_price_key], 'avail' => $price_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'cart' => $price_att, 'past' => $_past);
                 $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key] = $_t;
                 if (epl_is_date_level_time() && epl_get_element($_date_key, $cart_selected_times) != $_time_key) {
                     $do_count = false;
                 }
                 if (epl_is_date_level_price() && !in_array($_date_key, (array) $cart_selected_dates)) {
                     //if ( $_date_key != $_price_key ) {
                     $do_count = false;
                     //}
                 }
                 if (epl_is_time_specific_price($_price_key)) {
                     if ($event_details['_epl_price_parent_time_id'][$_price_key] != $_time_key) {
                         unset($event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]);
                         $do_count = false;
                     }
                 }
                 if (!epl_is_time_optonal() && !in_array($_time_key, $cart_selected_times) || !in_array($_date_key, (array) $cart_selected_dates)) {
                     $do_count = false;
                 }
                 if (!$do_count || $price_type != 'att') {
                     $time_total_att -= $price_att;
                     if (isset($event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['cart'])) {
                         $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['cart'] = 0;
                     }
                 } else {
                     //check for a price availability for each date/time
                     if ($price_att > 0 && $price_avail !== '') {
                         $_error = array();
                         if ($price_avail === 0 || $price_avail < 0) {
                             $_error = array($_displ_date . '<br />' . $_time . '<br />' . $_price, $sold_out_text);
                         } elseif ($price_att > epl_nz($price_avail, 1000)) {
                             $_error = array($_displ_date . '<br />' . $_time . '<br />' . $_price, sprintf(epl__(' Only %d spaces left.'), $price_avail));
                         }
                         if (!empty($_error)) {
                             $epl_error[] = $_error;
                             $event_snapshot[$event_id]['error'][] = $_error;
                         }
                         $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['avail_display'] = epl_get_element(1, $_error);
                     }
                 }
                 /* if( $price_type != 'att' )
                    $time_total_att -= $price_att; */
             }
             $date_total_att += $time_total_att;
             $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['cart'] = $time_total_att;
             //echo "<pre class='prettyprint'>" . __LINE__ . "> $_date "  . print_r($time_total_att, true). "</pre>";
             //check for time availablility for each date
             if ($this->flow_mode == 'n' && !epl_is_time_optonal() && $time_total_att > 0 && ($time_avail !== '' || $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['past'] === true)) {
                 $_error = array();
                 if (!epl_is_ongoing_event() && $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['past'] == 1) {
                     $_error = array($_displ_date . '<br />' . $_time, epl__('This time has passed.'));
                 }
                 if ($time_avail === 0 || $time_avail < 0) {
                     $_error = array($_displ_date . '<br />' . $_time, $sold_out_text);
                 } elseif ($time_total_att > epl_nz($time_avail, 1000)) {
                     $_error = array($_displ_date . '<br />' . $_time, sprintf(epl__('Only %d spaces left.'), $time_avail));
                 }
                 if (!empty($_error)) {
                     $epl_error[] = $_error;
                     $event_snapshot[$event_id]['error'][] = $_error;
                 }
                 $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['avail_display'] = epl_get_element(1, $_error);
             }
         }
         if ($rolling_regis && $rolling_regis_time_avail == 0 && $event_snapshot[$event_id][$_date_key]['date'] == '') {
             $event_snapshot[$event_id][$_date_key]['date']['hide'] = true;
         }
         //check for the date availability
         $event_snapshot[$event_id][$_date_key]['date']['cart'] = $date_total_att;
         if ($date_total_att > 0 && ($date_avail !== '' || $event_snapshot[$event_id][$_date_key]['date']['past'] === true) && (!epl_is_waitlist_approved() && !epl_is_waitlist_session_approved())) {
             $_error = array();
             if ($this->flow_mode == 'n' && ($date_avail === 0 || $date_avail < 0)) {
                 $_error = array($_displ_date, $sold_out_text);
                 if (epl_is_ok_for_waitlist() && ($wl_spaces_left = epl_waitlist_spaces_open()) !== false) {
                     $_error[1] .= '<br />' . epl__('If you would like to be added to the waiting list, please click on the button below.  You will not be charged at this time.');
                     if ($wl_spaces_left !== true) {
                         $_error[1] .= '<br />' . sprintf('Spaces available on the waiting list: %d', $wl_spaces_left);
                     }
                     if (epl_waitlist_enough_spaces($event_id) == false) {
                         $_error[1] .= '<br />' . sprintf('To continue, please select only %d.', $wl_spaces_left);
                     } else {
                         $_error[1] .= '<br />' . epl_anchor('#', epl__('Click here to add your name to the waitlist'), null, " class='open_add_to_waitlist_form epl_button' data-event_id='{$event_id}'");
                     }
                     $this->epl->epl_util->set_response_param('waitlist_form', '');
                 }
             } elseif ($this->flow_mode == 'n' && !epl_is_ongoing_event() && $event_snapshot[$event_id][$_date_key]['date']['past'] == 1) {
                 $_error = array($_displ_date, epl__('This date has passed.'));
             } elseif ($this->flow_mode == 'n' && $date_total_att > epl_nz($date_avail, 1000)) {
                 $_error = array($_displ_date, sprintf(epl__('Only %d spaces left.'), $date_avail));
             }
             $event_snapshot[$event_id][$_date_key]['date']['avail_display'] = epl_get_element(1, $_error);
             if (!empty($_error)) {
                 $event_snapshot[$event_id]['error'][] = $_error;
                 $epl_error[] = $_error;
             }
         }
         //$this->epl_table->add_row( '', $event_details['_epl_start_date'][$_date_key], $avail );
     }
     $_cache[$event_id] = $event_snapshot;
     return $event_snapshot;
 }
        function epl_column_data($column_name, $post_ID)
        {
            global $epl_fields, $event_details, $event_snapshot;
            $this->ecm->setup_event_details($post_ID);
            $this->erm->event_snapshot($post_ID);
            switch ($column_name) {
                case 'id':
                    echo $post_ID;
                    break;
                case 'location':
                    echo get_the_location_name();
                    break;
                case 'status':
                    $s = epl_get_event_status(true);
                    $class = 'status_' . key($s);
                    echo "<span class='status {$class}'>" . current($s) . '</span>';
                    break;
                    /*  case 'epl_categories':
                    
                                      foreach ( wp_get_object_terms( $id, 'epl_categories' ) as $tax )
                                      $r[] = $tax->name;
                    
                                      echo!is_array( $r ) ? '' : implode( ", ", $r );
                    
                                      break; */
                /*  case 'epl_categories':
                
                                  foreach ( wp_get_object_terms( $id, 'epl_categories' ) as $tax )
                                  $r[] = $tax->name;
                
                                  echo!is_array( $r ) ? '' : implode( ", ", $r );
                
                                  break; */
                case 'start_date':
                    $base_url = epl_get_url();
                    $event_regis_data = current($event_snapshot);
                    $table_link_arr = array('epl_action' => 'view_names', 'epl_download_trigger' => 1, 'table_view' => 1, 'epl_controller' => 'epl_report_manager', 'event_id' => $event_id);
                    $csv_link_arr = array('epl_action' => 'epl_attendee_list', 'epl_download_trigger' => 1, 'epl_controller' => 'epl_registration', 'event_id' => $event_id);
                    if (epl_is_empty_array($event_regis_data)) {
                        break;
                    }
                    $counter = 1;
                    foreach ($event_regis_data as $date_id => $date_data) {
                        $last_day = end($event_details['_epl_start_date']);
                        if ($last_day > EPL_DATE && ($event_details['_epl_event_status'] == 1 && $date_data['date']['timestamp'] < EPL_DATE) || $counter > 1) {
                            continue;
                        }
                        $counter++;
                        $date = $date_data['date']['disp'];
                        $date_capacity = epl_get_element_m($date_id, '_epl_date_capacity', $event_details);
                        $times = $date_data['time'];
                        ?>

                        <table id="event_snapshot_table" class="event_snapshot_sorting">
                            <thead>
                                <tr>
                                    <th><?php 
                        epl_e('Date');
                        ?>
</th>
                                    <th><?php 
                        epl_e('Time');
                        ?>
</th>
                                    <th><?php 
                        epl_e('Attendees');
                        ?>
</th>
                                    <th></th>
                                </tr>

                            </thead>

                            <?php 
                        foreach ($times as $time_id => $time_data) {
                            if (epl_is_date_level_time() && !epl_is_empty_array($date_specifc_time) && (!isset($date_specifc_time[$time_id]) || !isset($date_specifc_time[$time_id][$date_id]))) {
                                continue;
                            }
                            $time_capacity = epl_get_element_m($time_id, '_epl_time_capacity', $event_details);
                            $capacity = $time_capacity ? $time_capacity : ($date_capacity ? $date_capacity : epl_get_element_m($date_id, '_epl_date_per_time_capacity', $event_details));
                            $dt_array = array('date_id' => $date_id, 'time_id' => $time_id, 'event_id' => $post_ID);
                            $table_link_arr = array_merge($table_link_arr, $dt_array);
                            $csv_link_arr += $dt_array;
                            ?>

                                <tr class="epl_date_time">

                                    <td><?php 
                            echo date_i18n('D M d, Y', epl_get_date_timestamp(epl_get_element($date_id, $event_details['_epl_start_date'])));
                            ?>
</td>

                                    <?php 
                            if (epl_is_time_optonal()) {
                                ?>
                                        <td colspan="1"> - </td>
                                    <?php 
                            } else {
                                ?>
                                        <td><?php 
                                echo $time_data['disp'];
                                ?>
</td>

                                    <?php 
                            }
                            ?>

                                    <td><?php 
                            echo $time_data['regis'];
                            ?>
 / <?php 
                            echo $capacity ? $capacity : '&#8734;';
                            ?>
</td>


                                    <td>
                                        <?php 
                            echo epl_anchor(add_query_arg(array_merge($table_link_arr, $dt_array) + array('names_only' => 1), $base_url), epl__('View Attendees'), null, 'class="epl_view_attendee_list_table button-secondary"');
                            $table_link_arr['epl_action'] = 'epl_attendee_list';
                            $table_link_arr['epl_controller'] = 'epl_registration';
                            echo epl_anchor(add_query_arg($table_link_arr, $base_url), epl__('View Full Data'), null, 'class="epl_view_attendee_list_table button-secondary"');
                            echo epl_anchor(add_query_arg(array_merge($csv_link_arr, $dt_array), $base_url), epl__('Export CSV'), null, 'class="button-secondary"');
                            //echo  epl_anchor( $_SERVER['PHP_SELF'] . '&epl_action=epl_event_snapshot&event_id=' . $post->ID, epl__( 'Snapshot' ), '_blank', "class='epl_event_snapshot' data-event_id = '" . $post->ID . "'" );
                            ?>


                                    </td>

                                </tr>

                                <?php 
                        }
                    }
                    ?>


                    </table>
                    <?php 
                    break;
                default:
                    break;
                case 'actions':
                    $url_vars = array('epl_action' => 'duplicate_event', 'event_id' => $post_ID);
                    $url = add_query_arg($url_vars, epl_get_url());
                    echo " <a href='epl_action=duplicate_event&event_id={$post_ID}'><img src='" . EPL_FULL_URL . "images/status_online.png' title='" . epl__('Attendees') . "' alt='" . epl__('Attendees') . "' /></a>";
                    echo " <a href='epl_action=duplicate_event&event_id={$post_ID}'><img src='" . EPL_FULL_URL . "images/doc_excel_csv.png' title='" . epl__('Attendees') . "' alt='" . epl__('Attendees') . "' /></a>";
                    break;
            }
            // end switch
        }
        }
        ?>
                </div>


                <span class="date">
                    <?php 
        echo date_i18n('M d, Y', epl_get_date_timestamp($event['date']));
        ?>

                    <?php 
        $end = epl_get_element('end', $event, null);
        if ($end && $end != $event['date']) {
            ?>
                        - <?php 
            echo date_i18n('M d, Y', epl_get_date_timestamp($end));
            ?>
                    <?php 
        }
        ?>
                </span>

                <span class="time">
                    <?php 
        foreach ($event['times']['start'] as $k => $v) {
            $_e = $v != $event['times']['end'][$k] ? ' - ' . $event['times']['end'][$k] : '';
            echo "<br /> {$v}{$_e}";
        }
        ?>

                </span>
 function handle_upload($post_id, $attachment_id, $file = null)
 {
     if (is_null($file)) {
         return;
     }
     global $epl_fields;
     $this->epl->load_config('global-discount-fields');
     $fields = array_keys($epl_fields['epl_social_discount_fields']);
     foreach ($fields as $v) {
         ${$v} = array();
     }
     $arr = array();
     $row = 0;
     if (($handle = fopen($file, "r")) !== FALSE) {
         while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
             $row++;
             //if ( $row == 1 )
             //  continue;
             /* if ( $row == 400 ) {
             
                               break;
                               break;
                               } */
             $code_id = $data[0];
             $_epl_discount_code[$code_id] = $data[0];
             $_epl_discount_buyer[$code_id] = $data[1];
             $_epl_discount_amount[$code_id] = $data[2] != '' ? $data[2] : 0;
             $_epl_discount_max_usage[$code_id] = $data[3] != '' ? $data[3] : 1;
             $_epl_discount_end_date[$code_id] = epl_get_date_timestamp($data[4]);
             //$_epl_discount_status[$code_id] = $data[3];
             $_epl_discount_type[$code_id] = 5;
             $_epl_discount_active[$code_id] = 10;
         }
         fclose($handle);
         foreach ($fields as $v) {
             add_post_meta($post_id, $v, ${$v});
         }
     }
 }
 setup_event_details();
 $event_id = get_the_ID();
 if (epl_is_empty_array($event_details['_epl_start_date'])) {
     continue;
 }
 $counts = $erptm->get_attendee_counts($event_id, true);
 $event_excerpt = get_the_excerpt();
 $date_specifc_time = epl_get_element('_epl_date_specific_time', $event_details, array());
 $_status = epl_get_event_status(true);
 $status_id = key($_status);
 $status = current($_status);
 $class = 'status_' . $status_id;
 //$formatted_status = "<span class='status $class'>" . $status . '</span>';
 $formatted_status = "<span class='status {$class}'>&nbsp;&nbsp;</span>";
 foreach ($event_details['_epl_start_date'] as $date_id => $date) {
     $date = epl_get_date_timestamp($date);
     $temp_table_row = '';
     $end_date = $event_details['_epl_end_date'][$date_id];
     $unix_date = $date;
     if ($status_id == 3) {
         if ($date < EPL_DATE && $end_date > EPL_DATE) {
             $date = EPL_DATE;
         }
     }
     $weekday = date_i18n('N', $date);
     $price = current((array) $event_details['_epl_price']);
     if ($price <= 0) {
         $print_price = "<span class='price_free'>Free</span>";
     } else {
         $print_price = "<span class='price_amount'> " . epl_get_formatted_curr($price, null, true) . "</span>";
     }
function epl_get_regis_status($date_key = null)
{
    global $event_details, $capacity, $current_att_count, $available_space_arr;
    $today = date_i18n('m/d/Y H:i:s', EPL_TIME);
    $regis_start_date = epl_get_date_timestamp(epl_admin_dmy_convert(epl_get_element($date_key, $event_details['_epl_regis_start_date'], $today)));
    $regis_end_date = epl_get_date_timestamp(epl_admin_dmy_convert(epl_get_element($date_key, $event_details['_epl_regis_end_date'], $today)));
    $ok = epl_compare_dates($today, $regis_start_date, ">=");
    if (!$ok) {
        return epl__("Opens on") . ' ' . epl_formatted_date($event_details['_epl_regis_start_date'][$date_key]);
    }
    $ok = epl_compare_dates($today, strtotime('23:59:59', $regis_end_date), "<=");
    if (!$ok) {
        return epl__('Closed');
    }
    return epl__('Open');
}
示例#13
0
<?php

$epl = EPL_Base::get_instance();
$ecm = EPL_common_model::get_instance();
?>

<div id="event_list_wrapper" class="class_list">

    <?php 
global $event_list;
global $event_details, $event_fields, $current_att_count;
$_from_date = epl_get_date_timestamp(epl_get_element('date_from', $_POST));
$_to_date = epl_get_date_timestamp(epl_get_element('date_to', $_POST));
$table_row = array();
$event_dates = array();
/* custom event list loop */
if ($event_list->have_posts()) {
    while ($event_list->have_posts()) {
        $event_list->the_post();
        setup_event_details();
        $ecm->get_current_att_count(get_the_ID());
        $event_edit_link = epl_anchor(admin_url("post.php?post=" . get_the_ID() . "&action=edit"), get_the_title());
        $date_specifc_time = epl_get_element('_epl_date_specific_time', $event_details, array());
        $register_button_url = array();
        foreach ($event_details['_epl_start_date'] as $date_id => $date) {
            $temp_table_row = '';
            if ($date < EPL_DATE) {
                continue;
            }
            $price = current((array) $event_details['_epl_price']);
            if ($price <= 0) {
<?php

global $event_details, $location_details;
//$datepicker_dates = array( );
$datepicker_data = '';
$no_dates_selected = $show_date_selector_link ? '<span class="epl_date_selector_use_message">' . epl__("Please use the calendar above to select a date.") . '</span>' : '';
$event_id = $event_details['ID'];
foreach ($date as $date_id => $field) {
    //will revisit, for the datepicker
    //$datepicker_dates[] = array( 'Title' => 'something', 'Date' =>date_i18n( 'D, d M y H:i:s', epl_get_element( $date_id, $event_details['_epl_start_date'] ) ) . " +0000" );
    //skip expired event dates
    if ($flow_mode == 'n' && epl_get_element('_epl_event_status', $event_details) != 3 && epl_get_date_timestamp($event_details['_epl_start_date'][$date_id]) < EPL_DATE) {
        continue;
    }
    ob_start();
    ?>

    <div id="<?php 
    echo $date_id;
    ?>
" class="epl_date_individual_date_wrapper">



        <div class="epl_date_individual_date">

            <?php 
    echo $field['field'];
    ?>

            <?php 
 function _epl_event_list_query_arg($args)
 {
     $_filters = array('_epl_event_location' => array(), '_epl_course' => array(), '_epl_course_level' => array(), '_epl_event_sex' => array());
     foreach ($_filters as $_filter => $_options) {
         if (epl_get_element($_filter, $_POST)) {
             $_v = epl_get_element($_filter, $_POST);
             $args['meta_query'][] = array('key' => $_filter, 'value' => isset($_options['func']) ? $_options['func']($_v) : $_v, 'compare' => epl_get_element('compare', $_options, '='));
         }
     }
     if (epl_get_element('_epl_from_date', $_POST)) {
         $_f = epl_get_date_timestamp(epl_get_element('_epl_from_date', $_POST));
         $_t = epl_get_element('_epl_to_date', $_POST);
         $args['meta_query'][] = array('key' => '_q__epl_start_date', 'type' => 'numeric', 'value' => $_t ? array($_f, epl_get_date_timestamp($_t)) : $_f, 'compare' => $_t ? 'BETWEEN' : '>=');
     }
     return $args;
 }
示例#16
0
 function get_sess_days_for_fc($args = array())
 {
     global $event_details;
     $event_id = epl_get_element('event_id', $args);
     $event_bcg_color = epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_tax_bcg_color');
     $event_font_color = epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_tax_font_color');
     $r = array();
     $dates = epl_get_element('_epl_class_session_date', $event_details);
     $start_times = epl_get_element('_epl_class_session_start_time', $event_details);
     $end_times = epl_get_element('_epl_class_session_end_time', $event_details);
     $class_name = epl_get_element('post_title', $event_details);
     if (epl_is_empty_array($dates)) {
         return array();
     }
     foreach ($dates as $date_id => $date) {
         $data['_event'] = $d;
         //$c = $this->epl->load_view( 'front/tooltip/template-1', $data, true );
         $_t = explode(',', $event_data['term_list']);
         $bc = epl_get_element(current($_t), $event_bcg_color, '#ffffff');
         $tc = epl_get_element(current($_t), $event_font_color, 'blue');
         $r[] = array('title' => $class_name, 'term_list' => $event_data['term_list'], 'start' => date_i18n("Y-m-d\\TH:i:s", strtotime($start_times[$date_id], epl_get_date_timestamp($date))), 'end' => date_i18n("Y-m-d\\TH:i:s", strtotime($end_times[$date_id], epl_get_date_timestamp($date))), 'minTime ' => $start_times[$date_id], 'maxTime ' => $end_times[$date_id], 'url' => $date_sel_mode ? '' : $event_data['register_link'], 'id' => $event_data['event_id'], 'allDay' => 0);
     }
     $r = apply_filters('epl_get_cal_dates_response', $r);
     return json_encode($r);
 }