コード例 #1
0
ファイル: archive.php プロジェクト: severnaya99/Sg-2010
    $xoopsTpl->assign('currentyear', $fromyear);
    $xoopsTpl->assign('lang_actions', _AMS_NW_ACTIONS);
    $xoopsTpl->assign('lang_date', _AMS_NW_DATE);
    $xoopsTpl->assign('lang_views', _AMS_NW_VIEWS);
    // must adjust the selected time to server timestamp
    $timeoffset = $useroffset - $xoopsConfig['server_TZ'];
    $monthstart = mktime(0 - $timeoffset, 0, 0, $frommonth, 1, $fromyear);
    $monthend = mktime(23 - $timeoffset, 59, 59, $frommonth + 1, 0, $fromyear);
    $monthend = $monthend > time() ? time() : $monthend;
    $sql = "SELECT * FROM " . $xoopsDB->prefix("ams_article") . " WHERE published >= {$monthstart} and published <= {$monthend} ORDER by published DESC";
    $result = $xoopsDB->query($sql);
    $count = 0;
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $article = new AmsStory($myrow);
        $story = array();
        $story['title'] = "<a href='index.php?storytopic=" . $article->topicid() . "'>" . $article->topic_title() . "</a>: <a href='article.php?storyid=" . $article->storyid() . "'>" . $article->title() . "</a>";
        $story['counter'] = $article->counter();
        $story['date'] = formatTimestamp($article->published(), "m", $useroffset);
        $story['print_link'] = 'print.php?storyid=' . $article->storyid();
        $story['mail_link'] = 'mailto:?subject=' . sprintf(_AMS_NW_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_AMS_NW_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?storyid=' . $article->storyid();
        $xoopsTpl->append('stories', $story);
        $count++;
    }
    $xoopsTpl->assign('lang_printer', _AMS_NW_PRINTERFRIENDLY);
    $xoopsTpl->assign('lang_sendstory', _AMS_NW_SENDSTORY);
    $xoopsTpl->assign('lang_storytotal', sprintf(_AMS_NW_THEREAREINTOTAL, $count));
} else {
    $xoopsTpl->assign('show_articles', false);
}
$xoopsTpl->assign('lang_newsarchives', _AMS_NW_NEWSARCHIVES);
include XOOPS_ROOT_PATH . "/footer.php";