function evcal_ajax_callback() { global $eventon; $shortcode_args = ''; $status = 'GOOD'; $evodata = !empty($_POST['evodata']) ? $_POST['evodata'] : false; // Initial values $current_month = (int) (!empty($evodata['cmonth']) ? $evodata['cmonth'] : $_POST['current_month']); $current_year = (int) (!empty($evodata['cyear']) ? $evodata['cyear'] : $_POST['current_year']); $send_unix = isset($evodata['send_unix']) ? $evodata['send_unix'] : null; $direction = $_POST['direction']; $sort_by = !empty($_POST['sort_by']) ? $_POST['sort_by'] : (!empty($evodata['sort_by']) ? $evodata['sort_by'] : 'sort_date'); // generate new UNIX range dates for calendar if ($send_unix == '1') { $focus_start_date_range = isset($evodata['range_start']) ? (int) $evodata['range_start'] : null; $focus_end_date_range = isset($evodata['range_end']) ? (int) $evodata['range_end'] : null; $focused_month_num = $current_month; $focused_year = $current_year; } else { if ($direction == 'none') { $focused_month_num = $current_month; $focused_year = $current_year; } else { $focused_month_num = $direction == 'next' ? $current_month == 12 ? 1 : $current_month + 1 : ($current_month == 1 ? 12 : $current_month - 1); $focused_year = $direction == 'next' ? $current_month == 12 ? $current_year + 1 : $current_year : ($current_month == 1 ? $current_year - 1 : $current_year); } $focus_start_date_range = mktime(0, 0, 0, $focused_month_num, 1, $focused_year); $time_string = $focused_year . '-' . $focused_month_num . '-1'; $focus_end_date_range = mktime(23, 59, 59, $focused_month_num, date('t', strtotime($time_string)), $focused_year); } // base calendar arguments at this stage $eve_args = array('focus_start_date_range' => $focus_start_date_range, 'focus_end_date_range' => $focus_end_date_range, 'sort_by' => $sort_by, 'event_count' => !empty($_POST['event_count']) ? $_POST['event_count'] : (!empty($evodata['ev_cnt']) ? $evodata['ev_cnt'] : ''), 'filters' => isset($_POST['filters']) ? $_POST['filters'] : null); //print_r($eve_args); // shortcode arguments USED to build calendar $shortcode_args_arr = $_POST['shortcode']; if (!empty($shortcode_args_arr) && count($shortcode_args_arr) > 0) { foreach ($shortcode_args_arr as $f => $v) { $shortcode_args[$f] = $v; } $eve_args = array_merge($eve_args, $shortcode_args); $lang = $shortcode_args_arr['lang']; } else { $lang = ''; } // GET calendar header month year values $calendar_month_title = get_eventon_cal_title_month($focused_month_num, $focused_year, $lang); // AJAX Addon hook $eve_args = apply_filters('eventon_ajax_arguments', $eve_args, $_POST); // Calendar content $content_li = $eventon->evo_generator->eventon_generate_events($eve_args); // RETURN VALUES // Array of content for the calendar's AJAX call returned in JSON format $return_content = array('status' => !$evodata ? 'Need updated' : $status, 'content' => $content_li, 'cal_month_title' => $calendar_month_title, 'month' => $focused_month_num, 'year' => $focused_year, 'focus_start_date_range' => $focus_start_date_range, 'focus_end_date_range' => $focus_end_date_range); echo json_encode($return_content); exit; }
function get_calendar_header($arguments) { if ($this->calendar_nonlogged()) { return false; } global $eventon; // SHORTCODE // at this point shortcode arguments are processed $args = $this->cal->shortcode_args; //print_r($args); // FUNCTION $defaults = array('focused_month_num' => 1, 'focused_year' => date('Y'), 'range_start' => 0, 'range_end' => 0, 'send_unix' => false, 'header_title' => '', '_html_evcal_list' => true, 'sortbar' => true, '_html_sort_section' => true, 'date_header' => true, 'external' => false); // $arguments contain focused month num and focused year values // that need to be merged with existing values $arg_y = array_merge($defaults, $args, $arguments); extract($arg_y); //print_r($arg_y); // CONNECTION with action user addon do_action('eventon_cal_variable_action_au', $arg_y); //BASE settings to pass to calendar $cal_version = $eventon->version; $eventcard_open = $this->cal->is_eventcard_open ? 'eventcard="1"' : null; // calendar class names $boxCal = !empty($args['tiles']) && $args['tiles'] == 'yes' ? 'boxy' : null; $__cal_classes = array('ajde_evcal_calendar', $boxCal); if ($this->rtl) { $__cal_classes[] = 'evortl'; } if (!empty($args['tile_style']) && $args['tile_style'] != '0') { $__cal_classes[] = 'tile' . $args['tile_style']; } if ($this->cal->is_upcoming_list) { $__cal_classes[] = 'ul'; } // tile count if (!empty($args['tile_count']) && $args['tile_count'] != 2) { $__cal_classes[] = 'box_' . $args['tile_count']; } // plugin hook $__cal_classes = apply_filters('eventon_cal_class', $__cal_classes); $lang = !empty($args['lang']) ? $args['lang'] : 'L1'; $cal_header_title = get_eventon_cal_title_month($focused_month_num, $focused_year, $lang); //echo $lang; // calendar data variables $_cd = ''; $ux_val = $args['ux_val']; // figure out UX_val - user interaction if ($tiles == 'yes') { // if tiles then dont do slide down 5/19 $__ux_val = $ux_val == '1' ? '3' : $ux_val; } else { if (!empty($ux_val) && $ux_val != '0') { $__ux_val = $ux_val; } else { $__ux_val = '0'; } } $cdata = apply_filters('eventon_cal_jqdata', array('cyear' => $focused_year, 'cmonth' => $focused_month_num, 'runajax' => '1', 'evc_open' => !empty($args['evc_open']) && $args['evc_open'] == 'yes' ? '1' : '0', 'cal_ver' => $cal_version, 'mapscroll' => !empty($this->cal->evopt1['evcal_gmap_scroll']) && $this->cal->evopt1['evcal_gmap_scroll'] == 'yes' ? 'false' : 'true', 'mapformat' => !empty($this->cal->evopt1['evcal_gmap_format']) ? $this->cal->evopt1['evcal_gmap_format'] : 'roadmap', 'mapzoom' => !empty($this->cal->evopt1['evcal_gmap_zoomlevel']) ? $this->cal->evopt1['evcal_gmap_zoomlevel'] : '12', 'mapiconurl' => !empty($this->cal->evopt1['evo_gmap_iconurl']) ? $this->cal->evopt1['evo_gmap_iconurl'] : '', 'ev_cnt' => $args['event_count'], 'show_limit' => $args['show_limit'], 'tiles' => $args['tiles'], 'sort_by' => $args['sort_by'], 'filters_on' => $this->cal->filters, 'range_start' => $range_start, 'range_end' => $range_end, 'send_unix' => $send_unix ? '1' : '0', 'ux_val' => $__ux_val, 'accord' => !empty($accord) && $accord == 'yes' ? '1' : '0', 'rtl' => $this->rtl ? 'yes' : 'no'), $this->cal->evopt1); foreach ($cdata as $f => $v) { $_cd .= 'data-' . $f . '="' . $v . '" '; } $content = ''; // random cal id $cal_id = empty($cal_id) ? rand(100, 900) : $cal_id; // Calendar SHELL $content .= "<div id='evcal_calendar_" . $cal_id . "' class='" . implode(' ', $__cal_classes) . "' >"; if (!$external) { // layout changer $content .= $this->cal_parts_layout_changer($args); $content .= "<div class='evo-data' {$_cd} ></div>"; $sort_class = $this->cal->evcal_hide_sort == 'yes' ? 'evcal_nosort' : null; // HTML $content .= "<div id='evcal_head' class='calendar_header " . $sort_class . "' >"; // if the calendar arrows and headers are to show if ($date_header) { $hide_arrows = !empty($this->cal->evopt1['evcal_arrow_hide']) && $this->cal->evopt1['evcal_arrow_hide'] == 'yes' || !empty($args['hide_arrows']) && $args['hide_arrows'] == 'yes' ? true : false; $content .= $this->cal_above_header($arg_y); $content .= "<p id='evcal_cur' class='evo_month_title'> " . $cal_header_title . "</p>"; // arrows if (!$hide_arrows) { $content .= $this->cal_parts_arrows($args); } } else { if (!empty($header_title)) { $content .= "<p>" . $header_title . "</p>"; } } // (---) Hook for addon if (has_action('eventon_calendar_header_content')) { ob_start(); do_action('eventon_calendar_header_content', $content, $args); $content .= ob_get_clean(); } // Shortcode arguments $content .= $this->cal->shell->shortcode_args_for_cal(); $content .= "<div class='clear'></div></div>"; // SORT BAR $sortbar = $hide_so == 'yes' ? false : $sortbar; $content .= $_html_sort_section ? $this->cal->eventon_get_cal_sortbar($args, $sortbar) : null; } // RTL $rtl = $this->rtl ? 'evortl' : null; $content .= $_html_evcal_list ? "<div id='evcal_list' class='eventon_events_list {$rtl}'>" : null; return $content; }
function get_single_event_header($event_id, $repeat_interval = '') { $event_datetime = new evo_datetime(); $pmv = get_post_custom($event_id); $adjusted_start_time = $event_datetime->get_int_correct_event_time($pmv, $repeat_interval); $formatted_time = eventon_get_formatted_time($adjusted_start_time); return get_eventon_cal_title_month($formatted_time['n'], $formatted_time['Y']); }
/** * Calendar header content * @param array $arguments * @return string HTML content */ function get_calendar_header($arguments) { global $eventon; // SHORTCODE // at this point shortcode arguments are processed $args = $this->cal->shortcode_args; //print_r($args); // FUNCTION $defaults = array('focused_month_num' => 1, 'focused_year' => date('Y'), 'range_start' => 0, 'range_end' => 0, 'send_unix' => false, 'header_title' => '', '_html_evcal_list' => true, 'sortbar' => true, '_html_sort_section' => true, 'date_header' => true); // $arguments contain focused month num and focused year values // that need to be merged with existing values $arg_y = array_merge($defaults, $args, $arguments); extract($arg_y); //print_r($arg_y); // CONNECTION with action user addon do_action('eventon_cal_variable_action_au', $arg_y); //BASE settings to pass to calendar $cal_version = $eventon->version; $eventcard_open = $this->cal->is_eventcard_open ? 'eventcard="1"' : null; // right to left $rtl = !empty($args['rtl']) && $args['rtl'] == 'yes' ? 'evortl' : null; $upcoming_list = $this->cal->is_upcoming_list ? 'ul' : null; $boxCal = !empty($args['tiles']) && $args['tiles'] == 'yes' ? 'boxy' : null; $__cal_classes = apply_filters('eventon_cal_class', array('ajde_evcal_calendar', $rtl, $upcoming_list, $boxCal)); $lang = !empty($args['lang']) ? $args['lang'] : 'L1'; $cal_header_title = get_eventon_cal_title_month($focused_month_num, $focused_year, $lang); // calendar data variables $_cd = ''; // figure out UX_val - user interaction if ($tiles == 'yes') { $__ux_val = '3'; } else { if (!empty($ux_val) && $ux_val != '0') { $__ux_val = $ux_val; } else { $__ux_val = '0'; } } $cdata = apply_filters('eventon_cal_jqdata', array('cyear' => $focused_year, 'cmonth' => $focused_month_num, 'runajax' => '1', 'evc_open' => !empty($args['evc_open']) && $args['evc_open'] == 'yes' ? '1' : '0', 'cal_ver' => $cal_version, 'mapscroll' => !empty($this->cal->evopt1['evcal_gmap_scroll']) && $this->cal->evopt1['evcal_gmap_scroll'] == 'yes' ? 'false' : 'true', 'mapformat' => $this->cal->evopt1['evcal_gmap_format'] != '' ? $this->cal->evopt1['evcal_gmap_format'] : 'roadmap', 'mapzoom' => $this->cal->evopt1['evcal_gmap_zoomlevel'] != '' ? $this->cal->evopt1['evcal_gmap_zoomlevel'] : '12', 'ev_cnt' => $args['event_count'], 'show_limit' => $args['show_limit'], 'tiles' => $args['tiles'], 'sort_by' => $args['sort_by'], 'filters_on' => $this->cal->filters, 'range_start' => $range_start, 'range_end' => $range_end, 'send_unix' => $send_unix ? '1' : '0', 'ux_val' => $__ux_val, 'accord' => !empty($accord) && $accord == 'yes' ? '1' : '0'), $this->cal->evopt1); foreach ($cdata as $f => $v) { $_cd .= 'data-' . $f . '="' . $v . '" '; } $content = ''; // Calendar SHELL $content .= "<div id='evcal_calendar_" . $cal_id . "' class='" . implode(' ', $__cal_classes) . "' >\n\t\t\t\t<div class='evo-data' {$_cd} ></div>"; $sort_class = $this->cal->evcal_hide_sort == 'yes' ? 'evcal_nosort' : null; // HTML $content .= "<div id='evcal_head' class='calendar_header " . $sort_class . "' >"; // if the calendar arrows and headers are to show if ($date_header) { $hide_arrows_check = $this->cal->evopt1['evcal_arrow_hide'] == 'yes' ? "style='display:none'" : null; $content .= $this->cal->body->cal_above_header($arg_y); $content .= "<p id='evcal_cur'> " . $cal_header_title . "</p>\n\t\t\t\t\t\t<span id='evcal_prev' class='evcal_arrows evcal_btn_prev' " . $hide_arrows_check . "><i class='fa fa-angle-left'></i></span><span id='evcal_next' class='evcal_arrows evcal_btn_next' " . $hide_arrows_check . "><i class='fa fa-angle-right'></i></span>"; } else { if (!empty($header_title)) { $content .= "<p>" . $header_title . "</p>"; } } // (---) Hook for addon if (has_action('eventon_calendar_header_content')) { ob_start(); do_action('eventon_calendar_header_content', $content); $content .= ob_get_clean(); } // Shortcode arguments $content .= $this->cal->shell->shortcode_args_for_cal(); $content .= "<div class='clear'></div></div>"; // SORT BAR if ($hide_so != 'yes') { $content .= $_html_sort_section ? $this->cal->eventon_get_cal_sortbar($args, $sortbar) : null; } // RTL $rtl = !empty($args['rtl']) && $args['rtl'] == 'yes' ? 'evortl' : null; $content .= $_html_evcal_list ? "<div id='evcal_list' class='eventon_events_list {$rtl}'>" : null; return $content; }