コード例 #1
0
 /**
  * Return the embedded day view of the calendar, optionally filtered by
  * event categories and tags.
  *
  * @param array $args     associative array with any of these elements:
  *   int oneday_offset  => specifies which day to display relative to the
  *                        current day
  *   array cat_ids     => restrict events returned to the given set of
  *                        event category slugs
  *   array auth_ids    => restrict events returned to the given set of
  *                        authors
  *   array tag_ids     => restrict events returned to the given set of
  *                        event tag names
  *   array post_ids    => restrict events returned to the given set of
  *                        post IDs
  *
  * @return string	        returns string of view output
  */
 function get_oneday_view($args)
 {
     global $ai1ec_view_helper, $ai1ec_events_helper, $ai1ec_calendar_helper, $ai1ec_settings;
     $defaults = array('oneday_offset' => 0, 'cat_ids' => array(), 'tag_ids' => array(), 'auth_ids' => array(), 'post_ids' => array(), 'exact_date' => Ai1ec_Time_Utility::current_time());
     $args = wp_parse_args($args, $defaults);
     // Localize requested date and get components.
     $local_date = Ai1ec_Time_Utility::gmt_to_local($args['exact_date']);
     $bits = Ai1ec_Time_Utility::gmgetdate($local_date);
     // Apply day offset.
     $day_shift = 0 + $args['oneday_offset'];
     // Now align date to start of day (midnight).
     $local_date = gmmktime(0, 0, 0, $bits['mon'], $bits['mday'] + $day_shift, $bits['year']);
     $cell_array = $ai1ec_calendar_helper->get_oneday_cell_array($local_date, array('cat_ids' => $args['cat_ids'], 'tag_ids' => $args['tag_ids'], 'post_ids' => $args['post_ids'], 'auth_ids' => $args['auth_ids']));
     // Create pagination links.
     $pagination_links = $ai1ec_calendar_helper->get_oneday_pagination_links($args);
     $pagination_links = $ai1ec_view_helper->get_theme_view('pagination.php', array('links' => $pagination_links, 'data_type' => $args['data_type']));
     $date_format = Ai1ec_Meta::get_option('date_format', 'l, M j, Y');
     $title = Ai1ec_Time_Utility::date_i18n($date_format, $local_date, true);
     $time_format = Ai1ec_Meta::get_option('time_format', 'g a');
     // Calculate today marker's position.
     $now = Ai1ec_Time_Utility::current_time();
     $now = Ai1ec_Time_Utility::gmt_to_local($now);
     $now_text = $ai1ec_events_helper->get_short_time($now, false);
     $now = Ai1ec_Time_Utility::gmgetdate($now);
     $now = $now['hours'] * 60 + $now['minutes'];
     $is_ticket_button_enabled = $ai1ec_calendar_helper->is_buy_ticket_enabled_for_view('oneday');
     $show_reveal_button = $ai1ec_settings->week_view_starts_at > 0 || $ai1ec_settings->week_view_ends_at < 24;
     $view_args = array('title' => $title, 'type' => 'oneday', 'cell_array' => $cell_array, 'show_location_in_title' => $ai1ec_settings->show_location_in_title, 'now_top' => $now, 'now_text' => $now_text, 'pagination_links' => $pagination_links, 'post_ids' => join(',', $args['post_ids']), 'time_format' => $time_format, 'done_allday_label' => false, 'done_grid' => false, 'data_type' => $args['data_type'], 'data_type_events' => '', 'is_ticket_button_enabled' => $is_ticket_button_enabled, 'show_reveal_button' => $show_reveal_button);
     if ($ai1ec_settings->ajaxify_events_in_web_widget) {
         $view_args['data_type_events'] = $args['data_type'];
     }
     // Add navigation if requested.
     $navigation = Ai1ec_Render_Entity_Utility::get_instance('Navigation')->set($view_args)->get_content($args['no_navigation']);
     $view_args['navigation'] = $navigation;
     return apply_filters('ai1ec_get_oneday_view', $ai1ec_view_helper->get_theme_view('oneday.php', $view_args), $view_args);
 }
コード例 #2
0
/**
 * ai1ec_get_filter_menu function
 *
 * Template tag, to return contents for Ai1EC filter menu, in desired template
 * location.
 *
 * @return string Rendered HTML snippet
 */
function ai1ec_get_filter_menu()
{
    return Ai1ec_Render_Entity_Utility::get_instance('Filter_Menu')->get_content();
}