Exemplo n.º 1
0
 //continue;
 $event_id = get_the_ID();
 $event_excerpt = get_the_excerpt();
 $event_tooltip = '';
 if ($event_excerpt !== '') {
     $event_tooltip = " <span class='tip event_tooltip' title='" . $event_excerpt . "'>i</span>";
 }
 //$event_title = epl_anchor($event_details['_epl_link'],get_the_title(),'_self','class="event_link"');
 $event_title = get_the_title();
 $event_categories = strip_tags(get_the_term_list($event_id, 'epl_event_categories', '', ',', ''));
 $event_participation = $event_details['_epl_participation'];
 $event_ages = epl_get_element('_epl_ages', $event_details, array());
 $event_dow = date_i18n("D", $date);
 $event_dom = date_i18n("m/j/y", $date);
 $end_time = $event_details['_epl_end_time'][$time_id];
 $time_avail = epl_get_time_capacity($time_id) != '' ? ' / ' . epl_get_time_capacity($time_id) : '';
 //naah, crap
 //$event_ages_range = ageRange2($event_ages);
 $price = min($event_details['_epl_price']);
 if ($price <= 0) {
     $print_price = "<span class='price_free'>Free</span>";
 } else {
     $print_price = "<span class='price'>\$" . $price . "</span>";
 }
 $avail = epl_get_element($time_id, $event_details['_epl_time_capacity']);
 //build the td rows
 $temp_table_row = '<td>' . $event_dom . '</td>';
 //$temp_table_row .= '<td>' . $event_dow . '</td>';
 $temp_table_row .= '<td>' . $time . '</td>';
 $temp_table_row .= '<td>' . epl_get_att_count(array('for' => 'time', 'date_id' => $date_id, 'time_id' => $time_id, 'default' => 0)) . $time_avail . '</td>';
 //$temp_table_row .= '<td>' . epl_get_element( '_total_att_' . get_the_ID() . "_time_{$date_id}_{$time_id}", $current_att_count, 0 ) . ($avail ? $avail : '/') . '</td>';
