"", "result" => "", "table" => "", "header" => "", "footer" => "", ); //---------------------------- // request parameter //---------------------------- $qView = isset($_REQUEST["q_view"]) ? $_REQUEST["q_view"] : REQ_NON; $qInActive = isset($_REQUEST["q_inactive"]) ? $_REQUEST["q_inactive"] : REQ_NON; $qKeyword = isset($_REQUEST["q_keyword"]) ? $_REQUEST["q_keyword"] : REQ_NON; $qState = isset($_REQUEST["q_state"]) ? $_REQUEST["q_state"] : REQ_NON; $qOrgID = isset($_REQUEST["q_org_id"]) ? $_REQUEST["q_org_id"] : REQ_NON; $qType = isset($_REQUEST["q_type"]) ? $_REQUEST["q_type"] : 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($qView, "int"); Util::setType($qInActive, "int"); Util::setType($qKeyword, "string"); Util::setType($qState, "int"); Util::setType($qOrgID, "int"); Util::setType($qType, "int"); Util::setType($qOrder, "string"); Util::setType($qLimit, "int"); Util::setType($qOffset, "int"); //---------------------------- // Auth-Before validate //---------------------------- if ( $result === RES_OK ){ $isSysMgr = Auth::isSysMgr(User::get("type"), User::get("id")); if ( ! Validate::inKeyArray($qInActive, $G_ONOFF_TABLE) ){ $qInActive = OFF; } if ( $qInActive === ON ){ $qView = View_user::LIST_VIEW_ORG; $qOrgID = User::get("organization_id"); } if ( ! Validate::inKeyArray($qView, View_user::LIST_VIEW_TABLE()) ){ if ( Validate::isNumeric($qOrgID) ){ $qView = View_user::LIST_VIEW_ORG; } else { $qView = View_user::LIST_VIEW_ALL; } } if ( ! Validate::isNumeric($qOrgID) ){ $qOrgID = NULL; } } //---------------------------- // Auth //---------------------------- if ( $result === RES_OK ){ $authUser = Auth::instance("user"); $authOrg = Auth::instance("organization"); if ( ! $authUser->readList( $qOrgID ) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 1)}"); } } //---------------------------- // Auth-After validate //---------------------------- if ( $result === RES_OK ){ if ( ! Validate::isString($qKeyword) ){ $qKeyword = NULL; } if ( ! Validate::inKeyArray($qType, DAO::T_USER_TYPE_TABLE(NULL, ! $isSysMgr)) ){ $qType = NULL; } if ( ! Validate::inKeyArray($qState, DAO::T_USER_STATE_TABLE()) ){ $qState = NULL; } if ( ! Validate::isOrderParam($qOrder, DAO_user::ORDER_KEY_SQL_TABLE(), DAO_user::ORDER_VALUE_SQL_TABLE()) ){ $qOrder = NULL; } if ( ! Validate::isNumeric($qLimit) ){ $qLimit = HTML_LIMIT; } if ( ! Validate::isNumeric($qOffset) ){ $qOffset = HTML_OFFSET; } } //---------------------------- // process //---------------------------- if ( $result === RES_OK ){ $objDAOOrganization = DAO::instance("organization"); $objDAOUser = DAO::instance("user"); $objViewOrganization = View::instance("organization"); $objViewUser = View::instance("user"); $objDAOUser->setAuth($authUser); if ( $result === RES_OK && Validate::isNumeric($qOrgID) ){ $objDAOOrganization->setAuth($authOrg); $resDAOOrganization = $objDAOOrganization->get($qOrgID); if ( $resDAOOrganization["result"] === RES_OK ){ $arrTabRight[] = Util::esc($resDAOOrganization["data"][0]["t_organization_name"]); } else { $result = RES_NG; $gResult->push("{$WORD($wk, 2)}"); } } // ユーザー一覧取得 -------------------- if ( $result === RES_OK ){ if ( $qOrder ){ list($orderName, $orderType) = explode("-", $qOrder); $orderKeyName = $orderName; $orderName = DAO_user::ORDER_KEY_SQL_TABLE($orderName); $orderType = DAO_user::ORDER_VALUE_SQL_TABLE($orderType); $arrOrder = array( $orderName => $orderType, ); if ( $orderKeyName === DAO_user::ORDER_KEY_REGISTER ){ // registerが同じ(NULL)だった場合はidで判断 $arrOrder["t_user_id"] = $orderType; } } else { $arrOrder = NULL; } $keyword = NULL; if ( Validate::isString($qKeyword) ){ $keyword = array( "type" => DAO::TYPE_LIKE, "value" => Util::esc($qKeyword), ); } if ( is_Null($qType) && ! $isSysMgr ){ $qType = array_keys(DAO::T_USER_TYPE_TABLE(NULL, ! $isSysMgr)); } $resDAOUser = $objDAOUser->get(NULL, $keyword, $qState, $qType, $qOrgID, $arrOrder, $qLimit, $qOffset); $result = $resDAOUser["result"]; if ( $result === RES_NG ){ $gResult->push("{$WORD($wk, 3)}"); } else { parse_str( $_SERVER["QUERY_STRING"], $query); $arrHtml["table"] = $objViewUser->table($resDAOUser["data"], $qKeyword, $qOrgID, $query, $qView === View_user::LIST_VIEW_ALL); if ( $result === RES_OK ){ $arrHtml["header"] = Printer::paginationTableHeader(TRUE, ".", $_REQUEST, $resDAOUser["count"], $qLimit, $qOffset, 10); $arrHtml["footer"] = Printer::paginationTableFooter(TRUE, ".", $_REQUEST, $resDAOUser["count"], $qLimit, $qOffset, 10); } else { $gResult->push("{$WORD($wk, 4)}"); } } } } //---------------------------- // html //---------------------------- { // menu ---------------------------------------------------------------- if ( $result !== RES_NG ){ $arrMenu = array(); //----- if ( $qView === View_user::LIST_VIEW_ALL ){ $arrMenu[0] = $objViewOrganization->tab(View_organization::TAB_LIST, $authOrg); $arrMenu[1] = $objViewOrganization->tab(View_organization::TAB_NEW, $authOrg); $arrMenu[2] = $objViewUser->tab(View_user::TAB_LIST_ALL, $authUser, INIT_ID); } else { $arrMenu[0] = $objViewOrganization->tab(View_organization::TAB_LIST, $authOrg); $arrMenu[1] = $objViewOrganization->tab(View_organization::TAB_DETAIL, $authOrg, $qOrgID); $arrMenu[2] = $objViewUser->tab(View_user::TAB_LIST, $authUser, $qOrgID); $arrMenu[3] = $objViewUser->tab(View_user::TAB_NEW, $authUser, $qOrgID); } //----- $arrHtml["menu"] = Printer::menuTab($arrMenu, 2, $arrTabRight); } // title --------------------------------------------------------------- $title = "{$WORD($wk, 5)}"; // form ---------------------------------------------------------------- if ( $result === RES_NG ){ // アクション(OK) $arrHtml["footer"] = Printer::link("OK", "btn btn-default", NULL, NULL, "/"); } // result -------------------------------------------------------------- $arrHtml["result"] = $gResult->string(TRUE, $result); } ?>