コード例 #1
0
ファイル: year.php プロジェクト: rair/yacs
    if (!($text = Cache::get($cache_id))) {
        // robots cannot navigate
        if (!Surfer::is_crawler()) {
            // previous year
            $previous = $year - 1;
            // next year
            $next = $year + 1;
            // neighbours
            $neighbours = array(Dates::get_url($previous, 'year'), $previous, Dates::get_url($next, 'year'), $next, NULL, NULL);
            // links to display previous and next years
            $text .= Skin::neighbours($neighbours, 'slideshow');
        }
        // one calendar per month
        for ($index = 1; $index <= 12; $index++) {
            // items for this month
            $items =& Dates::list_for_month($year, $index, 'links');
            // draw all months - force empty months
            $text .= Dates::build_months($items, TRUE, TRUE, TRUE, FALSE, $year, $index);
        }
        // cache, whatever change, for 5 minutes
        Cache::put($cache_id, $text, 'stable', 300);
    }
    $context['text'] .= $text;
}
// page extra content
$cache_id = 'dates/year.php#extra';
if (!($text = Cache::get($cache_id))) {
    // side bar with the list of most recent pages
    if ($items =& Articles::list_by('publication', 0, COMPACT_LIST_SIZE, 'compact')) {
        $text =& Skin::build_box(i18n::s('Recent pages'), Skin::build_list($items, 'compact'), 'boxes');
    }
コード例 #2
0
ファイル: month.php プロジェクト: rair/yacs
        // page main content
        $cache_id = 'dates/month.php#text#' . $target;
        if (!($text = Cache::get($cache_id))) {
            // robots cannot navigate
            if (!Surfer::is_crawler()) {
                // previous month
                $previous = gmstrftime('%Y/%m', gmmktime(0, 0, 0, $month - 1, 1, $year));
                // next month
                $next = gmstrftime('%Y/%m', gmmktime(0, 0, 0, $month + 1, 1, $year));
                // neighbours
                $neighbours = array(Dates::get_url($previous, 'month'), Dates::get_month_label($previous), Dates::get_url($next, 'month'), Dates::get_month_label($next), Dates::get_url($year, 'year'), $year);
                // links to display previous and next months
                $text .= Skin::neighbours($neighbours, 'slideshow');
            }
            // get items for this month
            $items =& Dates::list_for_month($year, $month, 'links');
            // draw one month - force an empty month
            $text .= Dates::build_months($items, FALSE, FALSE, TRUE, FALSE, $year, $month);
            // cache, whatever change, for 5 minutes
            Cache::put($cache_id, $text, 'stable', 300);
        }
        $context['text'] .= $text;
    }
}
// page extra content
$cache_id = 'dates/month.php#extra';
if (!($text = Cache::get($cache_id))) {
    // side bar with the list of most recent pages
    if ($items =& Articles::list_by('publication', 0, COMPACT_LIST_SIZE, 'compact')) {
        $text =& Skin::build_box(i18n::s('Recent pages'), Skin::build_list($items, 'compact'), 'boxes');
    }