Changeset 22796 for branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php
- Timestamp:
- 2013/05/02 18:11:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Calendar.php
r22576 r22796 33 33 * @version $ $ 34 34 */ 35 class LC_Page_FrontParts_Bloc_Calendar extends LC_Page_FrontParts_Bloc_Ex 36 { 35 class LC_Page_FrontParts_Bloc_Calendar extends LC_Page_FrontParts_Bloc_Ex { 37 36 38 37 // }}} … … 44 43 * @return void 45 44 */ 46 function init() 47 { 45 function init() { 48 46 parent::init(); 49 47 } … … 54 52 * @return void 55 53 */ 56 function process() 57 { 54 function process() { 58 55 $this->action(); 59 56 $this->sendResponse(); … … 65 62 * @return void 66 63 */ 67 function action() 68 { 64 function action() { 69 65 66 // 休日取得取得 67 $this->arrHoliday = $this->lfGetHoliday(); 68 // 定休日取得取得 69 $this->arrRegularHoliday = $this->lfGetRegularHoliday(); 70 70 // カレンダーデータ取得 71 71 $this->arrCalendar = $this->lfGetCalendar(2); … … 79 79 * @return void 80 80 */ 81 function destroy() 82 { 81 function destroy() { 83 82 parent::destroy(); 84 83 } … … 90 89 * @return array カレンダー情報の配列を返す 91 90 */ 92 function lfGetCalendar($disp_month = 1) 93 { 94 $objDate = new SC_Date_Ex(); 91 function lfGetCalendar($disp_month = 1) { 95 92 $arrCalendar = array(); 96 93 $today = date('Y/m/d'); … … 112 109 $arrCalendar[$j][$i]['month'] = $month; 113 110 $arrCalendar[$j][$i]['day'] = $objDay->day; 114 $arrCalendar[$j][$i]['holiday'] = $ objDate->isHoliday($year, $month, $objDay->day);111 $arrCalendar[$j][$i]['holiday'] = $this->lfCheckHoliday($year, $month, $objDay->day); 115 112 $arrCalendar[$j][$i]['today'] = $today === sprintf('%04d/%02d/%02d', $year, $month, $objDay->day); 116 113 … … 121 118 return $arrCalendar; 122 119 } 120 121 /** 122 * 休日取得. 123 * 124 * @return array $arrHoliday 休日情報の配列を返す 125 */ 126 function lfGetHoliday() { 127 $objQuery = SC_Query_Ex::getSingletonInstance(); 128 $objQuery->setOrder('rank DESC'); 129 130 $where = 'del_flg <> 1'; 131 $arrRet = $objQuery->select('month, day', 'dtb_holiday', $where); 132 foreach ($arrRet AS $key=>$val) { 133 $arrHoliday[$val['month']][] = $val['day']; 134 } 135 return $arrHoliday; 136 } 137 138 /** 139 * 定休日取得. 140 * 141 * @return array $arrRegularHoliday 定休日情報の配列を返す 142 */ 143 function lfGetRegularHoliday() { 144 $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); 145 $arrRegularHoliday = explode('|', $arrInfo['regular_holiday_ids']); 146 return $arrRegularHoliday; 147 } 148 149 /** 150 * 休日チェック取得. 151 * 152 * @param integer $year 年 153 * @param integer $month 月 154 * @param integer $day 日 155 * @return boolean 休日の場合trueを返す 156 */ 157 function lfCheckHoliday($year, $month, $day) { 158 if (!empty($this->arrHoliday[$month])) { 159 if (in_array($day, $this->arrHoliday[$month])) { 160 return true; 161 } 162 } 163 if (!empty($this->arrRegularHoliday)) { 164 $day = date('w', mktime(0,0,0 ,$month, $day, $year)); 165 if (in_array($day, $this->arrRegularHoliday)) { 166 return true; 167 } 168 } 169 return false; 170 } 171 123 172 }
Note: See TracChangeset
for help on using the changeset viewer.