function _get_time_fields($date_id = null)
 {
     global $event_details, $capacity, $current_att_count, $event_snapshot;
     //if it is time specific pricing, value hidden
     $times = $event_details['_epl_start_time'];
     $input_type = epl_get_element('_epl_pricing_type', $event_details) == 10 ? 'text' : 'select';
     $date_specifc_time = epl_get_element('_epl_date_specific_time', $event_details, array());
     $rolling_regis = epl_get_element('_epl_rolling_regis', $event_details) == 10;
     $event_id = $this->get_current_event_id();
     $next_available_slot_found = false;
     if (epl_is_empty_array($times)) {
         return null;
     }
     $number_of_times = count($times);
     //adding the end time to the displayed value.  Notice the reference
     foreach ($times as $time_key => &$v) {
         if (!is_null($date_id)) {
             $weekday = date('N', $event_details['_epl_start_date'][$date_id]);
             $weekday_specific = epl_get_element_m($time_key, '_epl_weekday_specific_time', $event_details, array());
             if (!epl_is_empty_array($weekday_specific) && !isset($weekday_specific[$weekday])) {
                 unset($times[$time_key]);
                 continue;
             }
         }
         $_set = true;
         if ($v == '' || epl_get_element($time_key, epl_get_element('_epl_time_hide', $event_details)) == 10 || epl_is_date_level_time() && !epl_is_empty_array($date_specifc_time) && (array_key_exists($time_key, $date_specifc_time) && !array_key_exists($date_id, $date_specifc_time[$time_key]))) {
             unset($times[$time_key]);
             $_set = false;
         }
         if ($_set) {
             $v .= ($event_details['_epl_end_time'][$time_key] != '' ? ' - ' . $event_details['_epl_end_time'][$time_key] : '') . epl_prefix(' - ', epl_get_element_m($time_key, '_epl_time_note', $event_details));
         }
         $v = apply_filters('epl_erm__get_time_fields__time_option_fields', $v, $time_key);
         if ($rolling_regis) {
             if ($event_snapshot[$event_id][$date_id]['time'][$time_key]['avail'] === 0 || $next_available_slot_found === true) {
                 if (!EPL_IS_ADMIN) {
                     unset($times[$time_key]);
                 }
             } else {
                 if ($next_available_slot_found == true || $number_of_times == 1) {
                     continue;
                 }
                 $next_available_slot_found = true;
                 if (!EPL_IS_ADMIN) {
                     if (is_null($date_id)) {
                         $this->current_data[$this->regis_id]['_dates']['_epl_start_time'][$event_id][] = $time_key;
                     } else {
                         $this->current_data[$this->regis_id]['_dates']['_epl_start_time'][$event_id][$date_id] = $time_key;
                     }
                 }
                 //$this->current_data;
             }
         }
     }
     $times = apply_filters('epl_erm__get_time_fields__times', $times, $date_id);
     //user can select a date for each time
     if (is_null($date_id)) {
         $value = $this->get_current_value('_dates', '_epl_start_time', $event_details['ID']);
     } else {
         $value = $this->get_current_value('_dates', '_epl_start_time', $event_details['ID'], $date_id);
     }
     $data['time_optional'] = false;
     $style = '';
     if (epl_is_empty_array($times)) {
         $time_key = key($event_details['_epl_start_time']);
         $times = array($time_key => 1);
         //$style = "display:none";
         $data['time_optional'] = true;
     }
     //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($value, true). "</pre>";
     $epl_fields = array('input_type' => $input_type, 'input_name' => "_epl_start_time[{$event_details['ID']}][{$date_id}]", 'class' => 'epl_time_dd', 'options' => $times, 'style' => $style, 'default_value' => $value == '' && isset($_REQUEST['_time_id']) ? sanitize_text_field($_REQUEST['_time_id']) : '', 'value' => $value);
     $epl_fields += (array) $this->overview_trigger;
     //if (epl_get_element($event_details['_epl_time_hide']))
     $data['event_time'] = $this->epl_util->create_element($epl_fields);
     $data['event_time'] = $data['event_time']['field'];
     if (!is_null($date_id)) {
         return $data['event_time'];
     }
     return $this->epl->load_view($this->dest . '/cart/cart-times', $data, true);
 }
function epl_get_currency_symbol($amount = null)
{
    $_amount = $amount;
    $opt = epl_get_option('epl_general_options');
    $symbol = epl_get_element('epl_currency_symbol', $opt, '');
    $location = epl_get_element('epl_currency_symbol_location', $opt, 'b');
    if ($symbol) {
        if ($location == 'b') {
            $amount = epl_prefix($symbol, $amount);
        } else {
            $amount = epl_suffix(' ' . $symbol, $amount);
        }
    }
    $amount = apply_filters('epl_get_currency_symbol', $amount, $_amount, $symbol, $location);
    return $amount;
}
    <div class="toggle_container">


        <table class="epl_avail_spaces_table">
            <?php 
