コード例 #1
0
    /**
     * Outputs the content of the widget
     *
     * @param array $args
     * @param array $instance
     */
    public function widget($args, $instance)
    {
        // Only for WebTide members
        if (!IS_WEBTIDE_MEMBER) {
            return;
        }
        // If we have a next meeting...
        if (!($next_meeting = ua_webtide_get_next_monthly_meeting())) {
            return;
        }
        // Make sure we have a start date
        if (!(($event_start_date_str = isset($next_meeting->EventStartDate) ? $next_meeting->EventStartDate : NULL) && strtotime($event_start_date_str) !== false)) {
            return;
        }
        // Set the start datetime
        $event_start_date = new DateTime($event_start_date_str, new DateTimeZone('America/Chicago'));
        // Get the current date/time in Central time
        $right_now = new DateTime();
        $right_now->setTimeZone(new DateTimeZone('America/Chicago'));
        // Make sure its in the future
        if ($event_start_date < $right_now) {
            return;
        }
        // Are we viewing the next meeting?
        $viewing_next_meeting = is_single($next_meeting->ID);
        // If we're not a member and viewing it, don't print this
        if (!IS_WEBTIDE_MEMBER && $viewing_next_meeting) {
            return;
        }
        echo $args['before_widget'];
        echo $args['before_title'] . 'Our Next Meeting' . $args['after_title'];
        // If we're looking at it
        if (IS_WEBTIDE_MEMBER && $viewing_next_meeting) {
            ?>
<p><strong>You're looking at it!</strong><?php 
            // What's the difference
            $time_until_event = $right_now->diff($event_start_date);
            // It's today
            if (!$time_until_event->invert && $time_until_event->d <= 0) {
                ?>
 Looks like the meeting will start soon. We hope you'll join us!<?php 
            } else {
                if (!$time_until_event->invert && $time_until_event->d <= 7) {
                    ?>
 It's coming up soon. We hope you'll join us!<?php 
                }
            }
            ?>
</p><?php 
        } else {
            echo ua_webtide_get_next_monthly_meeting_html(array('event_title_element' => 'h4', 'abbreviate_dt' => true, 'view_details' => false));
        }
        echo $args['after_widget'];
    }
コード例 #2
0
/who-we-are/">Learn more about our community</a>
				</div> <!-- .welcome-message -->
				
			</div>
		</div>
		
	</div> <!-- #ua-webtide-welcome --><?php 
// Print the other sections of the home page
?>
<div id="ua-webtide-front-page-sections">
		
		<section>
			<div class="row"><?php 
// Make sure we have the html
//if ( ! $next_webtide_meeting_html ) {
$next_webtide_meeting_html = ua_webtide_get_next_monthly_meeting_html(array('include_excerpt' => true, 'include_button' => true, 'view_details' => false));
//}
?>
<div class="small-12 medium-12 large-4 large-push-8 columns"><?php 
// Have a different order for members, putting the next meeting note first on small screens
if (IS_WEBTIDE_MEMBER && $next_webtide_meeting_html) {
    ?>
<div class="webtide-next-meeting">

							<h2>Our Next Meeting</h2><?php 
    echo $next_webtide_meeting_html;
    ?>
</div><?php 
} else {
    ?>
<h2>Web Jobs at UA</h2>