source: branches/feature-module-update/html/admin/basis/control.php @ 15080

Revision 15080, 3.1 KB checked in by nanasess, 17 years ago (diff)

svn properties 設定

  • svn:mime-type - application/x-httpd-php; charset=UTF-8
  • svn:keywords - Id
  • Property svn:keywords set to Id
  • Property svn:mime-type set to application/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7require_once("../require.php");
8
9class 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();
24
25// 認証可否の判定
26sfIsSuccess($objSess);
27
28// パラメータ管理クラス
29$objFormParam = new SC_FormParam();
30// パラメータ情報の初期化
31lfInitParam();
32// POST値の取得
33$objFormParam->setParam($_POST);
34
35switch($_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// プルダウンの作成
57for ($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// サイト管理情報の取得
77function 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/* パラメータ情報の初期化 */
87function lfInitParam() {
88    global $objFormParam;
89    $objFormParam->addParam("設定状況", "control_flg", INT_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
90}
91
92/* 入力内容のチェック */
93function 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へデータを登録する */
105function 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
125?>
Note: See TracBrowser for help on using the repository browser.