Ignore:
Timestamp:
2007/08/21 17:36:52 (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/control.php

    r15080 r15336  
    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_Control_Ex.php"); 
    811 
    9 class LC_Page { 
    10     var $arrSession; 
    11     var $tpl_mode; 
    12     function LC_Page() { 
    13         $this->tpl_mainpage = 'basis/control.tpl'; 
    14         $this->tpl_subnavi = 'basis/subnavi.tpl'; 
    15         $this->tpl_mainno = 'basis'; 
    16         $this->tpl_subno = 'control'; 
    17         $this->tpl_subtitle = 'サイト管理設定'; 
    18     } 
    19 } 
    20 $conn = new SC_DBConn(); 
    21 $objPage = new LC_Page(); 
    22 $objView = new SC_AdminView(); 
    23 $objSess = new SC_Session(); 
     12// }}} 
     13// {{{ generate page 
    2414 
    25 // 認証可否の判定 
    26 sfIsSuccess($objSess); 
    27  
    28 // パラメータ管理クラス 
    29 $objFormParam = new SC_FormParam(); 
    30 // パラメータ情報の初期化 
    31 lfInitParam(); 
    32 // POST値の取得 
    33 $objFormParam->setParam($_POST); 
    34  
    35 switch($_POST['mode']) { 
    36     case 'edit': 
    37         // 入力値の変換 
    38         $objFormParam->convParam(); 
    39      
    40         // エラーチェック 
    41         $objPage->arrErr = lfCheckError(); 
    42         if(count($objPage->arrErr) == 0) { 
    43             lfSiteControlData($_POST['control_id']); 
    44             // javascript実行 
    45             $objPage->tpl_onload = "alert('更新が完了しました。');"; 
    46         } 
    47          
    48         break; 
    49     default: 
    50         break; 
    51 } 
    52  
    53 // サイト管理情報の取得 
    54 $arrSiteControlList = lfGetControlList(); 
    55  
    56 // プルダウンの作成 
    57 for ($i = 0; $i < count($arrSiteControlList); $i++) {    
    58     switch ($arrSiteControlList[$i]["control_id"]) { 
    59         // トラックバック 
    60         case SITE_CONTROL_TRACKBACK: 
    61             $arrSiteControlList[$i]["control_area"] = $arrSiteControlTrackBack; 
    62             break; 
    63         // アフィリエイト 
    64         case SITE_CONTROL_AFFILIATE: 
    65             $arrSiteControlList[$i]["control_area"] = $arrSiteControlAffiliate; 
    66             break; 
    67         default: 
    68             break; 
    69     } 
    70 } 
    71  
    72 $objPage->arrControlList = $arrSiteControlList; 
    73 $objView->assignobj($objPage); 
    74 $objView->display(MAIN_FRAME); 
    75 //----------------------------------------------------------------------------------------------------------------------------------- 
    76 // サイト管理情報の取得 
    77 function lfGetControlList() { 
    78     $objQuery = new SC_Query(); 
    79     // サイト管理情報の取得 
    80     $sql = "SELECT * FROM dtb_site_control "; 
    81     $sql .= "WHERE del_flg = 0"; 
    82     $arrRet = $objQuery->getall($sql); 
    83     return $arrRet; 
    84 } 
    85  
    86 /* パラメータ情報の初期化 */ 
    87 function lfInitParam() { 
    88     global $objFormParam; 
    89     $objFormParam->addParam("設定状況", "control_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    90 } 
    91  
    92 /* 入力内容のチェック */ 
    93 function lfCheckError() { 
    94     global $objFormParam; 
    95      
    96     // 入力データを渡す。 
    97     $arrRet =  $objFormParam->getHashArray(); 
    98     $objErr = new SC_CheckError($arrRet); 
    99     $objErr->arrErr = $objFormParam->checkError(); 
    100      
    101     return $objErr->arrErr; 
    102 } 
    103  
    104 /* DBへデータを登録する */ 
    105 function lfSiteControlData($control_id = "") { 
    106     global $objFormParam; 
    107      
    108     $objQuery = new SC_Query(); 
    109     $sqlval = $objFormParam->getHashArray();     
    110     $sqlval['update_date'] = 'Now()'; 
    111      
    112     // 新規登録 
    113     if($control_id == "") { 
    114         // INSERTの実行 
    115         //$sqlval['creator_id'] = $_SESSION['member_id']; 
    116         $sqlval['create_date'] = 'Now()'; 
    117         $objQuery->insert("dtb_site_control", $sqlval); 
    118     // 既存編集 
    119     } else { 
    120         $where = "control_id = ?"; 
    121         $objQuery->update("dtb_site_control", $sqlval, $where, array($control_id)); 
    122     } 
    123 } 
    124  
     15$objPage = new LC_Page_Admin_Basis_Control_Ex(); 
     16$objPage->init(); 
     17$objPage->process(); 
     18register_shutdown_function(array($objPage, "destroy")); 
    12519?> 
Note: See TracChangeset for help on using the changeset viewer.