<?php

$intervals = get_current_screen()->get_option('analytics_intervals', 'intervals');

?>

<fieldset class="metrics-prefs hidden">
    <legend>Metrics</legend>
</fieldset>

<fieldset class="screen-options">
    <legend>Analytics Timeframe</legend>

    <label class="screen-reader-text" for="analytics_interval">Time Interval</label>
    <select name="wp_screen_options[value][analytics_interval]" id="analytics_interval">
        <?php foreach ($intervals as $resolution => $items) : ?>
            <option
                value="<?php echo esc_attr($resolution); ?>"
                <?php selected($this->interval, $resolution); ?>
            >
                Past <?php echo human_time_diff(time() - ($resolution * $items)); ?>
                (<?php echo human_time_diff(time() - $resolution); ?> resolution)
            </option>
        <?php endforeach; ?>
    </select>
</fieldset>

<fieldset class="screen-options">
    <legend>Data Refresh</legend>

    <label>
        <input type="checkbox" name="wp_screen_options[value][analytics_refresh]" value="1" <?php checked($this->refresh); ?>>
        Automatically update chart data every 10 seconds.
    </label>
</fieldset>

<input type="hidden" name="wp_screen_options[option]" value="objectcache_screen_options">
