/** * Parser Uri request * @param Request $request */ public function parserRequestUri($request) { $url = $request->getPathUri(); if ($url) { $urlArr = preg_split("/\\//si", $url); if (preg_match("/^[a-z_]*\$/si", $urlArr[1])) { // http://localhost/?/ModuleName/ViewName/ $module_name = $urlArr[0]; $view_name = $request->pathNameToViewName($urlArr, 1); $uriParams = $request->getUriParameters($urlArr, 1); } elseif (preg_match("/^[a-z_]*\$/si", $urlArr[0])) { // http://localhost/?/ViewName/ $module_name = ''; $view_name = $request->pathNameToViewName($urlArr, 0); $uriParams = $request->getUriParameters($urlArr, 0); } else { throw new Exception(); /** @todo Change Exception class more specific. */ } } else { $module_name = ''; $view_name = ''; $uriParams = []; } return array('module' => $module_name, 'shortView' => $view_name, 'uriParams' => $uriParams); }
//($DEFAULT_MODULE="page") //http://localhost/?/article/1/f_catid_20=> http://localhost/bin/controller.php?view=page.view.ArticleView&fld:Id=1&fld:catid=20 //($DEFAULT_MODULE="page") //http://localhost/?/article/catid_20 => http://localhost/bin/controller.php?view=page.view.ArticleView&catid=20 //($DEFAULT_MODULE="page") define("OPENBIZ_USE_CUSTOM_SESSION_HANDLER", true); include 'app_init.php'; //$profile = Openbiz::$app->getUserProfile(); $profile = Openbiz::$app->getSessionContext()->getVar("_USER_PROFILE"); echo __FILE__ . __LINE__; echo '<pre>'; echo var_dump($profile); exit; $req = new Request(); echo '<pre>'; $url = $req->getPathUri(); echo 'getPathUri : ' . $url . '<br />'; echo var_dump($requestInfo); $module_name = $requestInfo['module']; $view_name = $requestInfo['view']; $PARAM_MAPPING = $requestInfo['uriParams']; $TARGET_VIEW = $module_name . ".view." . $view_name; $_GET['view'] = $_REQUEST['view'] = $TARGET_VIEW; $req->convertUriParamsToGetVars($requestInfo['uriParams']); echo 'getPathUri : ' . $req->getPathUri() . '<br />'; echo 'REQUEST_URI : ' . $_SERVER['REQUEST_URI'] . '<br />'; echo '$TARGET_VIEW : ' . $TARGET_VIEW . '<br />'; echo '$PARAM_MAPPING : <br />'; echo var_dump($PARAM_MAPPING); echo '</pre>'; exit;