function put_config($file_id, $REQUEST, $target, $sheet_name, &$list_colspan) { $str_type = array(0 => "number", 1 => "number", 2 => "rating", 3 => "image"); $conf = new FileConf($file_id); $list_requests = array(); foreach ($REQUEST as $item => $val) { preg_match("/field-(\\d+)-(\\d+)-(\\d+)-(\\d+)/", $item, $loc); if ($loc && $loc[0]) { $location = "{$loc[1]}-{$loc[2]}-{$loc[3]}"; $list_requests[$location] = $val; } } uksort($list_requests, 'strnatcmp'); foreach ($list_requests as $item => $val) { if (!isset($list_colspan[$item])) { $list_colspan[$item] = 0; } } $array_counts = array_count_values($list_requests); foreach ($array_counts as $key => $val) { $l = array_search($key, $list_requests, FALSE); if ($list_colspan[$l] == 0) { $list_colspan[$l] = $val; } } // XLSフィールド情報REQUEST取得 $conf->array_destroy("field"); $span_info = get_span_info_from_field_ids($REQUEST); foreach ($REQUEST as $item => $val) { preg_match("/field-(\\d+)-(\\d+)-(\\d+)-(\\d+)/", $item, $loc); if ($loc && $loc[0]) { $xls_fields = array(); $xls_fields["sheet_num"] = $loc[1]; $xls_fields["row"] = $loc[2]; $xls_fields["col"] = $loc[3]; $xls_fields["item_name"] = $val; # number, rating, image $xls_fields["type"] = $str_type[$loc[4]]; $location = "{$loc[1]}-{$loc[2]}-{$loc[3]}"; if (isset($list_colspan[$location])) { if ($list_colspan[$location] == 0) { continue; } $xls_fields["colspan"] = $list_colspan[$location]; } if (isset($span_info["colspan"][$xls_fields["row"]][$xls_fields["col"]])) { $xls_fields["colspan"] = $span_info["colspan"][$xls_fields["row"]][$xls_fields["col"]]; } // XLSフィールド情報保存 $conf->array_set("field", $xls_fields); } } $conf->array_commit(); if (isset($target) && strlen($target) > 0) { $conf->set("target", $target); } if (isset($sheet_name) && strlen($sheet_name) > 0) { $conf->set("name", $sheet_name); } $conf->set("selectedFieldDataJson", $_REQUEST["selectedFieldData"]); $conf->commit(); }
require_once 'config.php'; require_once 'init.php'; require_once 'lib/common.php'; require_once "lib/sheet.php"; require_once 'lib/file_conf.php'; require_once 'contrib/peruser.php'; // define('border_sw', true); // ファイルハンドリング if (isset($file_id) && $file_id) { $tgt_file = DST_DIR . $file_id . ".xls"; } else { // XXX: $errmsg = "ファイルが読み込めません"; put_err_page("不正なアクセスです"); die; } $conf = new FileConf($file_id); // // ヘッダ処理 // $header_opt .= "<link rel=\"stylesheet\" href=\"/external/css/jqDnR.css\" type=\"text/css\">\n"; $header_opt .= "<script type=\"text/javascript\" src=\"/external/js/jquery-1.4.1.min.js\"></script>\n"; $header_opt .= "<script type=\"text/javascript\" src=\"/external/js/jqDnR.js\"></script>\n"; //$header_opt .= "<script type=\"text/javascript\" src=\"/external/js/sheetedit.js\"></script>\n"; include TMP_HTML_DIR . "tpl.header.html"; // Excelファイル読み込み処理 if ($tgt_file) { list($xls, $errmsg) = excel_peruser_factory($charset, $tgt_file); $sheet = new Sheet($xls); } // // エラーメッセージ処理
function loadPreviouslySelectedFieldList($file_id) { $conf = new FileConf($file_id); return $conf->get("selectedFieldDataJson"); }