- Timestamp:
- 2013/05/02 18:11:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis.php
r22567 r22796 32 32 * @version $Id$ 33 33 */ 34 class LC_Page_Admin_Basis extends LC_Page_Admin_Ex 35 { 34 class LC_Page_Admin_Basis extends LC_Page_Admin_Ex { 36 35 37 36 // }}} … … 43 42 * @return void 44 43 */ 45 function init() 46 { 44 function init() { 47 45 parent::init(); 48 46 $this->tpl_mainpage = 'basis/index.tpl'; … … 70 68 * @return void 71 69 */ 72 function process() 73 { 70 function process() { 74 71 $this->action(); 75 72 $this->sendResponse(); … … 81 78 * @return void 82 79 */ 83 function action() 84 { 80 function action() { 81 85 82 $objDb = new SC_Helper_DB_Ex(); 86 $objFormParam = new SC_FormParam_Ex(); 87 88 89 $this->lfInitParam($objFormParam, $_POST); 90 $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "');"; 91 92 if ($this->getMode() === 'confirm') { 83 84 if ($objDb->sfGetBasisExists()) { 85 $this->tpl_mode = 'update'; 86 } else { 87 $this->tpl_mode = 'insert'; 88 } 89 90 if (!empty($_POST)) { 91 92 $objFormParam = new SC_FormParam_Ex(); 93 $this->lfInitParam($objFormParam, $_POST); 93 94 $objFormParam->setParam($_POST); 94 95 $objFormParam->convParam(); 95 96 96 97 $this->arrErr = $this->lfCheckError($objFormParam); 97 98 if (!empty($this->arrErr)) { 99 $this->arrForm = $objFormParam->getHashArray(); 100 return; 98 $post = $objFormParam->getHashArray(); 99 100 $this->arrForm = $post; 101 102 if (count($this->arrErr) == 0) { 103 switch ($this->getMode()) { 104 // 既存編集 105 case 'update': 106 $this->lfUpdateData($this->arrForm); 107 break; 108 // 新規作成 109 case 'insert': 110 $this->lfInsertData($this->arrForm); 111 break; 112 default: 113 break; 114 } 115 $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "'); window.alert('SHOPマスターの登録が完了しました。');"; 101 116 } 102 103 $arrData = $objFormParam->getDbArray(); 104 SC_Helper_DB_Ex::registerBasisData($arrData); 105 106 // キャッシュファイル更新 107 $objDb->sfCreateBasisDataCache(); 108 $this->tpl_onload .= "window.alert('SHOPマスターの登録が完了しました。');"; 109 } 110 111 $arrRet = $objDb->sfGetBasisData(true); 112 $objFormParam->setParam($arrRet); 113 $this->arrForm = $objFormParam->getHashArray(); 114 $this->arrForm['regular_holiday_ids'] = explode('|', $this->arrForm['regular_holiday_ids']); 117 if (empty($this->arrForm['regular_holiday_ids'])) { 118 $this->arrSel = array(); 119 } else { 120 $this->arrSel = $this->arrForm['regular_holiday_ids']; 121 } 122 } else { 123 $arrCol = $this->lfGetCol(); 124 $col = SC_Utils_Ex::sfGetCommaList($arrCol); 125 $arrRet = $objDb->sfGetBasisData(true, $col); 126 $this->arrForm = $arrRet; 127 128 $regular_holiday_ids = explode('|', $this->arrForm['regular_holiday_ids']); 129 $this->arrForm['regular_holiday_ids'] = $regular_holiday_ids; 130 $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "');"; 131 } 132 115 133 } 116 134 … … 120 138 * @return void 121 139 */ 122 function destroy() 123 { 140 function destroy() { 124 141 parent::destroy(); 125 142 } 126 143 127 /** 128 * 前方互換用 129 * 130 * @deprecated 2.12.4 131 */ 132 function lfUpdateData($arrData) 133 { 134 trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); 135 SC_Helper_DB_Ex::registerBasisData($arrData); 136 } 137 138 /** 139 * 前方互換用 140 * 141 * @deprecated 2.12.4 142 */ 143 function lfInsertData($arrData) 144 { 145 trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); 146 SC_Helper_DB_Ex::registerBasisData($arrData); 147 } 148 149 function lfInitParam(&$objFormParam, $post) 150 { 144 // 基本情報用のカラムを取り出す。 145 function lfGetCol() { 146 $arrCol = array( 147 'company_name', 148 'company_kana', 149 'shop_name', 150 'shop_kana', 151 'shop_name_eng', 152 'zip01', 153 'zip02', 154 'pref', 155 'addr01', 156 'addr02', 157 'tel01', 158 'tel02', 159 'tel03', 160 'fax01', 161 'fax02', 162 'fax03', 163 'business_hour', 164 'email01', 165 'email02', 166 'email03', 167 'email04', 168 'tax', 169 'tax_rule', 170 'free_rule', 171 'good_traded', 172 'message', 173 'regular_holiday_ids', 174 'latitude', 175 'longitude', 176 'downloadable_days', 177 'downloadable_days_unlimited' 178 ); 179 return $arrCol; 180 } 181 182 function lfUpdateData($array) { 183 $objQuery =& SC_Query_Ex::getSingletonInstance(); 184 $arrCol = $this->lfGetCol(); 185 foreach ($arrCol as $val) { 186 //配列の場合は、パイプ区切りの文字列に変換 187 if (is_array($array[$val])) { 188 $sqlval[$val] = implode('|', $array[$val]); 189 } else { 190 $sqlval[$val] = $array[$val]; 191 } 192 } 193 $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; 194 // UPDATEの実行 195 $ret = $objQuery->update('dtb_baseinfo', $sqlval); 196 197 GC_Utils_Ex::gfPrintLog('dtb_baseinfo に UPDATE を実行しました。'); 198 } 199 200 function lfInsertData($array) { 201 $objQuery =& SC_Query_Ex::getSingletonInstance(); 202 $arrCol = $this->lfGetCol(); 203 foreach ($arrCol as $val) { 204 $sqlval[$val] = $array[$val]; 205 } 206 $sqlval['id'] = 1; 207 $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; 208 // INSERTの実行 209 $ret = $objQuery->insert('dtb_baseinfo', $sqlval); 210 211 GC_Utils_Ex::gfPrintLog('dtb_baseinfo に INSERT を実行しました。'); 212 } 213 214 function lfInitParam(&$objFormParam, $post) { 151 215 $objFormParam->addParam('会社名', 'company_name', STEXT_LEN, 'KVa', array('MAX_LENGTH_CHECK')); 152 216 $objFormParam->addParam('会社名(フリガナ)', 'company_kana', STEXT_LEN, 'KVC', array('KANA_CHECK','MAX_LENGTH_CHECK')); … … 192 256 $objFormParam->addParam('ダウンロード無制限', 'downloadable_days_unlimited', array('EXIST_CHECK')); 193 257 } 194 $objFormParam->addParam('緯度', 'latitude', STEXT_LEN, '', array('MAX_LENGTH_CHECK' , 'NUM_POINT_CHECK'));195 $objFormParam->addParam('軽度', 'longitude', STEXT_LEN, '', array('MAX_LENGTH_CHECK' , 'NUM_POINT_CHECK'));258 $objFormParam->addParam('緯度', 'latitude', STEXT_LEN, '', array('MAX_LENGTH_CHECK')); 259 $objFormParam->addParam('軽度', 'longitude', STEXT_LEN, '', array('MAX_LENGTH_CHECK')); 196 260 197 261 $objFormParam->addParam('定休日', 'regular_holiday_ids', INT_LEN, 'n', array('MAX_LENGTH_CHECK')); … … 199 263 200 264 // 入力エラーチェック 201 function lfCheckError(&$objFormParam) 202 { 265 function lfCheckError(&$objFormParam) { 203 266 $arrErr = $objFormParam->checkError(); 204 267 $post = $objFormParam->getHashArray(); … … 211 274 $objErr->doFunc(array('FAX', 'fax01', 'fax02', 'fax03'), array('TEL_CHECK')); 212 275 276 $objErr->doFunc(array('緯度', 'latitude', STEXT_LEN), array('NUM_POINT_CHECK', 'MAX_LENGTH_CHECK')); 277 $objErr->doFunc(array('経度', 'longitude', STEXT_LEN), array('NUM_POINT_CHECK', 'MAX_LENGTH_CHECK')); 278 213 279 return array_merge((array)$arrErr, (array)$objErr->arrErr); 214 280 }
Note: See TracChangeset
for help on using the changeset viewer.