foreach ($table_data as $date_id => $data) {
    if ($data['date']['timestamp'] <= EPL_DATE && $event_details['_epl_event_status'] != 3) {
        continue;
    }
    $date = $data['date']['disp'];
    $times = $data['time'];
    ?>

                <tr class="epl_date"><td><?php 
    echo $data['date']['disp'];
    echo epl_prefix(' - ', epl_get_element_m($date_id, '_epl_date_note', $event_details, null));
    ?>
</td><td><?php 
    echo $data['date']['avail'];
    ?>
</td></tr>

                <?php 
    if (epl_is_addon_active('_epl_atp')) {
        foreach ($times as $time_id => $time_data) {
            //if ( $time_data['avail'] !== '' ):
            $prices = $time_data['price'];
            if ($time_data['disp'] !== '') {
                ?>

                            <tr class="epl_time"><td><?php 
    ?>
</td>

            </tr>

            <?php 
    foreach ($times as $time_id => $time_data) {
        //if ( $time_data['avail'] !== '' ):
        if (epl_get_element($time_id, epl_get_element('_epl_time_hide', $event_details)) == 0) {
            if (!epl_is_date_level_time() || epl_is_date_level_time() && !epl_is_empty_array($date_specifc_time) && (array_key_exists($time_id, $date_specifc_time) && array_key_exists($date_id, $date_specifc_time[$time_id]))) {
                $prices = $time_data['price'];
                if (!epl_is_time_optonal()) {
                    ?>
                            <tr class="epl_time">
                                <td><?php 
                    echo $time_data['disp'] . epl_prefix(' - ', $event_details['_epl_end_time'][$time_id]) . epl_prefix(' - ', epl_get_element_m($time_id, '_epl_time_note', $event_details));
                    ?>
</td>
                                <td></td>
                                <td><?php 
                    echo $show_avail_spaces ? $time_data['avail'] : '';
                    ?>
</td>
                            </tr>
                            <?php 
                }
                foreach ($prices as $price_id => $price_data) {
                    if (epl_is_time_specific_price($price_id) && !epl_get_element_m($time_id, $price_id, epl_get_element('_epl_time_specific_price', $event_details))) {
                        continue;
                    }
                    if (epl_is_date_specific_price($price_id) && !epl_get_element_m($date_id, $price_id, epl_get_element('_epl_date_specific_price', $event_details))) {
                $event_venue_title = get_the_location_name() . ' ' . get_the_location_gmap_icon('See Map');
                $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));
                $counts_day_key = $event_id . "_date_{$date_id}";
                $num_regis = epl_get_element('_total_att_' . $counts_day_key, $counts, 0);
                $counts_time_key = $event_id . "_time_{$date_id}_{$time_id}";
                //if ( $capacity !== false && isset( $counts['_total_att_' . $counts_time_key] ) ) {
                $num_regis = epl_get_element('_total_att_' . $counts_time_key, $counts, 0);
                //}
                $avail = $capacity - $num_regis;
                $regis_button_args = array('_date_id' => $date_id, '_time_id' => $time_id, 'event_id' => $event_id);
                $temp_table_row = array();
                $temp_table_row['title'] = '<td>' . $event_title . '</td>';
                $temp_table_row['day_of_week'] = '<td>' . $event_dow . '</td>';
                $temp_table_row['date'] = '<td>' . $event_dom . '</td>';
                $temp_table_row['time'] = '<td>' . $time . epl_prefix('-', $end_time) . '</td>';
                $temp_table_row['category'] = '<td>' . $event_categories . '</td>';
                $temp_table_row['location'] = '<td>' . $event_venue_title . '</td>';
                $temp_table_row['instructor'] = '<td>' . implode(', ', get_the_instructor_name(false, true, false)) . '</td>';
                $temp_table_row['available_spaces'] = '<td>' . ($capacity !== false ? $avail : '') . '</td>';
                $temp_table_row['regis_button'] = '<td>' . ($capacity === false || $avail !== '' && $avail > 0 ? get_the_register_button($event_id, false, $regis_button_args) : epl__('Sold Out')) . '</td>';
                $temp_table_row = array_intersect_key($temp_table_row, $default_fields);
                epl_sort_array_by_array($temp_table_row, $default_fields);
                if (!empty($temp_table_row)) {
                    $table_row[] = '<tr>' . implode($temp_table_row) . '</tr>';
                }
            }
        }
    }
}
$table_header = array();
                 $temp_table_row .= '<td></td>';
                 $temp_table_row .= '<td>NO DATE</td>';
                 $temp_table_row .= '<td></td>';
                 $temp_table_row .= '<td class="title"><input type="checkbox" name="event_ids[' . $event_id . ']" class="event_ids" value="' . $event_id . '">&nbsp;&nbsp;' . $event_edit_link . $date_note . $formatted_status . '</td>';
                 $temp_table_row .= '<td></td>';
                 $temp_table_row .= '<td></td>';
                 $temp_table_row .= '<td></td>';
                 $temp_table_row .= '<td>' . $status . '</td>';
                 $temp_table_row .= '<td>' . $event_id . ' ' . $delete_link . '</td>';
             } else {
                 $temp_table_row .= '<td>' . $event_categories . '</td>';
                 $temp_table_row .= '<td>' . $event_dow . '</td>';
                 $temp_table_row .= '<td>' . $event_dom . '</td>';
                 $temp_table_row .= '<td>' . $time . '</td>';
                 $temp_table_row .= '<td class="title"><input type="checkbox" name="event_ids[' . $event_id . ']" class="event_ids" value="' . $event_id . '">&nbsp;&nbsp;' . $event_edit_link . $date_note . $formatted_status . '</td>';
                 $temp_table_row .= '<td>' . "{$num_regis}" . epl_prefix(' / ', $capacity) . '<div class="epl_action_button_wrapper" style="float:right;">' . ($num_regis > 0 ? $load_att_name_button . ' ' . $load_att_full_data_button . ' ' . $load_att_comb_data_button . ' ' . $email_form_link : '') . ' ' . $add_regis_link . '</div></td>';
                 $temp_table_row .= '<td>' . $money_total . '</td>';
                 $temp_table_row .= '<td></td>';
                 $temp_table_row .= '<td>' . $status . '</td>';
                 $temp_table_row .= '<td>' . $event_id . ' ' . $delete_link . '</td>';
             }
             //following columns will be hidden like ninjas by the Datatables dom filters
             //$temp_table_row .= '<td><a href="#" class="btn" title="Edit Event">Ed</a><a href="#" class="btn" title="Reports">Re</a><a href="#" class="btn" title="Export CSV">Ex</a><a href="#" class="btn" title="Email Attendees">Em</a><a
             //
             //  href="#" class="btn" title="Notes">No</a><a href="#" class="btn" title="Add to Gcal/iCal">Ca</a></td>';
             if ($temp_table_row != '') {
                 $table_row[] = '<tr>' . $temp_table_row . '</tr>';
             }
         }
     }
 }
