* This file loads the mini calendar widget grid * * Override this template in your own theme by creating a file at [your-theme]/tribe-events/pro/widgets/mini-calendar/grid.php * * @package TribeEventsCalendar * */ if (!defined('ABSPATH')) { die('-1'); } ?> <?php $days_of_week = tribe_events_get_days_of_week('min'); $week = 0; $mini_cal_widget_id = Tribe__Events__Utils__Id_Generator::generate_id('tribe-mini-calendar-month', 'tribe-mini-calendar-month'); ?> <div class="tribe-mini-calendar-grid-wrapper"> <table class="tribe-mini-calendar" <?php tribe_events_the_mini_calendar_header_attributes(); ?> > <?php do_action('tribe_events_mini_cal_before_header'); ?> <thead class="tribe-mini-calendar-nav"> <tr> <td colspan="7"> <div> <?php tribe_events_the_mini_calendar_prev_link();
/** * Sets up an array of $days based on the current query, that can be used in the calendar loop * */ public function setup_view() { if ($this->use_cache && $this->html_cache->get() !== false) { return; } $days = array(); $date = $this->first_grid_date; // Start with the first grid date // Populate complete date range including leading/trailing days from adjacent months while ($date <= $this->final_grid_date) { $day_events = self::get_daily_events($date); $day = (int) substr($date, -2); $prev_month = (int) substr($date, 5, 2) < (int) substr($this->requested_date, 5, 2); $next_month = (int) substr($date, 5, 2) > (int) substr($this->requested_date, 5, 2); $month_type = self::CURRENT_MONTH; if ($prev_month) { $month_type = self::PREVIOUS_MONTH; } if ($next_month) { $month_type = self::NEXT_MONTH; } $days[] = array('daynum' => $day, 'daynum-id' => Tribe__Events__Utils__Id_Generator::generate_id($day, $day), 'date' => $date, 'events' => $day_events, 'total_events' => $day_events->found_posts, 'view_more' => $day_events->found_posts > $this->events_per_day ? self::view_more_link($date) : false, 'month' => $month_type); // Record the indicies marking the portion of the array relating to the current month if (!isset($this->current_month_begins) && self::CURRENT_MONTH === $month_type) { $this->current_month_begins = count($days) - 1; } if (isset($this->current_month_begins) && !isset($this->current_month_ends) && self::CURRENT_MONTH !== $month_type) { $this->current_month_ends = count($days) - 1; } // Advance forward one day $date = date(Tribe__Date_Utils::DBDATEFORMAT, strtotime("{$date} +1 day")); } // If the month ended without bleeding into the next month, our current_month_ends property may not be set if (!isset($this->current_month_ends)) { $this->current_month_ends = count($days) - 1; } // store set of found days for use in calendar loop functions self::$calendar_days = $days; }
/** * @test * it should allow for group resets */ public function it_should_allow_for_group_resets() { \Tribe__Events__Utils__Id_Generator::generate_id('foo', 'baz'); \Tribe__Events__Utils__Id_Generator::generate_id('foo', 'baz'); \Tribe__Events__Utils__Id_Generator::generate_id('foo', 'baz'); \Tribe__Events__Utils__Id_Generator::generate_id('tec', 'bar'); \Tribe__Events__Utils__Id_Generator::generate_id('tec', 'bar'); \Tribe__Events__Utils__Id_Generator::generate_id('tec', 'bar'); \Tribe__Events__Utils__Id_Generator::reset('baz'); $baz_out = \Tribe__Events__Utils__Id_Generator::generate_id('foo', 'baz'); $bar_out = \Tribe__Events__Utils__Id_Generator::generate_id('tec', 'bar'); $this->assertEquals('foo-0', $baz_out); $this->assertEquals('tec-3', $bar_out); }