Ignore:
Timestamp:
2013/05/02 18:11:36 (11 years ago)
Author:
h_yoshimoto
Message:

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

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  
    3333 * @version $ $ 
    3434 */ 
    35 class LC_Page_FrontParts_Bloc_Calendar extends LC_Page_FrontParts_Bloc_Ex  
    36 { 
     35class LC_Page_FrontParts_Bloc_Calendar extends LC_Page_FrontParts_Bloc_Ex { 
    3736 
    3837    // }}} 
     
    4443     * @return void 
    4544     */ 
    46     function init() 
    47     { 
     45    function init() { 
    4846        parent::init(); 
    4947    } 
     
    5452     * @return void 
    5553     */ 
    56     function process() 
    57     { 
     54    function process() { 
    5855        $this->action(); 
    5956        $this->sendResponse(); 
     
    6562     * @return void 
    6663     */ 
    67     function action() 
    68     { 
     64    function action() { 
    6965 
     66        // 休日取得取得 
     67        $this->arrHoliday = $this->lfGetHoliday(); 
     68        // 定休日取得取得 
     69        $this->arrRegularHoliday = $this->lfGetRegularHoliday(); 
    7070        // カレンダーデータ取得 
    7171        $this->arrCalendar = $this->lfGetCalendar(2); 
     
    7979     * @return void 
    8080     */ 
    81     function destroy() 
    82     { 
     81    function destroy() { 
    8382        parent::destroy(); 
    8483    } 
     
    9089     * @return array カレンダー情報の配列を返す 
    9190     */ 
    92     function lfGetCalendar($disp_month = 1) 
    93     { 
    94         $objDate = new SC_Date_Ex(); 
     91    function lfGetCalendar($disp_month = 1) { 
    9592        $arrCalendar = array(); 
    9693        $today = date('Y/m/d'); 
     
    112109                $arrCalendar[$j][$i]['month']       = $month; 
    113110                $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); 
    115112                $arrCalendar[$j][$i]['today']       = $today === sprintf('%04d/%02d/%02d', $year, $month, $objDay->day); 
    116113 
     
    121118        return $arrCalendar; 
    122119    } 
     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 
    123172} 
Note: See TracChangeset for help on using the changeset viewer.