source: branches/comu/html/admin/basis/point.php @ 11730

Revision 11730, 2.6 KB checked in by nanasess, 17 years ago (diff)

r11729 の変更を取消

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.