Exemplo n.º 7
0
 function get_the_event_dates_times_prices()
 {
     global $event_details, $event_snapshot;
     $_today = EPL_DATE;
     $_r = array();
     foreach ($event_details['_epl_start_date'] as $date_key => $date) {
         if (epl_is_ongoing_event() || true) {
             $_note = epl_get_element_m($date_key, '_epl_date_note', $event_details);
             $_location = '';
             if (epl_get_element($date_key, epl_get_element('_epl_date_location', $event_details))) {
                 $_location_id = epl_get_element($date_key, $event_details['_epl_date_location']);
                 $l = the_location_details($_location_id);
                 //sets up the location info
                 $_location = $l['post_title'];
                 //get_the_location_name();// . ' ' . get_the_location_gmap_icon();
                 //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r( epl_formatted_date( $date ) . $_location_id, true ) . "</pre>";
             }
             $_end = $date != $event_details['_epl_end_date'][$date_key] ? ' - ' . epl_formatted_date($event_details['_epl_end_date'][$date_key]) : '';
             $_r[$date_key]['date'] = array('disp' => epl_formatted_date($date) . $_end . ' ' . $_location);
             foreach ($event_details['_epl_start_time'] as $time_key => $time) {
                 if (epl_is_date_level_time() && epl_is_date_specific_time($time_key) && !epl_get_element_m($date_key, $time_key, $event_details['_epl_date_specific_time'])) {
                     continue;
                 }
                 $_r[$date_key]['time'][$time_key] = array('disp' => $time . epl_prefix(' - ', epl_get_element_m($time_key, '_epl_time_note', $event_details)));
                 foreach ($event_details['_epl_price_name'] as $price_key => $price_name) {
                     if (epl_is_date_level_price() && epl_is_date_specific_price($price_key) && !epl_get_element_m($date_key, $price_key, $event_details['_epl_date_specific_price'])) {
                         continue;
                     }
                     //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($event_details['_epl_price_name'], true). "</pre>";
                     $_r[$date_key]['time'][$time_key]['price'][$price_key] = array('disp' => $price_name, 'price' => epl_get_formatted_curr($event_details['_epl_price'][$price_key], null, true));
                     if (epl_is_time_specific_price($price_key) && !epl_get_element_m($time_key, $price_key, epl_get_element('_epl_time_specific_price', $event_details))) {
                         unset($_r[$date_key]['time'][$time_key]['price'][$price_key]);
                     }
                     if (epl_is_date_specific_price($price_key) && !epl_get_element_m($date_key, $price_key, epl_get_element('_epl_date_specific_price', $event_details))) {
                         unset($_r[$date_key]['time'][$time_key]['price'][$price_key]);
                     }
                 }
             }
         }
     }
     return $this->epl->load_view('front/dates-times-prices', array('table_data' => $_r), true);
 }