source: branches/rel/html/admin/basis/control.php @ 12157

Revision 12157, 3.0 KB checked in by uehara, 16 years ago (diff)
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.