Exemplo n.º 2
0
 function get_days_for_fc($args = array())
 {
     global $post;
     //page specific caching
     if (!epl_user_is_admin() && epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_enable_cache', 10) == 10 && false !== ($fc_dates = get_transient('epl_transient__get_days_for_fc__' . $post->ID))) {
         // return $fc_dates;
     }
     $show_att_counts = intval(epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_show_att_count', 0));
     if ($show_att_counts === 0) {
         $show_att_counts = epl_get_element('show_att_counts', $args) === true ? true : $show_att_counts;
     }
     if ($show_att_counts === 1 && !epl_user_is_admin()) {
         $show_att_counts = false;
     }
     if ($show_att_counts === 2 && !is_user_logged_in()) {
         $show_att_counts = false;
     }
     global $event_details;
     $events = $this->get_days_for_widget(3, $args);
     $show_first_date_only = apply_filters('epl__get_days_for_fc__', false);
     $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();
     $counter = 0;
     $date_sel_mode = false;
     //(epl_get_element( 'date_selector', $args, 0 ) == 1);
     foreach ($events as $date => $event_data) {
         $data['_event'] = $event_data;
         setup_event_details($event_data['event_id']);
         $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' => $date_sel_mode ? 'Select' : $event_data['title'], 'raw_title' => $event_data['title'], 'description' => $date_sel_mode ? $this->erm->get_the_dates($event_data['date_id']) : $c, 'term_list' => $event_data['term_list'], 'start_timestamp' => $event_data['date'], 'start' => epl_formatted_date($event_data['date'], 'Y-m-d'), 'end_timestamp' => $event_data['end'], 'end' => epl_formatted_date($event_data['end'], 'Y-m-d'), 'url' => $date_sel_mode ? '' : $event_data['register_link'], 'edit_url' => get_edit_post_link(), 'backgroundColor' => $bc, 'borderColor' => $bc, 'textColor' => $tc, 'className' => $event_data['register_link_type'] == 1 ? 'epl-no-modal' : '', 'id' => $event_data['event_id']);
         $weekday = date('N', $event_data['date']);
         //if multiple times, display the event for each time.
         if (count($event_data['times']['start']) > 1 && !$date_sel_mode) {
             $_tmp_title = $_r['title'];
             $_tmp_url = $_r['url'];
             foreach ($event_data['times']['start'] as $time_id => $time) {
                 if ($time == '') {
                     continue;
                 }
                 if (epl_is_date_level_time()) {
                     if (epl_is_date_specific_time($time_id) && !isset($event_details['_epl_date_specific_time'][$time_id][$event_data['date_id']])) {
                         continue;
                     }
                 }
                 $weekday_specific = epl_get_element_m($time_id, '_epl_weekday_specific_time', $event_details, array());
                 if (!epl_is_empty_array($weekday_specific) && !isset($weekday_specific[$weekday])) {
                     continue;
                 }
                 //$_r['title'] = '<span class="epl_fc_title_time"> ' . $time . '</span>' . $_tmp_title;
                 $_r['title'] = $_tmp_title;
                 $_r['raw_title'] = $_tmp_title;
                 if ($show_att_counts) {
                     $_r['title'] .= ' ' . '<span style="background-color:red;color:#fff;padding:0 4px;white-space: nowrap;"> ' . epl_get_att_count(array('for' => 'time', 'date_id' => $event_data['date_id'], 'time_id' => $time_id, 'default' => 0));
                     $_r['title'] .= (epl_get_time_capacity($time_id) != '' ? ' / ' . epl_get_time_capacity($time_id) : '') . '</span>';
                     $_r['att_counts'] = epl_get_att_count(array('for' => 'time', 'date_id' => $event_data['date_id'], 'time_id' => $time_id, 'default' => 0));
                     $_r['att_counts'] .= epl_get_time_capacity($time_id) != '' ? ' / ' . epl_get_time_capacity($time_id) : '';
                 }
                 $_r['url'] = $date_sel_mode ? '' : add_query_arg(array('_time_id' => $time_id), $event_data['register_link']);
                 $tmp_key_for_sorting = strtotime($time, $event_data['date']);
                 if (isset($r[$tmp_key_for_sorting])) {
                     $tmp_key_for_sorting .= '.' . $counter;
                     $counter++;
                 }
                 $_r['start'] = epl_formatted_date(strtotime($time, $event_data['date']), 'Y-m-d H:i:s');
                 $_r['end'] = epl_formatted_date(strtotime($event_data['times']['end'][$time_id], $show_first_date_only ? $event_data['start'] : $event_data['end']), 'Y-m-d H:i:s');
                 //$_r['allDay'] = false;
                 $r[$tmp_key_for_sorting] = $_r;
                 //$r[] = $_r;
                 $counter++;
             }
             continue;
         } else {
             $time = current($event_data['times']['start']);
             //$_r['title'] = ($time != '' ? '<span class="epl_fc_title_time"> ' . $time . '</span>' : '') . $_r['title'];
             $_r['title'] = $_r['title'];
             if (epl_is_empty_array($event_data['times']['start'])) {
                 $_r['start'] = epl_formatted_date($event_data['date'] + 25200, 'Y-m-d H:i:s');
             } else {
                 $_r['start'] = epl_formatted_date(strtotime(current($event_data['times']['start']) . ' ', $event_data['date']), 'Y-m-d H:i:s');
             }
             if (epl_is_empty_array($event_data['times']['end'])) {
                 $_r['end'] = epl_formatted_date($event_data['end'] + 86399, 'Y-m-d H:i:s');
             } else {
                 $_r['end'] = epl_formatted_date(strtotime(current($event_data['times']['end']) . ' ', $show_first_date_only ? $event_data['start'] : $event_data['end']), 'Y-m-d H:i:s');
             }
             if ($show_att_counts) {
                 $_r['title'] .= ' ' . '<span style="background-color:red;color:#fff;padding:0 4px;white-space: nowrap;"> ' . epl_get_att_count(array('for' => 'date', 'date_id' => $event_data['date_id'], 'default' => 0));
                 $_r['title'] .= (epl_get_date_capacity($event_data['date_id']) != '' ? ' / ' . epl_get_date_capacity($event_data['date_id']) : '') . '</span>';
                 $_r['att_counts'] = epl_get_att_count(array('for' => 'date', 'date_id' => $event_data['date_id'], 'default' => 0));
                 $_r['att_counts'] .= epl_get_date_capacity($event_data['date_id']) != '' ? ' / ' . epl_get_date_capacity($event_data['date_id']) : '';
             }
         }
         $tmp_key_for_sorting = strtotime(current($event_data['times']['start']) . ' ', $event_data['date']);
         if (isset($r[$tmp_key_for_sorting])) {
             $tmp_key_for_sorting .= '.' . $counter;
             $counter++;
         }
         $_r['sort_time'] = $tmp_key_for_sorting;
         $r[$tmp_key_for_sorting] = $_r;
         //$_r = apply_filters( 'epl_get_cal_dates_response_loop', $r );
         $counter++;
     }
     $raw = apply_filters('epl_get_cal_dates_response', $r);
     ksort($raw);
     //@TODO - temp solution for showing cal in the month of first avail. event
     global $first_event_date;
     $first_event_date = key($raw);
     if (isset($args['raw'])) {
         return $raw;
     }
     //using array_values to get rid of temp keys, fullcalendar doesn't seem to like them :)
     $r = json_encode(array_values($r));
     if (!epl_user_is_admin()) {
         set_transient('epl_transient__get_days_for_fc__' . $post->ID, base64_encode($r), 60 * 60 * 4);
     }
     return $r;
 }