-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLC_Page_Plugin_AjaxZip3_Config.php
138 lines (126 loc) · 4.25 KB
/
LC_Page_Plugin_AjaxZip3_Config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/*
*
* Copyright(c) 2000-2012 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// {{{ requires
require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
/**
* プラグインの設定クラス
*
* @package AjaxZip3
* @author SystemFriend Inc
* @version $Id: LC_Page_Plugin_AjaxZip3_Config.php 576 2014-05-19 05:48:57Z habu $
*/
class LC_Page_Plugin_AjaxZip3_Config extends LC_Page_Admin_Ex {
var $arrForm = array();
/**
* 初期化する.
*
* @return void
*/
function init() {
parent::init();
$this->tpl_mainpage = PLUGIN_UPLOAD_REALDIR ."AjaxZip3/templates/plg_AjaxZip3_config.tpl";
$this->tpl_subtitle = "ajaxzip3連携";
}
/**
* プロセス.
*
* @return void
*/
function process() {
$this->action();
$this->sendResponse();
}
/**
* Page のアクション.
*
* @return void
*/
function action() {
$objFormParam = new SC_FormParam_Ex();
$this->lfInitParam($objFormParam);
$objFormParam->setParam($_POST);
$objFormParam->convParam();
$arrForm = array();
switch ($this->getMode()) {
case 'edit':
$arrForm = $objFormParam->getHashArray();
$this->arrErr = $objFormParam->checkError();
// エラーなしの場合にはデータを更新
if (count($this->arrErr) == 0) {
// データ更新
$this->arrErr = $this->updateData($arrForm);
if (count($this->arrErr) == 0) {
// コンパイルファイルのクリア処理
SC_Utils_Ex::clearCompliedTemplate();
$this->tpl_onload = "alert('登録が完了しました。');";
}
}
break;
default:
// プラグイン情報を取得.
$plugin = SC_Plugin_Util_Ex::getPluginByPluginCode("AjaxZip3");
$arrForm['ajaxzip3_js_url'] = $plugin['free_field1'];
$arrForm['trigger'] = $plugin['free_field2'];
break;
}
$this->arrForm = $arrForm;
$this->setTemplate($this->tpl_mainpage);
}
/**
* デストラクタ.
*
* @return void
*/
function destroy() {
// parent::destroy(); // PHP 5.1.6 にてエラーが発生するため、コメントアウト
}
/**
* パラメーター情報の初期化
*
* @param object $objFormParam SC_FormParamインスタンス
* @return void
*/
function lfInitParam(&$objFormParam) {
$objFormParam->addParam('JS URL', 'ajaxzip3_js_url', URL_LEN, 'n', array('EXIST_CHECK', 'URL_CHECK', 'MAX_LENGTH_CHECK'), 'http://');
$objFormParam->addParam('住所取得タイミング', 'trigger', STEXT_LEN, 'n', array('EXIST_CHECK', 'MAX_LENGTH_CHECK'));
}
/**
*
* @param type $arrData
* @return type
*/
function updateData($arrData) {
$arrErr = array();
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objQuery->begin();
// UPDATEする値を作成する。
$sqlval = array();
$sqlval['free_field1'] = $arrData['ajaxzip3_js_url'];
$sqlval['free_field2'] = $arrData['trigger'];
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$where = "plugin_code = 'AjaxZip3'";
// UPDATEの実行
$objQuery->update('dtb_plugin', $sqlval, $where);
$objQuery->commit();
return $arrErr;
}
}