"", "result" => "", "table" => "", "header" => "", "footer" => "", ); //---------------------------- // request parameter //---------------------------- $qProjectID = isset($_SESSION["project_id"]) ? $_SESSION["project_id"] : REQ_NON; $qProp = isset($_REQUEST["q_prop"]) ? $_REQUEST["q_prop"] : REQ_NON; $qIsPublic = isset($_REQUEST["q_is_public"]) ? $_REQUEST["q_is_public"] : REQ_NON; $qPublic = isset($_REQUEST["q_public"]) ? $_REQUEST["q_public"] : REQ_NON; $qOrder = isset($_REQUEST["q_order"]) ? $_REQUEST["q_order"] : 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($qProp, "int"); Util::setType($qIsPublic, "int"); Util::setType($qPublic, "int"); Util::setType($qOrder, "string"); Util::setType($qLimit, "int"); Util::setType($qOffset, "int"); //---------------------------- // Auth-Before validate //---------------------------- if ( $result === RES_OK ){ if ( ! Validate::isNumeric($qProjectID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 1)}"); } } //---------------------------- // Auth //---------------------------- if ( $result === RES_OK ){ $auth = Auth::instance("data"); if( ! $auth->readList($qProjectID) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 2)}"); } } //---------------------------- // Auth-After validate //---------------------------- if ( $result === RES_OK ){ if ( $qIsPublic === ON ){ if ( ! Validate::inKeyArray($qProp, DAO::T_DATA_PROP_TABLE()) ){ $qProp = NULL; } if ( ! Validate::inKeyArray($qPublic, DAO::T_DATA_PUBLIC_TABLE()) ){ $qPublic = array(DAO::T_DATA_PUBLIC_ORG, DAO::T_DATA_PUBLIC_OPN); } } else { $qIsPublic = OFF; if ( ! Validate::inKeyArray($qProp, DAO::T_DATA_PROP_TABLE()) ){ $qProp = DAO::T_DATA_PROP_BRIEF; } if ( ! Validate::inKeyArray($qPublic, DAO::T_DATA_PUBLIC_TABLE()) ){ $qPublic = NULL; } } if ( ! Validate::isOrderParam($qOrder, DAO_data::ORDER_KEY_SQL_TABLE(), DAO_data::ORDER_VALUE_SQL_TABLE()) ){ $qOrder = NULL; } if ( ! Validate::isNumeric($qLimit) ){ $qLimit = HTML_LIMIT; } if ( ! Validate::isNumeric($qOffset) ){ $qOffset = HTML_OFFSET; } } //---------------------------- // function //---------------------------- //---------------------------- // process //---------------------------- if ( $result === RES_OK ){ $objDAOData = DAO::instance("data"); $objDAOProjectData = DAO::instance("project_data"); $objViewData = View::instance("data"); // ----------------------------- $tablist = NULL; if ( $qIsPublic === ON ){ $tablist = View_data::TAB_LIST_PUBLIC; } else if ( $qProp === DAO::T_DATA_PROP_BRIEF ){ $tablist = View_data::TAB_LIST_BRIEF; } else if ( $qProp === DAO::T_DATA_PROP_RESEARCH ){ $tablist = View_data::TAB_LIST_RESEARCH_RESULTS; } else if ( $qProp === DAO::T_DATA_PROP_DELIVER ){ $tablist = View_data::TAB_LIST_DELIVERABLE; } else if ( $qProp === DAO::T_DATA_PROP_OTHERS ){ $tablist = View_data::TAB_LIST_OTHER; } else { $result = RES_NG; } // 文書一覧取得 -------------------- if ( $result === RES_OK ){ $arrData = array(); if ( $result === RES_OK ){ if ( $qOrder ){ list($orderName, $orderType) = explode("-", $qOrder); $orderName = DAO_data::ORDER_KEY_SQL_TABLE($orderName); $orderType = DAO_data::ORDER_VALUE_SQL_TABLE($orderType); $arrOrder = array( $orderName => $orderType, ); } else { $arrOrder = NULL; } if ( $qIsPublic === OFF ){ // t_project_data基準で取得 //$objDAOData->setAuth($auth); // 参照がおかしい場合も表現するためコメントアウト $resDAOData = $objDAOData->get(NULL, NULL, $qPublic, $qProjectID, TRUE, $qProp, User::get("organization_id"), $arrOrder, $qLimit, $qOffset); } else { // t_data基準で取得 $objDAOData->setAuth($auth); $resDAOData = $objDAOData->get(NULL, DAO::T_DATA_STATE_NORMAL, $qPublic, $qProjectID, FALSE, $qProp, User::get("organization_id"), $arrOrder, $qLimit, $qOffset); } if ( ($result = $resDAOData["result"]) === RES_OK ){ $arrData = $resDAOData["data"]; } } $arrProjectData = array(); if ( $result === RES_OK && $qIsPublic === OFF ){ $resDAOProjectData = $objDAOProjectData->get($qProjectID); if ( ($result = $resDAOProjectData["result"]) === RES_OK ){ $arrProjectData = $resDAOProjectData["data"]; } } if ( $result === RES_NG ){ $gResult->push("{$WORD($wk, 3)}"); } else { // ページネーション parse_str( $_SERVER["QUERY_STRING"], $query); $arrHtml["table"] = $objViewData->table($tablist, $qProjectID, $arrData, $arrProjectData, $query); if ( $result === RES_OK ){ // ページネーション $arrHtml["header"] = Printer::paginationTableHeader(TRUE, ".", $_REQUEST, $resDAOData["count"], $qLimit, $qOffset, 10); $arrHtml["footer"] = Printer::paginationTableFooter(TRUE, ".", $_REQUEST, $resDAOData["count"], $qLimit, $qOffset, 10); } else if ( $result === RES_NO_DATA ){ $gResult->push("{$WORD($wk, 4)}"); } } } } //---------------------------- // menu //---------------------------- { // menu ---------------------------------------------------------------- if ( $result !== RES_NG ){ $arrMenu = array(); //----- $arrMenu = array( View_data::TAB_LIST_BRIEF => "", View_data::TAB_LIST_RESEARCH_RESULTS => "", View_data::TAB_LIST_DELIVERABLE => "", View_data::TAB_LIST_OTHER => "", View_data::TAB_LIST_PUBLIC => "", View_data::TAB_NEW => "", ); //----- foreach ( $arrMenu as $tab => &$value ){ $value = $objViewData->tab($tab, $auth, $qProjectID); } //----- $arrHtml["menu"] = Printer::menuTab($arrMenu, $tablist); } // title --------------------------------------------------------------- $title = "{$WORD($wk, 5)}"; // form ---------------------------------------------------------------- if ( $result === RES_NG ){ // アクション(OK) $arrHtml["footer"] = Printer::link("OK", "btn btn-default", NULL, NULL, "/content/project/"); } // result -------------------------------------------------------------- $arrHtml["result"] = $gResult->string(TRUE, $result); } ?>