source: branches/feature-module-gmo-pg/data/downloads/module/mdl_gmo-pg/mdl_gmo-pg.php @ 16179

Revision 16179, 4.4 KB checked in by naka, 15 years ago (diff)
Line 
1<?php
2/**
3 *
4 * @copyright    2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: 1.0 2006-06-04 06:38:01Z kakinaka $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9require_once(MODULE_PATH . "mdl_gmo-pg/mdl_gmo-pg.inc");
10
11//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
12class LC_Page {
13    //¥³¥ó¥¹¥È¥é¥¯¥¿
14    function LC_Page() {
15        //¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
16        $this->tpl_mainpage = MODULE_PATH . 'mdl_gmo-pg/mdl_gmo-pg.tpl';
17        $this->tpl_subtitle = '¥Ú¥¤¥á¥ó¥È¥²¡¼¥È¥¦¥§¥¤·èºÑ¥â¥¸¥å¡¼¥ë';
18    }
19}
20$objPage = new LC_Page();
21$objView = new SC_AdminView();
22$objQuery = new SC_Query();
23
24// ǧ¾Ú³Îǧ
25$objSess = new SC_Session();
26sfIsSuccess($objSess);
27
28// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
29$objFormParam = new SC_FormParam();
30$objFormParam = lfInitParam($objFormParam);
31// POSTÃͤμèÆÀ
32$objFormParam->setParam($_POST);
33
34// ÈÆÍѹàÌܤòÄɲÃ(ɬ¿Ü¡ª¡ª)
35sfAlterMemo();
36
37sfPrintR($_POST);
38
39switch($_POST['mode']) {
40case 'edit':
41    // ÆþÎÏ¥¨¥é¡¼È½Äê
42    $objPage->arrErr = lfCheckError();
43   
44    // ¥¨¥é¡¼¤Ê¤·¤Î¾ì¹ç¤Ë¤Ï¥Ç¡¼¥¿¤ò¹¹¿·   
45    if(count($objPage->arrErr) == 0) {
46        // ¥Ç¡¼¥¿¹¹¿·
47        lfUpdPaymentDB();
48       
49        // javascript¼Â¹Ô
50        $objPage->tpl_onload = 'alert("ÅÐÏ¿´°Î»¤·¤Þ¤·¤¿¡£\n´ðËܾðÊó¡ä»ÙʧÊýË¡ÀßÄê¤è¤ê¾ÜºÙÀßÄê¤ò¤·¤Æ¤¯¤À¤µ¤¤¡£"); window.close();';
51    }
52    break;
53case 'module_del':
54    // ÈÆÍѹàÌܤθºß¥Á¥§¥Ã¥¯
55    if(sfColumnExists("dtb_payment", "memo01")){
56        // ¥Ç¡¼¥¿¤Îºï½ü¥Õ¥é¥°¤ò¤¿¤Æ¤ë
57        $objQuery->query("UPDATE dtb_payment SET del_flg = 1 WHERE module_id = ?", array(MDL_GMOPG_ID));
58    }
59    break;
60default:
61    // ¥Ç¡¼¥¿¤Î¥í¡¼¥É
62    lfLoadData();   
63    break;
64}
65
66$objPage->arrForm = $objFormParam->getFormParamList();
67
68$objView->assignobj($objPage);                    //ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
69$objView->display($objPage->tpl_mainpage);        //¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
70//-------------------------------------------------------------------------------------------------------
71/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
72function lfInitParam($objFormParam) {
73    /* Ⱦ³Ñ±Ñ¿ô»ú13 ·å°ÊÆâ */
74    $objFormParam->addParam("¥·¥ç¥Ã¥×IP", "gmo_shopid", 13, "KVa", array("EXIST_CHECK", "ALNUM_CHECK", "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
75    /* Ⱦ³Ñ±Ñ¿ô»ú10 ·å°ÊÆâ */
76    $objFormParam->addParam("¥·¥ç¥Ã¥×¥Ñ¥¹¥ï¡¼¥É ", "gmo_shoppass", 10, "KVa", array("EXIST_CHECK", "ALNUM_CHECK",  "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
77    /* Ⱦ³Ñ±Ñ¿ô»ú10 ·å°ÊÆâ */
78    $objFormParam->addParam("ŹÊÞ´ÉÍýÈÖ¹æ", "gmo_tenantno", 10, "KVa", array("EXIST_CHECK", "ALNUM_CHECK",  "MAX_LENGTH_CHECK", "SPTAB_CHECK"));
79    return $objFormParam;
80}
81
82// ¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
83function lfCheckError(){
84    global $objFormParam;
85   
86    $arrErr = $objFormParam->checkError();
87   
88    return $arrErr;
89}
90
91// ÅÐÏ¿¥Ç¡¼¥¿¤òÆɤ߹þ¤à
92function lfLoadData(){
93    global $objFormParam;
94   
95    //¥Ç¡¼¥¿¤ò¼èÆÀ
96    $arrRet = sfGetPaymentDB("AND del_flg = '0'");
97   
98    // Ãͤò¥»¥Ã¥È
99    $objFormParam->setParam($arrRet[0]);
100
101    // ²èÌÌɽ¼¨ÍѤ˥ǡ¼¥¿¤òÊÑ´¹
102    $arrDisp = array();
103    $arrDisp = $arrRet[0];
104    if (!empty($arrDisp["pc_send"])) $arrDisp["pc"] = 1;
105    if (!empty($arrDisp["mobile_send"])) $arrDisp["mobile"] = 1;
106    $objFormParam->setParam($arrDisp);
107}
108
109// ¥Ç¡¼¥¿¤Î¹¹¿·½èÍý
110function lfUpdPaymentDB(){
111    global $objQuery;
112    global $objSess;
113
114    // del_flg¤òºï½ü¤Ë¤·¤Æ¤ª¤¯
115    $del_sql = "UPDATE dtb_payment SET del_flg = 1 WHERE module_id = ? ";
116    $objQuery->query($del_sql, array(MDL_GMOPG_ID));
117
118    // ¥Ç¡¼¥¿ÅÐÏ¿
119    $arrData = array();   
120    $arrData["payment_method"] = "¥Ú¥¤¥á¥ó¥È¥²¡¼¥È¥¦¥§¥¤¥¯¥ì¥¸¥Ã¥È";
121    $arrData["fix"] = 3;
122    $arrData["module_id"] = MDL_GMOPG_ID;
123    $arrData["module_path"] = MODULE_PATH . "mdl_gmo-pg/gmo-pg_credit.php";
124    $arrData["memo01"] = $_POST["gmo_shopid"];
125    $arrData["memo02"] = $_POST["gmo_shoppass"];
126    $arrData["memo03"] = $_POST["gmo_tenantno"];
127    $arrData["memo04"] = "";
128    $arrData["memo05"] = "";
129    $arrData["del_flg"] = "0";
130    $arrData["creator_id"] = $objSess->member_id;
131    $arrData["update_date"] = "now()";
132   
133    // ¥é¥ó¥¯¤ÎºÇÂçÃͤò¼èÆÀ¤¹¤ë
134    $max_rank = $objQuery->getone("SELECT max(rank) FROM dtb_payment");
135    $arrData['rank'] = $max_rank;
136   
137    sfPrintR($arrData);
138   
139    // ¹¹¿·¥Ç¡¼¥¿¤¬¤¢¤ì¤Ð¹¹¿·¤¹¤ë¡£
140    if(count($arrData) > 0){
141        // »ÙʧÊýË¡¥Ç¡¼¥¿¤ò¼èÆÀ
142        $arrPaymentData = lfGetPaymentDB();     
143        // ¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ì¤ÐUPDATE¡¢Ìµ¤±¤ì¤ÐINSERT
144        if(count($arrPaymentData) > 0){
145            $objQuery->update("dtb_payment", $arrData, " module_id = '" . MDL_GMOPG_ID . "'");
146        }else{
147            $objQuery->insert("dtb_payment", $arrData);
148        }
149    }
150}
151?>
Note: See TracBrowser for help on using the repository browser.