source: branches/feature-module-update/html/admin/basis/point.php @ 15079

Revision 15079, 2.7 KB checked in by nanasess, 17 years ago (diff)

svn:mime-type application/x-httpd-php; charset=UTF-8 設定

  • 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/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}
20
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();
26
27// 認証可否の判定
28sfIsSuccess($objSess);
29
30// パラメータ管理クラス
31$objFormParam = new SC_FormParam();
32// パラメータ情報の初期化
33lfInitParam();
34// POST値の取得
35$objFormParam->setParam($_POST);
36
37$cnt = $objQuery->count("dtb_baseinfo");
38
39if ($cnt > 0) {
40    $objPage->tpl_mode = "update";
41} else {
42    $objPage->tpl_mode = "insert";
43}
44
45if($_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/* パラメータ情報の初期化 */
78function 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
84function 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
94function 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 TracBrowser for help on using the repository browser.