function bfox_bp_plans_list_by_date($schedule_ids, $start_date, $end_date = '', $args = array()) { if (empty($end_date)) { $end_date = $start_date; } $reading_ids = array(); foreach ($schedule_ids as $schedule_id) { $schedule = BfoxReadingSchedule::schedule($schedule_id); $_reading_ids = $schedule->readings_in_range($start_date, $end_date); if (!empty($_reading_ids)) { $reading_ids[$schedule->revision_id] = $_reading_ids; } } return bfox_bp_plans_list_readings($schedule_ids, BfoxReadingPlan::get_readings(array('reading_ids' => $reading_ids)), $args); }
public static function delete_plan(BfoxReadingPlan $plan) { global $wpdb; // Delete all the schedules for the given plan and plan owner $schedule_ids = $wpdb->get_col($wpdb->prepare('SELECT id FROM ' . self::$table_name . ' WHERE plan_id = %d AND is_auto_sync = 1 AND owner_type = %d AND owner_id = %d', $plan->id, $plan->owner_type, $plan->owner_id)); if (!empty($schedule_ids)) { $wpdb->query('DELETE FROM ' . self::$table_name . ' WHERE id IN (' . implode(',', $schedule_ids) . ')'); $wpdb->query('DELETE FROM ' . self::$progress_table_name . ' WHERE schedule_id IN (' . implode(',', $schedule_ids) . ')'); } $plan->update_user_count(); }
public static function cache_clear($type = null) { if (is_null($type)) { self::$cache = array(); } else { self::$cache[$type] = array(); } }