絞り込み条件) private $expect_input_key = array( 'mode' => FALSE, // 検索種別 'page' => FALSE, // 改頁No 'cid' => FALSE, // 出演者コード 'lid' => FALSE, // レーベルコード ); private $products_list = array( array( 'product_id' => '526', 'image_path' => '/silkca_15001/silkca_15001_s.jpg', 'title' => '一徹カレンダー2014 サイン入り', 'price' => '2380', ), array( 'product_id' => '534', 'image_path' => '/silkca_14005/silkca_14005_s.jpg', 'title' => '月野カレンダー2014 サイン入り', 'price' => '2380', ), array( 'product_id' => '530', 'image_path' => '/silkca_14005/silkca_14005_s.jpg', 'title' => '月野カレンダー2014', 'price' => '2380', ), array( 'product_id' => '1150', 'image_path' => '/silkca_16004/silkca_16004_s.jpg', 'title' => '月野カレンダー2016 サイン入り', 'price' => '2500', ), array( 'product_id' => '1153', 'image_path' => '/silkca_16007/silkca_16007_s.jpg', 'title' => '有馬カレンダー2016 サイン入り', 'price' => '2500', ), array( 'product_id' => '1154', 'image_path' => '/silkca_16007/silkca_16007_s.jpg', 'title' => '有馬カレンダー2016 サイン入り +特典ブロマイド(有馬ver.)セット', 'price' => '3500', ), array( 'product_id' => '1141', 'image_path' => '/silkca_16004/silkca_16004_s.jpg', 'title' => '月野カレンダー2016', 'price' => '2500', ), array( 'product_id' => '1144', 'image_path' => '/silkca_16007/silkca_16007_s.jpg', 'title' => '有馬カレンダー2016', 'price' => '2500', ), array( 'product_id' => '11075', 'image_path' => '/silkca_17001/silkca_17001_s.jpg', 'title' => '一徹カレンダー2017 サイン入り', 'price' => '2500', ), array( 'product_id' => '11076', 'image_path' => '/silkca_17001/silkca_17001_s.jpg', 'title' => '一徹カレンダー2017 サイン入り +特典ブロマイド(一徹ver.)セット', 'price' => '3500', ), array( 'product_id' => '11077', 'image_path' => '/silkca_17001/silkca_17001_s.jpg', 'title' => '一徹カレンダー2017サイン入り+特典ブロマイド(一徹ver.) +特典DVD(一徹ver.)+ランダム封入特典セット', 'price' => '5000', ), array( 'product_id' => '11082', 'image_path' => '/silkca_17004/silkca_17004_s.jpg', 'title' => '月野カレンダー2017 サイン入り +特典ブロマイド(月野ver.)セット', 'price' => '3500', ), array( 'product_id' => '11083', 'image_path' => '/silkca_17004/silkca_17004_s.jpg', 'title' => '月野カレンダー2017  サイン入り+特典ブロマイド(月野ver.) +特典DVD(月野ver.)+ランダム封入特典セット', 'price' => '5000', ), array( 'product_id' => '11078', 'image_path' => '/silkca_17004/silkca_17004_s.jpg', 'title' => '月野カレンダー2017', 'price' => '3500', ), array( 'product_id' => '11087', 'image_path' => '/silkca_17007/silkca_17007_s.jpg', 'title' => '有馬カレンダー2017 サイン入り', 'price' => '2500', ), array( 'product_id' => '11088', 'image_path' => '/silkca_17007/silkca_17007_s.jpg', 'title' => '有馬カレンダー2017 サイン入り +特典ブロマイド(有馬ver.)セット', 'price' => '3500', ), array( 'product_id' => '11089', 'image_path' => '/silkca_17007/silkca_17007_s.jpg', 'title' => '有馬カレンダー2017  サイン入り+特典ブロマイド(有馬ver.) +特典DVD(有馬ver.)+ランダム封入特典セット', 'price' => '5000', ), array( 'product_id' => '11084', 'image_path' => '/silkca_17007/silkca_17007_s.jpg', 'title' => '有馬カレンダー2017', 'price' => '2500', ), array( 'product_id' => '11075', 'image_path' => '/silkca_17001/silkca_17001_s.jpg', 'title' => '一徹カレンダー2017 サイン入り', 'price' => '2500', ), array( 'product_id' => '11076', 'image_path' => '/silkca_17001/silkca_17001_s.jpg', 'title' => '一徹カレンダー2017 サイン入り +特典ブロマイド(一徹ver.)セット', 'price' => '3500', ), array( 'product_id' => '11077', 'image_path' => '/silkca_17001/silkca_17001_s.jpg', 'title' => '一徹カレンダー2017サイン入り+特典ブロマイド(一徹ver.) +特典DVD(一徹ver.)+ランダム封入特典セット', 'price' => '5000', ), array( 'product_id' => '11081', 'image_path' => '/silkca_17004/silkca_17004_s.jpg', 'title' => '月野カレンダー2017 サイン入り', 'price' => '2500', ), array( 'product_id' => '11082', 'image_path' => '/silkca_17004/silkca_17004_s.jpg', 'title' => '月野カレンダー2017 サイン入り +特典ブロマイド(月野ver.)セット', 'price' => '3500', ), array( 'product_id' => '11083', 'image_path' => '/silkca_17004/silkca_17004_s.jpg', 'title' => '月野カレンダー2017  サイン入り+特典ブロマイド(月野ver.) +特典DVD(月野ver.)+ランダム封入特典セット', 'price' => '', ), array( 'product_id' => '11087', 'image_path' => '/silkca_17007/silkca_17007_s.jpg', 'title' => '有馬カレンダー2017 サイン入り', 'price' => '2500', ), array( 'product_id' => '11088', 'image_path' => '/silkca_17007/silkca_17007_s.jpg', 'title' => '有馬カレンダー2017 サイン入り +特典ブロマイド(有馬ver.)セット', 'price' => '3500', ), array( 'product_id' => '11089', 'image_path' => '/silkca_17007/silkca_17007_s.jpg', 'title' => '有馬カレンダー2017  サイン入り+特典ブロマイド(有馬ver.) +特典DVD(有馬ver.)+ランダム封入特典セット', 'price' => '5000', ), ); /** * コンストラクタ * * @return void */ public function __construct() { parent::__construct(); } /** * メイン処理 * * @return void */ public function execute() { try { // リクエスト取得 $this->getRequest(); /* // リクエストデータチェック $this->validate($this->request); // エラー有無チェック if (is_array($this->error_data)) { // エラーメッセージを変数に格納 $search_err_msg = $this->error_data; } else { // 検索実行 if (isMobile() === true) { $limit = DCB_LIST_IMAGE_MAX_NUM_MB; } else if ($this->SiteUtil->f_site_type == SITES_TYPE_IOS || $this->SiteUtil->f_site_type == SITES_TYPE_ANDROID) { // スマホ処理 $limit = DCB_LIST_IMAGE_MAX_NUM_SP; } else { $limit = DCB_LIST_IMAGE_MAX_NUM; } $offset = $this->request['page'] - 1; if ($this->request['mode'] == 'labels') { $search_result = $this->Search->execLabelSearch($this->request['lid'], $limit, $offset); } elseif($this->request['mode'] == 'casts') { $search_result = $this->Search->execCastSearch($this->request['cid'], $limit, $offset); } elseif($this->request['mode'] == 'fanclub') { $search_result = $this->Search->execFanclubSearch($limit, $offset); } elseif($this->request['mode'] == 'event') { $search_result = $this->Search->execEventSearch($limit, $offset); } else { $search_result = $this->Search->execNormalSearch($limit, $offset); } // NEWアイコンチェック if ($search_result['cnt'] > 0) { foreach ($search_result['data'] as $key => $value) { if (strtotime($value['product_released']) > strtotime(date('Y-m-d 00:00:00')) - 30 * 86400) { $search_result['data'][$key]['is_new'] = true; } } } // 検索結果チェック if (count($search_result) == 0) { // 該当データが無い場合は、エラーメッセージを表示 $err = new bizException('ERR_DCB_SEARCH_NO_DATA'); $search_err_msg = array('name' => sprintf ($err->getMessage(), $this->request['word'])); } $pager_request = array(); if (isset($this->request['mode']) && $this->request['mode']) { $pager_request['mode'] = $this->request['mode']; } if (isset($this->request['lid']) && $this->request['lid']) { $pager_request['lid'] = $this->request['lid']; } if (isset($this->request['cid']) && $this->request['cid']) { $pager_request['cid'] = $this->request['cid']; } $pager_data = $this->getPager($search_result['cnt'], $limit, $this->request['page'], $pager_request); } */ // テンプレートデバックコード // $this->View->debug(); // テンプレート初期化 $this->displayInit($this->service); // テンプレートデータセット $this->setData(array ( // 'HEADER_OPTION' => $this->service, // 'HEADER_CSS_OPTION' => $this->service, // // 検索関連データ // 'SEARCH_DATA' => $this->request, // 'SEARCH_RESULT' => $search_result, // 'SEARCH_ERR' => $search_err_msg, // 'SEARCH_MODE' => $this->request['mode'], // 'PAGER' => $pager_data, // 'CURRENT_PAGE' => $this->request['page'], 'PRODUCTS' => $this->products_list, )); // テンプレート表示 // 判定 検索内容 // if ($this->request['mode'] == 'event') { // // イベントのお知らせ時 // $this->displayTpl('event_body.tpl'); // } else { // その他 $this->displayTpl(); // } } catch (bizException $ex) { $this->bizError($ex->getMessage()); } catch (Exception $ex) { $this->sysError($ex); } } ////////////////////////////////////////////////////////////////////// //////////////////////////// private method ////////////////////////// ////////////////////////////////////////////////////////////////////// /** * リクエスト取得 * * @author H.Kikuuchi * @return void */ private function getRequest() { // 入力値取得 foreach ($this->expect_input_key as $key => $is_multi) { // 判定 POST or GET if ($this->SiteUtil->request_method == 'POST') { $this->request[$key] = $_POST[$key]; } elseif ($this->SiteUtil->request_method == 'GET') { $this->request[$key] = rawurldecode($_GET[$key]); } // 複数指定 if (!is_array($this->request[$key]) && $is_multi === TRUE) { if ($this->request[$key] != '') { $this->request[$key] = explode('_' , $this->request[$key]); } } } $this->request['page'] = (!$this->request['page']) ? 1 : $this->request['page']; // 携帯対応 // Sessionパラメーターの混在回避 if (isMobile() === true) { if (strpos($this->request['mode'], '?') !== false) { $this->request['mode'] = str_replace(strstr($this->request['mode'], '?'), '', $this->request['mode']); } } } /** * チェック リクエスト * * @author H.Kikuuchi * @param array $data リクエスト * @return void */ private function validate($data) { // 入力値取得 foreach ($this->expect_input_key as $key => $is_multi) { if ($key == 'mode') { if ($this->request[$key] == '') { # $err = new bizException('ERR_DCB_SEARCH_KEYWORD_NO_PARAM'); # $this->error_data[] = $err->getMessage(); } else { $validate = $this->Validate->checkSearchKeyword($this->request[$key], 64); if ($validate['error']) { $err = new bizException('ERR_DCB_SEARCH_KEYWORD'.$validate['error']); $this->error_data[] = $err->getMessage(); $this->request[$key] = $validate['output']; } } } elseif ($this->request[$key] != '' || is_array($this->request[$key])) { try { $this->isNumeric($this->request[$key]); } catch (Exception $ex) { $this->error_data[] = $ex->getMessage(); } } } } /** * チェック 整数値? * * @author H.Kikuuchi * @param int or array $param * @return void */ private function isNumeric($params) { // 判定 配列かどうか if (is_array($params)) { foreach ($params as $one) { if (!preg_match("/^[0-9]+$/", $one)) { throw new bizException('ERR_DCB_LIST_VALIDATE'); } } } else { if (!preg_match("/^[0-9]+$/", $params)) { throw new bizException('ERR_DCB_LIST_VALIDATE'); } } } } ?>