Changeset 15307


Ignore:
Timestamp:
2007/08/17 18:52:09 (17 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/point.php

    r15080 r15307  
    55 * http://www.lockon.co.jp/ 
    66 */ 
     7 
     8// {{{ requires 
    79require_once("../require.php"); 
     10require_once(CLASS_PATH . "page_extends/admin/basis/LC_Page_Admin_Basis_Point_Ex.php"); 
    811 
    9 class LC_Page { 
    10     var $arrSession; 
    11     var $tpl_mode; 
    12     function LC_Page() { 
    13         $this->tpl_mainpage = 'basis/point.tpl'; 
    14         $this->tpl_subnavi = 'basis/subnavi.tpl'; 
    15         $this->tpl_subno = 'point'; 
    16         $this->tpl_mainno = 'basis'; 
    17         $this->tpl_subtitle = 'ポイント設定'; 
    18     } 
    19 } 
     12// }}} 
     13// {{{ generate page 
    2014 
    21 $conn = new SC_DBConn(); 
    22 $objPage = new LC_Page(); 
    23 $objView = new SC_AdminView(); 
    24 $objSess = new SC_Session(); 
    25 $objQuery = new SC_Query(); 
     15$objPage = new LC_Page_Admin_Basis_Point_Ex(); 
     16$objPage->init(); 
     17$objPage->process(); 
     18register_shutdown_function(array($objPage, "destroy")); 
     19?> 
    2620 
    27 // 認証可否の判定 
    28 sfIsSuccess($objSess); 
    29  
    30 // パラメータ管理クラス 
    31 $objFormParam = new SC_FormParam(); 
    32 // パラメータ情報の初期化 
    33 lfInitParam(); 
    34 // POST値の取得 
    35 $objFormParam->setParam($_POST); 
    36  
    37 $cnt = $objQuery->count("dtb_baseinfo"); 
    38  
    39 if ($cnt > 0) { 
    40     $objPage->tpl_mode = "update"; 
    41 } else { 
    42     $objPage->tpl_mode = "insert"; 
    43 } 
    44  
    45 if($_POST['mode'] != "") { 
    46     // 入力値の変換 
    47     $objFormParam->convParam(); 
    48     $objPage->arrErr = $objFormParam->checkError(); 
    49      
    50     if(count($objPage->arrErr) == 0) { 
    51         switch($_POST['mode']) { 
    52         case 'update': 
    53             lfUpdateData(); // 既存編集 
    54             break; 
    55         case 'insert': 
    56             lfInsertData(); // 新規作成 
    57             break; 
    58         default: 
    59             break; 
    60         } 
    61         // 再表示 
    62         //sfReload(); 
    63         $objPage->tpl_onload = "window.alert('ポイント設定が完了しました。');"; 
    64     } 
    65 } else { 
    66     $arrCol = $objFormParam->getKeyList(); // キー名一覧を取得 
    67     $col    = sfGetCommaList($arrCol); 
    68     $arrRet = $objQuery->select($col, "dtb_baseinfo"); 
    69     // POST値の取得 
    70     $objFormParam->setParam($arrRet[0]); 
    71 } 
    72  
    73 $objPage->arrForm = $objFormParam->getFormParamList(); 
    74 $objView->assignobj($objPage); 
    75 $objView->display(MAIN_FRAME); 
    76 //-------------------------------------------------------------------------------------------------------------------------------------- 
    77 /* パラメータ情報の初期化 */ 
    78 function lfInitParam() { 
    79     global $objFormParam; 
    80     $objFormParam->addParam("ポイント付与率", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
    81     $objFormParam->addParam("会員登録時付与ポイント", "welcome_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 
    82 } 
    83  
    84 function lfUpdateData() { 
    85     global $objFormParam; 
    86     // 入力データを渡す。 
    87     $sqlval = $objFormParam->getHashArray(); 
    88     $sqlval['update_date'] = 'Now()'; 
    89     $objQuery = new SC_Query(); 
    90     // UPDATEの実行 
    91     $ret = $objQuery->update("dtb_baseinfo", $sqlval); 
    92 } 
    93  
    94 function lfInsertData() { 
    95     global $objFormParam; 
    96     // 入力データを渡す。 
    97     $sqlval = $objFormParam->getHashArray(); 
    98     $sqlval['update_date'] = 'Now()'; 
    99     $objQuery = new SC_Query(); 
    100     // INSERTの実行 
    101     $ret = $objQuery->insert("dtb_baseinfo", $sqlval); 
    102 } 
    103  
Note: See TracChangeset for help on using the changeset viewer.