function bfox_bp_plans_get_active_schedule_ids() { global $bfox_bp_plans_active_schedule_ids, $user_ID; if (!isset($bfox_bp_plans_active_schedule_ids)) { if ($user_ID) { $bfox_bp_plans_active_schedule_ids = BfoxReadingSchedule::get(BfoxReadingSchedule::add_user_to_args($user_ID, array('date' => BfoxReadingSchedule::date()))); } else { $bfox_bp_plans_active_schedule_ids = array(); } } return (array) $bfox_bp_plans_active_schedule_ids; }
function bfox_bp_plans_list_month_year_readings($month, $year) { global $bp; $start_date = date('Y-m-d', strtotime("{$year}-{$month}-01")); $end_date = date('Y-m-d', strtotime('+1 month -1 day', strtotime($start_date))); $schedule_ids = BfoxReadingSchedule::get(BfoxReadingSchedule::add_current_owner_to_args(array('date' => array($start_date, $end_date)))); if ($bp->groups->current_group->id) { $show_checks = groups_is_user_member($bp->loggedin_user->id, $bp->groups->current_group->id); } else { $show_checks = $bp->loggedin_user->id == $bp->displayed_user->id; } ?> <h4 class="plans-calendar"><?php printf(__('Readings for %s', 'bfox'), date('F, Y', strtotime($start_date))); ?> </h4> <form action="" method="post"> <?php $checked_ids = bfox_bp_plans_list_by_date($schedule_ids, $start_date, $end_date, array('date_format' => 'F j (D)', 'is_item_list' => true, 'show_checks' => $show_checks)); ?> <br/> <?php if ($show_checks && !empty($schedule_ids)) { ?> <p> <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'); ?> " /> </p> <?php } ?> <?php if ($show_checks) { ?> <p> <a href="<?php echo bfox_bp_plan_url(); ?> "><?php _e('Schedule a reading plan', 'bfox'); ?> </a> </p> <?php } ?> </form> <?php }