00001 <?php
00002 require_once('PageHeader.php');
00003
00007 class AirTicketSearchPageHeader extends PageHeader {
00008
00014 private static $SORT_BY_OPTIONS = array (
00015 "" => "指定なし",
00016 "minprice" => "価格の安い順",
00017 "maxprice" => "価格の高い順"
00018 );
00019
00021 protected $dept_aprt_cd = null;
00022
00024 protected $region_cd = null;
00025
00027 protected $ctry_cd = null;
00028
00030 protected $trip_type = 1;
00031
00033 protected $open_ticket = null;
00034
00036 protected $direct_flight = null;
00037
00039 protected $online_book = null;
00040
00042 protected $mile = null;
00043
00049 public function __construct($fileName) {
00050 parent::__construct($fileName);
00051
00052 if (array_key_exists('dept_aprt_cd',$_GET) && $_GET['dept_aprt_cd'] != '') {
00053 $this->dept_aprt_cd = $_GET['dept_aprt_cd'];
00054 }
00055
00056 if (array_key_exists('region_cd',$_GET) && $_GET['region_cd'] != '') {
00057 $this->region_cd = $_GET['region_cd'];
00058 }
00059
00060 if (array_key_exists('ctry_cd',$_GET) && $_GET['ctry_cd'] != '') {
00061 $this->ctry_cd = $_GET['ctry_cd'];
00062 }
00063
00064 if (array_key_exists('trip_type',$_GET) && is_numeric($_GET['trip_type'])) {
00065 $this->trip_type = $_GET['trip_type'];
00066 }
00067
00068 if (array_key_exists('online_book',$_GET) && $_GET['online_book'] != '') {
00069 $this->online_book = $_GET['online_book'];
00070 }
00071
00072 if (array_key_exists('direct_flight',$_GET) && $_GET['direct_flight'] != '') {
00073 $this->direct_flight = $_GET['direct_flight'];
00074 }
00075
00076 if (array_key_exists('open_ticket',$_GET) && $_GET['open_ticket'] != '') {
00077 $this->open_ticket = $_GET['open_ticket'];
00078 }
00079
00080 if (array_key_exists('mile',$_GET) && $_GET['mile'] != '') {
00081 $this->mile = $_GET['mile'];
00082 }
00083 }
00084
00091 public function assignParams($airTicket) {
00092 parent::assignParams($airTicket);
00093
00094 if ($this->dept_aprt_cd) {
00095 $airTicket->setParam('dept_aprt_cd', $this->dept_aprt_cd);
00096 }
00097
00098 if ($this->region_cd) {
00099 $airTicket->setParam('region_cd', $this->region_cd);
00100 }
00101
00102 if ($this->ctry_cd) {
00103 $airTicket->setParam('ctry_cd', $this->ctry_cd);
00104 }
00105
00106
00107 if ($this->trip_type && $this->trip_type == 2) {
00108 $airTicket->setParam('ticket_type_cd', '4');
00109 }
00110
00111 if ($this->open_ticket) {
00112 $airTicket->setParam('ticket_kodawari', 'openjaw');
00113 }
00114
00115 if ($this->online_book) {
00116 $airTicket->setParam('ticket_kodawari', 'online_book');
00117 }
00118
00119 if ($this->mile) {
00120 $airTicket->setParam('ticket_kodawari', 'mile');
00121 }
00122
00123 if ($this->direct_flight) {
00124 $airTicket->setParam('ticket_kodawari', 'direct');
00125 }
00126 }
00127
00133 protected function isAdvancedSearchOptionOn() {
00134 return $this->online_book || $this->direct_flight
00135 || $this->open_ticket || $this->mile
00136 || $this->sort_by;
00137 }
00138
00144 protected function getSortByOptions() {
00145 return self::$SORT_BY_OPTIONS;
00146 }
00147
00154 protected function renderDepartureAirport($itemHtml) {
00155 $itemHtml = str_replace('${DEPARTURE_AIRPORT}',
00156 $this->dept_aprt_cd? htmlspecialchars($this->dept_aprt_cd) : '', $itemHtml);
00157
00158 return $itemHtml;
00159 }
00160
00167 protected function renderTripType($itemHtml) {
00168 $itemHtml = str_replace('${BOTH_WAY_STATUS}',$this->trip_type == 1 ? 'checked' : '',$itemHtml);
00169 $itemHtml = str_replace('${ONE_WAY_STATUS}',$this->trip_type == 2 ? 'checked' : '',$itemHtml);
00170
00171 return $itemHtml;
00172 }
00173
00180 protected function renderKodawariOptions($itemHtml) {
00181 $itemHtml = str_replace('${ONLINE_BOOK}',$this->online_book?'checked':'',$itemHtml);
00182 $itemHtml = str_replace('${DIRECT_FLIGHT}',$this->direct_flight?'checked':'',$itemHtml);
00183 $itemHtml = str_replace('${OPEN_TICKET}',$this->open_ticket?'checked':'',$itemHtml);
00184 $itemHtml = str_replace('${MILE}',$this->mile?'checked':'',$itemHtml);
00185
00186 return $itemHtml;
00187 }
00188
00194 protected function render() {
00195 global $_GET;
00196
00197
00198
00199
00200 $itemHtml = $this->view;
00201
00202 $itemHtml = $this->renderDepartureAirport($itemHtml);
00203 $itemHtml = $this->renderRegion($itemHtml, $this->region_cd);
00204 $itemHtml = $this->renderCountry($itemHtml, $this->region_cd, $this->ctry_cd, '国・地域', array('JP'));
00205 $itemHtml = $this->renderCityByCountry($itemHtml, $this->ctry_cd, $this->city_cd);
00206 $itemHtml = $this->renderLocationCodes($itemHtml);
00207
00208 $itemHtml = $this->renderTripType($itemHtml);
00209 $itemHtml = $this->renderKodawariOptions($itemHtml);
00210 $itemHtml = $this->renderSortBy($itemHtml);
00211 $itemHtml = $this->renderSortOrder($itemHtml);
00212 $itemHtml = $this->renderFlippering($itemHtml);
00213
00214 return $itemHtml;
00215 }
00216 }
00217 ?>