Changeset 15292


Ignore:
Timestamp:
2007/08/16 18:36:42 (13 years ago)
Author:
nanasess
Message:

クラス化対応

Location:
branches/feature-module-update
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/html/admin/basis/tradelaw.php

    r15080 r15292  
    55 * http://www.lockon.co.jp/ 
    66 */ 
     7// {{{ requires 
    78require_once("../require.php"); 
     9require_once(CLASS_PATH . "page_extends/admin/basis/LC_Page_Admin_Basis_Tradelaw_Ex.php"); 
    810 
    9 class LC_Page { 
    10     var $arrSession; 
    11     var $tpl_mode; 
    12     function LC_Page() { 
    13         $this->tpl_mainpage = 'basis/tradelaw.tpl'; 
    14         $this->tpl_subnavi = 'basis/subnavi.tpl'; 
    15         $this->tpl_subno = 'tradelaw'; 
    16         $this->tpl_mainno = 'basis'; 
    17         global $arrPref; 
    18         $this->arrPref = $arrPref; 
    19         global $arrTAXRULE; 
    20         $this->arrTAXRULE = $arrTAXRULE; 
    21         $this->tpl_subtitle = '特定商取引法'; 
    22     } 
    23 } 
     11// }}} 
     12// {{{ generate page 
    2413 
    25 $conn = new SC_DBConn(); 
    26 $objPage = new LC_Page(); 
    27 $objView = new SC_AdminView(); 
    28 $objSess = new SC_Session(); 
    29 $objQuery = new SC_Query(); 
    30  
    31 // 認証可否の判定 
    32 sfIsSuccess($objSess); 
    33  
    34 // パラメータ管理クラス 
    35 $objFormParam = new SC_FormParam(); 
    36 // パラメータ情報の初期化 
    37 lfInitParam(); 
    38 // POST値の取得 
    39 $objFormParam->setParam($_POST); 
    40  
    41 $cnt = $objQuery->count("dtb_baseinfo"); 
    42  
    43 if ($cnt > 0) { 
    44     $objPage->tpl_mode = "update"; 
    45 } else { 
    46     $objPage->tpl_mode = "insert"; 
    47 } 
    48  
    49 if($_POST['mode'] != "") { 
    50     // 入力値の変換 
    51     $objFormParam->convParam(); 
    52     $objPage->arrErr = lfCheckError($arrRet); 
    53      
    54     if(count($objPage->arrErr) == 0) { 
    55         switch($_POST['mode']) { 
    56         case 'update': 
    57             lfUpdateData(); // 既存編集 
    58             break; 
    59         case 'insert': 
    60             lfInsertData(); // 新規作成 
    61             break; 
    62         default: 
    63             break; 
    64         } 
    65         // 再表示 
    66         //sfReload(); 
    67         $objPage->tpl_onload = "window.alert('特定商取引法の登録が完了しました。');"; 
    68     } 
    69 } else { 
    70     $arrCol = $objFormParam->getKeyList(); // キー名一覧を取得 
    71     $col    = sfGetCommaList($arrCol); 
    72     $arrRet = $objQuery->select($col, "dtb_baseinfo"); 
    73     // DB値の取得 
    74     $objFormParam->setParam($arrRet[0]); 
    75 } 
    76  
    77 $objPage->arrForm = $objFormParam->getFormParamList(); 
    78 $objView->assignobj($objPage); 
    79 $objView->display(MAIN_FRAME); 
    80 //-------------------------------------------------------------------------------------------------------------------------------------- 
    81 /* パラメータ情報の初期化 */ 
    82 function lfInitParam() { 
    83     global $objFormParam; 
    84     $objFormParam->addParam("販売業者", "law_company", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    85     $objFormParam->addParam("運営責任者", "law_manager", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    86     $objFormParam->addParam("郵便番号1", "law_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
    87     $objFormParam->addParam("郵便番号2", "law_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK")); 
    88     $objFormParam->addParam("都道府県", "law_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
    89     $objFormParam->addParam("住所1", "law_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    90     $objFormParam->addParam("住所2", "law_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    91     $objFormParam->addParam("電話番号1", "law_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    92     $objFormParam->addParam("電話番号2", "law_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    93     $objFormParam->addParam("電話番号3", "law_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    94     $objFormParam->addParam("FAX番号1", "law_fax01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    95     $objFormParam->addParam("FAX番号2", "law_fax02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    96     $objFormParam->addParam("FAX番号3", "law_fax03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); 
    97     $objFormParam->addParam("メールアドレス", "law_email", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "EMAIL_CHECK", "EMAIL_CHAR_CHECK")); 
    98     $objFormParam->addParam("URL", "law_url", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "URL_CHECK")); 
    99     $objFormParam->addParam("必要料金", "law_term01", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    100     $objFormParam->addParam("注文方法", "law_term02", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    101     $objFormParam->addParam("支払方法", "law_term03", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    102     $objFormParam->addParam("支払期限", "law_term04", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    103     $objFormParam->addParam("引き渡し時期", "law_term05", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    104     $objFormParam->addParam("返品・交換について", "law_term06", MTEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK")); 
    105 } 
    106  
    107 function lfUpdateData() { 
    108     global $objFormParam; 
    109     // 入力データを渡す。 
    110     $sqlval = $objFormParam->getHashArray(); 
    111     $sqlval['update_date'] = 'Now()'; 
    112     $objQuery = new SC_Query(); 
    113     // UPDATEの実行 
    114     $ret = $objQuery->update("dtb_baseinfo", $sqlval); 
    115 } 
    116  
    117 function lfInsertData() { 
    118     global $objFormParam; 
    119     // 入力データを渡す。 
    120     $sqlval = $objFormParam->getHashArray(); 
    121     $sqlval['update_date'] = 'Now()'; 
    122     $objQuery = new SC_Query(); 
    123     // INSERTの実行 
    124     $ret = $objQuery->insert("dtb_baseinfo", $sqlval); 
    125 } 
    126  
    127 /* 入力内容のチェック */ 
    128 function lfCheckError() { 
    129     global $objFormParam; 
    130     // 入力データを渡す。 
    131     $arrRet =  $objFormParam->getHashArray(); 
    132     $objErr = new SC_CheckError($arrRet); 
    133     $objErr->arrErr = $objFormParam->checkError(); 
    134      
    135     // 電話番号チェック 
    136     $objErr->doFunc(array("TEL", "law_tel01", "law_tel02", "law_tel03", TEL_ITEM_LEN), array("TEL_CHECK")); 
    137     $objErr->doFunc(array("FAX", "law_fax01", "law_fax02", "law_fax03", TEL_ITEM_LEN), array("TEL_CHECK")); 
    138     $objErr->doFunc(array("郵便番号", "law_zip01", "law_zip02"), array("ALL_EXIST_CHECK")); 
    139      
    140     return $objErr->arrErr; 
    141 } 
    142  
     14$objPage = new LC_Page_Admin_Basis_Tradelaw_Ex(); 
     15$objPage->init(); 
     16$objPage->process(); 
     17register_shutdown_function(array($objPage, "destroy")); 
    14318?> 
Note: See TracChangeset for help on using the changeset viewer.