_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } /*---------------------------------------------------------- カレンダー表示 ----------------------------------------------------------*/ function executeCalendar () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } /*---------------------------------------------------------- 円/ドル選択表示 ----------------------------------------------------------*/ function executeCurrency () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } return $this->render('s/application/beach_currency'); } /*---------------------------------------------------------- 入力表示 ----------------------------------------------------------*/ function executeInput () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } return $this->render('s/application/beach_input'); } /*---------------------------------------------------------- オプション表示 ----------------------------------------------------------*/ function executeOption () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; $options = $this->_getOptions(); $options_list = array(); $options_value = array(); $options_output = array(); $options_name = array(); $options_price = array(); foreach ($options as $key => $val) { if ($this->pay_currency == 2) { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_value[$val['category']][$val['image']][] = $val['seq']; $options_output[$val['category']][$val['image']][] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_name[$val['category']][$val['seq']] = $val['name']; $options_price[$val['category']][$val['seq']] = preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; } else { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_value[$val['category']][$val['image']][] = $val['seq']; $options_output[$val['category']][$val['image']][] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_name[$val['category']][$val['seq']] = $val['name']; $options_price[$val['category']][$val['seq']] = number_format($val['price']) . '円'; } foreach ($val as $key2 => $val2) { $this->options[$key][$key2] = $val2; } } $this->options_list = $options_list; $this->options_value = $options_value; $this->options_output = $options_output; $this->options_name = $options_name; $this->options_price = $options_price; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { if ($this->pay_currency == 2) { $spas_list[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; } else { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; } } $spas_list[0] = 'スパ・エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_input'); } return $this->render('s/application/beach_option'); } /*---------------------------------------------------------- ブーケ表示 ----------------------------------------------------------*/ function executeBouquet1 () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; if ($this->pay_currency == 2) { $price = $plans['price2']; } else { $price = $plans['price']; } $price += $this->cameraman_list[$this->shimei]['price']; $price += $this->hairmake_shimei_list[$this->hairmake_shimei]['price']; $options = $this->_getOptions(); $options_list = array(); $options_list2 = array(); foreach ($options as $val) { if ($this->pay_currency == 2) { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_list2[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if (in_array($val['seq'], $this->option)) { $price += $val['price2']; } } else { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_list2[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if (in_array($val['seq'], $this->option)) { $price += $val['price']; } } } $this->options = $options; $this->options_list = $options_list; $this->options_list2 = $options_list2; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { if ($this->pay_currency == 2) { $spas_list[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if ($val['seq'] == $this->spa) { $price += $val['price2']; } } else { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; } } } if ($this->plu_option == 1) { if ($this->pay_currency == 2) { //$price += 350; $en = 1; } else { //$price += 39000; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=0&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url); $price += $pre_fitting_price; //$this->plu_option_str = '日本国内事前試着'; $this->plu_option_str = '衣装グレードアップ'; if ($this->pay_currency == 2) { //$this->plu_option_str .= ' 350ドル'; $en = 1; } else { //$this->plu_option_str .= ' 39,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url) . ($en == 1 ? 'ドル' : '円'); $this->plu_option_str .= " {$pre_fitting_price}"; $this->plu_option_str .= '
来店希望サロン:' . $GLOBALS['DRESS_SALON'][$this->plu_salon]; if ($this->plu_undecide == 1) { $this->plu_option_str .= '
来店希望日時:未定'; } else { $this->plu_option_str .= '
来店希望日時:' . date('Y年n月j日 H時〜', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time)); } } $spas_list[0] = 'スパ・エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; $this->price = $price; $bouquet = $this->_getBouquet(); foreach ($bouquet as $val) { $bouquet_list[$val['seq']] = $val['name']; } $this->bouquet_list = $bouquet_list; $this->bouquet = $bouquet; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } $_error = $this->_checkOption(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_option'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_input'); } if (in_array(8, $this->option)) { return $this->render('s/application/beach_bouquet1'); } else { return $this->render('s/application/beach_payment'); } } /*---------------------------------------------------------- ブーケ表示 ----------------------------------------------------------*/ function executeBouquet2nd () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; if ($this->pay_currency == 2) { $price = $plans['price2']; } else { $price = $plans['price']; } $price += $this->cameraman_list[$this->shimei]['price']; $price += $this->hairmake_shimei_list[$this->hairmake_shimei]['price']; $options = $this->_getOptions(); $options_list = array(); $options_list2 = array(); foreach ($options as $val) { if ($this->pay_currency == 2) { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_list2[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if (in_array($val['seq'], $this->option)) { $price += $val['price2']; } } else { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_list2[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if (in_array($val['seq'], $this->option)) { $price += $val['price']; } } } $this->options = $options; $this->options_list = $options_list; $this->options_list2 = $options_list2; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { if ($this->pay_currency == 2) { $spas_list[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if ($val['seq'] == $this->spa) { $price += $val['price2']; } } else { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; } } } if ($this->plu_option == 1) { if ($this->pay_currency == 2) { //$price += 350; $en = 1; } else { //$price += 39000; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=0&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url); $price += $pre_fitting_price; //$this->plu_option_str = '日本国内事前試着'; $this->plu_option_str = '衣装グレードアップ'; if ($this->pay_currency == 2) { //$this->plu_option_str .= ' 350ドル'; $en = 1; } else { //$this->plu_option_str .= ' 39,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url) . ($en == 1 ? 'ドル' : '円'); $this->plu_option_str .= " {$pre_fitting_price}"; $this->plu_option_str .= '
来店希望サロン:' . $GLOBALS['DRESS_SALON'][$this->plu_salon]; if ($this->plu_undecide == 1) { $this->plu_option_str .= '
来店希望日時:未定'; } else { $this->plu_option_str .= '
来店希望日時:' . date('Y年n月j日 H時〜', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time)); } } $spas_list[0] = 'スパ・エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; $this->price = $price; $bouquet = $this->_getBouquet(); foreach ($bouquet as $val) { $bouquet_list[$val['seq']] = $val['name']; } $this->bouquet_list = $bouquet_list; $this->bouquet = $bouquet; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_input'); } if (in_array(8, $this->option)) { return $this->render('s/application/beach_bouquet2'); } else { return $this->render('s/application/beach_payment'); } } /*---------------------------------------------------------- ブーケ表示 ----------------------------------------------------------*/ function executeBouquet3rd () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; if ($this->pay_currency == 2) { $price = $plans['price2']; } else { $price = $plans['price']; } $price += $this->cameraman_list[$this->shimei]['price']; $price += $this->hairmake_shimei_list[$this->hairmake_shimei]['price']; $options = $this->_getOptions(); $options_list = array(); $options_list2 = array(); foreach ($options as $val) { if ($this->pay_currency == 2) { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_list2[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if (in_array($val['seq'], $this->option)) { $price += $val['price2']; } } else { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_list2[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if (in_array($val['seq'], $this->option)) { $price += $val['price']; } } } $this->options = $options; $this->options_list = $options_list; $this->options_list2 = $options_list2; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { if ($this->pay_currency == 2) { $spas_list[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if ($val['seq'] == $this->spa) { $price += $val['price2']; } } else { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; } } } if ($this->plu_option == 1) { if ($this->pay_currency == 2) { //$price += 350; $en = 1; } else { //$price += 39000; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=0&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url); $price += $pre_fitting_price; //$this->plu_option_str = '日本国内事前試着'; $this->plu_option_str = '衣装グレードアップ'; if ($this->pay_currency == 2) { //$this->plu_option_str .= ' 350ドル'; $en = 1; } else { //$this->plu_option_str .= ' 39,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url) . ($en == 1 ? 'ドル' : '円'); $this->plu_option_str .= " {$pre_fitting_price}"; $this->plu_option_str .= '
来店希望サロン:' . $GLOBALS['DRESS_SALON'][$this->plu_salon]; if ($this->plu_undecide == 1) { $this->plu_option_str .= '
来店希望日時:未定'; } else { $this->plu_option_str .= '
来店希望日時:' . date('Y年n月j日 H時〜', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time)); } } $spas_list[0] = 'スパ・エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; $this->price = $price; $bouquet = $this->_getBouquet(); foreach ($bouquet as $val) { $bouquet_list[$val['seq']] = $val['name']; } $this->bouquet_list = $bouquet_list; $this->bouquet = $bouquet; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_input'); } if (in_array(8, $this->option)) { return $this->render('s/application/beach_bouquet3'); } else { return $this->render('s/application/beach_payment'); } } /*---------------------------------------------------------- お支払選択表示 ----------------------------------------------------------*/ function executePayment () { $price = 0; $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; if ($this->pay_currency == 2) { $price = $plans['price2']; } else { $price = $plans['price']; } $price += $this->cameraman_list[$this->shimei]['price']; $price += $this->hairmake_shimei_list[$this->hairmake_shimei]['price']; $options = $this->_getOptions(); $options_list = array(); $options_list2 = array(); foreach ($options as $val) { if ($this->pay_currency == 2) { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_list2[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if (in_array($val['seq'], $this->option)) { $price += $val['price2']; } } else { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_list2[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if (in_array($val['seq'], $this->option)) { $price += $val['price']; } } } $this->options = $options; $this->options_list = $options_list; $this->options_list2 = $options_list2; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { if ($this->pay_currency == 2) { $spas_list[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if ($val['seq'] == $this->spa) { $price += $val['price2']; } } else { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; } } } if ($this->plu_option == 1) { if ($this->pay_currency == 2) { //$price += 350; $en = 1; } else { //$price += 39000; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=0&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url); $price += $pre_fitting_price; //$this->plu_option_str = '日本国内事前試着'; $this->plu_option_str = '衣装グレードアップ'; if ($this->pay_currency == 2) { //$this->plu_option_str .= ' 350ドル'; $en = 1; } else { //$this->plu_option_str .= ' 39,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url) . ($en == 1 ? 'ドル' : '円'); $this->plu_option_str .= " {$pre_fitting_price}"; $this->plu_option_str .= '
来店希望サロン:' . $GLOBALS['DRESS_SALON'][$this->plu_salon]; if ($this->plu_undecide == 1) { $this->plu_option_str .= '
来店希望日時:未定'; } else { $this->plu_option_str .= '
来店希望日時:' . date('Y年n月j日 H時〜', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time)); } } $spas_list[0] = 'スパ・エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; $this->price = $price; $bouquet = $this->_getBouquet(); foreach ($bouquet as $val) { $bouquet_list[$val['seq']] = $val['name']; } $this->bouquet_list = $bouquet_list; $this->bouquet = $bouquet; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_input'); } return $this->render('s/application/beach_payment'); } /*---------------------------------------------------------- 確認表示 ----------------------------------------------------------*/ function executeConfirm () { $price = 0; $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; if ($this->pay_currency == 2) { $price = $plans['price2']; } else { $price = $plans['price']; } $price += $this->cameraman_list[$this->shimei]['price']; $price += $this->hairmake_shimei_list[$this->hairmake_shimei]['price']; $options = $this->_getOptions(); $options_list = array(); $options_list2 = array(); foreach ($options as $val) { if ($this->pay_currency == 2) { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_list2[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if (in_array($val['seq'], $this->option)) { $price += $val['price2']; } } else { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_list2[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if (in_array($val['seq'], $this->option)) { $price += $val['price']; } } } $this->options = $options; $this->options_list = $options_list; $this->options_list2 = $options_list2; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { if ($this->pay_currency == 2) { $spas_list[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if ($val['seq'] == $this->spa) { $price += $val['price2']; } } else { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; } } } if ($this->plu_option == 1) { if ($this->pay_currency == 2) { //$price += 350; $en = 1; } else { //$price += 39000; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=0&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url); $price += $pre_fitting_price; //$this->plu_option_str = '日本国内事前試着'; $this->plu_option_str = '衣装グレードアップ'; if ($this->pay_currency == 2) { //$this->plu_option_str .= ' 350ドル'; $en = 1; } else { //$this->plu_option_str .= ' 39,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url) . ($en == 1 ? 'ドル' : '円'); $this->plu_option_str .= " {$pre_fitting_price}"; $this->plu_option_str .= '
来店希望サロン:' . $GLOBALS['DRESS_SALON'][$this->plu_salon]; if ($this->plu_undecide == 1) { $this->plu_option_str .= '
来店希望日時:未定'; } else { $this->plu_option_str .= '
来店希望日時:' . date('Y年n月j日 H時〜', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time)); } } $spas_list[0] = 'スパ・エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; $this->price = $price; $bouquet = $this->_getBouquet(); foreach ($bouquet as $val) { $bouquet_list[$val['seq']]['name'] = $val['name']; $bouquet_list[$val['seq']]['photo'] = $val['photo']; } $this->bouquet_list = $bouquet_list; $this->bouquet = $bouquet; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_input'); } $_error = $this->_checkPayment(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_payment'); } return $this->render('s/application/beach_confirm'); } /*---------------------------------------------------------- 登録処理 ----------------------------------------------------------*/ function executeRegist () { $price = 0; $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('s/application/error'); } $this->plans = $plans; if ($this->pay_currency == 2) { $price = $plans['price2']; } else { $price = $plans['price']; } $price += $this->cameraman_list[$this->shimei]['price']; $price += $this->hairmake_shimei_list[$this->hairmake_shimei]['price']; $schedule = $plans['schedule']; $options = $this->_getOptions(); $options_list = array(); $options_list2 = array(); $option_schedule = array(); foreach ($options as $val) { if ($this->pay_currency == 2) { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; $options_list2[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if (in_array($val['seq'], $this->option)) { $price += $val['price2']; if (!empty($val['schedule'])) { $option_schedule[] = $val['schedule']; } } } else { $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; $options_list2[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if (in_array($val['seq'], $this->option)) { $price += $val['price']; if (!empty($val['schedule'])) { $option_schedule[] = $val['schedule']; } } } } $this->options = $options; $this->options_list = $options_list; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { if ($this->pay_currency == 2) { $spas_list[$val['seq']] = $val['name'] . ' ' . preg_replace('/^(.*)\.0+$/', '${1}', number_format($val['price2'], 2)) . 'ドル'; if ($val['seq'] == $this->spa) { $price += $val['price2']; } } else { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; } } } if ($this->plu_option == 1) { if ($this->pay_currency == 2) { //$price += 350; $en = 1; } else { //$price += 39000; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=0&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url); $price += $pre_fitting_price; //$this->plu_option_str = '日本国内事前試着'; $this->plu_option_str = '衣装グレードアップ'; if ($this->pay_currency == 2) { //$this->plu_option_str .= ' 350ドル'; $en = 1; } else { //$this->plu_option_str .= ' 39,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date); $pre_fitting_price = file_get_contents($_option_price_url) . ($en == 1 ? 'ドル' : '円'); $this->plu_option_str .= " {$pre_fitting_price}"; $this->plu_option_str .= '
来店希望サロン:' . $GLOBALS['DRESS_SALON'][$this->plu_salon]; if ($this->plu_undecide == 1) { $this->plu_option_str .= '
来店希望日時:未定'; } else { $this->plu_option_str .= '
来店希望日時:' . date('Y年n月j日 H時〜', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time)); } } $spas_list[0] = 'スパ・エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; $this->price = $price; $bouquet = $this->_getBouquet(); foreach ($bouquet as $val) { $bouquet_list[$val['seq']] = $val['name']; } $this->bouquet_list = $bouquet_list; $this->bouquet = $bouquet; $_error = $this->_checkCalendar($this->hope_date, $this->hope_time); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(); $calendar_list = $this->_getCalendarList(); $aki_calendar = get_calendar($this->plan, $this->p, 0); $this->calendar = $calendar; $this->calendar_list = $calendar_list; $this->aki_calendar = $aki_calendar; return $this->render('s/application/beach_calendar'); } if (empty($this->pay_currency)) { $this->errors['pay_currency'] = 'お支払いを希望する通貨を選択してください。'; return $this->render('s/application/beach_currency'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_input'); } $_error = $this->_checkPayment(); if ($_error) { $this->errors = $_error; return $this->render('s/application/beach_payment'); } $name1 = $this->sei1 . ' ' . $this->mei1; $name2 = $this->sei2 . ' ' . $this->mei2; $roman1 = $this->roman_sei1 . ' ' . $this->roman_mei1; $roman2 = $this->roman_sei2 . ' ' . $this->roman_mei2; $kana1 = $this->kana_sei1 . ' ' . $this->kana_mei1; $kana2 = $this->kana_sei2 . ' ' . $this->kana_mei2; $tel = $this->tel1 . '-' . $this->tel2 . '-' . $this->tel3; $zip = $this->zip1 . '-' . $this->zip2; $pref = $GLOBALS['PREF'][$this->pref]; $hawaii_tel = $this->hawaii_tel1 . '-' . $this->hawaii_tel2 . '-' . $this->hawaii_tel3; $arrival = $this->arrival['month'] . '月' . $this->arrival['date'] . '日' . $this->arrival['hour'] . '時'; $returns = $this->returns['month'] . '月' . $this->returns['date'] . '日' . $this->returns['hour'] . '時'; if ($this->size1 === 'o') { $size1 = $this->size1_other; } else { $size1 = $GLOBALS['MAN_SIZE'][$this->size1]; } if ($this->size2 === 'o') { $size2 = $this->size2_other; } else { $size2 = $GLOBALS['WOMAN_SIZE'][$this->size2_num]; } $hope_date = date('Y-m-d H:i:s', strtotime($this->hope_date . ' ' . $this->hope_time)); $option_str = ''; $option_note = '==== 追加OP ====' . "\n"; foreach ($this->option as $val) { if (in_array($val, array(179,180,191))) { $option_str .= (($this->kakou == 1) ? '[ナチュラル]' : '[しっかり]') . $options_list2[$val] . ' '; $option_note .= (($this->kakou == 1) ? '[ナチュラル]' : '[しっかり]') . $options_list2[$val] . "\n"; } else { $option_str .= $options_list2[$val] . ' '; $option_note .= $options_list2[$val] . "\n"; } } $option_schedule_str = implode(',', $option_schedule); if (!empty($option_schedule_str)) { $option_schedule_str = $option_schedule_str . ','; } $schedule = str_replace('O,', $option_schedule_str, $schedule); if (in_array(22, $this->option) || in_array(23, $this->option) || in_array(46, $this->option)) { $sql = "SELECT * FROM schedules WHERE seq IN (" . $schedule . ");"; $_schedules = $this->db->getAll($sql, array()); $_schedule = explode(',', $schedule); foreach ($_schedules as $val) { if ($val['waimanalo'] > 0) { foreach ($_schedule as $key2 => $val2) { if ($val2 == $val['seq']) { $_schedule[$key2] = $val['waimanalo']; } } } } $schedule = implode(',', $_schedule); } if (in_array(227, $this->option)) { $sql = "SELECT * FROM schedules WHERE seq IN (" . $schedule . ");"; $_schedules = $this->db->getAll($sql, array()); $_schedule = explode(',', $schedule); foreach ($_schedules as $val) { if ($val['downtown'] > 0) { foreach ($_schedule as $key2 => $val2) { if ($val2 == $val['seq']) { $_schedule[$key2] = $val['downtown']; } } } } $schedule = implode(',', $_schedule); } if (in_array(8, $this->option)) { if (!empty($this->bouquet1)) { $bouquet1_txt = "\nブーケ:" . '第1希望:' . $bouquet_list[$this->bouquet1]; } if (!empty($this->bouquet2)) { $bouquet2_txt = '第2希望:' . $bouquet_list[$this->bouquet2]; } if (!empty($this->bouquet3)) { $bouquet3_txt = '第3希望:' . $bouquet_list[$this->bouquet3]; } } if ($this->plu_option == 1) { $this->option[] = 188; } $option = implode(',', $this->option); $type = $this->plans['type']; $pay = $GLOBALS['PAYMENT'][$this->pay]; $spa = $this->spa; if (empty($this->spa)) { $spa = NULL; } $spa_time = $this->spa_time; if (empty($this->spa_time)) { $spa_time = NULL; } $spa_num = $this->spa_num; if (empty($this->spa_num)) { $spa_num = NULL; } $spa_str = $spas_list[$this->spa]; if ($this->spa) { foreach ($spas as $val) { if ($val['seq'] == $this->spa) { $spa_str = $val['name']; } } $spa_str .= ' ' . $GLOBALS['SPA_TIME'][$this->spa_time]; $spa_str .= ' ' . $GLOBALS['SPA_NUM'][$this->spa_num]; } $url = SSL . "/s/application/beach_meeting.php"; $way = empty($this->siteid) ? 0 : $this->siteid; // エージェント $agent_id = empty($this->agid) ? '' : $this->agid; // 支払期日 if ($this->pay == 2) { $pay_limit = date('Y-m-d', time() + (24 * 60 * 60 * 2)); } else { $pay_limit = date('Y-m-d', time() + (24 * 60 * 60 * 4)); } /* $pay_limit = NULL; if ($type == '1' || $type == '3') { // ビーチフォト、ビーチウェディングの場合、支払期限4日後 $pay_limit = date('Y-m-d', time() + (24 * 60 * 60 * 4)); } */ // ホテルタイプ // null:設定無し, 1:通常送迎有,2:徒歩圏内 $hotel_type = null; $send_status = $pick_status = $hiresend_status = $hirepick_status = null; $_hotel = $this->db->getRow('select * from hotel where (name=? OR name_en=?);', array($this->hotel, $this->hotel)); if ($_hotel) { $hotel_type = $_hotel['type']; if ($hotel_type == '2') { // 手配必要無いためNGステータス $send_status = $pick_status = $hiresend_status = $hirepick_status = 3; } } // カメラマン、牧師、ウクレレ、アテンド特記事項 // リムジン特記事項 // 現地スタッフへの申し送り事項 $final_information1 = ''; $final_information2 = ''; $hawaii_note = ''; if ($this->pregnancy) { $final_information1 = $GLOBALS['PREGNANCY_FINAL_INFORMATION1'][$this->pregnancy] . "\n"; $final_information2 = $GLOBALS['PREGNANCY_FINAL_INFORMATION2'][$this->pregnancy] . "\n"; $hawaii_note = $GLOBALS['PREGNANCY_HAWAII_NOTE'][$this->pregnancy] . "\n"; } if ($this->bring) { $hawaii_note .= "・衣装持込みあり:"; if ($this->bring == 1) { $hawaii_note .= ($GLOBALS['USER_BRING_TYPE'][$this->bring_type] . "\n"); } if ($this->bring == 2) { $hawaii_note .= ($this->bring_type_other . "\n"); } } if ($this->companion_adult > 0 || $this->companion_child > 0) { $final_information1 .= sprintf("*Guest : %d adults , %d kid. ", $this->companion_adult, $this->companion_child) . "\n"; $final_information2 .= sprintf("*Guest : %d adults , %d kid. ", $this->companion_adult, $this->companion_child) . "\n"; $hawaii_note .= sprintf("●ゲスト:大人%d名/小人%d名", $this->companion_adult, $this->companion_child) . "\n"; $hawaii_note .= " ┣代表者名: \n"; $hawaii_note .= " ┣宿泊先: \n"; $hawaii_note .= " ┣移動手段(同行範囲): \n"; $hawaii_note .= " ┣集合場所: \n"; $hawaii_note .= " ┗集合時間: \n"; } if (in_array($this->plan, array(35, 73, 103, 105)) || in_array(126, $this->option) || in_array(24, $this->option)) { $hawaii_note .= "●ホテル戻りのため、ブリーフィング時にHP掲載許可確認要\n"; } if ($this->plu_option == 1) { $hawaii_note .= "●国内事前試着アンケートご案内要\n"; } $hawaii_island_dept = ''; if ($this->hawaii_island_dept['month'] && $this->hawaii_island_dept['date']) { $hawaii_island_dept = $this->hawaii_island_dept['month'] . '月' . $this->hawaii_island_dept['date'] . '日'; } // NGで登録 $hairmake_status = 3; $sitter_status = 3; $sitter_options[] = array(17,19,136,139,140,141,142,143,144,149,150,151,193,204,208,214,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290); foreach ($this->option as $val) { if (in_array($val, $sitter_options)) { $sitter_status = null; break; } } // キャンペーンMAXを超えている場合、フォリオ(311)追加 if ($this->is_campaign_max_reserve == '1') { if ($option) { $option .= ',311'; } else { $option .= '311'; } $option_note .= "フォリオプレゼント(キャンペーン超過)\n"; $option_str .= "フォリオ(アルバム)プレゼント" . ' '; $hawaii_note .= "フォリオ(キャンペーン上限特典) 0円\n"; } $this->db->autoCommit(false); $sql = ''; $param = array( $name1, $name2, $roman1, $roman2, $this->mail, $this->groom_mail, $this->bride_mail, $tel, $this->password, $zip, $this->pref, $this->address1, $this->address2, $hawaii_tel, $this->hotel, $arrival, $returns, $size1, $size2, $this->foot1, $this->foot2, $this->message, $this->pay, $hope_date, $option, $type, $spa, $spa_time, $spa_num, $this->plan, 0, $price, $this->height1, $this->height2, $way, $schedule, $kana1, $kana2, (empty($this->bouquet1) ? 0 : $this->bouquet1), (empty($this->bouquet2) ? 0 : $this->bouquet2), (empty($this->bouquet3) ? 0 : $this->bouquet3), (($this->plan == 38) ? 0 : 0), $this->pregnancy, $this->companion_adult, $this->companion_child, (($this->bring == 2) ? 1 : $this->bring), (($this->bring == 1) ? $this->bring_type : 0), (($this->bring == 2) ? $this->bring_type_other : ''), $this->to_hawaii_island, $hawaii_island_dept, date('Y-m-d', $this->birthday1['Time']), date('Y-m-d', $this->birthday2['Time']), $agent_id, $price, $pay_limit, $this->pay_currency, $this->shimei, $this->hairmake_shimei, 1, $hotel_type, $send_status, $pick_status, $hiresend_status, $hirepick_status, (($this->plan == 99) ? 4 : 0), // 手動手配 $this->kakou, $option_note, empty($this->yukata1) ? NULL : $this->yukata1, empty($this->yukata2) ? NULL : $this->yukata2, $hairmake_status, $sitter_status, $final_information1, $final_information2, $hawaii_note, ); $sql .= ' INSERT INTO reserves '; $sql .= ' ( '; $sql .= ' name1, name2, roman1, roman2, mail, groom_mail, bride_mail, '; $sql .= ' tel, password, zip, pref, address1, '; $sql .= ' address2, hawaii_tel, hotel, arrival, returns, '; $sql .= ' size1, size2, foot1, foot2, message, '; $sql .= ' pay, decide_date, option, type, spa, '; $sql .= ' spa_time, spa_num, plan, status, price, '; $sql .= ' height1, height2, way, schedule, created, '; $sql .= ' kana1, kana2, bouquet1, bouquet2, bouquet3, '; $sql .= ' cameraman_agent, pregnancy, companion_adult, companion_child, bring, bring_type, bring_type_other, to_hawaii_island, hawaii_island_dept, '; $sql .= ' birthday1, birthday2, agent_id, agent_price, '; $sql .= ' pay_limit, pay_currency, cameraman_shimei, hairmake_shimei, smart, hotel_type, '; $sql .= ' send_status, pick_status, hiresend_status, hirepick_status, attendant_status, photo_kakou, '; $sql .= ' note, yukata1, yukata2, '; $sql .= ' hairmake_status, sitter_status, '; $sql .= ' final_information1, final_information2, hawaii_note '; $sql .= ' ) '; $sql .= ' VALUES (?,?,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,now(), ?,?,?,?,?, ?,?,?,?,?,?,?,?,?, ?,?,?,?, ?,?,?,?,?,?, ?,?,?,?,?,?, ?,?,?, ?,?, ?,?,?); '; $result = $this->db->query($sql, $param); if (DB::isError($result)) { //echo '
';
            //print_r($result);
            //echo '
';
            //exit;
            $this->db->rollback();
            $this->errors['message'] = '登録処理に失敗しました。';
            return $this->render('s/application/error');
        }

        $this->db->commit();

        $sql = "SELECT currval('reserve_seq_seq') AS seq;";
        $_reserves_seq = $this->db->getRow($sql, array());
        $reserves_seq = $_reserves_seq['seq'];

        $this->db->autoCommit(false);
        $sql  = " INSERT INTO calendars ";
        $sql .= ' ( ';
        $sql .= ' type, reserve_date, reserve_seq ';
        $sql .= ' ) ';
        $sql .= ' VALUES (?,?,?); ';
        $result = $this->db->query($sql, array($plans['calendar'], $hope_date, $reserves_seq));
        $this->db->commit();

        // プルメリアサロン
        if ($this->plu_option == 1) {
            if ($this->plu_undecide == 1) {
                $param = array(
                    $reserves_seq,
                    $name1,
                    $kana1,
                    1, // 性別
                    $this->mail,

                    $tel,
                    0, // status
                    1, // オアフ
                );
                $sql  = 'INSERT INTO plu_reserves ';
                $sql .= '( ';
                $sql .= 'reserve_seq, name, kana, sex, mail, ';
                $sql .= 'tel, status, place_type, updated, created ';
                $sql .= ') ';
                $sql .= 'VALUES (?,?,?,?,?, ?,?,?,now(),now()); ';
                $result = $this->db->query($sql, $param);

            } else {
                $start_date = date('Y-m-d H:i:s', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time));
                $end_date = date('Y-m-d H:i:s', (strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time) + (1 * 60 * 60)));

                $param = array(
                    $reserves_seq,
                    $name1,
                    $kana1,
                    1, // 性別
                    $this->mail,

                    $tel,
                    $this->plu_salon, // salon
                    1, // オアフ
                    $start_date, // decide_date
                    0, // status
                );
                $sql  = 'INSERT INTO plu_reserves ';
                $sql .= '( ';
                $sql .= 'reserve_seq, name, kana, sex, mail, ';
                $sql .= 'tel, salon, place_type, decide_date, status, updated, created ';
                $sql .= ') ';
                $sql .= 'VALUES (?,?,?,?,?, ?,?,?,?,?,now(),now()); ';
                $result = $this->db->query($sql, $param);

                $sql = "SELECT currval('plu_reserves_seq_seq') AS seq;";
                $_plu_reserves_seq = $this->db->getRow($sql, array());
                $plu_reserves_seq = $_plu_reserves_seq['seq'];


                $param = array(
                    1,
                    $this->plu_salon,
                    $plu_reserves_seq,
                    $start_date,
                    $end_date,
                );
                $sql  = "INSERT INTO plu_salon_calendars ";
                $sql .= '( ';
                $sql .= 'status, salon, reserve_seq, start_date, end_date ';
                $sql .= ') ';
                $sql .= 'VALUES (?,?,?,?,?); ';
                $result = $this->db->query($sql, $param);
            }
        }

        $this->db->commit();

        $subject = '【Royal Kaila Wedding】お申込みありがとうございます';
        switch ($this->siteid) {
            case 1 :
                $subject = '【Photo Wedding Royal Kaila】お申込みありがとうございます';
                break;
            case 2 :
                $subject = '【Hawaii Wedding Royal Kaila】お申込みありがとうございます';
                break;
            case 3 :
                $subject = '【Hawaii Resort Royal Kaila】お申込みありがとうございます';
                break;
            case 'location' :
                $subject = '【Wedding Location Royal Kaila】お申込みありがとうございます';
                break;
            case 4 :
                $subject = '【Premium Hawaii Beach Wedding By Royal Kaila】お申込みありがとうございます';
                break;
        }

        $pay_str  = "お支払いの詳細はこちらをご確認ください。\n";
        $pay_str .= "https://www.exeojapan.com/ssl/royalkaila/s/application/beach_payment.php?id=" . md5($reserves_seq) . "\n";
        if ($this->pay == 2) {
            $pay_str .= "24時間以内のお支払いをお願いいたします。";
        } else {
            $pay_str .= "本日より3日以内のお支払いをお願いいたします。";
        }

        $rainy_option_info = "";
        //if ($this->isAvailableRainyOption($this->plan, $this->option, $hope_date)) {
        //    $rainy_option_info = file_get_contents(RAINY_OPTION_INFO_TEMPLATE);;
        //    $pay_str .= "\n";
        //    $pay_str .= "\n";
        //    if ($this->pay == 2) {
        //        $pay_str .= "また、雨の日保険を追加でお申し込みされる方は、\n下記URLからお支払に進んで頂きますと\n";
        //        $pay_str .= "雨の日保険をプラスした金額でお支払が可能となります。\n";
        //    } else {
        //        $pay_str .= "また、雨の日保険を追加でお申し込みされる方は、\n下記URLからお支払い金額が確認できますので、\n";
        //        $pay_str .= "表示された金額をお振込み頂ければ、雨の日保険のお申し込みが可能となります。\n";
        //    }
        //    $pay_str .= "https://www.exeojapan.com/ssl/royalkaila/s/application/beach_payment.php?id=" . md5($reserves_seq) . "&rainy=1\n";
        //}

        $cacual_photo_info = "";
        //if ($this->isAvailableCasualPhoto($this->plan, $this->option, $hope_date)) {
        //    $cacual_photo_info = file_get_contents(CACUAL_PHOTO_INFO_TEMPLATE);;
        //}

        $shimei_str = '';
        if ($this->shimei > 0) {
            $shimei_str = 'カメラマン指名:' . $this->cameraman_list[$this->shimei]['name'] . ' 指名料:';
            if ($this->pay_currency == 1) {
                $shimei_str .= number_format($this->cameraman_list[$this->shimei]['price']) . '円';
            } else {
                $shimei_str .= preg_replace('/^(.*)\.0+$/', '${1}', number_format($this->cameraman_list[$this->shimei]['price'], 2)) . 'ドル';
            }
        }

        $hairmake_shimei_str = '';
        if ($this->hairmake_shimei > 0) {
            $hairmake_shimei_str = 'ヘアメイク指名:' . $this->hairmake_shimei_list[$this->hairmake_shimei]['name'] . ' 指名料:';
            if ($this->pay_currency == 1) {
                $hairmake_shimei_str .= number_format($this->hairmake_shimei_list[$this->hairmake_shimei]['price']) . '円';
            } else {
                $hairmake_shimei_str .= preg_replace('/^(.*)\.0+$/', '${1}', number_format($this->hairmake_shimei_list[$this->hairmake_shimei]['price'], 2)) . 'ドル';
            }
        }
        
        if (($this->plan == 111) || ($this->plan == 112)) {
            $shimei_str .= "\n" . '浴衣:新郎様 ' . $GLOBALS['YUKATA1_LIST'][$this->yukata1] . '、新婦様 ' . $GLOBALS['YUKATA2_LIST'][$this->yukata2];
        }

        if ($this->plu_option == 1) {
            //$this->plu_option_str = '日本国内事前試着:';
            $this->plu_option_str = '衣装グレードアップ:';
            if ($this->pay_currency == 2) {
                //$this->plu_option_str .= '350ドル';
                $en = 1;
            } else {
                //$this->plu_option_str .= '39,000円';
                $en = 0;
            }
            $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CODE, $en, $this->hope_date);
            $pre_fitting_price = file_get_contents($_option_price_url) . ($en == 1 ? 'ドル' : '円');
            $this->plu_option_str .= " {$pre_fitting_price}";
            $this->plu_option_str .= "\n来店希望サロン:" . $GLOBALS['DRESS_SALON'][$this->plu_salon];
            if ($this->plu_undecide == 1) {
                $this->plu_option_str .= "\n来店希望日時:未定";
                $this->plu_option_str .= "\n来店希望日が決まりましたら下記URLよりお知らせください。";
                $this->plu_option_str .= "\nhttps://www.exeojapan.com/ssl/royalkaila/s/application/dress_salon.php";
                $this->plu_option_str .= "\n※試着のご予約可能日は、撮影ご希望日の1週間前までとなります。";
            } else {
                $this->plu_option_str .= "\n来店希望日時:" . date('Y年n月j日 H時〜', strtotime($this->plu_hope_date . ' ' . $this->plu_hope_time));
            }
        }
        // 新郎様、新婦様メールアドレス
        $groom_mail_text = '';
        if ($this->groom_mail) {
            $groom_mail_text = "\n新郎様メールアドレス:{$this->groom_mail}";
        }
        $bride_mail_text = '';
        if ($this->bride_mail) {
            $bride_mail_text = "\n新婦様メールアドレス:{$this->bride_mail}";
        }
        $bring = 'なし';
        if ($this->bring == 1) {
            $bring = 'あり ' . $GLOBALS['USER_BRING_TYPE'][$this->bring_type];
        } elseif ($this->bring == 2) {
            $bring = 'あり ' . $this->bring_type_other;
        }

        $to_hawaii_island = 'いいえ';
        if ($this->to_hawaii_island == 1) {
            $to_hawaii_island = 'はい';
            $to_hawaii_island .= "(渡航日:{$hawaii_island_dept})";
        } elseif ($this->to_hawaii_island == 2) {
            $to_hawaii_island = 'はい(渡航日:未定)';
        }

        $fp = fopen(BEACH_MAIL_TEMPLATE_SM, "r");
        $msg = "";
        while ($x = fgets($fp)) {
            $x = ereg_replace("%%RAINY_OPTION_INFO%%", $rainy_option_info, $x);
            $x = ereg_replace("%%CACUAL_PHOTO_INFO%%", $cacual_photo_info, $x);
            $x = ereg_replace("%%NAME1%%", $name1, $x);
            $x = ereg_replace("%%NAME2%%", $name2, $x);
            $x = ereg_replace("%%ROMAN1%%", $roman1, $x);
            $x = ereg_replace("%%ROMAN2%%", $roman2, $x);
            $x = ereg_replace("%%KANA1%%", $kana1, $x);
            $x = ereg_replace("%%KANA2%%", $kana2, $x);
            $x = ereg_replace("%%BIRTHDAY1%%", date('Y年m月d日', $this->birthday1['Time']), $x);
            $x = ereg_replace("%%BIRTHDAY2%%", date('Y年m月d日', $this->birthday2['Time']), $x);
            $x = ereg_replace("%%MAIL%%", $this->mail . $groom_mail_text . $bride_mail_text, $x);
            $x = ereg_replace("%%TEL%%", $tel, $x);
            $x = ereg_replace("%%PASSWORD%%", $this->password, $x);
            $x = ereg_replace("%%ZIP%%", $zip, $x);
            $x = ereg_replace("%%PREF%%", $pref, $x);
            $x = ereg_replace("%%ADDRESS1%%", $this->address1, $x);
            $x = ereg_replace("%%ADDRESS2%%", $this->address2, $x);
            $x = ereg_replace("%%HAWAII_TEL%%", $hawaii_tel, $x);
            $x = ereg_replace("%%HOTEL%%", $this->hotel, $x);
            $x = ereg_replace("%%ARRIVAL%%", $arrival, $x);
            $x = ereg_replace("%%RETURNS%%", $returns, $x);
            $x = ereg_replace("%%SIZE1%%", $size1, $x);
            $x = ereg_replace("%%SIZE2%%", $size2, $x);
            $x = ereg_replace("%%FOOT1%%", $this->foot1, $x);
            $x = ereg_replace("%%FOOT2%%", $this->foot2, $x);
            $x = ereg_replace("%%HEIGHT1%%", $this->height1, $x);
            $x = ereg_replace("%%HEIGHT2%%", $this->height2, $x);
            $x = ereg_replace("%%MESSAGE%%", $this->message, $x);
            $x = ereg_replace("%%PAY%%", $pay, $x);
            $x = ereg_replace("%%PAY_STR%%", $pay_str, $x);
            $x = ereg_replace("%%HOPE_DATE%%", date('Y年m月d日 H時i分〜', strtotime($hope_date)), $x);
            $x = ereg_replace("%%OPTION%%", $option_str, $x);
            $x = ereg_replace("%%BOUQUET%%", $bouquet1_txt . ' ' . $bouquet2_txt . ' ' . $bouquet3_txt, $x);
            $x = ereg_replace("%%PLUMERIA%%", $this->plu_option_str, $x);
            $x = ereg_replace("%%SPA_STR%%", $spa_str, $x);
            $x = ereg_replace("%%PLAN%%", $plans['name'], $x);
            $x = ereg_replace("%%PRICE%%", preg_replace('/^(.*)\.0+$/', '${1}', number_format($price, 2)) . (($this->pay_currency == 1) ? '円' : 'ドル'), $x);
            $x = ereg_replace("%%ID%%", $reserves_seq, $x);
            $x = ereg_replace("%%URL%%", $url, $x);
            $x = ereg_replace("%%OTHER%%", $shimei_str."\n".$hairmake_shimei_str, $x);
            $x = ereg_replace("%%PREGNANCY%%", (($this->pregnancy == 0) ? 'いいえ' : '妊娠' . $this->pregnancy . 'ヶ月'), $x);
            $x = ereg_replace("%%COMPANION_ADULT%%", $this->companion_adult, $x);
            $x = ereg_replace("%%COMPANION_CHILD%%", $this->companion_child, $x);
            $x = ereg_replace("%%BRING%%", $bring, $x);
            $x = ereg_replace("%%TO_HAWAII_ISLAND%%", $to_hawaii_island, $x);
            $msg .= $x;
        }

        mb_language("Japanese");
        mb_internal_encoding("EUC-JP");
        if ($this->mail) {
            mb_send_mail($this->mail, $subject, $msg, "From:" . ORDER_MAIL, "-f " . ORDER_MAIL);
        }
        mb_send_mail(ORDER_MAIL, $subject, $msg, "From:" . $this->mail, "-f " . ORDER_MAIL);
        mb_send_mail('takeshiyokohama8940@docomo.ne.jp', '[SP]' . $subject, $msg, "From:" . ORDER_MAIL, "-f " . ORDER_MAIL);
        mb_send_mail('m-rose.0130@i.softbank.jp', '[SP]' . $subject, $msg, "From:" . ORDER_MAIL, "-f " . ORDER_MAIL);
        mb_send_mail('timing_and_heart-16@docomo.ne.jp', '[SP]' . $subject, $msg, "From:" . ORDER_MAIL, "-f " . ORDER_MAIL);

        $this->redirectTo('finish');
    }

    // ---------------------------------------------
    // 完了
    // ---------------------------------------------
    function executeFinish () {
        return $this->render('s/application/finish');
    }

    // ---------------------------------------------
    // 日時確認
    // ---------------------------------------------
    function _checkCalendar ($hope_date, $hope_time) {
        $hope_sec = strtotime($hope_date . ' ' . $hope_time);

        // プランに設定された予約可能曜日
        $weeks = explode(',', $this->plans['weeks']);
        // プランに設定された予約可能時間
        $times = explode(',', $this->plans['times']);
        // サロンメイク・ホテルメイクどちらのカレンダーか
        $calendar_type = $this->plans['calendar'];

        // サンセット、ダウンタウン+サンセット、プレミアムフォト、サンセット+星空プランの場合
        $plan_seq = $this->plans['seq'];
        if ($plan_seq == 35) {
            $hour = $this->sunset_times[date('n', $hope_sec)];
            $times = array(date('H:i', strtotime(date('Y-m-d 00:00:00')) + $hour));
        }
        if ($plan_seq == 73) {
            $hour = $this->downtown_sunset_times[date('n', $hope_sec)];
            $times = array(date('H:i', strtotime(date('Y-m-d 00:00:00')) + $hour));
        }
        if ($plan_seq == 103) {
            $hour = $this->premium_sunset_times[date('n', $hope_sec)];
            $times = array(date('H:i', strtotime(date('Y-m-d 00:00:00')) + $hour));
        }
        if ($plan_seq == 105) {
            $hour = $this->sunset_starry_sky_times[date('n', $hope_sec)];
            $times = array(date('H:i', strtotime(date('Y-m-d 00:00:00')) + $hour));
        }

        if (!in_array($hope_time, $times)) {
            return 'ご選択いただいた日時はご予約できません。';
        }
        if (!in_array(date('w', $hope_sec), $weeks)) {
            return 'ご選択いただいた日時はご予約できません。';
        }
        // 7日前確認
        if ($hope_sec < (time() + (24 * 60 * 60 * 7))) {
            return 'ご選択いただいた日時はご予約できません。';
        }

        if ($plan_seq == 35 || $plan_seq == 73 || $plan_seq == 103 || $plan_seq == 105) {
            $param = array(($hope_date . ' 00:00:00'), ($hope_date . ' 23:59:59'));
            $sql  = "SELECT decide_date FROM reserves ";
            $sql .= " WHERE decide_date >= ? ";
            $sql .= " AND decide_date < ? ";
            //$sql .= " AND ( plan IN (35,43,44,60,61,62,63,64,72,73,74,91,102,103,105,107,108,109,110) ";
            $sql .= " AND ( plan IN (35,43,44,60,61,62,63,64,72,73,91,102,103,105,107,108,109,110) ";
            $sql .= " OR  24 = ANY(string_to_array(regexp_replace(option, '^0$|^0,', ''), ',')) ";
            $sql .= " OR 126 = ANY(string_to_array(regexp_replace(option, '^0$|^0,', ''), ',')) )";
            $sql .= " AND status IN (0,1,2,3,10); ";
            //$reserve_date = $this->db->getRow($sql, $param);
            $reserve_date = $this->db->getAll($sql, $param);
            if (count($reserve_date) >= 2) {
                return 'ご選択いただいた日時はご予約できません。';
            }
            if ($plan_seq == 103) {
                // プレミアムフォトお申し込みの場合(プレミアム、スペシャルは1日1件)
                foreach ($reserve_date as $i => $item) {
                    if (in_array($item['plan'], array(64, 72, 102, 103, 107, 108, 109, 110))) {
                        return 'ご選択いただいた日時はご予約できません。';
                    }
                }
            }
        } else {
            $param = array(date('Y-m-d H:i:s', $hope_sec), $calendar_type);
            $sql  = "SELECT reserve_date FROM calendars ";
            $sql .= " WHERE reserve_date = ? ";
            $sql .= " AND type = ?; ";
            $reserve_date = $this->db->getRow($sql, $param);
            if (!empty($reserve_date)) {
                return 'ご選択いただいた日時はご予約できません。';
            }
        }

        return NULL;
    }

    // ---------------------------------------------
    // 入力確認
    // ---------------------------------------------
    function _checkInput () {
        $errors = array();

        if (empty($this->sei1) || empty($this->mei1)) {
            $errors['name1'] = '新郎様氏名を入力してください。';
        }
        if (empty($this->sei2) || empty($this->mei2)) {
            $errors['name2'] = '新婦様氏名を入力してください。';
        }
        if (empty($this->roman_sei1) || empty($this->roman_mei1)) {
            $errors['roman1'] = '新郎様ローマ字を入力してください。';
        } else if (!preg_match('/^[a-zA-Z]+$/', $this->roman_sei1) || !preg_match('/^[a-zA-Z]+$/', $this->roman_mei1)) {
            $errors['roman1'] = '新郎様ローマ字は全て半角英字で入力してください。';
        }
        if (empty($this->roman_sei2) || empty($this->roman_mei2)) {
            $errors['roman2'] = '新婦様ローマ字を入力してください。';
        } else if (!preg_match('/^[a-zA-Z]+$/', $this->roman_sei2) || !preg_match('/^[a-zA-Z]+$/', $this->roman_mei2)) {
            $errors['roman2'] = '新婦様ローマ字は全て半角英字で入力してください。';
        }

        $_kana_sei1 = mb_convert_encoding($this->kana_sei1, "UTF-8", "EUC-JP");
        $_kana_mei1 = mb_convert_encoding($this->kana_mei1, "UTF-8", "EUC-JP");
        $_kana_sei2 = mb_convert_encoding($this->kana_sei2, "UTF-8", "EUC-JP");
        $_kana_mei2 = mb_convert_encoding($this->kana_mei2, "UTF-8", "EUC-JP");
        $pattern = mb_convert_encoding('/^[ァ-ヶー]+$/u', "UTF-8", "EUC-JP");
        if (empty($this->kana_sei1) || empty($this->kana_mei1)) {
            $errors['kana1'] = '新郎様フリガナを入力してください。';
        } else if (!preg_match($pattern, $_kana_sei1) || !preg_match($pattern, $_kana_mei1)) {
            $errors['kana1'] = '新郎様フリガナは全て全角カタカナで入力してください。';
        }
        if (empty($this->kana_sei2) || empty($this->kana_mei2)) {
            $errors['kana2'] = '新婦様フリガナを入力してください。';
        } else if (!preg_match($pattern, $_kana_sei2) || !preg_match($pattern, $_kana_mei2)) {
            $errors['kana2'] = '新婦様フリガナは全て全角カタカナで入力してください。';
        }

        if (!checkdate($this->birthday1['Month'], $this->birthday1['Day'], $this->birthday1['Year'])) {
            $errors['birthday1'] = '正しい新郎様生年月日を選択してください。';
        }
        if (!checkdate($this->birthday2['Month'], $this->birthday2['Day'], $this->birthday2['Year'])) {
            $errors['birthday2'] = '正しい新婦様生年月日を選択してください。';
        }

        if (empty($this->mail)) {
            $errors['mail'] = 'メールアドレスを入力してください。';
        } else if (!preg_match('/^[a-zA-Z0-9\.\-\+\_]+@[a-zA-Z0-9\-\_]+\.[a-zA-Z0-9\.\-\+]+$/', $this->mail)) {
            $errors['mail'] = '正しいメールアドレスを入力してください。';
        } else if ($this->mail != $this->mail2) {
            $errors['mail'] = '確認用メールアドレスと一致しません。';
        }
        if (empty($this->tel1) || empty($this->tel2) || empty($this->tel3)) {
            $errors['tel'] = 'お電話番号を入力してください。';
        } else if (!preg_match('/^[0-9]{2,5}$/', $this->tel1) || !preg_match('/^[0-9]{1,4}$/', $this->tel2) || !preg_match('/^[0-9]{4}$/', $this->tel3)) {
            $errors['tel'] = '正しいお電話番号を入力してください。';
        }
        if (empty($this->password)) {
            $errors['password'] = 'パスワードを入力してください。';
        } else if (!preg_match('/^[a-zA-Z0-9]+$/', $this->password)) {
            $errors['password'] = 'パスワードは全て半角英数で入力してください。';
        } else if (strlen($this->password) < 4) {
            $errors['password'] = 'パスワードは4文字以上で入力してください。';
        } else if ($this->password != $this->password2) {
            $errors['mail'] = '確認用パスワードと一致しません。';
        }
        if (empty($this->zip1) || empty($this->zip2)) {
            $errors['zip'] = '郵便番号を入力してください。';
        } else if (!preg_match('/^[0-9]{3}$/', $this->zip1) || !preg_match('/^[0-9]{4}$/', $this->zip2)) {
            $errors['zip'] = '正しい郵便番号を入力してください。';
        }
        if (empty($this->pref)) {
            $errors['pref'] = '都道府県を選択してください。';
        }
        if (empty($this->address1)) {
            $errors['address1'] = '市区町村を入力してください。';
        }
        if (empty($this->address2)) {
            $errors['address2'] = '番地・ビル名を入力してください。';
        }
        if (!preg_match('/^[0-9]{1,2}$/', $this->arrival['month']) || !preg_match('/^[0-9]{1,2}$/', $this->arrival['date']) || !preg_match('/^[0-9]{1,2}$/', $this->arrival['hour'])) {
            $errors['arrival'] = '正しいハワイ到着日時を入力してください。';
        }
        if (!preg_match('/^[0-9]{1,2}$/', $this->returns['month']) || !preg_match('/^[0-9]{1,2}$/', $this->returns['date']) || !preg_match('/^[0-9]{1,2}$/', $this->returns['hour'])) {
            $errors['returns'] = '正しい帰国日時を入力してください。';
        }
        if (!is_numeric($this->size1)) {
            $errors['size1'] = 'お洋服のサイズ(新郎様)を選択してください。';
        } else if (($this->size1 === 'o') && (!$this->size1_other)) {
            $errors['size1'] = 'お洋服のサイズ(新郎様)のその他が未入力です。';
        }
        if ($this->size2 == 1) {
            if ($this->size2_num < 5) {
                $errors['size2'] = 'お洋服のサイズ(新婦様)を選択してください。';
            }
        } else if (($this->size2 === 'o') && (!$this->size2_other)) {
            $errors['size2'] = 'お洋服のサイズ(新婦様)のその他が未入力です。';
        }
        if (!is_numeric($this->foot1)) {
            $errors['foot1'] = '靴のサイズ(新郎様)を半角数字で入力してください。';
        }
        if (!is_numeric($this->foot2)) {
            $errors['foot2'] = '靴のサイズ(新婦様)を半角数字で入力してください。';
        }
        if (!is_numeric($this->height1)) {
            $errors['height1'] = '身長(新郎様)を半角数字で入力してください。';
        }
        if (!is_numeric($this->height2)) {
            $errors['height2'] = '身長(新婦様)を半角数字で入力してください。';
        }

        if (!is_numeric($this->pregnancy)) {
            $errors['pregnancy'] = 'ご妊娠中かどうかを選択してください。';
        }
        if (!is_numeric($this->companion_adult)) {
            $errors['companion_adult'] = 'ご参列者(大人)の人数を選択してください。';
        }
        if (!is_numeric($this->companion_child)) {
            $errors['companion_child'] = 'ご参列者(子供)の人数を選択してください。';
        }
        if (!is_numeric($this->bring)) {
            $errors['bring'] = 'お持込の衣装の有無を選択してください。';
        } else if ($this->bring == 1 && !$this->bring_type) {
            $errors['bring'] = 'お持込の衣装を選択してください。';
        } else if ($this->bring == 2 && !$this->bring_type_other) {
            $errors['bring'] = 'お持込の衣装の詳細を入力して下さい。';
        }
        if (!is_numeric($this->to_hawaii_island)) {
            $errors['to_hawaii_island'] = 'ハワイ島へいかれるかどうかを選択してください。';
        } elseif ($this->to_hawaii_island == 1 && (!preg_match('/^[0-9]{1,2}$/', $this->hawaii_island_dept['month']) || !preg_match('/^[0-9]{1,2}$/', $this->hawaii_island_dept['date']))) {
            $errors['to_hawaii_island'] = 'ハワイ島へいかれる現地時間を入力してください。';
        }
        if (empty($this->yukata1) && (($this->plan == 111) || ($this->plan == 112))) {
            $errors['yukata1'] = '新郎様の甚平を選択してください。';
        }
        if (empty($this->yukata2) && (($this->plan == 111) || ($this->plan == 112))) {
            $errors['yukata2'] = '新婦様の浴衣を選択してください。';
        }

        if ($this->privchk != 1) {
            $errors['privchk'] = '「お申込みに関する個人情報の取り扱い」に同意してください。';
        }

        return $errors;
    }

    // ---------------------------------------------
    // オプション確認
    // ---------------------------------------------
    function _checkOption () {
        $errors = array();

        if ($this->plu_option == 1) {
            if ($this->plu_undecide == 1) {

            } else if (($this->plu_salon > 0) && !empty($this->plu_hope_date) && !empty($this->plu_hope_time)) {
            } else {
                //$errors['plu_option'] = '日本国内事前試着をご希望の場合は、ご希望のサロンと日時を選択してください。';
                $errors['plu_option'] = '衣装グレードアップをご希望の場合は、ご希望のサロンと日時を選択してください。';
            }
        }

        $_option = $this->option;
        foreach ($_option as $val) {
            if (array_key_exists($val, $GLOBALS['ADD_HOTEL_OPTION_CHECK_LIST'])) {
                if (empty($this->hotel)) {
                    $errors['add_hotel_option'] = 'ホテル内撮影オプションを選択された場合、ホテル名をして下さい。';
                } else {
                    $_hotel = $this->db->getRow('select * from hotel where (name=? OR name_en=?);', array($this->hotel, $this->hotel));
                    $val2 = $GLOBALS['ADD_HOTEL_OPTION_CHECK_LIST'][$val];
                    if ($_hotel['seq'] != $val2) {
                        $errors['add_hotel_option'] = 'ホテル内撮影オプションを選択された場合、同じホテル名を選択して下さい。';
                    }
                }

            }
        }

        return $errors;
    }

    // ---------------------------------------------
    // 入金方法確認
    // ---------------------------------------------
    function _checkPayment () {
        $price = $this->price;

        if (empty($this->pay)) {
            $errors['pay'] = '支払方法を選択してください。';
        } else if (($price > 150000) && ($this->pay == 2)) {
            $errors['pay'] = 'この支払方法は選択できません。';
        }
    }

    // ---------------------------------------------
    // プラン取得
    // ---------------------------------------------
    function _getPlan () {
        $hope_date = empty($this->hope_date) ? date('Y-m-d') : $this->hope_date;
        $param = array($hope_date, $this->plan);

        $sql  = "SELECT ";
        $sql .= "  A.seq,A.name,A.name_eng,T1.price,T1.price2,A.church,A.weeks,A.times,A.schedule,A.type,A.calendar,A.cut ";
        $sql .= "FROM ";
        $sql .= "  (SELECT ";
        $sql .= "    DISTINCT ON (plan_seq) plan_seq, start_date, price, price2 ";
        $sql .= "    FROM plan_price ";
        $sql .= "    WHERE start_date <= ? ";
        $sql .= "    AND switch IS TRUE ";
        $sql .= "    ORDER BY plan_seq, start_date DESC) T1 ";
        $sql .= "LEFT JOIN ";
        $sql .= "  plans A ";
        $sql .= "  ON A.seq = T1.plan_seq ";
        $sql .= "WHERE ";
        $sql .= "  A.seq = ?;";
        $plans = $this->db->getRow($sql, $param);

        return $plans;
    }

    // ---------------------------------------------
    // オプション取得
    // ---------------------------------------------
    function _getOptions () {
        $param = array($this->hope_date);

        $sql  = "SELECT ";
        $sql .= "  A.seq, A.name,T1.price,T1.price2,A.plan_seq,A.schedule,A.category,A.sort,A.switch,A.cut,A.caption,A.photo,A.image ";
        $sql .= "FROM ";
        $sql .= "  (SELECT ";
        $sql .= "    DISTINCT ON (option_seq) option_seq, start_date, price, price2 ";
        $sql .= "    FROM option_price ";
        $sql .= "    WHERE start_date <= ? ";
        $sql .= "    AND switch IS TRUE ";
        $sql .= "    ORDER BY option_seq, start_date DESC) T1 ";
        $sql .= "LEFT JOIN ";
        $sql .= "  options A ";
        $sql .= "  ON A.seq = T1.option_seq ";
        $sql .= "WHERE ";
        $sql .= "  ('" . $this->plan . "' = ANY(string_to_array(A.plan_seq,',')) ";
        if (in_array($this->plan, array(1, 2, 38))) {
            $sql .= "  OR A.seq IN (62, 63)) ";
        } else {
            $sql .= "  ) ";
        }

        if (strtotime($this->hope_date) < (time() + 21*60*60*24)) {
            $sql .= "  AND A.seq NOT IN (8) ";
        }
        if (strtotime($this->hope_date) < (time() + 45*60*60*24)) {
            $sql .= "  AND A.seq NOT IN (9,11,12,32,137) ";
        }

        $sql .= "ORDER BY ";
        $sql .= "  A.category ASC, A.sort ASC;";
        $options = $this->db->getAll($sql, $param);

        return $options;
    }

    // ---------------------------------------------
    // スパ取得
    // ---------------------------------------------
    function _getSpas () {
        $param = array($this->hope_date);

        $sql  = "SELECT ";
        $sql .= "  A.seq, A.name,T1.price,T1.price2,A.plan_seq,A.schedue,A.sort,A.caption,A.image ";
        $sql .= "FROM ";
        $sql .= "  (SELECT ";
        $sql .= "    DISTINCT ON (spa_seq) spa_seq, start_date, price, price2 ";
        $sql .= "    FROM spa_price ";
        $sql .= "    WHERE start_date <= ? ";
        $sql .= "    AND switch IS TRUE ";
        $sql .= "    ORDER BY spa_seq, start_date DESC) T1 ";
        $sql .= "LEFT JOIN ";
        $sql .= "  spas A ";
        $sql .= "  ON A.seq = T1.spa_seq ";
        $sql .= "WHERE ";
        $sql .= "  '" . $this->plan . "' = ANY(string_to_array(A.plan_seq,',')) ";
        $sql .= "ORDER BY ";
        $sql .= "  A.sort ASC;";
        $spas = $this->db->getAll($sql, $param);

        return $spas;
    }

    // ---------------------------------------------
    // ブーケ取得
    // ---------------------------------------------
    function _getBouquet () {
        $param = array();
        $sql  = "SELECT * FROM bouquet ";
        $sql .= " WHERE switch IS TRUE ";
        $sql .= " ORDER BY sort ASC; ";
        $bouquet = $this->db->getAll($sql, $param);
        return $bouquet;
    }

    // ---------------------------------------------
    // カレンダーリスト取得
    // ---------------------------------------------
    function _getCalendarList ($max = 9) {
        $calendar_list = array();
        $year = date('Y');
        $month = date('n');
        if ($year == '2013') {
            $year = 2014;
            $month = 1;
        }
        //// 201712まで公開とする
        //$ym = date('Ym');
        //if ($ym <= '201712') {
        //    $max = 201712 - $ym + 1;
        //}
        for ($i = 0; $i < $max; $i++) {
            $_time = mktime(0, 0, 0, ($month + $i), 1, $year);
            if ($i == $this->p) {
                $calendar_list[$i]['str'] = date('Y年n月', $_time);
            } else {
                $calendar_list[$i]['str'] = date('n月', $_time);
            }
            $calendar_list[$i]['param'] = '&p=' . $i;
        }
        return $calendar_list;
    }

    // ---------------------------------------------
    // カレンダー取得
    // ---------------------------------------------
    function _getCalendar () {
        // 初期値設定
        $calendar = array();

        $start_time = mktime(0, 0, 0, (date('n') + $this->p), 1, date('Y'));
        if (date('Y') === '2013') {
            $start_time = mktime(0, 0, 0, (1 + $this->p), 1, 2014);
        }
        $start = date('Y-m-d H:i:s', $start_time);
        $end = date('Y-m-d H:i:s', mktime(0, 0, 0, (date('n') + $this->p + 1), 1, date('Y')));
        if (date('Y') === '2013') {
            $end = date('Y-m-d H:i:s', mktime(0, 0, 0, (1 + $this->p + 1), 1, 2014));
        }
        $year = date('Y', $start_time);
        $month = date('m', $start_time);
        $firstday = date('w', $start_time);
        $_lastday = strtotime(date('Y-m-t', $start_time));
        $lastday = date('w', $_lastday);

        // プランに設定された予約可能曜日
        $weeks = explode(',', $this->plans['weeks']);
        // サロンメイク・ホテルメイクどちらのカレンダーか
        $calendar_type = $this->plans['calendar'];

        // 定休日取得(01時に登録があれば定休日)
        $param = array($start, $end, $calendar_type);
        $sql  = "SELECT reserve_date FROM calendars ";
        $sql .= " WHERE reserve_date >= ? ";
        $sql .= " AND reserve_date < ? ";
        $sql .= " AND reserve_date::time = '01:00' ";
        $sql .= " AND type = ? ";
        $sql .= " ORDER BY reserve_date; ";
        $_reserve_date2 = $this->db->getAll($sql, $param);
        $holiday = array();
        foreach ($_reserve_date2 as $val) {
            $holiday[] = date('j', strtotime($val['reserve_date']));
        }
        unset($_reserve_date2);

        // 前月日曜日から1日まで
        $day = 0;
        while ($day < $firstday) {
            $_ary = array();
            $_ary['date'] = 0;
            $_ary['class'] = '';
            $_ary['status'] = 0; // 時間表示なし
            if (($day === 0) || ($day === 6)) {
                $_ary['class'] = 'holiday';
            }
            $calendar[] = $_ary;
            $day++;
        }

        $plan_seq = $this->plans['seq'];
        // 1日〜31日までループ
        for ($date = 1; $date <= 31; $date++) {
            if (checkdate($month, $date, $year) === TRUE) {
                $_time = mktime(0, 0, 0, $month, $date, $year);
                $_week = date('w', $_time);

                $_ary['date'] = $date;
                if (!in_array($_week, $weeks) && !($_week == 0 && in_array($plan_seq, $this->sunday_list))) {
                    // 定休日:プラン指定の曜日外 && 日曜日でサンデープラン対象外
                    $_ary['class'] = 'holi';
                    $_ary['status'] = 0;
                    if ($plan_seq == 99) {
                        $_ary['class'] = '';
                    }
                } else if (in_array($date, $holiday)) {
                    // 定休日:指定された日付
                    $_ary['class'] = 'holi';
                    $_ary['status'] = 0;
                    /*
                    } else if (($month == 7) && ($date == 4)) {
                        // 定休日:独立記念日
                        $_ary['class'] = 'holi';
                        $_ary['status'] = 0;
                    */
                } else if (($month == 12) && ($date == 25)) {
                    // 定休日:クリスマス
                    $_ary['class'] = 'holi';
                    $_ary['status'] = 0;
                } else if (($month == 1) && ($date == 1)) {
                    // 定休日:お正月
                    $_ary['class'] = 'holi';
                    $_ary['status'] = 0;
                } else if ($_time < time()) {
                    // 受付け終了
                    $_ary['class'] = 'finish';
                    $_ary['status'] = 0;
                } else if ((($plan_seq == 100) || ($plan_seq == 101)) && ($_time < mktime(0, 0, 0, 4, 1, 2016))) {
                    // 受付け終了
                    $_ary['class'] = 'finish';
                    $_ary['status'] = 0;
                //// 星空プラン受付停止
                //} else if (($this->plan == 105) && ($month == 6)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && ($month == 9)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && ($month == 10)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && ($month == 11)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 4)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 5)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 8)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 9)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 16)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 17)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 19)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 20)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 21)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                //} else if (($this->plan == 105) && (date('W', $_time) == 22)) {
                //    $_ary['class'] = 'finish';
                //    $_ary['status'] = 0;
                // モアナルア・ガーデン予約不可
                } else if (in_array($this->plan, array(94,95,96,97,98)) && in_array($date, array(11,12,13,14,15,16)) && ($month == 7) && ($year == 2017)) {
                    $_ary['class'] = 'finish';
                    $_ary['status'] = 0;
                } else {
                    $_ary['class'] = '';
                    if ($_time < (time() + 7 * 24 * 60 * 60)) {
                        // 7日以内(電話予約)
                        $_ary['status'] = 2; // オンライン予約不可
                    } else {
                        // 通常のカレンダー表示
                        $_ary['status'] = 1; // オンライン予約可
                        $_ary['query'] = '?date=' . date('Y-m-d', $_time);
                    }
                }
                $calendar[] = $_ary;
            }
        }

        $lastday++;
        while ($lastday <= 6) {
            $_ary = array();
            $_ary['date'] = 0;
            $_ary['class'] = '';
            $_ary['status'] = 0;
            if (($lastday === 0) || ($lastday === 6)) {
                $_ary['class'] = 'holiday';
            }
            $calendar[] = $_ary;
            $lastday++;
        }

        return $calendar;
    }

    function isAvailableRainyOption($plan, $options, $hope_date) {
        if ($plan) {
            if (!in_array($plan, array(1,2,38))) {
                // ビーチフォト、ハワイウェディングスタイルのみ
                return false;
            }
        }
        if ($options) {
            foreach ($options as $option) {
                // 撮影場所追加、雨の日保険、ご参列者送迎、ベビーシッター が申し込まれていない場合
                if (in_array($option, array(24,126,247,248,249,250,251, 62,63, 79,80,93,94,120,107,160,161, 19,244,17,245))) {
                    return false;
                }
            }
        }
        if ($hope_date) {
            $two_week = date('Y-m-d', time() + 14 * 24 * 60 * 60);
            $date = date('Y-m-d', strtotime($hope_date));
            $time = date('H:i', strtotime($hope_date));
            if ($date < $two_week) {
                return false;
            }
        }
        return true;
    }
    
    function isAvailableCasualPhoto($plan, $options, $hope_date) {
        if ($plan) {
            if (!in_array($plan, array(1,2,3,38,39))) {
                // ビーチフォト、ビーチウェディング、ハワイウェディングスタイルのみ
                return false;
            }
        }
        if ($options) {
            foreach ($options as $option) {
                // 雨の日保険、撮影場所追加 が申し込まれていない場合
                if (in_array($option, array(62,63,24,25,26,27,122,123,124,126,134,156,159,247,248,249,250,251,263,264))) {
                    return false;
                }
            }
        }
        if ($hope_date) {
            $date = date('n', strtotime($hope_date));
            $time = date('H:i', strtotime($hope_date));
            if ($date >= 5 && $date <= 8) {
                // 5月-8月 全ての時間OK
                
            } elseif (($date >= 10 && $date <= 12) || ($date == 1)) {
                // 10月-1月 7:30-13:30 OK
                if (!(strtotime($time) >= strtotime('7:30') && strtotime($time) <= strtotime('13:30'))) {
                    return false;
                }
            } elseif (($date >= 2 && $date <= 4) || ($date == 9)) {
                // 2月-4月、9月 7:30-14:00 OK
                if (!(strtotime($time) >= strtotime('7:30') && strtotime($time) <= strtotime('14:00'))) {
                    return false;
                }
            }
        }
        return true;
    }
    
    function _getBeachPhotoHPReserve($date) {
        $param = array(($date . ' 00:00:00'), ($date . ' 23:59:59'));
        $sql  = "SELECT decide_date, plan FROM reserves ";
        $sql .= " WHERE decide_date >= ? ";
        $sql .= " AND decide_date < ? ";
        $sql .= " AND plan IN (2, 38) ";
        $sql .= " AND status IN (0,1,2,3,10) ";
        $sql .= " AND ( agent_seq = 0 OR agent_seq IS NULL )";
        $sql .= " ORDER BY decide_date; ";
        $_reserve_date = $this->db->getAll($sql, $param);
        $reserve_date = array();
        foreach ($_reserve_date as $key => $val) {
            $reserve_date[$key]['date'] = strtotime($val['decide_date']);
            $reserve_date[$key]['plan'] = $val['plan'];
        }
        return $reserve_date;
    }

    /*----------------------------------------------------------
     設定フィルター
     ----------------------------------------------------------*/
    function defaultSetBeforeFilter () {
        parent::defaultSetBeforeFilter();

        // 入力値をSESSIONに格納、SESSION値を各項目として代入
        $_array = array(
            'sei1', 'mei1', 'sei2', 'mei2',
            'roman_sei1', 'roman_mei1', 'roman_sei2', 'roman_mei2',
            'kana_sei1', 'kana_mei1', 'kana_sei2', 'kana_mei2',
            'mail2', 'password2', 'mail', 'groom_mail', 'bride_mail', 'tel1', 'tel2', 'tel3', 'password',
            'zip1', 'zip2', 'pref', 'address1', 'address2',
            'hawaii_tel1', 'hawaii_tel2', 'hawaii_tel3', 'hotel', 'arrival',
            'returns', 'size1', 'size2', 'foot1', 'foot2',
            'size1_other', 'size2_other', 'size2_num', 'height1', 'height2',
            'message', 'pay', 'privchk', 'shimei', 'hairmake_shimei',
            'hope_date', 'hope_time', 'plan', 'option',
            'spa', 'spa_time', 'spa_num', 'siteid', 'agid',
            'bouquet1', 'bouquet2', 'bouquet3',
            'pregnancy', 'companion_adult', 'companion_child', 'bring', 'bring_type', 'bring_type_other', 'to_hawaii_island','hawaii_island_dept',
            'birthday1', 'birthday2', 'pay_currency',
            'plu_option', 'plu_hope_date', 'plu_hope_time', 'plu_undecide', 'plu_salon',
            'kakou', 'before_sunday_plan', 'yukata1', 'yukata2',
        );
        foreach ($_GET as $key => $val) {
            if (!isset($_POST[$key])) {
                $_POST[$key] = $val;
            }
        }
        foreach ($_array as $val) {
            if (isset($_POST[$val])) {
                $_SESSION[$val] = $this->{$val};
            } else {
                if (isset($_SESSION[$val])) {
                    $this->{$val} = $_SESSION[$val];
                }
            }
        }
        if (empty($this->p)) {
            $this->p = 0;
        }
        if (empty($this->shimei)) {
            $this->shimei = 0;
        }
        if (empty($this->hairmake_shimei)) {
            $this->hairmake_shimei = 0;
        }

        if ($_SESSION['plan'] == 2) {
            $_SESSION['plan'] = 38;
        }
        if ($_SESSION['plan'] == 38 && $this->hope_date) {
            $_reserves = $this->_getBeachPhotoHPReserve($this->hope_date);
            if (count($_reserves) >= CAMPAIGN_MAX_RESERVE_COUNT) {
                // キャンペーン最大件数を超えた場合
                $_SESSION['plan'] = 2;
                $this->plan = 2;
                $this->is_campaign_max_reserve = 1;
            }
        }

        if (is_numeric($_SESSION['plan'])) {
            $_start_date = isset($this->hope_date) ? $this->hope_date : date('Y-m-d');
            $param = array($_SESSION['plan'], $_start_date);
            $sql  = "SELECT * FROM cameraman_shimei ";
            $sql .= " WHERE plan_seq = ? ";
            $sql .= " AND start_date <= ? ";
            $sql .= " AND switch IS TRUE ";
            $sql .= " ORDER BY start_date DESC LIMIT 1; ";
            $_shimei = $this->db->getRow($sql, $param);

            if ($this->pay_currency != 2) {
                $_shimei_price = $_shimei['price'];
                $_shimei_half_price = $_shimei['half_price'];
                $_shimei_employee_price = $_shimei['employee_price'];
            } else {
                $_shimei_price = $_shimei['price2'];
                $_shimei_half_price = $_shimei['half_price2'];
                $_shimei_employee_price = $_shimei['employee_price2'];
            }

            $this->cameraman_list = array();
            $this->cameraman_list[0]['name'] = '指名なし';
            $this->cameraman_list[0]['url'] = '';
            $this->cameraman_list[0]['price'] = 0;

            if ($_SESSION['plan'] != 105) {
                // 指名不可プラン
                $this->cameraman_list[15]['name'] = 'Hide';
                $this->cameraman_list[15]['url'] = 'http://www.photographer-plumeria.com/gallery/';
                if (time() < mktime(0, 0, 0, 5, 1, 2016)) {
                    $this->cameraman_list[15]['price'] = $_shimei_half_price;
                    $this->cameraman_list[15]['full_price'] = $_shimei_price;
                } else {
                    $this->cameraman_list[15]['price'] = ($_shimei_employee_price > 0) ? $_shimei_employee_price : $_shimei_price;
                }

                $this->cameraman_list[14]['name'] = 'Teppei';
                $this->cameraman_list[14]['url'] = 'http://www.photographer-bridal.com/gallery/';
                if (time() < mktime(0, 0, 0, 5, 1, 2016)) {
                    $this->cameraman_list[14]['price'] = $_shimei_half_price;
                    $this->cameraman_list[14]['full_price'] = $_shimei_price;
                } else {
                    $this->cameraman_list[14]['price'] = ($_shimei_employee_price > 0) ? $_shimei_employee_price : $_shimei_price;
                }

                $this->cameraman_list[23]['name'] = 'Daisuke';
                $this->cameraman_list[23]['url'] = 'http://www.photographer-royalkaila.com/gallery/';
                $this->cameraman_list[23]['price'] = ($_shimei_employee_price > 0) ? $_shimei_employee_price : $_shimei_price;

                $this->cameraman_list[8]['name'] = 'Jun';
                $this->cameraman_list[8]['url'] = 'http://www.royalkaila-junno.com/gallery/';
                $this->cameraman_list[8]['price'] = ($_shimei_employee_price > 0) ? $_shimei_employee_price : $_shimei_price;

                //$this->cameraman_list[27]['name'] = 'Andy';
                //$this->cameraman_list[27]['url'] = '';
                //$this->cameraman_list[27]['price'] = ($_shimei_employee_price > 0) ? $_shimei_employee_price : $_shimei_price;

                if ($_SESSION['plan'] != 100) {
                    $this->cameraman_list[22]['name'] = 'Yui';
                    $this->cameraman_list[22]['url'] = 'http://www.royalkaila-yuichiro.com/gallery/';
                    $this->cameraman_list[22]['price'] = $_shimei_price;

                    $this->cameraman_list[11]['name'] = 'Kazuya';
                    $this->cameraman_list[11]['url'] = 'http://www.photographer-memories.com/gallery/beach.html';
                    $this->cameraman_list[11]['price'] = $_shimei_price;

                    $this->cameraman_list[1]['name'] = 'Mako';
                    $this->cameraman_list[1]['url'] = 'http://www.photographer-mako.com/gallery/beach.html';
                    $this->cameraman_list[1]['price'] = $_shimei_price;

                    $this->cameraman_list[7]['name'] = 'Eric';
                    $this->cameraman_list[7]['url'] = 'http://www.photographer-hawaii.com/gallery/beach_photo.html';
                    $this->cameraman_list[7]['price'] = $_shimei_price;

                    /*$this->cameraman_list[13]['name'] = 'Mike Anthony';
                    $this->cameraman_list[13]['url'] = '';
                    $this->cameraman_list[13]['price'] = $_shimei_price;*/
                }
            }

            // ヘアメイク指名料金
            $_start_date = isset($this->hope_date) ? $this->hope_date : date('Y-m-d');
            $param = array($_SESSION['plan'], $_start_date);
            $sql  = "SELECT * FROM hairmake_shimei_price ";
            $sql .= " WHERE plan_seq = ? ";
            $sql .= " AND start_date <= ? ";
            $sql .= " AND switch IS TRUE ";
            $sql .= " ORDER BY start_date DESC LIMIT 1; ";
            $_shimei = $this->db->getRow($sql, $param);

            // employ_price,employ_price2を取得し料金が設定されていたら自社カメラマンに設定する
            if ($this->pay_currency != 2) {
                $_shimei_price = $_shimei['price'];
                $_shimei_half_price = $_shimei['half_price'];
                $_shimei_employee_price = $_shimei['employee_price'];
            } else {
                $_shimei_price = $_shimei['price2'];
                $_shimei_half_price = $_shimei['half_price2'];
                $_shimei_employee_price = $_shimei['employee_price2'];
            }

            $this->hairmake_shimei_list = array();
            $this->hairmake_shimei_list[0]['name'] = '指名なし';
            $this->hairmake_shimei_list[0]['url'] = '';
            $this->hairmake_shimei_list[0]['price'] = 0;

            if (!in_array($_SESSION['plan'], array(31, 32, 33, 34, 57, 58, 59, 65, 66, 69, 70, 71))) {
                // 和装・マリーナ以外
                $sql  = "SELECT * FROM hairmake_shimei ";
                $sql .= " WHERE ";
                $sql .= " switch IS TRUE ";
                $sql .= " AND status = 1 ";
                $sql .= " ORDER BY sort ASC; ";
                $_hairmake_shimei_list = $this->db->getAll($sql, array());
                foreach ($_hairmake_shimei_list as $_hairmake_shimei) {
                    $_hairmake_shimei_seq = $_hairmake_shimei['seq'];

                    $this->hairmake_shimei_list[$_hairmake_shimei_seq] = $_hairmake_shimei;
                    $this->hairmake_shimei_list[$_hairmake_shimei_seq]['price'] = $_shimei_price;
                }
            }
        }

        $this->birthday1['Time'] = '0-0-0';
        if (!empty($this->birthday1['Year'])) {
            $this->birthday1['Time'] = mktime(0, 0, 0, $this->birthday1['Month'], $this->birthday1['Day'], $this->birthday1['Year']);
        }
        $this->birthday2['Time'] = '0-0-0';
        if (!empty($this->birthday2['Year'])) {
            $this->birthday2['Time'] = mktime(0, 0, 0, $this->birthday2['Month'], $this->birthday2['Day'], $this->birthday2['Year']);
        }

        // ホテルリスト
        $_hotel_list = $this->db->getAll('select * from hotel ', array());
        $this->hotel_list = array();
        foreach ($_hotel_list as $key => $val) {
            $this->hotel_list[] = $val;
        }

        // 早朝オプション対象リスト
        $this->early_list = array();
        $this->early_list[] = 1;
        $this->early_list[] = 2;
        $this->early_list[] = 4;
        $this->early_list[] = 38;
        $this->early_list[] = 74;
        $this->early_list[] = 96;
        $this->early_list[] = 111;
        $this->early_list[] = 112;
        $this->early_list[] = 115;

        // 早朝オプション(7時半)対象リスト
        $this->early_list2 = array();
        $this->early_list2[] = 1;
        $this->early_list2[] = 2;
        $this->early_list2[] = 4;
        $this->early_list2[] = 38;
        $this->early_list2[] = 111;
        $this->early_list2[] = 112;
        $this->early_list2[] = 115;

        // サンデープラン対象リスト
        $this->sunday_list = array();
        $this->sunday_list[] = 2;
        $this->sunday_list[] = 38;
        
        // ステータス表示対象リスト
        $this->view_status_list = array();
        $this->view_status_list[] = 2;
        $this->view_status_list[] = 38;

        // サンセットプラン サロン来店時間
        $this->sunset_times[1] = (14 * 60 * 60) + (25 * 60); // 14:25
        $this->sunset_times[2] = (14 * 60 * 60) + (45 * 60); // 14:45
        $this->sunset_times[3] = (14 * 60 * 60) + (55 * 60); // 14:55
        $this->sunset_times[4] = (15 * 60 * 60) + (5 * 60); // 15:05
        $this->sunset_times[5] = (15 * 60 * 60) + (20 * 60); // 15:20
        $this->sunset_times[6] = (15 * 60 * 60) + (30 * 60); // 15:30
        $this->sunset_times[7] = (15 * 60 * 60) + (30 * 60); // 15:30
        $this->sunset_times[8] = (15 * 60 * 60) + (15 * 60); // 15:15
        $this->sunset_times[9] = (14 * 60 * 60) + (50 * 60); // 14:50
        $this->sunset_times[10] = (14 * 60 * 60) + (25 * 60); // 14:25
        $this->sunset_times[11] = (14 * 60 * 60) + (5 * 60); // 14:05
        $this->sunset_times[12] = (14 * 60 * 60) + (10 * 60); // 14:10
        // ダウンタウン+サンセットプラン サロン来店時間
        $this->downtown_sunset_times[1] = (14 * 60 * 60) + (10 * 60); // 14:10
        $this->downtown_sunset_times[2] = (14 * 60 * 60) + (30 * 60); // 14:30
        $this->downtown_sunset_times[3] = (14 * 60 * 60) + (40 * 60); // 14:40
        $this->downtown_sunset_times[4] = (14 * 60 * 60) + (50 * 60); // 14:50
        $this->downtown_sunset_times[5] = (15 * 60 * 60) + (5 * 60); // 15:05
        $this->downtown_sunset_times[6] = (15 * 60 * 60) + (15 * 60); // 15:15
        $this->downtown_sunset_times[7] = (15 * 60 * 60) + (15 * 60); // 15:15
        $this->downtown_sunset_times[8] = (15 * 60 * 60) + (0 * 60); // 15:00
        $this->downtown_sunset_times[9] = (14 * 60 * 60) + (35 * 60); // 14:35
        $this->downtown_sunset_times[10] = (14 * 60 * 60) + (5 * 60); // 14:05
        $this->downtown_sunset_times[11] = (13 * 60 * 60) + (50 * 60); // 13:50
        $this->downtown_sunset_times[12] = (14 * 60 * 60) + (0 * 60); // 14:00
        if (isset($this->hope_date) && $this->hope_date >= '2016-07-01') {
            // 2016年7月1日以降
            $this->downtown_sunset_times[1] = (13 * 60 * 60) + (55 * 60); // 13:55
            $this->downtown_sunset_times[2] = (14 * 60 * 60) + (15 * 60); // 14:15
            $this->downtown_sunset_times[3] = (14 * 60 * 60) + (25 * 60); // 14:25
            $this->downtown_sunset_times[4] = (14 * 60 * 60) + (35 * 60); // 14:35
            $this->downtown_sunset_times[5] = (14 * 60 * 60) + (50 * 60); // 14:50
            $this->downtown_sunset_times[6] = (15 * 60 * 60) + (0 * 60); // 15:00
            $this->downtown_sunset_times[7] = (15 * 60 * 60) + (0 * 60); // 15:00
            $this->downtown_sunset_times[8] = (14 * 60 * 60) + (45 * 60); // 14:45
            $this->downtown_sunset_times[9] = (14 * 60 * 60) + (20 * 60); // 14:20
            $this->downtown_sunset_times[10] = (13 * 60 * 60) + (55 * 60); // 13:55
            $this->downtown_sunset_times[11] = (13 * 60 * 60) + (35 * 60); // 13:35
            $this->downtown_sunset_times[12] = (13 * 60 * 60) + (40 * 60); // 13:40
        }
        // プレミアムフォトプラン サロン来店時間
        $this->premium_sunset_times[1] = (12 * 60 * 60) + (15 * 60);
        $this->premium_sunset_times[2] = (12 * 60 * 60) + (35 * 60);
        $this->premium_sunset_times[3] = (12 * 60 * 60) + (45 * 60);
        $this->premium_sunset_times[4] = (12 * 60 * 60) + (55 * 60);
        $this->premium_sunset_times[5] = (13 * 60 * 60) + (10 * 60);
        $this->premium_sunset_times[6] = (13 * 60 * 60) + (20 * 60);
        $this->premium_sunset_times[7] = (13 * 60 * 60) + (20 * 60);
        $this->premium_sunset_times[8] = (13 * 60 * 60) + (5 * 60);
        $this->premium_sunset_times[9] = (12 * 60 * 60) + (40 * 60);
        $this->premium_sunset_times[10] = (12 * 60 * 60) + (15 * 60);
        $this->premium_sunset_times[11] = (11 * 60 * 60) + (55 * 60);
        $this->premium_sunset_times[12] = (12 * 60 * 60) + (0 * 60);
        // サンセット+星空 サロン来店時間
        $this->sunset_starry_sky_times[1] = (14 * 60 * 60) + (55 * 60); // 14:55
        $this->sunset_starry_sky_times[2] = (15 * 60 * 60) + (15 * 60); // 15:15
        $this->sunset_starry_sky_times[3] = (15 * 60 * 60) + (25 * 60); // 15:25
        $this->sunset_starry_sky_times[4] = (15 * 60 * 60) + (35 * 60); // 15:35
        $this->sunset_starry_sky_times[5] = (16 * 60 * 60) + (05 * 60); // 16:05
        $this->sunset_starry_sky_times[6] = (16 * 60 * 60) + (15 * 60); // 16:15
        $this->sunset_starry_sky_times[7] = (16 * 60 * 60) + (00 * 60); // 16:00
        $this->sunset_starry_sky_times[8] = (15 * 60 * 60) + (45 * 60); // 15:45
        $this->sunset_starry_sky_times[9] = (15 * 60 * 60) + (20 * 60); // 15:20
        $this->sunset_starry_sky_times[10] = (14 * 60 * 60) + (55 * 60); // 14:55
        $this->sunset_starry_sky_times[11] = (14 * 60 * 60) + (35 * 60); // 14:35
        $this->sunset_starry_sky_times[12] = (14 * 60 * 60) + (40 * 60); // 14:40
        if (isset($this->hope_date) && $this->hope_date >= '2017-05-01') {
            // 2017年5月1日以降
            $this->sunset_starry_sky_times[5] = (15 * 60 * 60) + (50 * 60); // 15:50
            $this->sunset_starry_sky_times[6] = (16 * 60 * 60) + (00 * 60); // 16:00
        }

        // サンデープランに変更
        if (!empty($_SESSION['hope_date']) && !empty($_SESSION['hope_time'])) {
            $_week = date('w', strtotime($_SESSION['hope_date']));
            $_hour = date('G:i', (strtotime($_SESSION['hope_date'] . ' ' . $_SESSION['hope_time'])));
            if (($_hour == '9:00') && ($_week == 0 && in_array($_SESSION['plan'], $this->sunday_list))) {
                $this->before_sunday_plan = $_SESSION['plan'];
                $_SESSION['before_sunday_plan'] = $_SESSION['plan'];
                $_SESSION['plan'] = 99;
                $this->plan = 99;
            }
        }
        if ($this->action == '' || $this->action == 'index' || $this->action == 'calendar') {
            // カレンダー
            if ($this->before_sunday_plan) {
                $_SESSION['plan'] = $this->before_sunday_plan;
                $_SESSION['before_sunday_plan'] = 0;
                $this->plan = $this->before_sunday_plan;
                $this->before_sunday_plan = 0;
            }
        }

        // プルメリアサロン選択可能日
        if (!empty($_SESSION['hope_date']) && !empty($_SESSION['hope_time'])) {
            $_year = date('Y', (strtotime($_SESSION['hope_date'] . ' ' . $_SESSION['hope_time']) - (8 * 24 * 60 * 60)));
            $_month = date('n', (strtotime($_SESSION['hope_date'] . ' ' . $_SESSION['hope_time']) - (8 * 24 * 60 * 60))) - 1;
            $_day = date('j', (strtotime($_SESSION['hope_date'] . ' ' . $_SESSION['hope_time']) - (8 * 24 * 60 * 60)));
            $this->plu_maxdate = $_year . ', ' . $_month . ', ' . $_day;
        } else {
            $this->plu_maxdate = date('Y, m, d');
        }

        // プログラム名
        $this->program_name = 'beach.php';
        $this->program_time = 'beach_time.php';
    }
}

$controller = new BeachController();
$controller->process();

exit;