"", "result" => "", ); //---------------------------- // request parameter //---------------------------- $qProjectID = isset($_SESSION["project_id"]) ? $_SESSION["project_id"] : REQ_NON; $qID = isset($_REQUEST["q_id"]) ? $_REQUEST["q_id"] : REQ_NON; //---------------------------- // judge post //---------------------------- //---------------------------- // set types //---------------------------- Util::setType($qProjectID, "int"); Util::setType($qID, "int"); //---------------------------- // Auth-Before validate //---------------------------- if ( $result === RES_OK ){ if ( ! Validate::isNumeric($qID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 1)}"); } if ( ! Validate::isNumeric($qProjectID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 2)}"); } } //---------------------------- // Auth //---------------------------- if ( $result === RES_OK ){ $auth = Auth::instance("exterm"); if ( ! $auth->processDownload($qID, $qProjectID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 3)}"); } } //---------------------------- // Auth-After validate //---------------------------- if ( $result === RES_OK ){ } //---------------------------- // function //---------------------------- //---------------------------- // process //---------------------------- if ( $result === RES_OK ){ $objDAOExterm = DAO::instance("exterm"); if ( $result === RES_OK ){ $objDAOExterm->setAuth($auth); $resDAOExterm = $objDAOExterm->get($qID); $result = $resDAOExterm["result"]; if ( $result === RES_OK ){ $dataExterm = $resDAOExterm["data"][0]; if ( $dataExterm["t_exterm_state"] === DAO::T_EXTERM_STATE_FAILED ){ $result = RES_NG; $gResult->push("{$WORD($wk, 4)}"); } else if ( $dataExterm["t_exterm_state"] !== DAO::T_EXTERM_STATE_COMPLT ){ $result = RES_NG; $gResult->push("{$WORD($wk, 5)}"); } } else { $result = RES_NG; $gResult->push("{$WORD($wk, 6)}"); } } if ( $result === RES_OK ){ $path = Setting::get("PATH_DATA_EXTERM")."/{$qID}/output.tsv"; if ( ! file_exists($path) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 7)}"); } } if ( $result === RES_OK ){ header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"{$qID}.tsv\""); header("Content-Length: " . filesize($path)); echo file_get_contents($path); exit(); } // 結果 -------------------- if ( $result !== RES_OK ){ $gResult->push("{$WORD($wk, 8)}"); } } //---------------------------- // menu //---------------------------- { // title --------------------------------------------------------------- $title = "{$WORD($wk, 9)}"; // form ---------------------------------------------------------------- // アクション(OK) $arrHtml["form"] = Printer::link("OK", "btn btn-default", NULL, NULL, "/content/project/"); // result -------------------------------------------------------------- $arrHtml["result"] = $gResult->string(TRUE, $result); } ?>