source: branches/version-2_13-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php @ 22856

Revision 22856, 3.2 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。もう少し整えたいが、一旦現状コミット。
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 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
24define('CALENDAR_ROOT', DATA_REALDIR.'module/Calendar'.DIRECTORY_SEPARATOR);
25require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';
26
27/**
28 * Calendar のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $ $
33 */
34class LC_Page_FrontParts_Bloc_Calendar extends LC_Page_FrontParts_Bloc_Ex
35{
36    /**
37     * Page を初期化する.
38     *
39     * @return void
40     */
41    function init()
42    {
43        parent::init();
44    }
45
46    /**
47     * Page のプロセス.
48     *
49     * @return void
50     */
51    function process()
52    {
53        $this->action();
54        $this->sendResponse();
55    }
56
57    /**
58     * Page のアクション.
59     *
60     * @return void
61     */
62    function action()
63    {
64        // カレンダーデータ取得
65        $this->arrCalendar = $this->lfGetCalendar(2);
66
67
68    }
69
70    /**
71     * デストラクタ.
72     *
73     * @return void
74     */
75    function destroy()
76    {
77        parent::destroy();
78    }
79
80    /**
81     * カレンダー情報取得.
82     *
83     * @param integer $disp_month 表示する月数
84     * @return array カレンダー情報の配列を返す
85     */
86    function lfGetCalendar($disp_month = 1)
87    {
88        $objDate = new SC_Date_Ex();
89        $arrCalendar = array();
90        $today = date('Y/m/d');
91
92        for ($j = 0; $j <= $disp_month - 1; $j++) {
93            $time = mktime(0, 0, 0, date('n') + $j, 1);
94            $year = date('Y', $time);
95            $month = date('n', $time);
96
97            $objMonth = new Calendar_Month_Weekdays($year, $month, 0);
98            $objMonth->build();
99            $i = 0;
100            while ($objDay = $objMonth->fetch()) {
101                $arrCalendar[$j][$i]['in_month']    = $month == $objDay->month;
102                $arrCalendar[$j][$i]['first']       = $objDay->first;
103                $arrCalendar[$j][$i]['last']        = $objDay->last;
104                $arrCalendar[$j][$i]['empty']       = $objDay->empty;
105                $arrCalendar[$j][$i]['year']        = $year;
106                $arrCalendar[$j][$i]['month']       = $month;
107                $arrCalendar[$j][$i]['day']         = $objDay->day;
108                $arrCalendar[$j][$i]['holiday']     = $objDate->isHoliday($year, $month, $objDay->day);
109                $arrCalendar[$j][$i]['today']       = $today === sprintf('%04d/%02d/%02d', $year, $month, $objDay->day);
110
111                $i++;
112            }
113        }
114
115        return $arrCalendar;
116    }
117}
Note: See TracBrowser for help on using the repository browser.