source: branches/feature-module-update/data/class/SC_Date.php @ 16741

Revision 16741, 3.2 KB checked in by adachi, 15 years ago (diff)

set eol-style:LF

  • 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-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/* 日時表示用クラス */
25class SC_Date {
26    var $start_year;
27    var $month;
28    var $day;
29    var $end_year;
30   
31    // コンストラクタ
32    function SC_Date($start_year='', $end_year='') {
33        if ( $start_year )  $this->setStartYear($start_year);   
34        if ( $end_year )    $this->setEndYear($end_year);
35    }
36   
37    function setStartYear($year){
38        $this->start_year = $year;
39    }
40   
41    function getStartYear(){
42        return $this->start_year;
43    }
44   
45    function setEndYear($endYear) {
46        $this->end_year = $endYear;
47    }
48   
49    function getEndYear() {
50        return $this->end_year;
51    }
52   
53    function setMonth($month){
54        $this->month = $month;         
55    }
56   
57    function setDay ($day){
58        $this->day = $day;
59    }
60           
61    function getYear($year = '', $default = ''){
62        if ( $year ) $this->setStartYear($year);
63       
64        $year = $this->start_year;
65        if ( ! $year ) $year = DATE("Y");
66       
67        $end_year = $this->end_year;
68        if ( ! $end_year ) $end_year = (DATE("Y") + 3);
69       
70        $year_array = array();
71       
72        for ($i=$year; $i<=($end_year); $i++){     
73            $year_array[$year] = $i;
74            if($year == $default) {
75                $year_array['----'] = "----";
76            }
77            $year++;
78        }
79        return $year_array;
80    }
81   
82    function getZeroYear($year = ''){
83        if ( $year ) $this->setStartYear($year);
84       
85        $year = $this->start_year;
86        if ( ! $year ) $year = DATE("Y");
87       
88        $end_year = $this->end_year;
89        if ( ! $end_year ) $end_year = (DATE("Y") + 3);
90       
91        $year_array = array();
92       
93        for ($i=$year; $i<=($end_year); $i++){
94            $key = substr($i, -2);
95            $year_array[$key] = $key;
96        }
97        return $year_array;
98    }
99   
100    function getZeroMonth(){
101   
102        $month_array = array();
103        for ($i=1; $i <= 12; $i++){
104            $val = sprintf("%02d", $i);
105            $month_array[$val] = $val;
106        }
107        return $month_array;
108    }   
109   
110   
111    function getMonth(){
112   
113        $month_array = array();
114        for ($i=0; $i < 12; $i++){     
115            $month_array[$i + 1 ] = $i + 1;
116        }
117        return $month_array;
118    }   
119   
120    function getDay(){ 
121       
122        $day_array = array();
123        for ($i=0; $i < 31; $i++){     
124            $day_array[ $i + 1 ] = $i + 1;
125        }
126       
127        return $day_array;
128    }
129
130    function getHour(){
131       
132        $day_array = array();
133        for ($i=0; $i<=23; $i++){       
134            $hour_array[$i] = $i;
135        }
136       
137        return $hour_array;
138    }
139
140    function getMinutes(){ 
141       
142        $minutes_array = array();
143        for ($i=0; $i<=59; $i++){       
144            $minutes_array[$i] = $i;
145        }
146       
147        return $minutes_array;
148    }
149   
150    function getMinutesInterval(){ 
151       
152        $minutes_array = array("00"=>"00", "30"=>"30");     
153        return $minutes_array;
154    }   
155}
156?>
Note: See TracBrowser for help on using the repository browser.