source: temp/trunk/html/admin/basis/point.php @ 1949

Revision 1949, 2.5 KB checked in by kakinaka, 20 years ago (diff)

blank

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2
3require_once("../require.php");
4
5class LC_Page {
6    var $arrSession;
7    var $tpl_mode;
8    function LC_Page() {
9        $this->tpl_mainpage = 'basis/point.tpl';
10        $this->tpl_subnavi = 'basis/subnavi.tpl';
11        $this->tpl_subno = 'point';
12        $this->tpl_mainno = 'basis';
13        $this->tpl_subtitle = '¥Ý¥¤¥ó¥ÈÀßÄê';
14    }
15}
16
17$conn = new SC_DBConn();
18$objPage = new LC_Page();
19$objView = new SC_AdminView();
20$objSess = new SC_Session();
21$objQuery = new SC_Query();
22
23// ǧ¾Ú²ÄÈݤÎȽÄê
24sfIsSuccess($objSess);
25
26// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
27$objFormParam = new SC_FormParam();
28// ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½
29lfInitParam();
30// POSTÃͤμèÆÀ
31$objFormParam->setParam($_POST);
32
33$cnt = $objQuery->count("dtb_baseinfo");
34
35if ($cnt > 0) {
36    $objPage->tpl_mode = "update";
37} else {
38    $objPage->tpl_mode = "insert";
39}
40
41if($_POST['mode'] != "") {
42    // ÆþÎÏÃͤÎÊÑ´¹
43    $objFormParam->convParam();
44    $objPage->arrErr = $objFormParam->checkError();
45   
46    if(count($objPage->arrErr) == 0) {
47        switch($_POST['mode']) {
48        case 'update':
49            lfUpdateData(); // ´û¸ÊÔ½¸
50            break;
51        case 'insert':
52            lfInsertData(); // ¿·µ¬ºîÀ®
53            break;
54        default:
55            break;
56        }
57        // ºÆÉ½¼¨
58        //sfReload();
59        $objPage->tpl_onload = "window.alert('¥Ý¥¤¥ó¥ÈÀßÄ꤬´°Î»¤·¤Þ¤·¤¿¡£');";
60    }
61} else {
62    $arrCol = $objFormParam->getKeyList(); // ¥­¡¼Ì¾°ìÍ÷¤ò¼èÆÀ
63    $col    = sfGetCommaList($arrCol);
64    $arrRet = $objQuery->select($col, "dtb_baseinfo");
65    // POSTÃͤμèÆÀ
66    $objFormParam->setParam($arrRet[0]);
67}
68
69$objPage->arrForm = $objFormParam->getFormParamList();
70$objView->assignobj($objPage);
71$objView->display(MAIN_FRAME);
72//--------------------------------------------------------------------------------------------------------------------------------------
73/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
74function lfInitParam() {
75    global $objFormParam;
76    $objFormParam->addParam("¥Ý¥¤¥ó¥ÈÉÕͿΨ", "point_rate", PERCENTAGE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
77    $objFormParam->addParam("²ñ°÷ÅÐÏ¿»þÉÕÍ¿¥Ý¥¤¥ó¥È", "welcome_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
78}
79
80function lfUpdateData() {
81    global $objFormParam;
82    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£
83    $sqlval = $objFormParam->getHashArray();
84    $sqlval['update_date'] = 'Now()';
85    $objQuery = new SC_Query();
86    // UPDATE¤Î¼Â¹Ô
87    $ret = $objQuery->update("dtb_baseinfo", $sqlval);
88}
89
90function lfInsertData() {
91    global $objFormParam;
92    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£
93    $sqlval = $objFormParam->getHashArray();
94    $sqlval['update_date'] = 'Now()';
95    $objQuery = new SC_Query();
96    // INSERT¤Î¼Â¹Ô
97    $ret = $objQuery->insert("dtb_baseinfo", $sqlval);
98}
99
Note: See TracBrowser for help on using the repository browser.