Changeset 20369
- Timestamp:
- 2011/02/24 11:54:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php
r20368 r20369 43 43 var $objFormParam; 44 44 45 /** SC_UploadFile インスタンス */46 var $objUpfile;47 48 45 /** TAGエラーチェックフィールド情報 */ 49 46 var $arrTagCheckItem; … … 83 80 $this->arrMaker = SC_Helper_DB_Ex::sfGetIDValueList("dtb_maker", "maker_id", "name"); 84 81 $this->arrPayments = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); 82 $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); 85 83 $this->arrAllowedTag = $masterData->getMasterData("mtb_allowed_tag"); 86 84 $this->arrTagCheckItem = array(); … … 104 102 function action() { 105 103 $this->objDb = new SC_Helper_DB_Ex(); 106 107 // ファイル管理クラス 108 $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR); 109 // サイト基本情報 (ポイントレート初期値用) 110 $this->arrInfo = $this->objDb->sfGetBasisData(); 104 111 105 // CSV管理ヘルパー 112 106 $objCSV = new SC_Helper_CSV_Ex(); … … 124 118 125 119 // CSVファイルアップロード情報の初期化 126 $ this->lfInitFile();127 // パラメータ管理クラス128 $this->objFormParam = new SC_FormParam(); 120 $objUpFile = new SC_UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR); 121 $this->lfInitFile($objUpFile); 122 129 123 // パラメータ情報の初期化 130 $this->lfInitParam($arrCSVFrame); 131 132 $this->objFormParam->setHtmlDispNameArray(); 133 $this->arrTitle = $this->objFormParam->getHtmlDispNameArray(); 124 $objFormParam = new SC_FormParam(); 125 $this->lfInitParam($objFormParam, $arrCSVFrame); 126 127 $objFormParam->setHtmlDispNameArray(); 128 $this->arrTitle = $objFormParam->getHtmlDispNameArray(); 134 129 135 130 switch($this->getMode()) { 136 131 case 'csv_upload': 137 $this->doUploadCsv( );132 $this->doUploadCsv($objFormParam, $objUpFile); 138 133 break; 139 134 default: … … 169 164 * @return void 170 165 */ 171 function doUploadCsv( ) {166 function doUploadCsv(&$objFormParam, &$objUpFile) { 172 167 // ファイルアップロードのチェック 173 $ this->objUpFile->makeTempFile('csv_file');174 $arrErr = $ this->objUpFile->checkExists();168 $objUpFile->makeTempFile('csv_file'); 169 $arrErr = $objUpFile->checkExists(); 175 170 if (count($arrErr) > 0) { 176 171 $this->arrErr = $arrErr; … … 178 173 } 179 174 // 一時ファイル名の取得 180 $filepath = $ this->objUpFile->getTempFilePath('csv_file');175 $filepath = $objUpFile->getTempFilePath('csv_file'); 181 176 // CSVファイルの文字コード変換 182 177 $enc_filepath = SC_Utils_Ex::sfEncodeFile($filepath, CHAR_CODE, CSV_TEMP_REALDIR); … … 192 187 193 188 // 登録フォーム カラム情報 194 $this->arrFormKeyList = $ this->objFormParam->getKeyList();189 $this->arrFormKeyList = $objFormParam->getKeyList(); 195 190 196 191 $err = false; 197 192 198 193 // 登録対象の列数 199 $col_max_count = $ this->objFormParam->getCount();194 $col_max_count = $objFormParam->getCount(); 200 195 // 行数 201 196 $line_count = 0; … … 226 221 } 227 222 // シーケンス配列を格納する。 228 $ this->objFormParam->setParam($arrCSV, true);229 $arrRet = $ this->objFormParam->getHashArray();230 $ this->objFormParam->setParam($arrRet);223 $objFormParam->setParam($arrCSV, true); 224 $arrRet = $objFormParam->getHashArray(); 225 $objFormParam->setParam($arrRet); 231 226 // 入力値の変換 232 $ this->objFormParam->convParam();227 $objFormParam->convParam(); 233 228 // <br>なしでエラー取得する。 234 $arrCSVErr = $this->lfCheckError( );229 $arrCSVErr = $this->lfCheckError($objFormParam); 235 230 236 231 // 入力エラーチェック … … 243 238 } 244 239 245 $this->lfRegistProduct($objQuery, $line_count );246 $arrParam = $ this->objFormParam->getHashArray();240 $this->lfRegistProduct($objQuery, $line_count, $objFormParam); 241 $arrParam = $objFormParam->getHashArray(); 247 242 248 243 $this->addRowResult($line_count, "商品ID:".$arrParam['product_id'] . " / 商品名:" . $arrParam['name']); … … 281 276 * @return void 282 277 */ 283 function lfInitFile( ) {284 $ this->objUpFile->addFile("CSVファイル", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false);278 function lfInitFile(&$objUpFile) { 279 $objUpFile->addFile("CSVファイル", 'csv_file', array('csv'), CSV_SIZE, true, 0, 0, false); 285 280 } 286 281 … … 291 286 * @return void 292 287 */ 293 function lfInitParam(&$ arrCSVFrame) {288 function lfInitParam(&$objFormParam, &$arrCSVFrame) { 294 289 // 固有の初期値調整 295 290 $arrCSVFrame = $this->lfSetParamDefaultValue($arrCSVFrame); … … 319 314 } 320 315 // パラメーター登録 321 $ this->objFormParam->addParam(316 $objFormParam->addParam( 322 317 $item['disp_name'] 323 318 , $col … … 336 331 * @return void 337 332 */ 338 function lfCheckError( ) {333 function lfCheckError(&$objFormParam) { 339 334 // 入力データを渡す。 340 $arrRet = $ this->objFormParam->getHashArray();335 $arrRet = $objFormParam->getHashArray(); 341 336 $objErr = new SC_CheckError($arrRet); 342 $objErr->arrErr = $ this->objFormParam->checkError(false);337 $objErr->arrErr = $objFormParam->checkError(false); 343 338 // HTMLタグチェックの実行 344 339 foreach($this->arrTagCheckItem as $item) { … … 372 367 * @return void 373 368 */ 374 function lfRegistProduct($objQuery, $line = "" ) {369 function lfRegistProduct($objQuery, $line = "", &$objFormParam) { 375 370 $objProduct = new SC_Product(); 376 371 // 登録データ対象取得 377 $arrList = $ this->objFormParam->getHashArray();372 $arrList = $objFormParam->getHashArray(); 378 373 // 登録時間を生成(DBのnow()だとcommitした際、すべて同一の時間になってしまう) 379 374 $arrList['update_date'] = $this->lfGetDbFormatTimeWithLine($line);
Note: See TracChangeset
for help on using the changeset viewer.
