Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Admin_Customer_SearchCustomer.php

Documentation is available at LC_Page_Admin_Customer_SearchCustomer.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once(CLASS_PATH "pages/LC_Page.php");
  26.  
  27. /**
  28.  * Admin_Customer_SearchCustomer のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id$
  33.  */
  34. {
  35.  
  36.     // }}}
  37.     // {{{ functions
  38.  
  39.     /**
  40.      * Page を初期化する.
  41.      *
  42.      * @return void 
  43.      */
  44.     function init()
  45.     {
  46.         parent::init();
  47.         $this->tpl_mainpage = 'customer/search_customer.tpl';
  48.     }
  49.  
  50.     /**
  51.      * Page のプロセス.
  52.      *
  53.      * @return void 
  54.      */
  55.     function process()
  56.     {
  57.         // 認証可否の判定
  58.         $objSess new SC_Session();
  59.         SC_Utils_Ex::sfIsSuccess($objSess);
  60.  
  61.         $objView new SC_AdminView();
  62.         // POSTのモードがsearchなら顧客検索開始
  63.         if($_POST['mode'== 'search'){
  64.             $this->objFormParam new SC_FormParam();
  65.             // 値の初期化
  66.             $this->lfInitParam();
  67.             // POST値の取得
  68.             $this->objFormParam->setParam($_POST);
  69.             // 入力値の変換
  70.             $this->objFormParam->convParam();
  71.  
  72.             // 入力された値を取得する
  73.             $arrForm $this->objFormParam->getHashArray();
  74.  
  75.             // エラーチェック
  76.             $this->arrErr $this->lfCheckError();
  77.             ifis_array($this->arrErr=== true && count($this->arrErr) ){
  78.                 $is_select false;
  79.             }else{
  80.                 $where "del_flg = 0";
  81.  
  82.                 // 検索
  83.                 foreach($arrForm as $tmp_key => $val){
  84.                     ifis_array($val=== false && strlen($val)){
  85.                         $key strtr($tmp_key array('search_' => ''));
  86.                         switch($key){
  87.                             case 'customer_id':
  88.                                 $where .= " AND customer_id = ? ";
  89.                                 $sqlval[$key$val;
  90.                                 break;
  91.                             case 'name01':
  92.                                     $where .= " AND name01 ILIKE ? ";
  93.                                     $sqlval[$key'%'.$val.'%';
  94.                                 break;
  95.                             case 'name02':
  96.                                     $where .= " AND name02 ILIKE ? ";
  97.                                     $sqlval[$key'%'.$val.'%';
  98.                                 break;
  99.                             case 'kana01':
  100.                                     $where .= " AND kana01 ILIKE ? ";
  101.                                     $sqlval[$key'%'.$val.'%';
  102.                                 break;
  103.                             case 'kana02':
  104.                                     $where .= " AND kana02 ILIKE ? ";
  105.                                     $sqlval[$key'%'.$val.'%';
  106.                                 break;
  107.                             default :
  108.                                 break;
  109.                         }
  110.                     }
  111.                 }
  112.  
  113.                 $is_select true;
  114.             }
  115.  
  116.  
  117.             if$is_select === true ){
  118.                 $objQuery new SC_Query();
  119.  
  120.                 // 既に購入した事がある顧客を取得
  121.                 $col '*';
  122.                 $from 'dtb_customer';
  123.                 $order 'customer_id';
  124.                 $arrCustomer $objQuery->select($col$from$where$sqlval);
  125.  
  126.                 // 顧客情報を取得できたら、テンプレートに
  127.                 ifis_array($arrCustomer=== true && count($arrCustomer0){
  128.                     $customer_count count($arrCustomer);
  129.                     if$customer_count != ){
  130.                         $this->tpl_linemax $customer_count;
  131.                     }
  132.                 else {
  133.                     $this->tpl_linemax null;
  134.                 }
  135.  
  136.                 // ページ送りの処理
  137.                 if(isset($_POST['search_page_max'])
  138.                    && is_numeric($_POST['search_page_max'])) {
  139.                     $page_max $_POST['search_page_max'];
  140.                 else {
  141.                     $page_max SEARCH_PMAX;
  142.                 }
  143.  
  144.                 // ページ送りの取得
  145.                 $objNavi new SC_PageNavi($_POST['search_pageno']$customer_count$page_max"fnNaviSearchOnlyPage"NAVI_PMAX);
  146.                 $this->tpl_strnavi $objNavi->strnavi;      // 表示文字列
  147.                 $startno $objNavi->start_row;
  148.  
  149.                 // 取得範囲の指定(開始行番号、行数のセット)
  150.                 $objQuery->setLimitOffset($page_max$startno);
  151.                 // 表示順序
  152.                 $objQuery->setOrder($order);
  153.                 // 検索結果の取得
  154.                 $this->arrCustomer $objQuery->select($col$from$where$sqlval);
  155.             }
  156.  
  157.         }
  158.         // 画面の表示
  159.         $this->arrForm $arrForm;
  160.         $objView->assignobj($this);
  161.         $objView->display($this->tpl_mainpage);
  162.     }
  163.  
  164.     /**
  165.      * デストラクタ.
  166.      *
  167.      * @return void 
  168.      */
  169.     function destroy()
  170.     {
  171.         parent::destroy();
  172.     }
  173.  
  174.     /* パラメータ情報の初期化 */
  175.     function lfInitParam({
  176.         $this->objFormParam->addParam("顧客ID""search_customer_id"INT_LEN"n"array("NUM_CHECK""MAX_LENGTH_CHECK"));
  177.         $this->objFormParam->addParam("顧客名(姓)""search_name01"STEXT_LEN"aKV"array("NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  178.         $this->objFormParam->addParam("顧客名(名)""search_name02"STEXT_LEN"aKV"array("NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  179.         $this->objFormParam->addParam("顧客名(カナ)"'search_kana01'STEXT_LEN"CKV"array("NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  180.         $this->objFormParam->addParam("顧客名(カナ/名)"'search_kana02'STEXT_LEN"CKV"array("NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  181.     }
  182.  
  183.     /* 入力内容のチェック */
  184.     function lfCheckError({
  185.         // 入力データを渡す。
  186.         $arrRet =  $this->objFormParam->getHashArray();
  187.         $objErr new SC_CheckError($arrRet);
  188.         $objErr->arrErr $this->objFormParam->checkError();
  189.  
  190.         return $objErr->arrErr;
  191.     }
  192. }
  193. ?>

Documentation generated on Fri, 24 Feb 2012 13:58:40 +0900 by Seasoft