source: branches/dev/data/downloads/module/mdl_ebis_tag/ebis_tag.php @ 15058

Revision 15058, 7.1 KB checked in by adati, 14 years ago (diff)
Line 
1<?php
2/**
3 *
4 * @copyright   2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: ebis_tag.php,v 1.30 2007/07/18 04:02:40 adachi Exp $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9
10//require_once("./require.php");
11//require_once MODULE_PATH . 'ebis_tag_conf.php';
12
13// ǧ¾Ú³Îǧ
14$objSess = new SC_Session();
15sfIsSuccess($objSess);
16
17//¥Ú¡¼¥¸´ÉÍý¥¯¥é¥¹
18class LC_Page {
19    //¥³¥ó¥¹¥È¥é¥¯¥¿
20    function LC_Page() {
21        //¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
22        $this->tpl_mainpage  = MODULE_PATH . 'mdl_ebis_tag/ebis_tag.tpl';
23        $this->tpl_subtitle  = 'EBiS¥¿¥°Ëä¤á¹þ¤ßµ¡Ç½';
24        $this->tpl_uniqid    = '';
25       
26        global $arrEBiSTagCustomerId;
27        $this->arrEBiSTagCustomerId = $arrEBiSTagCustomerId;
28        global $arrEBiSTagPayment;
29        $this->arrEBiSTagPayment = $arrEBiSTagPayment;
30        global $arrEBiSTagOptions;
31        $this->arrEBiSTagOptions = $arrEBiSTagOptions;
32    }
33}
34
35$objPage = new LC_Page();
36$objView = new SC_AdminView();
37
38// ¥Ñ¥é¥á¡¼¥¿´ÉÍý¥¯¥é¥¹
39$objFormParam = new SC_FormParam();
40$objFormParam = lfInitParam($objFormParam);
41// POSTÃͤμèÆÀ
42$objFormParam->setParam($_POST);
43
44switch($_POST['mode']) {
45case 'edit':
46    // ²èÌÌÁ«°Ü¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
47    //if (sfIsValidTransition($objSess) == false) {
48    //    sfDispError(INVALID_MOVE_ERRORR);
49    //}
50   
51    // ÆþÎÏ¥¨¥é¡¼È½Äê
52    $objPage->arrErr = $objFormParam->checkError();
53    if(count($objPage->arrErr) == 0) {
54        $arrRet = $objFormParam->getHashArray();
55        $sqlval['sub_data'] = serialize($arrRet);
56        $objQuery = new SC_Query();
57        $objQuery->update("dtb_module", $sqlval, "module_id = ?", array(EBIS_TAG_MID));
58        // javascript¼Â¹Ô
59        $objPage->tpl_onload = "window.close();";
60    }
61    break;
62case 'csv':
63    // ²èÌÌÁ«°Ü¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯
64    //if (sfIsValidTransition($objSess) == false) {
65    //    sfDispError(INVALID_MOVE_ERRORR);
66    //}
67    $csv = lgGetCsvData();
68    sfCSVDownload($csv, 'ebis_tag_');
69    exit;
70default:
71    $arrRet = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(EBIS_TAG_MID));
72    $arrSubData = unserialize($arrRet[0]['sub_data']);
73    $objFormParam->setParam($arrSubData);
74   
75    // ¥æ¥Ë¡¼¥¯ID¤òËä¤á¹þ¤ß
76    // $objPage->tpl_uniqid = $objSess->getUniqId();
77    break;
78}
79
80$objPage->arrForm = $objFormParam->getFormParamList();
81$objView->assignobj($objPage);      //ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
82$objView->display($objPage->tpl_mainpage);      //¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
83//-------------------------------------------------------------------------------------------------------
84/* ¥Ñ¥é¥á¡¼¥¿¾ðÊó¤Î½é´ü²½ */
85function lfInitParam($objFormParam) {
86    $objFormParam->addParam("¥æ¡¼¥¶ID", "user", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
87    $objFormParam->addParam("¥Ñ¥¹¥ï¡¼¥É", "pass", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
88    $objFormParam->addParam("¥í¥°¥¤¥óURL", "login_url", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
89    $objFormParam->addParam("EBiS°ú¿ô", "cid", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
90   
91    $objFormParam->addParam("¸ÜµÒID", "m1id", INT_LEN, "", array("MAX_LENGTH_CHECK", 'NUM_CHECK'));
92    $objFormParam->addParam("¹ØÆþ¶â³Û", "a1id", INT_LEN, "", array("MAX_LENGTH_CHECK", 'NUM_CHECK'));
93   
94    for ($i = 1; $i <= EBiS_TAG_OPTIONS_MAX; $i++) {
95        $title = "Ǥ°Õ¹àÌÜ$i";
96        $name  = 'o' . $i . 'id';
97        $objFormParam->addParam(
98            $title, $name, INT_LEN, "",
99            array("MAX_LENGTH_CHECK", "NUM_CHECK")
100        );
101    }
102    return $objFormParam;
103}
104
105/* CSV¼èÆÀ */
106function lgGetCsvData() {
107    $csv  = lfGetDetailPageCSV();
108    $csv .= lfGetListPageCSV();
109    $csv .= lfGetFrontPageCSV();
110    return $csv;
111}
112
113/* ¾¦Éʾܺ٥ڡ¼¥¸¤ÎCSV¤ò¼èÆÀ */
114function lfGetDetailPageCSV() {
115    $table    = 'dtb_products';
116    $colmuns  = 'product_id, name';
117    $objQuery = new SC_Query();
118   
119    $arrRet = $objQuery->select($colmuns, $table);
120   
121    $arrCSV = array();
122    foreach ($arrRet as $key => $product) {
123        $id  = $product['product_id'];
124        $url = SITE_URL . 'products/detail.php?product_id=';
125        $title = str_replace('"', '\"', $product['name']);
126       
127        $arrCSV[$key]['page_id']    = '"' . 'detail-p' . $id . '"';
128        $arrCSV[$key]['page_title'] = '"' . $title . '"';
129        $arrCSV[$key]['url']        = '"' . $url . $id . '"';
130    }
131   
132    return lfCreateCSV($arrCSV);
133}
134
135/* ¾¦ÉÊ°ìÍ÷¥Ú¡¼¥¸¤ÎCSV¤ò¼èÆÀ */
136function lfGetListPageCSV() {
137    $table    = 'dtb_category';
138    $colmuns  = 'category_id, category_name';
139    $objQuery = new SC_Query();
140   
141    $arrRet = $objQuery->select($colmuns, $table);
142   
143    $arrCSV = array();
144    foreach ($arrRet as $key => $category) {
145        $id  = $category['category_id'];
146        $url = SITE_URL . 'products/list.php?category_id=';
147        $title = str_replace('"', '\"', $category['category_name']);
148       
149        $arrCSV[$key]['page_id']    = '"' . 'list-c' . $id . '"';
150        $arrCSV[$key]['page_title'] = '"' . $title . '"';
151        $arrCSV[$key]['url']        = '"' . $url . $id . '"';
152    }
153    return lfCreateCSV($arrCSV);
154}
155
156function lfCreateCSV ($arrCSV) {
157    $csv_str = '';
158    foreach ($arrCSV as $csv) {
159        $csv_str .= join(',', $csv) . "\n";
160    }
161    return $csv_str;
162}
163
164/* ¤½¤Î¾¥Ú¡¼¥¸¤ÎCSV¤ò¼èÆÀ */
165function lfGetFrontPageCSV() {
166    // ¹àÌÜÄɲäκݤϲ¼µ­Ï¢ÁÛÇÛÎó¤òÄɲá£
167    // page_title,url¤ÏǤ°Õ¡¢¤Ê¤¤¾ì¹ç¤Ïpage_id¤«¤é¼«Æ°À¸À®¤µ¤ì¤ë
168    // 'page_id' => 'top', 'page_title' => '' , 'url' => 'index.php'
169    $arrList = array(
170        array('page_id' => 'top', 'page_title' => '' , 'url' => 'index.php'),
171        array('page_id' => 'abouts_index'),
172        array('page_id' => 'cart_index'),
173        array('page_id' => 'contact_index'),
174        array('page_id' => 'contact_confirm', 'page_title' => '', 'url' => 'contact/index.php'),
175        array('page_id' => 'contact_complete'),
176        array('page_id' => 'order_index'),
177        array('page_id' => 'entry_kiyaku'),
178        array('page_id' => 'entry_index'),
179        array('page_id' => 'entry_confirm', 'page_title' => '', 'url' => 'entry/index.php'),
180        array('page_id' => 'regist_complete', 'page_title' => '', 'url' => 'entry/complete.php'),
181        array('page_id' => 'products_favorite'),
182        array('page_id' => 'shopping_deliv'),
183        array('page_id' => 'shopping_payment'),
184        array('page_id' => 'shopping_confirm'),
185        array('page_id' => 'thanks', 'page_title' => '', 'url' => 'shopping/complete.php'),
186        array('page_id' => 'mypage_index'),
187        array('page_id' => 'mypage_change'),
188        array('page_id' => 'mypage_change_confirm', 'page_title' => '', 'url' => 'mypage/change.php'),
189        array('page_id' => 'mypage_change_complete', 'page_title' => '', 'url' => 'mypage/change_complete.php'),
190    );
191   
192    foreach ($arrList as $key => $list) {
193        if ( empty($arrList[$key]['page_title']) ) {
194            $arrList[$key]['page_title'] = $arrList[$key]['page_id'];
195        }
196       
197        if ( empty($arrList[$key]['url']) ) {
198            $url = SITE_URL . str_replace('_', '/', $arrList[$key]['url']);
199            $arrList[$key]['url'] = $url . '.php';
200        } else {
201            $arrList[$key]['url'] = SITE_URL . $arrList[$key]['url'];
202        }
203    }
204   
205    return lfCreateCSV($arrList);
206}
207?>
Note: See TracBrowser for help on using the repository browser.