Beispiel #1
0
 function date_period_label($_dt_start, $_dt_end = 0)
 {
     //$config =& SlimStatConfig::get_instance();
     $usr_dt_start = SlimStat::to_user_time($_dt_start);
     $usr_dt_end = SlimStat::to_user_time($_dt_end);
     $start_d = strftime("%e", $usr_dt_start);
     $start_m = strftime("%b", $usr_dt_start);
     $start_y = strftime("%Y", $usr_dt_start);
     if ($_dt_end == 0) {
         $_dt_end = $_dt_start;
     }
     $end_d = strftime("%e", $usr_dt_end);
     $end_m = strftime("%b", $usr_dt_end);
     $end_y = strftime("%Y", $usr_dt_end);
     if ($start_y != $end_y) {
         return $start_d . " " . $start_m . " " . $start_y . " - " . $end_d . " " . $end_m . " " . $end_y;
     } elseif ($start_m != $end_m) {
         return $start_d . " " . $start_m . " - " . $end_d . " " . $end_m . " " . $end_y;
     } elseif ($start_d != $end_d) {
         if ($start_d == 1 && $end_d == SlimStat::days_in_month($_dt_end)) {
             return strftime("%B", $_dt_end) . " " . $end_y;
         } else {
             return $start_d . " - " . $end_d . " " . $end_m . " " . $end_y;
         }
     } elseif (date("j M Y", SlimStat::to_user_time(time())) == date("j M Y", $usr_dt_end)) {
         return $this->date_periods["today"] . ", " . $end_d . " " . $end_m . " " . $end_y;
     } else {
         return strftime("%a", $_dt_end) . ", " . $end_d . " " . $end_m . " " . $end_y;
     }
 }
Beispiel #2
0
            while (date("w", $dt) != $config->week_start_day) {
                $dt += $config->day;
            }
            $dt -= $config->day;
        }
    }
    print SlimStat::render_module($config->i18n->module_titles["daily"] . " <span><a href=\"rss.php?daily\">" . $config->i18n->feed . "</a></span>", date_table($dt, ucfirst($config->i18n->date_periods["day"]), $days, '0', '$config->day', $filters));
}
if ($config->show_modules["weekly"] && (!isset($hours_spanned) || $hours_spanned >= 24)) {
    //$dt = ( !isset( $filters["filter_dt_end"] ) ) ? time() : min( time(), $filters["filter_dt_end"] );
    $dt = !isset($filters["filter_dt_end"]) ? mktime(12, 0, 0) : $filters["filter_dt_end"];
    while (date("w", $dt) != $config->week_start_day) {
        // move back to start of week
        $dt -= $config->day;
    }
    $weeks = isset($days_spanned) && $days_spanned > 7 && date("w", mktime(12, 0, 0, date("n"), SlimStat::days_in_month($dt))) < 2 ? 6 : 5;
    if (isset($days_spanned) && $days_spanned == 1) {
        $weeks = 1;
    }
    print SlimStat::render_module($config->i18n->module_titles["weekly"], date_table($dt, ucfirst($config->i18n->date_periods["week"]), $weeks, '$config->day * 6', '$config->week', $filters));
}
if ($config->show_modules["monthly"] && (!isset($days_spanned) || $days_spanned >= 7)) {
    $dt = mktime(12, 0, 0);
    while (date("j", $dt) > 1) {
        // move back to first day of month
        $dt -= $config->day;
    }
    $months = 13;
    if (isset($days_spanned) && $days_spanned == 7) {
        $months = 1;
    }