"", "result" => "", "table" => "", "header" => "", "footer" => "", "form" => "", ); //---------------------------- // request parameter //---------------------------- $qProjectID = isset($_SESSION["project_id"]) ? $_SESSION["project_id"] : REQ_NON; $qKind = isset($_REQUEST["q_kind"]) ? $_REQUEST["q_kind"] : REQ_NON; $qID = isset($_REQUEST["q_id"]) ? $_REQUEST["q_id"] : REQ_NON; $qLimit = isset($_REQUEST["q_limit"]) ? $_REQUEST["q_limit"] : REQ_NON; $qOffset = isset($_REQUEST["q_offset"]) ? $_REQUEST["q_offset"] : REQ_NON; //---------------------------- // judge post //---------------------------- //---------------------------- // set types //---------------------------- Util::setType($qProjectID, "int"); Util::setType($qKind, "string"); Util::setType($qID, "int"); Util::setType($qLimit, "int"); Util::setType($qOffset, "int"); //---------------------------- // Auth-Before validate //---------------------------- if ( $result === RES_OK ){ if ( ! Validate::inKeyArray($qKind, Term::KIND_TABLE()) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 1)}"); } if ( ! Validate::isNumeric($qProjectID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 2)}"); } if ( ! Validate::isNumeric($qID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 3)}"); } } //---------------------------- // Auth //---------------------------- if ( $result === RES_OK ){ $auth = Auth::instance("term_root", $qKind); if ( ! $auth->read($qID, $qProjectID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 4)}"); } $isReadOnly = ! $auth->write($qID, $qProjectID); } //---------------------------- // Auth-After validate //---------------------------- if ( $result === RES_OK ){ if ( ! Validate::isNumeric($qLimit) ){ $qLimit = HTML_LIMIT; } if ( ! Validate::isNumeric($qOffset) ){ $qOffset = HTML_OFFSET; } } if ( Validate::inKeyArray($qKind, Term::KIND_TABLE()) ){ $kindText = Term::KIND_TABLE($qKind); $kindChildText = Term::KIND_TABLE($qKind, FALSE); } else { $kindText = ""; $kindChildText = ""; } //---------------------------- // function //---------------------------- //---------------------------- // process //---------------------------- if ( $result === RES_OK ){ $objDAOTermRoot = DAO::instance("term_root", $qKind); $objDAOTerm = DAO::instance("term", $qKind); $objViewTermRoot = View::instance("term_root"); $objViewTerm = View::instance("term"); // 辞書情報取得 -------------------- if ( $result === RES_OK ){ $objDAOTermRoot->setAuth( $auth ); $resDAOTermRoot = $objDAOTermRoot->get($qID, DAO::T_TERM_ROOT_STATE_NORMAL); $result = $resDAOTermRoot["result"]; if ( $result === RES_OK ){ $dataTermRoot = $resDAOTermRoot["data"][0]; $arrTabRight[] = $objViewTermRoot->title($dataTermRoot); } else { $result = RES_NG; $gResult->push("{$WORD($wk, 5)}"); } } // 用語一覧取得 -------------------- if ( $result === RES_OK ){ $resDAOTerm = $objDAOTerm->get($qID, NULL, $qLimit, $qOffset); $result = $resDAOTerm["result"]; if ( $result === RES_NG ){ $gResult->push("{$WORD($wk, 6)}"); } else { $arrHtml["table"] = $objViewTerm->table($qID, $qKind, $resDAOTerm["data"], $isReadOnly); if ( $result === RES_OK ){ // ページネーション $arrHtml["header"] = Printer::paginationTableHeader(TRUE, ".", $_REQUEST, $resDAOTerm["count"], $qLimit, $qOffset, 10); $arrHtml["footer"] = Printer::paginationTableFooter(TRUE, ".", $_REQUEST, $resDAOTerm["count"], $qLimit, $qOffset, 10); } else if ( $result === RES_NO_DATA && $isReadOnly ){ $gResult->push("{$WORD($wk, 7)}"); } } } } //---------------------------- // menu //---------------------------- { $jsReadOnly = ($isReadOnly) ? ON : OFF; // menu ---------------------------------------------------------------- if ( $result !== RES_NG ){ $arrMenu = array(); //----- $arrMenu[100] = $objViewTermRoot->tab($qKind, View_term_root::TAB_LIST, $auth, $qProjectID); if ( $isReadOnly ){ $arrMenu[0] = $objViewTermRoot->tab($qKind, View_term_root::TAB_ITEM_LIST, $auth, $qProjectID, $qID); } else { $arrMenu[0] = $objViewTermRoot->tab($qKind, View_term_root::TAB_ITEM_EDIT, $auth, $qProjectID, $qID); } $arrMenu[1] = $objViewTermRoot->tab($qKind, View_term_root::TAB_EDIT, $auth, $qProjectID, $qID); $arrMenu[2] = $objViewTermRoot->tab($qKind, View_term_root::TAB_IMPORT, $auth, $qProjectID, $qID); $arrMenu[3] = $objViewTermRoot->tab($qKind, View_term_root::TAB_EXPORT, $auth, $qProjectID, $qID); //----- $arrHtml["menu"] = Printer::menuTab($arrMenu, 0, $arrTabRight); } // title --------------------------------------------------------------- $title = $isReadOnly ? "{$WORD($wk, 8, $kindText)}" : "{$WORD($wk, 9, $kindText)}"; // form ---------------------------------------------------------------- if ( $result !== RES_NG ){ if ( ! $isReadOnly ){ $arrControl = array(); $arrAction = array(); $arrControl[] = array( "id" => NULL, "name" => NULL, "form" => Printer::input("hidden", "q_kind", "q_kind", $qKind), ); $arrControl[] = array( "id" => NULL, "name" => NULL, "form" => Printer::input("hidden", "q_project_id", "q_project_id", $qProjectID), ); // アクション(OK) $arrAction[] = Printer::input("submit", NULL, NULL, "OK", "btn btn-primary"); $arrHtml["form"] = Printer::form("tempform_term", "tempform_term", "/content/term_root/", "get", $arrControl, $arrAction); } } else { // アクション(OK) $arrHtml["footer"] = Printer::link("OK", "btn btn-default", NULL, NULL, "/content/project/"); } // result -------------------------------------------------------------- $arrHtml["result"] = $gResult->string(TRUE, $result); } ?>