_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('familyphoto/error'); } $this->plans = $plans; $calendar = $this->_getCalendar(1); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar'); } /*---------------------------------------------------------- カレンダー表示 ----------------------------------------------------------*/ function executeCalendar2 () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('familyphoto/error'); } $this->plans = $plans; $_error = $this->_checkCalendar($this->hope_date1, $this->hope_time1); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(1); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar'); } $calendar = $this->_getCalendar(2); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; if ($plans['type'] == '3') { // ビーチウェディングの場合(第一希望のみ) //./wedding.php?action=input&hope_date2=&&hope_time2= return $this->redirectTo('input', array('hope_date2' => '', 'hope_time2' => '')); } return $this->render('familyphoto/wed_calendar2'); } /*---------------------------------------------------------- カレンダー表示 ----------------------------------------------------------*/ function executeCalendar3 () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('familyphoto/error'); } $this->plans = $plans; $_error = $this->_checkCalendar($this->hope_date1, $this->hope_time1); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(1); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar'); } $_error = $this->_checkCalendar2($this->hope_date2, $this->hope_time2); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(2); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar2'); } $calendar = $this->_getCalendar(3); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar3'); } /*---------------------------------------------------------- 入力表示 ----------------------------------------------------------*/ function executeInput () { $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('familyphoto/error'); } $this->plans = $plans; $church = $this->_getChurch(); $this->church = $church; $options = $this->_getOptions(); //$options_list = array(); //foreach ($options as $val) { // $options_list[$val['category']][$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; //} //$this->options = $options; //$this->options_list = $options_list; $options_list = array(); $options_value = array(); $options_output = array(); $options_name = array(); $options_price = array(); foreach ($options as $val) { $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['image']][] = $val['name']; $options_price[$val['category']][$val['image']][] = number_format($val['price']) . '円'; } $this->options = $options; $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) { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; } $spas_list[0] = 'エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; if ($this->plu_option == 1) { $price += 39000; } else if ($this->plu_option == 2) { $price += 10000; } $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_date1, $this->hope_time1); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(1); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar'); } $_error = $this->_checkCalendar2($this->hope_date2, $this->hope_time2); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(2); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar2'); } $_error = $this->_checkCalendar3($this->hope_date3, $this->hope_time3); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(3); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar3'); } return $this->render('familyphoto/wed_input'); } /*---------------------------------------------------------- 確認表示 ----------------------------------------------------------*/ function executeConfirm () { $excluding_tax = array();//20170824 $price = 0; $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('familyphoto/error'); } $this->plans = $plans; $church = $this->_getChurch(); $this->church = $church; $price = $plans['price']; //$price = $plans['price_shimei']; $excluding_tax['price'] = $plans['price']; //20170824 $price += $this->cameraman_list[$this->shimei]['price']; $excluding_tax['cameraman_shimei'] = $this->cameraman_list[$this->shimei]['price']; //20170824 $options = $this->_getOptions(); //$options_list = array(); //$options_list2 = array(); //$option_schedule = array(); //foreach ($options as $val) { // $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; $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']; $excluding_tax['option'][$val['seq']] = $val['price2'];//20170824 } $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)) . 'ドル'; } 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']; $excluding_tax['option'][$val['seq']] = $val['price'];//20170824 } $options_value[$val['category']][$val['image']][] = $val['seq']; $options_output[$val['category']][$val['image']][] = $val['name'] . ' ' . number_format($val['price']) . '円'; } } 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_date1); $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)); } } else if ($this->plu_option == 2) { //$this->plu_option_str = '[キャンペーン]日本国内事前試着'; $this->plu_option_str = '[キャンペーン]衣装グレードアップ'; if ($this->pay_currency == 2) { //$this->plu_option_str .= ' 100ドル'; $en = 1; } else { //$this->plu_option_str .= ' 10,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CP1_CODE, $en, $this->hope_date1); $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)); } } $this->options = $options; $this->options_list = $options_list; $this->options_list2 = $options_list2; $this->options_value = $options_value; $this->options_output = $options_output; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; $excluding_tax['spa'] = $val['price'];//20170824 } } $spas_list[0] = 'エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; if ($this->plu_option == 1) { $price += 39000; $excluding_tax['plu_option'] = 39000 ;//20170824 } else if ($this->plu_option == 2) { $price += 10000; $excluding_tax['plu_option'] = 10000 ;//20170824 } $including_tax = $this->_taxCalculation($excluding_tax);//20170901 $this->price = $price; //$this->price = $including_tax;//20170824 $this->including_tax = $including_tax;//20170901 $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_date1, $this->hope_time1); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(1); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar'); } $_error = $this->_checkCalendar2($this->hope_date2, $this->hope_time2); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(2); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar2'); } $_error = $this->_checkCalendar3($this->hope_date3, $this->hope_time3); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(3); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar3'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('familyphoto/wed_input'); } foreach ($this->option as $key => $val) { if (in_array($val, $options_list)) { unset($_SESSION['option'][$key]); } } return $this->render('familyphoto/wed_confirm'); } /*---------------------------------------------------------- 登録処理 ----------------------------------------------------------*/ function executeRegist () { $excluding_tax = array();// 20170818 $price = 0; $plans = $this->_getPlan(); if (!$plans) { $this->errors['message'] = '各プランのお申込みボタンよりお申込みしてください。'; return $this->render('familyphoto/error'); } $this->plans = $plans; $price = $plans['price']; $excluding_tax['price'] = $plans['price']; //20170819 //$price = $plans['price_shimei']; $schedule = $plans['schedule']; $church = $this->_getChurch(); $this->church = $church; $price += $this->cameraman_list[$this->shimei]['price']; $excluding_tax['cameraman_shimei'] = $this->cameraman_list[$this->shimei]['price']; //20170819 $options = $this->_getOptions(); //$options_list = array(); //$options_list2 = array(); //foreach ($options as $val) { // $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; //$this->options_list2 = $options_list2; $options_list = array(); $options_value = array(); $options_output = array(); foreach ($options as $key => $val) { $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']) . '円'; if (in_array($val['seq'], $this->option)) { $price += $val['price']; $excluding_tax['option'][$val['seq']] = $val['price'];//20170819 } 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; $spas = $this->_getSpas(); $spas_list = array(); foreach ($spas as $val) { $spas_list[$val['seq']] = $val['name'] . ' ' . number_format($val['price']) . '円'; if ($val['seq'] == $this->spa) { $price += $val['price']; $excluding_tax['spa'] = $val['price'];//20170819 } } $spas_list[0] = 'エステなし'; $this->spas = $spas; $this->spas_list = $spas_list; if ($this->plu_option == 1) { $price += 39000; $excluding_tax['plu_option'] = 39000;//20170819 } else if ($this->plu_option == 2) { $price += 10000; $excluding_tax['plu_option'] = 10000;//20170819 } $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_date1, $this->hope_time1); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(1); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar'); } $_error = $this->_checkCalendar2($this->hope_date2, $this->hope_time2); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(2); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar2'); } $_error = $this->_checkCalendar3($this->hope_date3, $this->hope_time3); if ($_error) { $this->errors['hope_date'] = $_error; $calendar = $this->_getCalendar(3); $calendar_list = $this->_getCalendarList(); $this->calendar = $calendar; $this->calendar_list = $calendar_list; return $this->render('familyphoto/wed_calendar3'); } $_error = $this->_checkInput(); if ($_error) { $this->errors = $_error; return $this->render('familyphoto/wed_input'); } $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_date1 = date('Y-m-d H:i:s', strtotime($this->hope_date1 . ' ' . $this->hope_time1)); $hope_date2 = NULL; $hope_date3 = NULL; if (!empty($this->hope_date2)) { $hope_date2 = date('Y-m-d H:i:s', strtotime($this->hope_date2 . ' ' . $this->hope_time2)); } if (!empty($this->hope_date3)) { $hope_date3 = date('Y-m-d H:i:s', strtotime($this->hope_date3 . ' ' . $this->hope_time3)); } $option = implode(',', $this->option); $option_str = ''; foreach ($this->option as $val) { $option_str .= $options_list2[$val] . ' '; } $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(8, $this->option) || in_array($this->plan, $this->bouquet_plan)) { 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; } else if ($this->plu_option == 2) { $this->option[] = 196; } $type = $this->plans['type']; $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 . "/application/wedding_meeting.php"; $way = empty($this->siteid) ? 0 : $this->siteid; // エージェントID $agent_id = empty($this->agid) ? '' : $this->agid; // 支払期日 $pay_limit = NULL; if ($type == '1' || $type == '3') { // ビーチフォト、ビーチウェディングの場合、支払期限4日後 $pay_limit = date('Y-m-d', time() + (24 * 60 * 60 * 4)); } // ステータス $status = 0; // ご予約日 $decide_date = NULL; if ($type == '3') { // ビーチウェディングの場合、日程決定 $status = 1; // 日程決定 $decide_date = $hope_date1; } // ホテルタイプ // 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; } } $including_tax = $this->_taxCalculation($excluding_tax);//20170901 $price = $including_tax; $other = ""; $this->db->autoCommit(false); $sql = ''; $param = array( $name1, $name2, $roman1, $roman2, $this->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, $decide_date, $hope_date1, $hope_date2, $hope_date3, $option, $type, $spa, $spa_time, $spa_num, $this->plan, $status, $price, $this->height1, $this->height2, $way, $church['seq'], $schedule, $kana1, $kana2, (empty($this->bouquet1) ? 0 : $this->bouquet1), (empty($this->bouquet2) ? 0 : $this->bouquet2), (empty($this->bouquet3) ? 0 : $this->bouquet3), (($this->plan == 39) ? 0 : 0), $this->pregnancy, $this->companion_adult, $this->companion_child, $this->bring, date('Y-m-d', $this->birthday1['Time']), date('Y-m-d', $this->birthday2['Time']), $agent_id, $price, $pay_limit, $this->shimei, $hotel_type, $send_status, $pick_status, $hiresend_status, $hirepick_status, ); $sql .= ' INSERT INTO reserves '; $sql .= ' ( '; $sql .= ' name1, name2, roman1, roman2, mail, '; $sql .= ' tel, password, zip, pref, address1, '; $sql .= ' address2, hawaii_tel, hotel, arrival, returns, '; $sql .= ' size1, size2, foot1, foot2, message, '; $sql .= ' decide_date, '; $sql .= ' hope_date1, hope_date2, hope_date3, option, type, '; $sql .= ' spa, spa_time, spa_num, plan, status, '; $sql .= ' price, height1, height2, way, church, '; $sql .= ' schedule, created, kana1, kana2, bouquet1, bouquet2, bouquet3, '; $sql .= ' cameraman_agent, pregnancy, companion_adult, companion_child, bring, '; $sql .= ' birthday1, birthday2, agent_id, agent_price, '; $sql .= ' pay_limit, cameraman_shimei, hotel_type, '; $sql .= ' send_status, pick_status, hiresend_status, hirepick_status '; $sql .= ' ) '; $sql .= ' VALUES (?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?, ?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?, ?,now(),?,?,?,?,?, ?,?,?,?,?, ?,?,?,?, ?,?,?, ?,?,?,?); '; $result = $this->db->query($sql, $param); if (DB::isError($result)) { $this->db->rollback(); $this->errors['message'] = '登録処理に失敗しました。'; return $this->render('familyphoto/error'); } $this->db->commit(); $sql = "SELECT currval('reserve_seq_seq') AS seq;"; $_reserves_seq = $this->db->getRow($sql, array()); $reserves_seq = $_reserves_seq['seq']; if (!empty($decide_date)) { $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'], $decide_date, $reserves_seq)); $this->db->commit(); } // プルメリアサロン if (($this->plu_option == 1) || ($this->plu_option == 2)) { if ($this->plu_undecide == 1) { $param = array( $reserves_seq, $name1, $kana1, 1, // 性別 $this->mail, $tel, 0, // status ); $sql = 'INSERT INTO plu_reserves '; $sql .= '( '; $sql .= 'reserve_seq, name, kana, sex, mail, '; $sql .= 'tel, status, 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 $start_date, // decide_date 0, // status ); $sql = 'INSERT INTO plu_reserves '; $sql .= '( '; $sql .= 'reserve_seq, name, kana, sex, mail, '; $sql .= 'tel, salon, 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); } } $subject = '【ROYAL KAILA】挙式プランお申込みありがとうございます'; 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; } $hope_date_mail = ""; if ($type == '3') { $hope_date_mail .= "ご予約日 : ".date('Y年m月d日 H時i分~', strtotime($hope_date1))."\n"; } else { $hope_date_mail .= "第1希望 : ".date('Y年m月d日 H時i分~', strtotime($hope_date1))."\n"; $hope_date_mail .= "第2希望 : ".(!empty($hope_date2) ? date('Y年m月d日 H時i分~', strtotime($hope_date2)) : 'なし')."\n"; $hope_date_mail .= "第3希望 : ".(!empty($hope_date3) ? date('Y年m月d日 H時i分~', strtotime($hope_date3)) : 'なし')."\n"; } $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)) . 'ドル'; } } 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_date1); $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/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)); } } else if ($this->plu_option == 2) { //$this->plu_option_str = '[キャンペーン]日本国内事前試着:'; $this->plu_option_str = '[キャンペーン]衣装グレードアップ:'; if ($this->pay_currency == 2) { //$this->plu_option_str .= '100ドル'; $en = 1; } else { //$this->plu_option_str .= '10,000円'; $en = 0; } $_option_price_url = sprintf("%s?seq=%s&en=%s&f=1&date=%s", OPTION_PRICE_URL, PRE_FITTING_OPTION_CP1_CODE, $en, $this->hope_date1); $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/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)); } } $pay = "未決定"; $fp = fopen(WEDDING_MAIL_TEMPLATE_FPH, "r"); $msg = ""; while ($x = fgets($fp)) { $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, $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("%%HOPE_DATE1%%", date('Y年m月d日 H時i分~', strtotime($hope_date1)), $x); //$x = ereg_replace("%%HOPE_DATE2%%", (!empty($hope_date2) ? date('Y年m月d日 H時i分~', strtotime($hope_date2)) : 'なし'), $x); //$x = ereg_replace("%%HOPE_DATE3%%", (!empty($hope_date3) ? date('Y年m月d日 H時i分~', strtotime($hope_date3)) : 'なし'), $x); $x = ereg_replace("%%HOPE_DATE%%", $hope_date_mail, $x); $x = ereg_replace("%%OPTION%%", $option_str, $x); $x = ereg_replace("%%SPA_STR%%", $spa_str, $x); $x = ereg_replace("%%PLAN%%", $plans['name'], $x); $x = ereg_replace("%%CHURCH%%", $church['name'], $x); $x = ereg_replace("%%PRICE%%", number_format($price), $x); $x = ereg_replace("%%ID%%", $reserves_seq, $x); $x = ereg_replace("%%URL%%", $url, $x); $x = ereg_replace("%%OTHER%%", $other, $x); $x = ereg_replace("%%BOUQUET%%", $bouquet1_txt . ' ' . $bouquet2_txt . ' ' . $bouquet3_txt, $x); $x = ereg_replace("%%PLUMERIA%%", $this->plu_option_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%%", (($this->bring == 1) ? 'あり' : 'なし'), $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', $subject, $msg, "From:" . ADMIM_MAIL, "-f " . ADMIM_MAIL); // mb_send_mail('honda@exeo-japan.jp', $subject, $msg, "From:" . ADMIM_MAIL, "-f " . ADMIM_MAIL); // mb_send_mail('shinkai@exeo-japan.jp', $subject, $msg, "From:" . ADMIM_MAIL, "-f " . ADMIM_MAIL); // mb_send_mail('nagakubo@exeo-japan.jp', $subject, $msg, "From:" . ADMIM_MAIL, "-f " . ADMIM_MAIL); // mb_send_mail('shimazu@exeo-japan.jp', $subject, $msg, "From:" . ADMIM_MAIL, "-f " . ADMIM_MAIL); $this->redirectTo('finish'); } // --------------------------------------------- // 完了 // --------------------------------------------- function executeFinish () { return $this->render('familyphoto/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']; if (!in_array($hope_time, $times)) { return 'ご選択いただいた日時はご予約できません。1'; } if (!in_array(date('w', $hope_sec), $weeks)) { return 'ご選択いただいた日時はご予約できません。2'; } if ($hope_sec < (time() + (24 * 60 * 60 * 10))) { return 'ご選択いただいた日時はご予約できません。3'; } $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 'ご選択いただいた日時はご予約できません。4'; } return NULL; } // --------------------------------------------- // 日時確認 // --------------------------------------------- function _checkCalendar2 ($hope_date, $hope_time) { if (empty($hope_date)) { return NULL; } $hope_sec = strtotime($hope_date . ' ' . $hope_time); if (($this->hope_date1 == $hope_date) && ($this->hope_time1 == $hope_time)) { return '第1希望と同じ日時を選択しています。'; } // プランに設定された予約可能曜日 $weeks = explode(',', $this->plans['weeks']); // プランに設定された予約可能時間 $times = explode(',', $this->plans['times']); // サロンメイク・ホテルメイクどちらのカレンダーか $calendar_type = $this->plans['calendar']; if (!in_array($hope_time, $times)) { return 'ご選択いただいた日時はご予約できません。11'; } if (!in_array(date('w', $hope_sec), $weeks)) { return 'ご選択いただいた日時はご予約できません。22'; } if ($hope_sec < (time() + (24 * 60 * 60 * 10))) { return 'ご選択いただいた日時はご予約できません。33'; } $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 'ご選択いただいた日時はご予約できません。44'; } return NULL; } // --------------------------------------------- // 日時確認 // --------------------------------------------- function _checkCalendar3 ($hope_date, $hope_time) { if (empty($hope_date)) { return NULL; } $hope_sec = strtotime($hope_date . ' ' . $hope_time); if (($this->hope_date1 == $hope_date) && ($this->hope_time1 == $hope_time)) { return '第1希望と同じ日時を選択しています。'; } if (($this->hope_date2 == $hope_date) && ($this->hope_time2 == $hope_time)) { return '第2希望と同じ日時を選択しています。'; } // プランに設定された予約可能曜日 $weeks = explode(',', $this->plans['weeks']); // プランに設定された予約可能時間 $times = explode(',', $this->plans['times']); // サロンメイク・ホテルメイクどちらのカレンダーか $calendar_type = $this->plans['calendar']; if (!in_array($hope_time, $times)) { return 'ご選択いただいた日時はご予約できません。111'; } if (!in_array(date('w', $hope_sec), $weeks)) { return 'ご選択いただいた日時はご予約できません。222'; } if ($hope_sec < (time() + (24 * 60 * 60 * 10))) { return 'ご選択いただいた日時はご予約できません。333'; } $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 'ご選択いただいた日時はご予約できません。444'; } 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['roman1'] = '同伴者ローマ字は全て半角英字で入力してください。'; } $_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'] = 'お持込の衣装の有無を選択してください。'; } if ($this->privchk != 1) { $errors['privchk'] = '「お申込みに関する個人情報の取り扱い」に同意してください。'; } 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'] = '衣装グレードアップをご希望の場合は、ご希望のサロンと日時を選択してください。'; } } else if ($this->plu_option == 2) { 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'] = '衣装グレードアップをご希望の場合は、ご希望のサロンと日時を選択してください。'; } } return $errors; } // --------------------------------------------- // プラン取得 // --------------------------------------------- function _getPlan () { $hope_date = empty($this->hope_date1) ? date('Y-m-d') : $this->hope_date1; $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; /* $param = array($this->plan); $sql = "SELECT * FROM plans "; $sql .= " WHERE seq = ? "; $sql .= " AND type > 1; "; $plans = $this->db->getRow($sql, $param); return $plans; */ } // --------------------------------------------- // 教会取得 // --------------------------------------------- function _getChurch () { $param = array($this->plans['seq']); $sql = "SELECT churchs.* FROM churchs, plans "; $sql .= " WHERE plans.seq = ? "; $sql .= " AND plans.church = churchs.seq; "; $church = $this->db->getRow($sql, $param); return $church; } // --------------------------------------------- // オプション取得 // --------------------------------------------- function _getOptions () { $param = array($this->hope_date1); $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 ($this->church_cmpg_frag) { $sql .= " OR A.seq IN (195)) "; } else { $sql .= " ) "; } $sql .= "ORDER BY "; $sql .= " A.category ASC, A.sort ASC;"; $options = $this->db->getAll($sql, $param); return $options; /* $param = array(); $sql = "SELECT * FROM options "; $sql .= " WHERE '" . $this->plan . "' = ANY(string_to_array(plan_seq,',')) "; $sql .= " ORDER BY sort ASC; "; $options = $this->db->getAll($sql, $param); return $options; */ } // --------------------------------------------- // スパ取得 // --------------------------------------------- function _getSpas () { $param = array($this->hope_date1); $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; /* $param = array(); $sql = "SELECT * FROM spas "; $sql .= " WHERE '" . $this->plan . "' = ANY(string_to_array(plan_seq,',')) "; $sql .= " ORDER BY 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; } $j = 0; if (($this->plans['church'] >= 1) && ($this->plans['church'] <= 7)) { $max = 12; $calendar_list[$year]['str'] = $year . "年"; $calendar_list[$year]['class'] = ' class="year"'; } // 201806まで公開とする $ym = date('Ym'); if ($ym <= '201806') { $_e = (2018 * 12) + 6; $_s = ($year * 12) + $month; $max = $_e - $_s + 1; } for ($i = 0; $i < $max; $i++) { $_time = mktime(0, 0, 0, ($month + $i), 1, $year); if (($this->plans['church'] >= 1) && ($this->plans['church'] <= 7)) { $calendar_list[$j]['str'] = date('n月', $_time); $calendar_list[$j]['class'] = ' class="month"'; $calendar_list[$j]['param'] = '&p=' . $i; if (date('n', $_time) === '12') { $_year = date('Y', mktime(0, 0, 0, ($month + $i + 1), 1, $year)); $calendar_list[$_year]['str'] = $_year . "年"; $calendar_list[$_year]['class'] = ' class="year"'; } } else { $calendar_list[$j]['str'] = date('Y年n月', $_time); $calendar_list[$j]['param'] = '&p=' . $i; } $j++; } return $calendar_list; } // --------------------------------------------- // カレンダー取得 // --------------------------------------------- function _getCalendar ($hope = 1) { // 初期値設定 $calendar = array(); $waku = 17; $min = 30 * 60; $hour = 6.5 * 60 * 60; $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']); // プランに設定された予約可能時間 $times = explode(',', $this->plans['times']); // サロンメイク・ホテルメイクどちらのカレンダーか $calendar_type = $this->plans['calendar']; // 埋まっているスケジュール取得 $param = array($start, $end, $calendar_type); $sql = "SELECT reserve_date FROM calendars "; $sql .= " WHERE reserve_date >= ? "; $sql .= " AND reserve_date < ? "; $sql .= " AND type = ? "; $sql .= " ORDER BY reserve_date; "; $_reserve_date = $this->db->getAll($sql, $param); $reserve_date = array(); foreach ($_reserve_date as $val) { $reserve_date[] = strtotime($val['reserve_date']); } unset($_reserve_date); // 定休日取得(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++; } // 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)) { // 定休日:プラン指定の曜日外 $_ary['class'] = 'holiday'; $_ary['status'] = 0; } else if (in_array($date, $holiday)) { // 定休日:指定された日付 $_ary['class'] = 'holiday'; $_ary['status'] = 0; } else if (($month == 7) && ($date == 4)) { // 定休日:独立記念日 $_ary['class'] = 'holiday'; $_ary['status'] = 0; } else if (($month == 12) && ($date == 25)) { // 定休日:クリスマス $_ary['class'] = 'holiday'; $_ary['status'] = 0; } else if (($month == 1) && ($date == 1)) { // 定休日:お正月 $_ary['class'] = 'holiday'; $_ary['status'] = 0; } else if ($_time < time()) { // 受付け終了 $_ary['class'] = 'finish'; $_ary['status'] = 0; } else { $_ary['class'] = ''; if ($_time < (time() + 10 * 24 * 60 * 60)) { // 10日以内(電話予約) $_ary['status'] = 2; // オンライン予約不可 for ($i = 0; $i < $waku; $i++) { $_hour_time = $_time + $hour + $min * $i; $_hour = date('G:i', $_hour_time); $_ary['time'][$_hour] = 1; if (!in_array($_hour, $times)) { // プラン指定の時間外 $_ary['time'][$_hour] = 0; } else { foreach ($reserve_date as $val) { if ($val == $_hour_time) { // 時間が埋まっている $_ary['time'][$_hour] = 0; } } } } } else { // 通常のカレンダー表示 $_ary['status'] = 1; // オンライン予約可 for ($i = 0; $i < $waku; $i++) { $_hour_time = $_time + $hour + $min * $i; $_hour = date('G:i', $_hour_time); $_ary['time'][$_hour] = 1; $_ary['query'][$_hour] = '&hope_date' . $hope . '=' . date('Y-m-d', $_hour_time) . '&hope_time' . $hope . '=' . $_hour; // 8時台で早朝オプション対象の場合は空き時間ステータスを2にする。 if ((date('G', $_hour_time) == 8) && in_array($this->plans['seq'], $this->early_list)) { $_ary['time'][$_hour] = 2; } // 9時で早朝オプション対象の場合は空き時間ステータスを2にする。 if ((date('G', $_hour_time) == 9) && (date('i', $_hour_time) == '00') && in_array($this->plans['seq'], $this->early_list)) { $_ary['time'][$_hour] = 2; } if (!in_array($_hour, $times)) { // プラン指定の時間外 $_ary['time'][$_hour] = 0; } else { foreach ($reserve_date as $val) { if ($val == $_hour_time) { // 時間が埋まっている $_ary['time'][$_hour] = 0; } } } } } } $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 defaultSetBeforeFilter () { parent::defaultSetBeforeFilter(); // 入力値をSESSIONに格納、SESSION値を各項目として代入 // 20170825 'shimei'追加 $_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', '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', 'privchk', 'shimei', 'hope_date1', 'hope_time1', 'hope_date2', 'hope_time2', 'hope_date3', 'hope_time3', 'plan', 'option', 'spa', 'spa_time', 'spa_num', 'siteid', 'agid', 'bouquet1', 'bouquet2', 'bouquet3', 'pregnancy', 'companion_adult', 'companion_child', 'bring', 'birthday1', 'birthday2', 'plu_option', 'plu_hope_date', 'plu_hope_time', 'plu_undecide', 'plu_salon', ); 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; } $this->flag1 = array(6, 7, 8, 9, 10, 11, 30); for ($i = 12; $i < 30; $i++) { $this->flag2[] = $i; } // if ($_SESSION['plan'] == 3) { // $_SESSION['plan'] = 39; // } // 最初からブーケ選び放題の付いているプラン $this->bouquet_plan = array(12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29); if (is_numeric($_SESSION['plan'])) { $_start_date = isset($this->hope_date1) ? $this->hope_date1 : 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']; } else { $_shimei_price = $_shimei['price2']; $_shimei_half_price = $_shimei['half_price2']; } $this->cameraman_list = array(); $this->cameraman_list[0]['name'] = '指名なし'; $this->cameraman_list[0]['url'] = ''; $this->cameraman_list[0]['price'] = 0; if ($_SESSION['plan'] != 104) { // 指名不可プラン $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_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_price; } $this->cameraman_list[23]['name'] = 'Daisuke'; $this->cameraman_list[23]['url'] = ''; $this->cameraman_list[23]['price'] = $_shimei_price; if ($_SESSION['plan'] != 101) { $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;*/ } } } $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']); } // 早朝オプション対象リスト $this->early_list = array(); $this->early_list[] = 67; // プルメリアサロン選択可能日 if (!empty($_SESSION['hope_date1']) && !empty($_SESSION['hope_time1'])) { $_year = date('Y', (strtotime($_SESSION['hope_date1'] . ' ' . $_SESSION['hope_time1']) - (8 * 24 * 60 * 60))); $_month = date('n', (strtotime($_SESSION['hope_date1'] . ' ' . $_SESSION['hope_time1']) - (8 * 24 * 60 * 60))) - 1; $_day = date('j', (strtotime($_SESSION['hope_date1'] . ' ' . $_SESSION['hope_time1']) - (8 * 24 * 60 * 60))); $this->plu_maxdate = $_year . ', ' . $_month . ', ' . $_day; } else { $this->plu_maxdate = date('Y, m, d'); } // ホテルリスト $_hotel_list = $this->db->getAll('select * from hotel ', array()); $this->hotel_list = array(); foreach ($_hotel_list as $key => $val) { $this->hotel_list[] = $val; } // 教会チャペル挙式 国内事前試着&お取り置きサービス $this->church_cmpg_list = array( 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, ); // キャンペーン許可変数 $this->church_cmpg_frag = false; $end = strtotime('2015-12-31 23:59:59'); $hope_time1 = strtotime($this->hope_date1); $hope_time2 = strtotime($this->hope_date2); $hope_time3 = strtotime($this->hope_date3); if ( ( (!empty($this->hope_date1) && ($hope_time1 < $end)) || (!empty($this->hope_date2) && ($hope_time2 < $end)) || (!empty($this->hope_date3) && ($hope_time3 < $end)) ) && (in_array($this->plan, $this->church_cmpg_list)) ) { $this->church_cmpg_frag = true; } // $this->cameraman = array( // 'name' => 'familyphoto', // 's_name' => 'familyphoto', // ); } /*---------------------------------------------------------- 税込計算 2017-09-01 ----------------------------------------------------------*/ function _taxCalculation($excluding_tax){ $including_tax = ""; foreach ($excluding_tax as $val){ if (is_array($val)){ foreach ($val as $val2){ $including_tax += taxInclude($val2); } } else { $including_tax += taxInclude($val); } } return $including_tax; } } $controller = new BeachController(); $controller->process(); exit;