source: branches/version-1/data/downloads/module/mdl_cybs/mdl_cybs.php @ 17187

Revision 17187, 2.6 KB checked in by adachi, 15 years ago (diff)

サイバーソース設定画面対応

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/**
3 * ¥â¥¸¥å¡¼¥ë¥Ð¡¼¥¸¥ç¥óɽµ­
4 * @version CVS: $Id$
5 */
6require_once 'mdl_cybs.inc';
7require_once 'class/mdl_cybs_config.php';
8
9class LC_Page {
10    //¥³¥ó¥¹¥È¥é¥¯¥¿
11    function LC_Page() {
12        //¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È¤Î»ØÄê
13        $this->tpl_mainpage = MODULE_PATH . 'mdl_cybs/mdl_cybs.tpl';
14        $this->tpl_subtitle = '¥µ¥¤¥Ð¡¼¥½¡¼¥¹·èºÑ¥â¥¸¥å¡¼¥ë';
15        $this->extension_installed = lfIsInstalledCybsExt();
16    }
17}
18
19$objPage = new LC_Page;
20$objView = new SC_AdminView;
21
22$objForm = lfInitParam($_POST);
23$objPage->arrForm = $objForm->getFormParamList();
24
25$mode = isset($_POST['mode']) ? $_POST['mode'] : '';
26switch($mode) {
27// ÆþÎϹàÌܤÎÅÐÏ¿
28case 'edit':
29    if ($arrErr = lfCheckError($objForm)) {
30        $objPage->arrErr = $arrErr;
31        break;
32    }
33
34    $objConfig =& Mdl_Cybs_Config::getInstanse();
35    $objConfig->registerConfig($objConfig->createSqlArray($objForm));
36    $objPage->tpl_onload = 'alert("ÅÐÏ¿´°Î»¤·¤Þ¤·¤¿¡£\n´ðËܾðÊó¡ä»ÙʧÊýË¡ÀßÄê¤è¤ê¾ÜºÙÀßÄê¤ò¤·¤Æ¤¯¤À¤µ¤¤¡£"); window.close();';
37    break;
38
39// Ä̾ïɽ¼¨
40default:
41    // DB¤ÎÅÐÏ¿Ãͤò¼èÆÀ¤¹¤ë.
42    $objConfig =& Mdl_Cybs_Config::getInstanse();
43    $arrConfig = $objConfig->getConfig();
44sfPrintR($arrConfig);
45    // DB¤ËÃͤ¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ì¤Ð¤½¤ÎÃͤòɽ¼¨¤µ¤»¤ë
46    if (!empty($arrConfig)) {
47        $objForm = lfInitParam($arrConfig);
48        $objPage->arrForm = $objForm->getFormParamList();
49    }
50}
51
52$objView->assignObj($objPage);
53$objView->display($objPage->tpl_mainpage);
54//sfPrintR($objView->_smarty->get_template_vars());
55
56/**
57 * ¥Ñ¥é¥á¡¼¥¿¤Î½é´ü²½
58 *
59 * @param array
60 * @return SC_FormParam
61 */
62function lfInitParam($arrParam) {
63    $objForm = new SC_FormParam;
64    $objForm->addParam('¥ê¥¯¥¨¥¹¥ÈÀè', 'cybs_request_url', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
65    $objForm->addParam('¥Þ¡¼¥Á¥ã¥ó¥ÈID', 'cybs_merchant_id', MTEXT_LEN, '', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
66    $objForm->addParam('¥ª¥ó¥Ç¥Þ¥ó¥É²Ý¶â', 'cybs_ondemand_use', 1, '', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
67    $objForm->addParam('3D¥»¥­¥å¥¢Ç§¾Ú', 'cybs_3d_use', 1, '', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
68    $objForm->setParam($arrParam);
69    $objForm->convParam();
70    return $objForm;
71}
72/**
73 * ¥¨¥é¡¼¥Á¥§¥Ã¥¯¤ò¹Ô¤¦
74 *
75 * @param SC_FormParam $objForm
76 * @return array|null
77 */
78function lfCheckError($objForm) {
79    $arrErr = $objForm->checkError();
80    if ($arrErr) return $arrErr;
81
82    return null;
83}
84
85/**
86 * mod_cybs¤¬¥¤¥ó¥¹¥È¡¼¥ëºÑ¤ß¤«¥Á¥§¥Ã¥¯¤¹¤ë.
87 *
88 * @return boolean
89 */
90function lfIsInstalledCybsExt() {
91    if (!extension_loaded(MDL_CYBS_EXT)) {
92        if (@!dl(MDL_CYBS_EXT)) {
93            return false;
94        }
95    }
96    return true;
97}
98?>
Note: See TracBrowser for help on using the repository browser.