<?php
require_once("../common.php");
require_once("../commongw.php");
include("../lib/feedcreator.class.php");
$pgsql = sqlcon();
require_once("./team_base.php");


$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = $r["tmname"];
$rss->description = $r["seo"];
$rss->link = "http://" . BASE_URL . "team/?t=" . $teamid;
$rss->syndicationURL = "http://" . BASE_URL . "team/feed.php?t=" . $teamid;

// 新着情報の取得
$res = pg_query_params($pgsql, "SELECT newstitle, newscontent, entrydt, COALESCE(regidt, modidt) AS last_update FROM latestnews WHERE delkn = 'f' AND teamid = $1 ORDER BY entrydt DESC, last_update DESC limit 5", array($teamid));
while ($data = pg_fetch_object($res)) {
    $item = new FeedItem();
    $item->title = $data->newstitle;
    $item->link = "http://" . BASE_URL . "team/?t=" . $teamid;
    $item->description = $data->newscontent;
    $item->date = $data->entrydt."T00:00:00";
    $item->source = "http://" . BASE_URL . "team/?t=" . $teamid;
    $item->author = $r["tmname"];

    $rss->addItem($item);
}

$rss->outputFeed("RSS1.0");
?>