source: tmp/version-2_5-test/data/class/pages/rss/LC_Page_Rss.php @ 18609

Revision 18609, 3.6 KB checked in by kajiwara, 14 years ago (diff)

正式版にナイトリービルド版をマージしてみるテスト

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Date Revision
  • Property svn:mime-type set to text/x-httpd-php
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "pages/LC_Page.php");
26
27/**
28 * RSS のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_RSS extends LC_Page {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = "rss/index.tpl";
47        $this->encode = "UTF-8";
48        $this->description = "新着情報";
49    }
50
51    /**
52     * Page のプロセス.
53     *
54     * @return void
55     */
56    function process() {
57        $objQuery = new SC_Query();
58        $objView = new SC_SiteView(false);
59
60        //新着情報を取得
61        $arrNews = $this->lfGetNews($objQuery);
62       
63        //キャッシュしない(念のため)
64        header("pragma: no-cache");
65
66        //XMLテキスト(これがないと正常にRSSとして認識してくれないツールがあるため)
67        header("Content-type: application/xml");
68
69        //新着情報をセット
70        $this->arrNews = $arrNews;
71
72        //店名をセット
73        $this->site_title = $arrNews[0]['shop_name'];
74
75        //代表Emailアドレスをセット
76        $this->email = $arrNews[0]['email'];
77
78        //セットしたデータをテンプレートファイルに出力
79        $objView->assignobj($this);
80
81        //画面表示
82        $objView->display($this->tpl_mainpage, true);
83    }
84
85    /**
86     * デストラクタ.
87     *
88     * @return void
89     */
90    function destroy() {
91        parent::destroy();
92    }
93
94    /**
95     * 新着情報を取得する
96     *
97     * @param SC_Query $objQuery DB操作クラス
98     * @return array $arrNews 取得結果を配列で返す
99     */
100    function lfGetNews(&$objQuery){
101        $col = "";
102        $col .= "news_id ";        // 新着情報ID
103        $col .= ",news_title ";    // 新着情報タイトル
104        $col .= ",news_comment ";  // 新着情報本文
105        $col .= ",news_date ";     // 日付
106        $col .= ",news_url ";      // 新着情報URL
107        $col .= ",news_select ";   // 新着情報の区分(1:URL、2:本文)
108        $col .= ",(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name  ";    // 店名
109        $col .= ",(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";           // 代表Emailアドレス
110        $from = "dtb_news";
111        $where = "del_flg = '0'";
112        $order = "rank DESC";
113        $objQuery->setorder($order);
114        $arrNews = $objQuery->select($col,$from,$where);
115       
116        // RSS用に変換
117        foreach (array_keys($arrNews) as $key) {
118            $row =& $arrNews[$key];
119            // 日付
120            $row['news_date'] = date('r', strtotime($row['news_date']));
121        }
122       
123        return $arrNews;
124    }
125}
126?>
Note: See TracBrowser for help on using the repository browser.