コード例 #1
0
ファイル: index.php プロジェクト: vojtajina/sitellite
    $before = date('Y-m-d', mktime(0, 0, 0, $cgi->month + 1, 1, $cgi->year));
} else {
    $year = date('Y');
    $month = date('m');
    $after = date('Y-m-d', mktime(0, 0, 0, $month, 0, $year));
    $before = date('Y-m-d', mktime(0, 0, 0, $month + 1, 1, $year));
}
$constraints[] = 'created > "' . $after . '" and created < "' . $before . '"';
if (!empty($constraints)) {
    $query .= ' where ';
    $total = count($constraints);
    $sofar = 0;
    foreach ($constraints as $constraint) {
        $sofar++;
        $query .= $constraint;
        if ($sofar < $total) {
            $query .= ' and ';
        }
    }
}
$query .= ' order by created desc';
$res = db_fetch_array($query);
//generate the calendar
loader_import('siteblog.Filters');
loader_import('saf.Date.Calendar.Mini');
$cal = new MiniCal($parameters['minical']);
foreach ($res as $post) {
    list($year, $month, $day) = explode('-', $post->created);
    $cal->addLink($day, '/index/siteblog-post-action/id.' . $post->id . '/title.' . siteblog_filter_link_title($post->subject));
}
echo $cal->render();
コード例 #2
0
ファイル: index.php プロジェクト: vojtajina/sitellite
    $parameters['category'] = '';
}
if (!isset($parameters['audience']) || empty($parameters['audience'])) {
    $parameters['audience'] = '';
}
if (!isset($parameters['user']) || empty($parameters['user'])) {
    $parameters['user'] = '';
}
// if date is past one year from present, tell robots to skip
$cy = date('Y');
$cm = date('m');
list($y, $m) = split('-', $parameters['minical']);
if ($y > $cy + 1 || $y < $cy - 1 || $y == $cy + 1 && $m >= $cm || $y == $cy - 1 && $m <= $cm) {
    page_add_meta('robots', 'noindex,nofollow');
}
$cal = new MiniCal($parameters['minical']);
$e = new SiteEvent_Event();
$list = $e->getMonthly($parameters['minical'], $parameters['category'], $parameters['audience'], $parameters['user'], 'date, until_date, recurring');
foreach (array_keys($list) as $k) {
    $item =& $list[$k];
    list($y, $m, $d) = split('-', $item->date);
    list($yy, $mm, $dd) = split('-', $item->until_date);
    switch ($item->recurring) {
        case 'yearly':
            if ($m == $cal->month) {
                $cal->addLink($d, site_prefix() . '/index/siteevent-app/view.day/day.' . $parameters['minical'] . '-' . $d);
            }
            break;
        case 'monthly':
            $cal->addLink($d, site_prefix() . '/index/siteevent-app/view.day/day.' . $parameters['minical'] . '-' . $d);
            break;