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

Revision 22857, 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     * @return void
72     */
73    function destroy()
74    {
75        parent::destroy();
76    }
77
78    /**
79     * カレンダー情報取得.
80     *
81     * @param integer $disp_month 表示する月数
82     * @return array カレンダー情報の配列を返す
83     */
84    function lfGetCalendar($disp_month = 1)
85    {
86        $objDate = new SC_Date_Ex();
87        $arrCalendar = array();
88        $today = date('Y/m/d');
89
90        for ($j = 0; $j <= $disp_month - 1; $j++) {
91            $time = mktime(0, 0, 0, date('n') + $j, 1);
92            $year = date('Y', $time);
93            $month = date('n', $time);
94
95            $objMonth = new Calendar_Month_Weekdays($year, $month, 0);
96            $objMonth->build();
97            $i = 0;
98            while ($objDay = $objMonth->fetch()) {
99                $arrCalendar[$j][$i]['in_month']    = $month == $objDay->month;
100                $arrCalendar[$j][$i]['first']       = $objDay->first;
101                $arrCalendar[$j][$i]['last']        = $objDay->last;
102                $arrCalendar[$j][$i]['empty']       = $objDay->empty;
103                $arrCalendar[$j][$i]['year']        = $year;
104                $arrCalendar[$j][$i]['month']       = $month;
105                $arrCalendar[$j][$i]['day']         = $objDay->day;
106                $arrCalendar[$j][$i]['holiday']     = $objDate->isHoliday($year, $month, $objDay->day);
107                $arrCalendar[$j][$i]['today']       = $today === sprintf('%04d/%02d/%02d', $year, $month, $objDay->day);
108
109                $i++;
110            }
111        }
112
113        return $arrCalendar;
114    }
115}
Note: See TracBrowser for help on using the repository browser.