/**
  * Output the metabox
  */
 public static function output($post)
 {
     $calendar = new SP_Calendar($post);
     $data = $calendar->data();
     $usecolumns = $calendar->columns;
     self::table($data, $usecolumns);
 }
function sp_get_calendar($post = 0)
{
    $calendar = new SP_Calendar($post);
    return $calendar->data();
}
Ejemplo n.º 3
0
<?php

/**
 * Event List
 *
 * @author 		ProSports
 * @package 	ProSports/Templates
 * @version     1.5
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$defaults = array('id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => 'default', 'date_to' => 'default', 'number' => -1, 'show_team_logo' => get_option('prosports_event_list_show_logos', 'no') == 'yes' ? true : false, 'link_teams' => get_option('prosports_link_teams', 'no') == 'yes' ? true : false, 'link_venues' => get_option('prosports_link_venues', 'yes') == 'yes' ? true : false, 'sortable' => get_option('prosports_enable_sortable_tables', 'yes') == 'yes' ? true : false, 'scrollable' => get_option('prosports_enable_scrollable_tables', 'yes') == 'yes' ? true : false, 'responsive' => get_option('prosports_enable_responsive_tables', 'yes') == 'yes' ? true : false, 'paginated' => get_option('prosports_event_list_paginated', 'yes') == 'yes' ? true : false, 'rows' => get_option('prosports_event_list_rows', 10), 'order' => 'default', 'columns' => null, 'show_all_events_link' => false);
extract($defaults, EXTR_SKIP);
$calendar = new SP_Calendar($id);
if ($status != 'default') {
    $calendar->status = $status;
}
if ($date != 'default') {
    $calendar->date = $date;
}
if ($date_from != 'default') {
    $calendar->from = $date_from;
}
if ($date_to != 'default') {
    $calendar->to = $date_to;
}
if ($order != 'default') {
    $calendar->order = $order;
}
 /**
  * Define our custom columns shown in admin.
  * @param  string $column
  */
 public function custom_columns($column, $post_id)
 {
     switch ($column) {
         case 'sp_league':
             echo get_the_terms($post_id, 'sp_league') ? the_terms($post_id, 'sp_league') : __('All', 'prosports');
             break;
         case 'sp_season':
             echo get_the_terms($post_id, 'sp_season') ? the_terms($post_id, 'sp_season') : __('All', 'prosports');
             break;
         case 'sp_venue':
             echo get_the_terms($post_id, 'sp_venue') ? the_terms($post_id, 'sp_venue') : __('All', 'prosports');
             break;
         case 'sp_team':
             $teams = (array) get_post_meta($post_id, 'sp_team', false);
             $teams = array_filter($teams);
             if (empty($teams)) {
                 echo __('All', 'prosports');
             } else {
                 $current_team = get_post_meta($post_id, 'sp_current_team', true);
                 foreach ($teams as $team_id) {
                     if (!$team_id) {
                         continue;
                     }
                     $team = get_post($team_id);
                     if ($team) {
                         echo $team->post_title;
                         if ($team_id == $current_team) {
                             echo '<span class="dashicons dashicons-yes" title="' . __('Current Team', 'prosports') . '"></span>';
                         }
                         echo '<br>';
                     }
                 }
             }
             break;
         case 'sp_events':
             $calendar = new SP_Calendar($post_id);
             echo sizeof($calendar->data());
             break;
         case 'sp_layout':
             echo sp_array_value(SP()->formats->calendar, get_post_meta($post_id, 'sp_format', true), '&mdash;');
             break;
     }
 }
Ejemplo n.º 5
0
/**
 * Event Calendar
 *
 * @author 		ThemeBoy
 * @package 	SportsPress/Templates
 * @version     1.8.2
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $wpdb, $m, $monthnum, $year, $wp_locale;
$defaults = array('id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => 'default', 'date_to' => 'default', 'initial' => true, 'caption_tag' => 'h4', 'show_all_events_link' => false);
extract($defaults, EXTR_SKIP);
if (isset($id)) {
    $calendar = new SP_Calendar($id);
    if ($status != 'default') {
        $calendar->status = $status;
    }
    if ($date != 'default') {
        $calendar->date = $date;
    }
    if ($date_from != 'default') {
        $calendar->from = $date_from;
    }
    if ($date_to != 'default') {
        $calendar->to = $date_to;
    }
    $events = $calendar->data();
    $event_ids = array();
    foreach ($events as $event) {