public function widget($args, $instance)
    {
        extract($args);
        // Only show this widget for users
        global $user_ID;
        if (empty($user_ID)) {
            return;
        }
        if (empty($instance['title'])) {
            $instance['title'] = __('My Bible Readings', 'bfox');
        }
        echo $before_widget . $before_title . $instance['title'] . $after_title;
        $schedule_ids = bfox_bp_plans_get_active_schedule_ids();
        //$start_date = date('Y-m-d', strtotime('last saturday +1 day')); // Start on Sundays
        $start_date = date('Y-m-d', strtotime('-3 days'));
        // Start 3 days ago
        $end_date = date('Y-m-d', strtotime('+3 days'));
        // Start 3 days from now
        if (empty($schedule_ids)) {
            echo __('You don\'t have any active reading plan schedules.', 'bfox');
        } else {
            $args = array('date_format' => 'l', 'show_checks' => true, 'user_id' => $user_ID);
            ?>
			<form action="" method="post">
			<?php 
            $checked_ids = bfox_bp_plans_list_by_date($schedule_ids, $start_date, $end_date, $args);
            ?>
			<input type="hidden" name="bible_reading_plan_old_checks" value="<?php 
            echo implode(',', $checked_ids);
            ?>
" />
			<input type="submit" name="bible_reading_save_checks" value="<?php 
            _e('Save Progress', 'bfox');
            ?>
" />
			</form>
			<br/>
			<a href="<?php 
            echo bfox_bp_bible_study_calendar_url();
            ?>
"><?php 
            _e('View Calendar', 'bfox');
            ?>
</a>
			<?php 
        }
        ?>
		<br/>
		<a href="<?php 
        echo bfox_bp_plan_url();
        ?>
"><?php 
        _e('Schedule a reading plan', 'bfox');
        ?>
</a></p>
		<?php 
        echo $after_widget;
    }
Exemple #2
0
 public function schedule_url()
 {
     return bfox_bp_plan_url($this->slug) . 'add-schedule/';
 }