コード例 #1
0
ファイル: index.php プロジェクト: rair/yacs
 * - index.php
 *
 * @author Bernard Paques
 * @author GnapZ
 * @reference
 * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
 */
// common definitions and initial processing
include_once '../shared/global.php';
include_once 'dates.php';
// load the skin
load_skin('dates');
// the title of the page
$context['page_title'] = i18n::s('Dates');
// count dates in the database
$stats = Dates::stat();
if ($stats['count']) {
    $context['page_menu'] += array('_count' => sprintf(i18n::ns('%d date', '%d dates', $stats['count']), $stats['count']));
}
// page main content
$cache_id = 'dates/index.php#text';
if (!($text = Cache::get($cache_id))) {
    // get and draw upcoming events with links to global calendars
    if ($items =& Dates::list_future(0, 200, 'links')) {
        $text = Dates::build_months($items, TRUE);
    } else {
        $text = i18n::s('No event has been planned so far');
    }
    // cache, whatever changes, for 1 minute
    Cache::put($cache_id, $text, 'stable', 60);
}